]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
Make IP_HL and IP_HL_SET consistent.
authorTed Lemon <source@isc.org>
Tue, 1 Feb 2000 18:25:09 +0000 (18:25 +0000)
committerTed Lemon <source@isc.org>
Tue, 1 Feb 2000 18:25:09 +0000 (18:25 +0000)
common/icmp.c
common/tr.c
includes/netinet/ip.h

index 02e2150f6340751fe374cd32d1f4e131250cb346..c510055ab40198d81563d8f6f08fa9d844a79818 100644 (file)
@@ -23,7 +23,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: icmp.c,v 1.19 2000/02/01 18:19:48 mellon Exp $ Copyright (c) 1997, 1998 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: icmp.c,v 1.20 2000/02/01 18:25:07 mellon Exp $ Copyright (c) 1997, 1998 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -180,7 +180,7 @@ isc_result_t icmp_echoreply (h)
 
        /* Find the IP header length... */
        ip = (struct ip *)icbuf;
-       hlen = IP_HL (ip) << 2;
+       hlen = IP_HL (ip);
 
        /* Short packet? */
        if (status < hlen + (sizeof *icfrom)) {
index f9707816b5b7310dca9bbaf0395c4f82843a02be..e03bc9831378d03ec21fbc1d31d71fc2815cadc1 100644 (file)
@@ -161,7 +161,7 @@ ssize_t decode_tr_header (interface, buf, bufix, from)
          * filter code in bpf.c */
         llc = (struct trllc *)(buf + bufix + hdr_len);
         ip = (struct ip *) (llc + 1);
-        udp = (struct udphdr *) ((unsigned char*) ip + ip->ip_hl * 4);
+        udp = (struct udphdr *) ((unsigned char*) ip + IP_HL (ip));
 
         /* make sure it is a snap encoded, IP, UDP, unfragmented packet sent
          * to our port */
index 4afb80d73486a61d29c7606700d8d54aafa466b6..0a1e35840443b8051290372207fb7383c020ab42 100644 (file)
@@ -64,10 +64,10 @@ struct ip {
 };
 
 #define IP_V(iph)      ((iph)->ip_fvhl >> 4)
-#define IP_HL(iph)     ((iph)->ip_fvhl & 0x0F)
+#define IP_HL(iph)     (((iph)->ip_fvhl & 0x0F) << 2)
 #define IP_V_SET(iph,x)        ((iph)->ip_fvhl = ((iph)->ip_fvhl & 0x0F) | ((x) << 4))
 #define IP_HL_SET(iph,x) ((iph)->ip_fvhl = \
-                         ((iph)->ip_fvhl & 0xF0) | ((x) >> 2))
+                         ((iph)->ip_fvhl & 0xF0) | (((x) >> 2) & 0x0F))
 
 #define        IP_MAXPACKET    65535           /* maximum packet size */