Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/sys/netinet/ip_input.c,v rcsdiff: /ftp/cvs/cvsroot/src/sys/netinet/ip_input.c,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.82.2.6 retrieving revision 1.85 diff -u -p -r1.82.2.6 -r1.85 --- src/sys/netinet/ip_input.c 2000/05/06 16:43:25 1.82.2.6 +++ src/sys/netinet/ip_input.c 1999/05/03 21:14:47 1.85 @@ -1,4 +1,4 @@ -/* $NetBSD: ip_input.c,v 1.82.2.6 2000/05/06 16:43:25 he Exp $ */ +/* $NetBSD: ip_input.c,v 1.85 1999/05/03 21:14:47 hwr Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -340,13 +340,12 @@ next: } ip = mtod(m, struct ip *); } - /* - * RFC1122: packets with a multicast source address are - * not allowed. + * we drop packets that have a multicast address as source + * as wanted by rfc 1112 */ if (IN_MULTICAST(ip->ip_src.s_addr)) { - /* XXX stat */ + ipstat.ips_odropped++; goto bad; } @@ -365,8 +364,7 @@ next: /* * Check for additional length bogosity */ - if (len < hlen) - { + if (len < hlen) { ipstat.ips_badlen++; goto bad; } @@ -430,8 +428,10 @@ next: * Check our list of addresses, to see if the packet is for us. */ INADDR_TO_IA(ip->ip_dst, ia); - if (ia != NULL) - goto ours; + if (ia != NULL) { + if (ia->ia_ifp->if_flags & IFF_UP) + goto ours; + } if (m->m_pkthdr.rcvif->if_flags & IFF_BROADCAST) { for (ifa = m->m_pkthdr.rcvif->if_addrlist.tqh_first; ifa != NULL; ifa = ifa->ifa_list.tqe_next) { @@ -856,11 +856,11 @@ ip_dooptions(m) struct mbuf *m; { register struct ip *ip = mtod(m, struct ip *); - register u_char *cp, *cp0; + register u_char *cp; register struct ip_timestamp *ipt; register struct in_ifaddr *ia; int opt, optlen, cnt, off, code, type = ICMP_PARAMPROB, forward = 0; - struct in_addr dst; + struct in_addr *sin, dst; n_time ntime; dst = ip->ip_dst; @@ -919,7 +919,7 @@ ip_dooptions(m) break; } off--; /* 0 origin */ - if ((off + sizeof(struct in_addr)) > optlen) { + if (off > optlen - sizeof(struct in_addr)) { /* * End of source route. Should be for us. */ @@ -961,7 +961,7 @@ ip_dooptions(m) * If no space remains, ignore. */ off--; /* 0 origin */ - if ((off + sizeof(struct in_addr)) > optlen) + if (off > optlen - sizeof(struct in_addr)) break; bcopy((caddr_t)(&ip->ip_dst), (caddr_t)&ipaddr.sin_addr, sizeof(ipaddr.sin_addr)); @@ -990,7 +990,7 @@ ip_dooptions(m) goto bad; break; } - cp0 = (cp + ipt->ipt_ptr - 1); + sin = (struct in_addr *)(cp + ipt->ipt_ptr - 1); switch (ipt->ipt_flg) { case IPOPT_TS_TSONLY: @@ -1005,8 +1005,8 @@ ip_dooptions(m) m->m_pkthdr.rcvif); if (ia == 0) continue; - bcopy(&ia->ia_addr.sin_addr, - cp0, sizeof(struct in_addr)); + bcopy((caddr_t)&ia->ia_addr.sin_addr, + (caddr_t)sin, sizeof(struct in_addr)); ipt->ipt_ptr += sizeof(struct in_addr); break; @@ -1014,7 +1014,7 @@ ip_dooptions(m) if (ipt->ipt_ptr - 1 + sizeof(n_time) + sizeof(struct in_addr) > ipt->ipt_len) goto bad; - bcopy(cp0, &ipaddr.sin_addr, + bcopy((caddr_t)sin, (caddr_t)&ipaddr.sin_addr, sizeof(struct in_addr)); if (ifa_ifwithaddr((SA)&ipaddr) == 0) continue; @@ -1025,8 +1025,7 @@ ip_dooptions(m) goto bad; } ntime = iptime(); - cp0 = (u_char *) &ntime; /* XXX GCC BUG */ - bcopy(cp0, (caddr_t)cp + ipt->ipt_ptr - 1, + bcopy((caddr_t)&ntime, (caddr_t)cp + ipt->ipt_ptr - 1, sizeof(n_time)); ipt->ipt_ptr += sizeof(n_time); } @@ -1238,7 +1237,7 @@ ip_forward(m, srcrt) ntohl(ip->ip_src.s_addr), ntohl(ip->ip_dst.s_addr), ip->ip_ttl); #endif - if (m->m_flags & (M_BCAST|M_MCAST) || in_canforward(ip->ip_dst) == 0) { + if (m->m_flags & M_BCAST || in_canforward(ip->ip_dst) == 0) { ipstat.ips_cantforward++; m_freem(m); return;