File dhcpdump-1.6-tcpdump-3.8.1.dif of Package dhcp-tools

diff -uNr dhcpdump-1.6.orig/dhcpdump.c dhcpdump-1.6/dhcpdump.c
--- dhcpdump-1.6.orig/dhcpdump.c	2003-11-20 12:56:21.000000000 +0100
+++ dhcpdump-1.6/dhcpdump.c	2004-05-10 12:14:26.000000000 +0200
@@ -525,15 +525,24 @@
 // field 5: length of IP packets + 14
 // field 6: ip address origin
 // field 8: ip address destination
+//
+// FIXME: printing of IP header has changed in recent tcpdump:
+// tcpdump 3.7.2:
+// 11:36:54.120287 0:30:65:c2:61:d2 ff:ff:ff:ff:ff:ff 0800 590: 0.0.0.0.68 > 255.255.255.255.67:  xid:0x320ed9cb secs:10 vend-rfc1048 DHCP:DISCOVER MSZ:548 RQ:192.168.0.180 LT:4294967295 PR:SM+DG+NS+HN+DN+RP+TTL+BR+MD+RD+SR+YD+YS+NTP+LPR+LOG+T200+WNS VC:"Linux 2.4.26-1-default ppc" CID:[ether]00:30:65:c2:61:d2
+// [0]             [1]              [2]               [3]  [4]  [5]       [6] [7]                
+//
+// tcpdump 3.8.1:
+// 12:37:06.225651 00:30:65:c2:61:d2 > ff:ff:ff:ff:ff:ff, ethertype IPv4, length 590: IP 0.0.0.0.68 > 255.255.255.255.67: BOOTP/DHCP, Request from 00:30:65:c2:61:d2, length: 548
+// [0]            [1]               [2] [3]               [4]       [5]   [6]    [7] [8] [9]      [10] [11]
 int readheader(uchar *buf) {
     int n;
     char **ap;
-    char *argv[10];
+    char *argv[13];
     char max_data_str[20];
 
     for (ap=argv,n=0;(*ap=strsep((char **)&buf," \t"))!=NULL;n++)
 	if (**ap!='\0') {
-	    if (++ap>=&argv[10])
+	    if (++ap>=&argv[13])
 		break;
 	    switch(n) {
 		default:
@@ -544,19 +553,20 @@
 		case 1:	// mac origin
 		    strcpy(mac_origin,argv[1]);
 		    break;
-		case 2:	// mac destination
-		    strcpy(mac_destination,argv[2]);
+		case 3:	// mac destination
+		    strcpy(mac_destination,argv[3]);
+		    mac_destination[strlen(mac_destination)-1]=0; /* trailing comma */
 		    break;
-		case 4: // size of packet
-		    strcpy(max_data_str,argv[4]);
+		case 7: // size of packet
+		    strcpy(max_data_str,argv[7]);
 		    max_data_str[strlen(max_data_str)-1]=0;
 		    max_data_len=atoi(max_data_str)-14; // note 2 *************
 		    break;
-		case 5:	// ip origin
-		    strcpy(ip_origin,argv[5]);
+		case 9:	// ip origin
+		    strcpy(ip_origin,argv[9]);
 		    break;
-		case 7:	// ip destination
-		    strcpy(ip_destination,argv[7]);
+		case 11:	// ip destination
+		    strcpy(ip_destination,argv[11]);
 		    ip_destination[strlen(ip_destination)-1]=0;
 		    break;
 	    }
openSUSE Build Service is sponsored by