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.7 retrieving revision 1.83 diff -u -p -r1.82.2.7 -r1.83 --- src/sys/netinet/ip_input.c 2001/05/30 09:44:09 1.82.2.7 +++ src/sys/netinet/ip_input.c 1999/04/07 02:31:05 1.83 @@ -1,4 +1,4 @@ -/* $NetBSD: ip_input.c,v 1.82.2.7 2001/05/30 09:44:09 he Exp $ */ +/* $NetBSD: ip_input.c,v 1.83 1999/04/07 02:31:05 proff Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -167,8 +167,6 @@ int ip_defttl; struct ipqhead ipq; int ipq_locked; -int ip_nfragpackets = 0; -int ip_maxfragpackets = 200; static __inline int ipq_lock_try __P((void)); static __inline void ipq_unlock __P((void)); @@ -342,16 +340,6 @@ next: } ip = mtod(m, struct ip *); } - - /* - * RFC1122: packets with a multicast source address are - * not allowed. - */ - if (IN_MULTICAST(ip->ip_src.s_addr)) { - /* XXX stat */ - goto bad; - } - if (in_cksum(m, hlen) != 0) { ipstat.ips_badsum++; goto bad; @@ -432,8 +420,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) { @@ -643,17 +633,6 @@ ip_reass(ipqe, fp) * If first fragment to arrive, create a reassembly queue. */ if (fp == 0) { - /* - * Enforce upper bound on number of fragmented packets - * for which we attempt reassembly; - * If maxfrag is 0, never accept fragments. - * If maxfrag is -1, accept all fragments without limitation. - */ - if (ip_maxfragpackets < 0) - ; - else if (ip_nfragpackets >= ip_maxfragpackets) - goto dropfrag; - ip_nfragpackets++; MALLOC(fp, struct ipq *, sizeof (struct ipq), M_FTABLE, M_NOWAIT); if (fp == NULL) @@ -769,7 +748,6 @@ insert: ip->ip_dst = fp->ipq_dst; LIST_REMOVE(fp, ipq_q); FREE(fp, M_FTABLE); - ip_nfragpackets--; m->m_len += (ip->ip_hl << 2); m->m_data -= (ip->ip_hl << 2); /* some debugging cruft by sklower, below, will go away soon */ @@ -808,7 +786,6 @@ ip_freef(fp) } LIST_REMOVE(fp, ipq_q); FREE(fp, M_FTABLE); - ip_nfragpackets--; } /* @@ -830,17 +807,6 @@ ip_slowtimo() ip_freef(fp); } } - /* - * If we are over the maximum number of fragments - * (due to the limit being lowered), drain off - * enough to get down to the new limit. - */ - if (ip_maxfragpackets < 0) - ; - else { - while (ip_nfragpackets > ip_maxfragpackets && ipq.lh_first) - ip_freef(ipq.lh_first); - } IPQ_UNLOCK(); #ifdef GATEWAY ipflow_slowtimo(); @@ -882,11 +848,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; @@ -945,7 +911,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. */ @@ -987,7 +953,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)); @@ -1016,7 +982,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: @@ -1031,8 +997,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; @@ -1040,7 +1006,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; @@ -1051,8 +1017,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); } @@ -1264,7 +1229,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; @@ -1548,11 +1513,6 @@ ip_sysctl(name, namelen, oldp, oldlenp, return (error); } #endif - - case IPCTL_MAXFRAGPACKETS: - return (sysctl_int(oldp, oldlenp, newp, newlen, - &ip_maxfragpackets)); - default: return (EOPNOTSUPP); }