LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 2041|回复: 1

网络工具ipdump 的 linux 补丁

[复制链接]
发表于 2006-4-8 12:12:18 | 显示全部楼层 |阅读模式
ipdump 是个用于查看网络协议包的很有用的工具,可惜它的源代码是针对BSD平台的。(source forge),为了在 linux 上也能使用,我改了一下源代码,希望对大家有用。

源代码地址:
http://nchc.dl.sourceforge.net/s ... ipdump-1.1.1.tar.gz

下面是 patch
-------------------------------------------------------------------------------------------------------


diff -c ipdump/basics.c bsd_ipdump_myChange/basics.c
*** ipdump/basics.c        2000-06-08 00:43:17.000000000 +0800
--- bsd_ipdump_myChange/basics.c        2006-04-05 13:21:53.689745104 +0800
***************
*** 71,78 ****
  
  void print_address(const char *hdr, const char *tag, const u_long *addr)
    {
!   iprintf(hdr, "%s%s%s", (tag && *tag ? tag : ""), (tag && *tag ? ": " : ""),
!           addr2ascii(AF_INET, addr, sizeof(u_long), 0));
    if(no_names == 0)
      {
      struct hostent *host =
--- 71,86 ----
  
  void print_address(const char *hdr, const char *tag, const u_long *addr)
    {
! /*          iprintf(hdr, "%s%s%s", (tag && *tag ? tag : ""), (tag && *tag ? ": " : ""),addr2ascii(AF_INET, addr, sizeof(u_long), 0));  
!  *          
!  *          in linux I can't find the function addr2ascii so I change the above line
!  *          as below */
!
!           struct in_addr temp;
!           temp.s_addr = *addr;
!           iprintf(hdr, "%s%s%s", (tag && *tag ? tag : ""), (tag && *tag ? ": " : ""),inet_ntoa(temp));
!           
!           /* end whitelilis's this change */
    if(no_names == 0)
      {
      struct hostent *host =
***************
*** 108,116 ****
  
  
  void print_network(const char *hdr, const char *tag, const u_long *addr)
!   {
!   iprintf(hdr, "%s%s%s", (tag && *tag ? tag : ""), (tag && *tag ? ": " : ""),
!           addr2ascii(AF_INET, addr, sizeof(u_long), 0));
    if(no_names == 0)
      {
      struct netent *net = getnetbyaddr(*addr, AF_INET);
--- 116,130 ----
  
  
  void print_network(const char *hdr, const char *tag, const u_long *addr)
! {
!  /* iprintf(hdr, "%s%s%s", (tag && *tag ? tag : ""), (tag && *tag ? ": " : ""),addr2ascii(AF_INET, addr, sizeof(u_long), 0));
!   
!   * whitelilis's change like the line 79 */
!
!         struct in_addr temp;
!         temp.s_addr = *addr;
!   iprintf(hdr, "%s%s%s", (tag && *tag ? tag : ""), (tag && *tag ? ": " : ""),inet_ntoa(temp));
!   
    if(no_names == 0)
      {
      struct netent *net = getnetbyaddr(*addr, AF_INET);
diff -c ipdump/Makefile bsd_ipdump_myChange/Makefile
*** ipdump/Makefile        2000-06-09 03:23:45.000000000 +0800
--- bsd_ipdump_myChange/Makefile        2006-04-05 13:05:16.070406296 +0800
***************
*** 84,93 ****
  CFLAGS = -O2 -g -Wall -pipe
  LDLIBS = -lpcap
  
! .ifdef PCAP
    CFLAGS += -I${pcap}/include
    LDLIBS += -L${pcap}/lib
! .endif
  
  
  sources = ipdump.c ipv4.c icmpv4.c scan.c indent.c ether.c udp.c tcp.c raw.c\
--- 84,93 ----
  CFLAGS = -O2 -g -Wall -pipe
  LDLIBS = -lpcap
  
! #.ifdef PCAP
    CFLAGS += -I${pcap}/include
    LDLIBS += -L${pcap}/lib
! #.endif
  
  
  sources = ipdump.c ipv4.c icmpv4.c scan.c indent.c ether.c udp.c tcp.c raw.c\
发表于 2006-4-8 12:41:22 | 显示全部楼层
thx for your work
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表