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.273 retrieving revision 1.278 diff -u -p -r1.273 -r1.278 --- src/sys/netinet/ip_input.c 2008/08/20 18:35:20 1.273 +++ src/sys/netinet/ip_input.c 2009/01/19 02:27:57 1.278 @@ -1,4 +1,4 @@ -/* $NetBSD: ip_input.c,v 1.273 2008/08/20 18:35:20 matt Exp $ */ +/* $NetBSD: ip_input.c,v 1.278 2009/01/19 02:27:57 christos Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -91,9 +91,10 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.273 2008/08/20 18:35:20 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.278 2009/01/19 02:27:57 christos Exp $"); #include "opt_inet.h" +#include "opt_compat_netbsd.h" #include "opt_gateway.h" #include "opt_pfil_hooks.h" #include "opt_ipsec.h" @@ -173,6 +174,11 @@ __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. @@ -330,10 +336,8 @@ do { \ #define IPQ_UNLOCK() ipq_unlock() -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", NULL, - IPL_VM); +struct pool inmulti_pool; +struct pool ipqent_pool; #ifdef INET_CSUM_COUNTERS #include @@ -399,6 +403,11 @@ ip_init(void) const struct protosw *pr; int i; + 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", + NULL, IPL_VM); + pr = pffindproto(PF_INET, IPPROTO_RAW, SOCK_RAW); if (pr == 0) panic("ip_init"); @@ -928,6 +937,7 @@ ours: */ if (ip->ip_tos != fp->ipq_tos) { IP_STATINC(IP_STAT_BADFRAGS); + IPQ_UNLOCK(); goto bad; } goto found; @@ -1118,8 +1128,7 @@ ip_reass(struct ipqent *ipqe, struct ipq else if (ip_nfragpackets >= ip_maxfragpackets) goto dropfrag; ip_nfragpackets++; - MALLOC(fp, struct ipq *, sizeof (struct ipq), - M_FTABLE, M_NOWAIT); + fp = malloc(sizeof (struct ipq), M_FTABLE, M_NOWAIT); if (fp == NULL) goto dropfrag; LIST_INSERT_HEAD(ipqhead, fp, ipq_q); @@ -1250,7 +1259,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); @@ -1303,7 +1312,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--; } @@ -1967,9 +1976,11 @@ ip_forward(struct mbuf *m, int srcrt) type = ICMP_UNREACH; code = ICMP_UNREACH_NEEDFRAG; - if ((rt = rtcache_validate(&ipforward_rt)) != NULL) { + if ((rt = rtcache_validate(&ipforward_rt)) != NULL) + destmtu = rt->rt_ifp->if_mtu; #if defined(IPSEC) || defined(FAST_IPSEC) + { /* * If the packet is routed over IPsec tunnel, tell the * originator the tunnel MTU. @@ -1985,10 +1996,7 @@ ip_forward(struct mbuf *m, int srcrt) sp = ipsec4_getpolicybyaddr(mcopy, IPSEC_DIR_OUTBOUND, IP_FORWARDING, &ipsecerror); -#endif - destmtu = rt->rt_ifp->if_mtu; -#if defined(IPSEC) || defined(FAST_IPSEC) if (sp != NULL) { /* count IPsec header size */ ipsechdr = ipsec4_hdrsiz(mcopy, @@ -2003,6 +2011,7 @@ ip_forward(struct mbuf *m, int srcrt) && sp->req->sav != NULL && sp->req->sav->sah != NULL) { ro = &sp->req->sav->sah->sa_route; + rt = rtcache_validate(ro); if (rt && rt->rt_ifp) { destmtu = rt->rt_rmx.rmx_mtu ? @@ -2018,8 +2027,8 @@ ip_forward(struct mbuf *m, int srcrt) KEY_FREESP(&sp); #endif } -#endif /*defined(IPSEC) || defined(FAST_IPSEC)*/ } +#endif /*defined(IPSEC) || defined(FAST_IPSEC)*/ IP_STATINC(IP_STAT_CANTFRAG); break; @@ -2048,10 +2057,22 @@ ip_savecontrol(struct inpcb *inp, struct struct mbuf *m) { - if (inp->inp_socket->so_options & SO_TIMESTAMP) { + if (inp->inp_socket->so_options & SO_TIMESTAMP +#ifdef SO_OTIMESTAMP + || inp->inp_socket->so_options & SO_OTIMESTAMP +#endif + ) { 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)