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.268.2.5 retrieving revision 1.275.4.1.8.2 diff -u -p -r1.268.2.5 -r1.275.4.1.8.2 --- src/sys/netinet/ip_input.c 2010/03/11 15:04:28 1.268.2.5 +++ src/sys/netinet/ip_input.c 2011/01/07 03:17:44 1.275.4.1.8.2 @@ -1,4 +1,4 @@ -/* $NetBSD: ip_input.c,v 1.268.2.5 2010/03/11 15:04:28 yamt Exp $ */ +/* $NetBSD: ip_input.c,v 1.275.4.1.8.2 2011/01/07 03:17:44 matt Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -91,10 +91,9 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.268.2.5 2010/03/11 15:04:28 yamt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.275.4.1.8.2 2011/01/07 03:17:44 matt Exp $"); #include "opt_inet.h" -#include "opt_compat_netbsd.h" #include "opt_gateway.h" #include "opt_pfil_hooks.h" #include "opt_ipsec.h" @@ -174,11 +173,6 @@ __KERNEL_RCSID(0, "$NetBSD: ip_input.c,v #define IPMTUDISCTIMEOUT (10 * 60) /* as per RFC 1191 */ #endif -#ifdef COMPAT_50 -#include -#include -#endif - /* * Note: DIRECTED_BROADCAST is handled this way so that previous * configuration using this option will Just Work. @@ -383,8 +377,6 @@ struct mowner ip_rx_mowner = MOWNER_INIT struct mowner ip_tx_mowner = MOWNER_INIT("internet", "tx"); #endif -static void sysctl_net_inet_ip_setup(struct sysctllog **); - /* * Compute IP limits derived from the value of nmbclusters. */ @@ -405,8 +397,6 @@ ip_init(void) const struct protosw *pr; int i; - sysctl_net_inet_ip_setup(NULL); - pool_init(&inmulti_pool, sizeof(struct in_multi), 0, 0, 0, "inmltpl", NULL, IPL_SOFTNET); pool_init(&ipqent_pool, sizeof(struct ipqent), 0, 0, 0, "ipqepl", @@ -1132,7 +1122,8 @@ ip_reass(struct ipqent *ipqe, struct ipq else if (ip_nfragpackets >= ip_maxfragpackets) goto dropfrag; ip_nfragpackets++; - fp = malloc(sizeof (struct ipq), M_FTABLE, M_NOWAIT); + MALLOC(fp, struct ipq *, sizeof (struct ipq), + M_FTABLE, M_NOWAIT); if (fp == NULL) goto dropfrag; LIST_INSERT_HEAD(ipqhead, fp, ipq_q); @@ -1263,7 +1254,7 @@ insert: ip->ip_src = fp->ipq_src; ip->ip_dst = fp->ipq_dst; LIST_REMOVE(fp, ipq_q); - free(fp, M_FTABLE); + FREE(fp, M_FTABLE); ip_nfragpackets--; m->m_len += (ip->ip_hl << 2); m->m_data -= (ip->ip_hl << 2); @@ -1316,7 +1307,7 @@ ip_freef(struct ipq *fp) printf("ip_freef: nfrags %d != %d\n", fp->ipq_nfrags, nfrags); ip_nfrags -= nfrags; LIST_REMOVE(fp, ipq_q); - free(fp, M_FTABLE); + FREE(fp, M_FTABLE); ip_nfragpackets--; } @@ -1566,7 +1557,7 @@ ip_dooptions(struct mbuf *m) /* * locate outgoing interface */ - memcpy((void *)&ipaddr.sin_addr, (void *)(cp + off), + bcopy((void *)(cp + off), (void *)&ipaddr.sin_addr, sizeof(ipaddr.sin_addr)); if (opt == IPOPT_SSRR) ia = ifatoia(ifa_ifwithladdr(sintosa(&ipaddr))); @@ -1602,7 +1593,7 @@ ip_dooptions(struct mbuf *m) off--; /* 0 origin */ if ((off + sizeof(struct in_addr)) > optlen) break; - memcpy((void *)&ipaddr.sin_addr, (void *)(&ip->ip_dst), + bcopy((void *)(&ip->ip_dst), (void *)&ipaddr.sin_addr, sizeof(ipaddr.sin_addr)); /* * locate outgoing interface; if we're the destination, @@ -1669,7 +1660,7 @@ ip_dooptions(struct mbuf *m) (u_char *)ip; goto bad; } - memcpy(&ipaddr.sin_addr, cp0, + bcopy(cp0, &ipaddr.sin_addr, sizeof(struct in_addr)); if (ifatoia(ifa_ifwithaddr(sintosa(&ipaddr))) == NULL) @@ -1743,7 +1734,7 @@ save_rte(u_char *option, struct in_addr #endif /* 0 */ if (olen > sizeof(ip_srcrt) - (1 + sizeof(dst))) return; - memcpy((void *)ip_srcrt.srcopt, (void *)option, olen); + bcopy((void *)option, (void *)ip_srcrt.srcopt, olen); ip_nhops = (olen - IPOPT_OFFSET - 1) / sizeof(struct in_addr); ip_srcrt.dst = dst; } @@ -2061,22 +2052,10 @@ ip_savecontrol(struct inpcb *inp, struct struct mbuf *m) { - if (inp->inp_socket->so_options & SO_TIMESTAMP -#ifdef SO_OTIMESTAMP - || inp->inp_socket->so_options & SO_OTIMESTAMP -#endif - ) { + if (inp->inp_socket->so_options & SO_TIMESTAMP) { struct timeval tv; microtime(&tv); -#ifdef SO_OTIMESTAMP - if (inp->inp_socket->so_options & SO_OTIMESTAMP) { - struct timeval50 tv50; - timeval_to_timeval50(&tv, &tv50); - *mp = sbcreatecontrol((void *) &tv50, sizeof(tv50), - SCM_OTIMESTAMP, SOL_SOCKET); - } else -#endif *mp = sbcreatecontrol((void *) &tv, sizeof(tv), SCM_TIMESTAMP, SOL_SOCKET); if (*mp) @@ -2122,12 +2101,6 @@ ip_savecontrol(struct inpcb *inp, struct if (*mp) mp = &(*mp)->m_next; } - if (inp->inp_flags & INP_RECVTTL) { - *mp = sbcreatecontrol((void *) &ip->ip_ttl, - sizeof(uint8_t), IP_RECVTTL, IPPROTO_IP); - if (*mp) - mp = &(*mp)->m_next; - } } /* @@ -2146,10 +2119,9 @@ sysctl_net_inet_ip_forwsrcrt(SYSCTLFN_AR if (error || newp == NULL) return (error); - error = kauth_authorize_network(l->l_cred, KAUTH_NETWORK_FORWSRCRT, - 0, NULL, NULL, NULL); - if (error) - return (error); + if (kauth_authorize_network(l->l_cred, KAUTH_NETWORK_FORWSRCRT, + 0, NULL, NULL, NULL)) + return (EPERM); ip_forwsrcrt = tmp; @@ -2211,7 +2183,7 @@ sysctl_net_inet_ip_maxflows(SYSCTLFN_ARG static int sysctl_net_inet_ip_hashsize(SYSCTLFN_ARGS) -{ +{ int error, tmp; struct sysctlnode node; @@ -2239,7 +2211,7 @@ sysctl_net_inet_ip_hashsize(SYSCTLFN_ARG * EINVAL if not a power of 2 */ error = EINVAL; - } + } return error; } @@ -2252,8 +2224,7 @@ sysctl_net_inet_ip_stats(SYSCTLFN_ARGS) return (NETSTAT_SYSCTL(ipstat_percpu, IP_NSTATS)); } -static void -sysctl_net_inet_ip_setup(struct sysctllog **clog) +SYSCTL_SETUP(sysctl_net_inet_ip_setup, "sysctl net.inet.ip subtree setup") { extern int subnetsarelocal, hostzeroisbroadcast;