#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"
/* 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)) {
* 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 */
};
#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 */