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/netinet6/ip6_input.c,v rcsdiff: /ftp/cvs/cvsroot/src/sys/netinet6/ip6_input.c,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.118.2.3 retrieving revision 1.119 diff -u -p -r1.118.2.3 -r1.119 --- src/sys/netinet6/ip6_input.c 2010/03/11 15:04:29 1.118.2.3 +++ src/sys/netinet6/ip6_input.c 2008/05/04 07:22:15 1.119 @@ -1,4 +1,4 @@ -/* $NetBSD: ip6_input.c,v 1.118.2.3 2010/03/11 15:04:29 yamt Exp $ */ +/* $NetBSD: ip6_input.c,v 1.119 2008/05/04 07:22:15 thorpej Exp $ */ /* $KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $ */ /* @@ -62,14 +62,12 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ip6_input.c,v 1.118.2.3 2010/03/11 15:04:29 yamt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ip6_input.c,v 1.119 2008/05/04 07:22:15 thorpej Exp $"); -#include "opt_gateway.h" #include "opt_inet.h" #include "opt_inet6.h" #include "opt_ipsec.h" #include "opt_pfil_hooks.h" -#include "opt_compat_netbsd.h" #include #include @@ -122,11 +120,6 @@ __KERNEL_RCSID(0, "$NetBSD: ip6_input.c, #include #endif /* FAST_IPSEC */ -#ifdef COMPAT_50 -#include -#include -#endif - #include #include "faith.h" @@ -162,7 +155,6 @@ static struct m_tag *ip6_setdstifaddr(st static int ip6_hopopts_input(u_int32_t *, u_int32_t *, struct mbuf **, int *); static struct mbuf *ip6_pullexthdr(struct mbuf *, size_t, int); -static void sysctl_net_inet6_ip6_setup(struct sysctllog **); /* * IP6 initialization: fill in IP6 protocol switch table. @@ -174,7 +166,6 @@ ip6_init(void) const struct ip6protosw *pr; int i; - sysctl_net_inet6_ip6_setup(NULL); pr = (const struct ip6protosw *)pffindproto(PF_INET6, IPPROTO_RAW, SOCK_RAW); if (pr == 0) panic("ip6_init"); @@ -963,7 +954,7 @@ ip6_process_hopopts(struct mbuf *m, u_in return (-1); } optlen = IP6OPT_RTALERT_LEN; - memcpy((void *)&rtalert_val, (void *)(opt + 2), 2); + bcopy((void *)(opt + 2), (void *)&rtalert_val, 2); *rtalertp = ntohs(rtalert_val); break; case IP6OPT_JUMBO: @@ -998,7 +989,7 @@ ip6_process_hopopts(struct mbuf *m, u_in * We may see jumbolen in unaligned location, so * we'd need to perform bcopy(). */ - memcpy(&jumboplen, opt + 2, sizeof(jumboplen)); + bcopy(opt + 2, &jumboplen, sizeof(jumboplen)); jumboplen = (u_int32_t)htonl(jumboplen); #if 1 @@ -1111,27 +1102,17 @@ ip6_savecontrol(struct in6pcb *in6p, str #define IS2292(x, y) (y) #endif - if (in6p->in6p_socket->so_options & SO_TIMESTAMP -#ifdef SO_OTIMESTAMP - || in6p->in6p_socket->so_options & SO_OTIMESTAMP -#endif - ) { +#ifdef SO_TIMESTAMP + if (in6p->in6p_socket->so_options & SO_TIMESTAMP) { struct timeval tv; microtime(&tv); -#ifdef SO_OTIMESTAMP - if (in6p->in6p_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) mp = &(*mp)->m_next; } +#endif /* some OSes call this logic with IPv4 packet, for SO_TIMESTAMP */ if ((ip6->ip6_vfc & IPV6_VERSION_MASK) != IPV6_VERSION) @@ -1141,7 +1122,7 @@ ip6_savecontrol(struct in6pcb *in6p, str if ((in6p->in6p_flags & IN6P_PKTINFO) != 0) { struct in6_pktinfo pi6; - memcpy(&pi6.ipi6_addr, &ip6->ip6_dst, sizeof(struct in6_addr)); + bcopy(&ip6->ip6_dst, &pi6.ipi6_addr, sizeof(struct in6_addr)); in6_clearscope(&pi6.ipi6_addr); /* XXX */ pi6.ipi6_ifindex = m->m_pkthdr.rcvif ? m->m_pkthdr.rcvif->if_index : 0; @@ -1276,7 +1257,7 @@ ip6_savecontrol(struct in6pcb *in6p, str switch (nxt) { case IPPROTO_DSTOPTS: - if (!(in6p->in6p_flags & IN6P_DSTOPTS)) + if (!in6p->in6p_flags & IN6P_DSTOPTS) break; *mp = sbcreatecontrol((void *)ip6e, elen, @@ -1287,7 +1268,7 @@ ip6_savecontrol(struct in6pcb *in6p, str break; case IPPROTO_ROUTING: - if (!(in6p->in6p_flags & IN6P_RTHDR)) + if (!in6p->in6p_flags & IN6P_RTHDR) break; *mp = sbcreatecontrol((void *)ip6e, elen, @@ -1581,7 +1562,7 @@ ip6_addaux(struct mbuf *m) M_NOWAIT); if (mtag) { m_tag_prepend(m, mtag); - memset(mtag + 1, 0, sizeof(struct ip6aux)); + bzero(mtag + 1, sizeof(struct ip6aux)); } } return mtag; @@ -1614,21 +1595,17 @@ ip6_delaux(struct mbuf *m) static int sysctl_net_inet6_ip6_maxflows(SYSCTLFN_ARGS) { - int error; + int s; - error = sysctl_lookup(SYSCTLFN_CALL(rnode)); - if (error || newp == NULL) - return (error); + s = sysctl_lookup(SYSCTLFN_CALL(rnode)); + if (s || newp == NULL) + return (s); - mutex_enter(softnet_lock); - KERNEL_LOCK(1, NULL); - - ip6flow_reap(0); - - KERNEL_UNLOCK_ONE(NULL); - mutex_exit(softnet_lock); + s = splsoftnet(); + ip6flow_reap(0); + splx(s); - return (0); + return (0); } static int @@ -1648,21 +1625,16 @@ sysctl_net_inet6_ip6_hashsize(SYSCTLFN_A /* * Can only fail due to malloc() */ - mutex_enter(softnet_lock); - KERNEL_LOCK(1, NULL); - - error = ip6flow_invalidate_all(tmp); - - KERNEL_UNLOCK_ONE(NULL); - mutex_exit(softnet_lock); + if (ip6flow_invalidate_all(tmp)) + return ENOMEM; } else { /* * EINVAL if not a power of 2 - */ - error = EINVAL; + */ + return EINVAL; } - return error; + return (0); } #endif /* GATEWAY */ @@ -1670,7 +1642,7 @@ sysctl_net_inet6_ip6_hashsize(SYSCTLFN_A * System control for IP6 */ -const u_char inet6ctlerrmap[PRC_NCMDS] = { +u_char inet6ctlerrmap[PRC_NCMDS] = { 0, 0, 0, 0, 0, EMSGSIZE, EHOSTDOWN, EHOSTUNREACH, EHOSTUNREACH, EHOSTUNREACH, ECONNREFUSED, ECONNREFUSED, @@ -1686,8 +1658,7 @@ sysctl_net_inet6_ip6_stats(SYSCTLFN_ARGS return (NETSTAT_SYSCTL(ip6stat_percpu, IP6_NSTATS)); } -static void -sysctl_net_inet6_ip6_setup(struct sysctllog **clog) +SYSCTL_SETUP(sysctl_net_inet6_ip6_setup, "sysctl net.inet6.ip6 subtree setup") { #ifdef RFC2292 #define IS2292(x, y) ((in6p->in6p_flags & IN6P_RFC2292) ? (x) : (y))