rem: if (hlen < sizeof(struct ip)) {
add: if (hlen < (int) sizeof(struct ip)) {
context: void ipv4_input(struct mbuf *m, int hdrlen){	struct ip *ip;	struct in_ifaddr *ia = NULL;	int hlen;	struct ipq *fp;	#if SHOW_DEBUG	dump_ipv4_header(buf);#endif	if (!m)		return;	/* If we don't have a pointer to our IP addresses we can't go on */	if (!ip_ifaddr) {		ip_ifaddr = get_primary_addr();		if (!ip_ifaddr) {			printf("ipv4_input: no interfaces available! (ip_ifaddr == NULL)\n");			goto bad;		}	}	ipstat.ips_total++;	/* Get the whole header in the first mbuf */	if (m->m_len < sizeof(struct ip) && 	    (m = m_pullup(m, sizeof(struct ip))) == NULL) {		ipstat.ips_toosmall++;		return;	}	ip = mtod(m, struct ip *);	/* Check IP version... */	if (ip->ip_v != IPVERSION) {		printf("Wrong IP version! %d\n", ip->ip_v);		ipstat.ips_badvers++;		goto bad;	}	/* Figure out of header length */	hlen = ip->ip_hl << 2;	/* Check we're at least the minimum possible length */	if (hlen < sizeof(struct ip)) {		ipstat.ips_badhlen++;		goto bad;	}	/* Check again we have the entire header in the first mbuf */	if (hlen > m->m_len) {		if ((m = m_pullup(m, hlen)) == NULL) {			ipstat.ips_badhlen++;			goto bad;		}		ip = mtod(m, struct ip *);	}	/* Checksum (should be 0) */		if ((ip->ip_sum = in_cksum(m, hlen, 0)) != 0) {		printf("ipv4_input: checksum failed\n");		ipstat.ips_badsum++;		goto bad;	}	/* we put the length into host order here... */	ip->ip_len = ntohs(ip->ip_len);	/* sanity check. Datagram MUST be longer than the header! */	if (ip->ip_len < hlen) {		ipstat.ips_badhlen++;		goto bad;	}	ip->ip_id = ntohs(ip->ip_id);	ip->ip_off = ntohs(ip->ip_off);		/* the first mbuf should be the packet hdr, so check it's length */	if (m->m_pkthdr.len < ip->ip_len) {		ipstat.ips_tooshort++;		goto bad;	}	/* Strip excess data from mbuf */	if (m->m_pkthdr.len > ip->ip_len) {		if (m->m_len == m->m_pkthdr.len) {			m->m_len = ip->ip_len;			m->m_pkthdr.len = ip->ip_len;		} else 			m_adj(m, ip->ip_len - m->m_pkthdr.len);	}	/* options processing */		ip_nhops = 0;	if (hlen > sizeof(struct ip) && ip_dooptions(m))		return;		for (ia = ip_ifaddr;ia; ia = ia->ia_next) {		if (IA_SIN(ia)->sin_addr.s_addr == ip->ip_dst.s_addr)			goto ours;				if (ia->ia_ifp == m->m_pkthdr.rcvif && 		    (ia->ia_ifp->if_flags & IFF_BROADCAST)) {			uint32 t;						if (satosin(&ia->ia_broadaddr)->sin_addr.s_addr == ip->ip_dst.s_addr)				goto ours;			if (ip->ip_dst.s_addr == ia->ia_netbroadcast.s_addr)				goto ours;			t = ntohl(ip->ip_dst.s_addr);			if (t == ia->ia_subnet)				goto ours;			if (t == ia->ia_net)				goto ours;		}	}		if (ip->ip_dst.s_addr == (uint32)INADDR_BROADCAST)		goto ours;	if (ip->ip_dst.s_addr == INADDR_ANY)		goto ours;		if (ipforwarding == 0) {		ipstat.ips_cantforward++;		m_freem(m);	} else 		ip_forward(m, 0);	return;ours:	if (ip->ip_off & ~IP_DF) {		if (m->m_flags & M_EXT) {			if ((m = m_pullup(m, sizeof(struct ip))) == NULL) {				ipstat.ips_toosmall++;				return;			}			ip = mtod(m, struct ip*);		}		for (fp = ipq.next; fp != &ipq; fp = fp->next) {			if (ip->ip_id == fp->ipq_id &&			    ip->ip_src.s_addr == fp->ipq_src.s_addr &&			    ip->ip_dst.s_addr == fp->ipq_dst.s_addr &&			    ip->ip_p == fp->ipq_p)				goto found;		}		fp = NULL;found:		ip->ip_len -= hlen;		((struct ipasfrag*)ip)->ipf_mff &= ~1;		if (ip->ip_off & IP_MF)			((struct ipasfrag*)ip)->ipf_mff |= 1;		ip->ip_off <<= 3;		if (((struct ipasfrag*)ip)->ipf_mff & 1 || ip->ip_off) {			ipstat.ips_fragments++;			ip = ip_reass((struct ipasfrag*)ip, fp);			if (ip == NULL)				return;			ipstat.ips_reassembled++;			m = dtom(ip);		} else if (fp)			ip_freef(fp);	} else		ip->ip_len -= hlen;		#if SHOW_ROUTE	/* This just shows which interface we're planning on using */	printf("Accepting packet [%d] to address %08lx via device %s from src addr %08lx\n",	       ip->ip_p, ntohl(ip->ip_dst.s_addr), m->m_pkthdr.rcvif->if_name, 	       ntohl(ip->ip_src.s_addr));#endif	ipstat.ips_delivered++;	if (proto[ip->ip_p] && proto[ip->ip_p]->pr_input) {		proto[ip->ip_p]->pr_input(m, hlen);		return;	} else {		printf("proto[%d] = %p\n", ip->ip_p, proto[ip->ip_p]);		goto bad;	}		return;bad:	m_freem(m);	return;}