CVS commit: src/sys/netinet
Module Name:src Committed By: christos Date: Fri May 27 16:44:15 UTC 2016 Modified Files: src/sys/netinet: in.c Log Message: make hostzerobroadcast default to "no". To generate a diff of this commit: cvs rdiff -u -r1.165 -r1.166 src/sys/netinet/in.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/in.c diff -u src/sys/netinet/in.c:1.165 src/sys/netinet/in.c:1.166 --- src/sys/netinet/in.c:1.165 Mon Apr 4 03:37:07 2016 +++ src/sys/netinet/in.c Fri May 27 12:44:15 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: in.c,v 1.165 2016/04/04 07:37:07 ozaki-r Exp $ */ +/* $NetBSD: in.c,v 1.166 2016/05/27 16:44:15 christos Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -91,7 +91,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: in.c,v 1.165 2016/04/04 07:37:07 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: in.c,v 1.166 2016/05/27 16:44:15 christos Exp $"); #include "arp.h" @@ -157,7 +157,7 @@ static void in_sysctl_init(struct sysctl #endif #ifndef HOSTZEROBROADCAST -#define HOSTZEROBROADCAST 1 +#define HOSTZEROBROADCAST 0 #endif /* Note: 61, 127, 251, 509, 1021, 2039 are good. */
CVS commit: src/sys/netinet
Module Name:src Committed By: rjs Date: Sun May 22 23:04:27 UTC 2016 Modified Files: src/sys/netinet: sctputil.c sctputil.h Log Message: Use const for arguments to sctp_is_same_scope(). To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/netinet/sctputil.c cvs rdiff -u -r1.1 -r1.2 src/sys/netinet/sctputil.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/sctputil.c diff -u src/sys/netinet/sctputil.c:1.7 src/sys/netinet/sctputil.c:1.8 --- src/sys/netinet/sctputil.c:1.7 Thu May 12 02:24:17 2016 +++ src/sys/netinet/sctputil.c Sun May 22 23:04:27 2016 @@ -1,5 +1,5 @@ /* $KAME: sctputil.c,v 1.39 2005/06/16 20:54:06 jinmei Exp $ */ -/* $NetBSD: sctputil.c,v 1.7 2016/05/12 02:24:17 ozaki-r Exp $ */ +/* $NetBSD: sctputil.c,v 1.8 2016/05/22 23:04:27 rjs Exp $ */ /* * Copyright (c) 2001, 2002, 2003, 2004 Cisco Systems, Inc. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sctputil.c,v 1.7 2016/05/12 02:24:17 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sctputil.c,v 1.8 2016/05/22 23:04:27 rjs Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -2959,7 +2959,7 @@ sctp_is_there_an_abort_here(struct mbuf * so, create this function to compare link local scopes */ uint32_t -sctp_is_same_scope(struct sockaddr_in6 *addr1, struct sockaddr_in6 *addr2) +sctp_is_same_scope(const struct sockaddr_in6 *addr1, const struct sockaddr_in6 *addr2) { struct sockaddr_in6 a, b; Index: src/sys/netinet/sctputil.h diff -u src/sys/netinet/sctputil.h:1.1 src/sys/netinet/sctputil.h:1.2 --- src/sys/netinet/sctputil.h:1.1 Tue Oct 13 21:28:35 2015 +++ src/sys/netinet/sctputil.h Sun May 22 23:04:27 2016 @@ -1,5 +1,5 @@ /* $KAME: sctputil.h,v 1.15 2005/03/06 16:04:19 itojun Exp $ */ -/* $NetBSD: sctputil.h,v 1.1 2015/10/13 21:28:35 rjs Exp $ */ +/* $NetBSD: sctputil.h,v 1.2 2016/05/22 23:04:27 rjs Exp $ */ #ifndef __SCTPUTIL_H__ #define __SCTPUTIL_H__ @@ -190,7 +190,8 @@ void sctp_handle_ootb(struct mbuf *, int struct sctp_inpcb *, struct mbuf *); int sctp_is_there_an_abort_here(struct mbuf *, int, int *); -uint32_t sctp_is_same_scope(struct sockaddr_in6 *, struct sockaddr_in6 *); +uint32_t sctp_is_same_scope(const struct sockaddr_in6 *, + const struct sockaddr_in6 *); const struct sockaddr_in6 *sctp_recover_scope(const struct sockaddr_in6 *, struct sockaddr_in6 *);
CVS commit: src/sys/netinet
Module Name:src Committed By: rjs Date: Sun May 22 23:04:27 UTC 2016 Modified Files: src/sys/netinet: sctputil.c sctputil.h Log Message: Use const for arguments to sctp_is_same_scope(). To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/netinet/sctputil.c cvs rdiff -u -r1.1 -r1.2 src/sys/netinet/sctputil.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: rjs Date: Sun May 22 22:18:41 UTC 2016 Modified Files: src/sys/netinet: sctp_pcb.c Log Message: Remove rtcache reference to route before freeing the containing struct. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/netinet/sctp_pcb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/sctp_pcb.c diff -u src/sys/netinet/sctp_pcb.c:1.5 src/sys/netinet/sctp_pcb.c:1.6 --- src/sys/netinet/sctp_pcb.c:1.5 Thu May 12 02:24:17 2016 +++ src/sys/netinet/sctp_pcb.c Sun May 22 22:18:41 2016 @@ -1,5 +1,5 @@ /* $KAME: sctp_pcb.c,v 1.39 2005/06/16 18:29:25 jinmei Exp $ */ -/* $NetBSD: sctp_pcb.c,v 1.5 2016/05/12 02:24:17 ozaki-r Exp $ */ +/* $NetBSD: sctp_pcb.c,v 1.6 2016/05/22 22:18:41 rjs Exp $ */ /* * Copyright (c) 2001, 2002, 2003, 2004 Cisco Systems, Inc. @@ -33,7 +33,7 @@ * SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: sctp_pcb.c,v 1.5 2016/05/12 02:24:17 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sctp_pcb.c,v 1.6 2016/05/22 22:18:41 rjs Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -2899,6 +2899,7 @@ sctp_free_remote_addr(struct sctp_nets * callout_destroy(>rxt_timer.timer); callout_destroy(>pmtu_timer.timer); net->dest_state = SCTP_ADDR_NOT_REACHABLE; + rtcache_free(>ro); SCTP_ZONE_FREE(sctppcbinfo.ipi_zone_net, net); sctppcbinfo.ipi_count_raddr--; } @@ -3160,6 +3161,7 @@ sctp_free_assoc(struct sctp_inpcb *inp, } prev = net; TAILQ_REMOVE(>nets, net, sctp_next); + rtcache_free(>ro); /* free it */ net->ref_count = 0; SCTP_ZONE_FREE(sctppcbinfo.ipi_zone_net, net);
CVS commit: src/sys/netinet
Module Name:src Committed By: rjs Date: Sun May 22 22:18:41 UTC 2016 Modified Files: src/sys/netinet: sctp_pcb.c Log Message: Remove rtcache reference to route before freeing the containing struct. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/netinet/sctp_pcb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: ozaki-r Date: Tue May 17 09:00:24 UTC 2016 Modified Files: src/sys/netinet: if_arp.c Log Message: Get rid of unnecessary assignment To generate a diff of this commit: cvs rdiff -u -r1.209 -r1.210 src/sys/netinet/if_arp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/if_arp.c diff -u src/sys/netinet/if_arp.c:1.209 src/sys/netinet/if_arp.c:1.210 --- src/sys/netinet/if_arp.c:1.209 Mon Apr 25 14:38:08 2016 +++ src/sys/netinet/if_arp.c Tue May 17 09:00:24 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: if_arp.c,v 1.209 2016/04/25 14:38:08 ozaki-r Exp $ */ +/* $NetBSD: if_arp.c,v 1.210 2016/05/17 09:00:24 ozaki-r Exp $ */ /*- * Copyright (c) 1998, 2000, 2008 The NetBSD Foundation, Inc. @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.209 2016/04/25 14:38:08 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.210 2016/05/17 09:00:24 ozaki-r Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -598,7 +598,7 @@ arp_rtrequest(int req, struct rtentry *r rt->rt_expire = 0; if (useloopback) { - ifp = rt->rt_ifp = lo0ifp; + rt->rt_ifp = lo0ifp; rt->rt_rmx.rmx_mtu = 0; } rt->rt_flags |= RTF_LOCAL;
CVS commit: src/sys/netinet
Module Name:src Committed By: ozaki-r Date: Tue May 17 09:00:24 UTC 2016 Modified Files: src/sys/netinet: if_arp.c Log Message: Get rid of unnecessary assignment To generate a diff of this commit: cvs rdiff -u -r1.209 -r1.210 src/sys/netinet/if_arp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: ozaki-r Date: Mon May 9 07:02:10 UTC 2016 Modified Files: src/sys/netinet: ip_output.c Log Message: Fix compilation for ppc To generate a diff of this commit: cvs rdiff -u -r1.254 -r1.255 src/sys/netinet/ip_output.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/ip_output.c diff -u src/sys/netinet/ip_output.c:1.254 src/sys/netinet/ip_output.c:1.255 --- src/sys/netinet/ip_output.c:1.254 Wed May 4 15:42:32 2016 +++ src/sys/netinet/ip_output.c Mon May 9 07:02:10 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: ip_output.c,v 1.254 2016/05/04 15:42:32 christos Exp $ */ +/* $NetBSD: ip_output.c,v 1.255 2016/05/09 07:02:10 ozaki-r Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -91,7 +91,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.254 2016/05/04 15:42:32 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.255 2016/05/09 07:02:10 ozaki-r Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -1500,7 +1500,7 @@ ip_get_membership(const struct sockopt * static int ip_add_membership(struct ip_moptions *imo, const struct sockopt *sopt) { - struct ifnet *ifp; + struct ifnet *ifp = NULL; // XXX: gcc [ppc] struct in_addr ia; int i, error;
CVS commit: src/sys/netinet
Module Name:src Committed By: ozaki-r Date: Mon May 9 07:02:10 UTC 2016 Modified Files: src/sys/netinet: ip_output.c Log Message: Fix compilation for ppc To generate a diff of this commit: cvs rdiff -u -r1.254 -r1.255 src/sys/netinet/ip_output.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: christos Date: Wed May 4 15:42:32 UTC 2016 Modified Files: src/sys/netinet: ip_output.c Log Message: fix compilation for ppc. To generate a diff of this commit: cvs rdiff -u -r1.253 -r1.254 src/sys/netinet/ip_output.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/ip_output.c diff -u src/sys/netinet/ip_output.c:1.253 src/sys/netinet/ip_output.c:1.254 --- src/sys/netinet/ip_output.c:1.253 Wed Apr 27 20:16:56 2016 +++ src/sys/netinet/ip_output.c Wed May 4 11:42:32 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: ip_output.c,v 1.253 2016/04/28 00:16:56 ozaki-r Exp $ */ +/* $NetBSD: ip_output.c,v 1.254 2016/05/04 15:42:32 christos Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -91,7 +91,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.253 2016/04/28 00:16:56 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.254 2016/05/04 15:42:32 christos Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -1556,8 +1556,8 @@ ip_add_membership(struct ip_moptions *im static int ip_drop_membership(struct ip_moptions *imo, const struct sockopt *sopt) { - struct in_addr ia; - struct ifnet *ifp; + struct in_addr ia = { .s_addr = 0 }; // XXX: gcc [ppc] + struct ifnet *ifp = NULL; // XXX: gcc [ppc] int i, error; if (sopt->sopt_size == sizeof(struct ip_mreq))
CVS commit: src/sys/netinet
Module Name:src Committed By: christos Date: Wed May 4 15:42:32 UTC 2016 Modified Files: src/sys/netinet: ip_output.c Log Message: fix compilation for ppc. To generate a diff of this commit: cvs rdiff -u -r1.253 -r1.254 src/sys/netinet/ip_output.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: rjs Date: Tue Apr 26 11:02:57 UTC 2016 Modified Files: src/sys/netinet: sctputil.c Log Message: Fix build when IPSEC enabled. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/netinet/sctputil.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/sctputil.c diff -u src/sys/netinet/sctputil.c:1.5 src/sys/netinet/sctputil.c:1.6 --- src/sys/netinet/sctputil.c:1.5 Mon Apr 11 08:56:16 2016 +++ src/sys/netinet/sctputil.c Tue Apr 26 11:02:57 2016 @@ -1,5 +1,5 @@ /* $KAME: sctputil.c,v 1.39 2005/06/16 20:54:06 jinmei Exp $ */ -/* $NetBSD: sctputil.c,v 1.5 2016/04/11 08:56:16 ozaki-r Exp $ */ +/* $NetBSD: sctputil.c,v 1.6 2016/04/26 11:02:57 rjs Exp $ */ /* * Copyright (c) 2001, 2002, 2003, 2004 Cisco Systems, Inc. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sctputil.c,v 1.5 2016/04/11 08:56:16 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sctputil.c,v 1.6 2016/04/26 11:02:57 rjs Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -87,8 +87,8 @@ __KERNEL_RCSID(0, "$NetBSD: sctputil.c,v #include #ifdef IPSEC -#include -#include +#include +#include #endif /* IPSEC */ #include
CVS commit: src/sys/netinet
Module Name:src Committed By: rjs Date: Tue Apr 26 11:02:57 UTC 2016 Modified Files: src/sys/netinet: sctputil.c Log Message: Fix build when IPSEC enabled. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/netinet/sctputil.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: ozaki-r Date: Tue Apr 19 09:36:35 UTC 2016 Modified Files: src/sys/netinet: ip_output.c Log Message: Fix error path To generate a diff of this commit: cvs rdiff -u -r1.250 -r1.251 src/sys/netinet/ip_output.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: ozaki-r Date: Tue Apr 19 09:36:35 UTC 2016 Modified Files: src/sys/netinet: ip_output.c Log Message: Fix error path To generate a diff of this commit: cvs rdiff -u -r1.250 -r1.251 src/sys/netinet/ip_output.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/ip_output.c diff -u src/sys/netinet/ip_output.c:1.250 src/sys/netinet/ip_output.c:1.251 --- src/sys/netinet/ip_output.c:1.250 Tue Apr 19 09:29:54 2016 +++ src/sys/netinet/ip_output.c Tue Apr 19 09:36:35 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: ip_output.c,v 1.250 2016/04/19 09:29:54 ozaki-r Exp $ */ +/* $NetBSD: ip_output.c,v 1.251 2016/04/19 09:36:35 ozaki-r Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -91,7 +91,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.250 2016/04/19 09:29:54 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.251 2016/04/19 09:36:35 ozaki-r Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -289,7 +289,7 @@ ip_hresolv_output(struct ifnet * const i out: error = ip_mark_mpls(ifp, m, rt0); if (error != 0) - return error; + goto bad; error = klock_if_output(ifp, m, dst, rt); goto exit;
CVS commit: src/sys/netinet
Module Name:src Committed By: ozaki-r Date: Tue Apr 19 09:29:54 UTC 2016 Modified Files: src/sys/netinet: ip_output.c Log Message: Separate MPLS-related routines from ip_hresolv_output No functional changes. To generate a diff of this commit: cvs rdiff -u -r1.249 -r1.250 src/sys/netinet/ip_output.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/ip_output.c diff -u src/sys/netinet/ip_output.c:1.249 src/sys/netinet/ip_output.c:1.250 --- src/sys/netinet/ip_output.c:1.249 Mon Apr 18 01:28:06 2016 +++ src/sys/netinet/ip_output.c Tue Apr 19 09:29:54 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: ip_output.c,v 1.249 2016/04/18 01:28:06 ozaki-r Exp $ */ +/* $NetBSD: ip_output.c,v 1.250 2016/04/19 09:29:54 ozaki-r Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -91,7 +91,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.249 2016/04/18 01:28:06 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.250 2016/04/19 09:29:54 ozaki-r Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -195,6 +195,37 @@ klock_if_output(struct ifnet * const ifp return error; } +static int +ip_mark_mpls(struct ifnet * const ifp, struct mbuf * const m, struct rtentry *rt) +{ + int error = 0; +#ifdef MPLS + union mpls_shim msh; + + if (rt == NULL || rt_gettag(rt) == NULL || + rt_gettag(rt)->sa_family != AF_MPLS || + (m->m_flags & (M_MCAST | M_BCAST)) != 0 || + ifp->if_type != IFT_ETHER) + return 0; + + msh.s_addr = MPLS_GETSADDR(rt); + if (msh.shim.label != MPLS_LABEL_IMPLNULL) { + struct m_tag *mtag; + /* + * XXX tentative solution to tell ether_output + * it's MPLS. Need some more efficient solution. + */ + mtag = m_tag_get(PACKET_TAG_MPLS, + sizeof(int) /* dummy */, + M_NOWAIT); + if (mtag == NULL) + return ENOMEM; + m_tag_prepend(m, mtag); + } +#endif + return error; +} + /* * Send an IP packet to a host. * @@ -256,30 +287,9 @@ ip_hresolv_output(struct ifnet * const i } out: -#ifdef MPLS - if (rt0 != NULL && rt_gettag(rt0) != NULL && - rt_gettag(rt0)->sa_family == AF_MPLS && - (m->m_flags & (M_MCAST | M_BCAST)) == 0 && - ifp->if_type == IFT_ETHER) { - union mpls_shim msh; - msh.s_addr = MPLS_GETSADDR(rt0); - if (msh.shim.label != MPLS_LABEL_IMPLNULL) { - struct m_tag *mtag; - /* - * XXX tentative solution to tell ether_output - * it's MPLS. Need some more efficient solution. - */ - mtag = m_tag_get(PACKET_TAG_MPLS, - sizeof(int) /* dummy */, - M_NOWAIT); - if (mtag == NULL) { -error = ENOMEM; -goto bad; - } - m_tag_prepend(m, mtag); - } - } -#endif + error = ip_mark_mpls(ifp, m, rt0); + if (error != 0) + return error; error = klock_if_output(ifp, m, dst, rt); goto exit;
CVS commit: src/sys/netinet
Module Name:src Committed By: ozaki-r Date: Tue Apr 19 09:29:54 UTC 2016 Modified Files: src/sys/netinet: ip_output.c Log Message: Separate MPLS-related routines from ip_hresolv_output No functional changes. To generate a diff of this commit: cvs rdiff -u -r1.249 -r1.250 src/sys/netinet/ip_output.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: ozaki-r Date: Tue Apr 19 04:13:56 UTC 2016 Modified Files: src/sys/netinet: if_arp.c if_inarp.h Log Message: Constify rtentry of arpresolve We don't need to (rather shouldn't) modify rtentry in there. To generate a diff of this commit: cvs rdiff -u -r1.207 -r1.208 src/sys/netinet/if_arp.c cvs rdiff -u -r1.48 -r1.49 src/sys/netinet/if_inarp.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/if_arp.c diff -u src/sys/netinet/if_arp.c:1.207 src/sys/netinet/if_arp.c:1.208 --- src/sys/netinet/if_arp.c:1.207 Mon Apr 18 02:24:42 2016 +++ src/sys/netinet/if_arp.c Tue Apr 19 04:13:56 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: if_arp.c,v 1.207 2016/04/18 02:24:42 ozaki-r Exp $ */ +/* $NetBSD: if_arp.c,v 1.208 2016/04/19 04:13:56 ozaki-r Exp $ */ /*- * Copyright (c) 1998, 2000, 2008 The NetBSD Foundation, Inc. @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.207 2016/04/18 02:24:42 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.208 2016/04/19 04:13:56 ozaki-r Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -685,7 +685,7 @@ arprequest(struct ifnet *ifp, * Any other value indicates an error. */ int -arpresolve(struct ifnet *ifp, struct rtentry *rt, struct mbuf *m, +arpresolve(struct ifnet *ifp, const struct rtentry *rt, struct mbuf *m, const struct sockaddr *dst, void *desten, size_t destlen) { struct llentry *la; @@ -707,18 +707,6 @@ arpresolve(struct ifnet *ifp, struct rte return 0; } - /* - * Re-send the ARP request when appropriate. - */ -#ifdef DIAGNOSTIC - if (rt->rt_expire == 0) { - /* This should never happen. (Should it? -gwr) */ - printf("%s: unresolved and rt_expire == 0\n", __func__); - /* Set expiration time to now (expired). */ - rt->rt_expire = time_uptime; - } -#endif - notfound: #ifdef IFF_STATICARP /* FreeBSD */ #define _IFF_NOARP (IFF_NOARP | IFF_STATICARP) @@ -859,17 +847,18 @@ notfound: (dst)->sin_addr, enaddr); } else { struct sockaddr_in sin; + struct rtentry *_rt; sockaddr_in_init(, >r_l3addr.addr4, 0); /* XXX */ - rt = rtalloc1((struct sockaddr *), 0); - if (rt == NULL) + _rt = rtalloc1((struct sockaddr *), 0); + if (_rt == NULL) goto bad; - arprequest(ifp, (rt->rt_ifa->ifa_addr)->sin_addr, + arprequest(ifp, + (_rt->rt_ifa->ifa_addr)->sin_addr, (dst)->sin_addr, enaddr); - rtfree(rt); - rt = NULL; + rtfree(_rt); } return error; } Index: src/sys/netinet/if_inarp.h diff -u src/sys/netinet/if_inarp.h:1.48 src/sys/netinet/if_inarp.h:1.49 --- src/sys/netinet/if_inarp.h:1.48 Thu Apr 7 03:22:15 2016 +++ src/sys/netinet/if_inarp.h Tue Apr 19 04:13:56 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: if_inarp.h,v 1.48 2016/04/07 03:22:15 christos Exp $ */ +/* $NetBSD: if_inarp.h,v 1.49 2016/04/19 04:13:56 ozaki-r Exp $ */ /* * Copyright (c) 1982, 1986, 1993 @@ -75,7 +75,7 @@ MALLOC_DECLARE(M_IPARP); extern struct ifqueue arpintrq; void arp_ifinit(struct ifnet *, struct ifaddr *); void arp_rtrequest(int, struct rtentry *, const struct rt_addrinfo *); -int arpresolve(struct ifnet *, struct rtentry *, struct mbuf *, +int arpresolve(struct ifnet *, const struct rtentry *, struct mbuf *, const struct sockaddr *, void *, size_t); void arpintr(void); void arprequest(struct ifnet *, const struct in_addr *, const struct in_addr *,
CVS commit: src/sys/netinet
Module Name:src Committed By: ozaki-r Date: Tue Apr 19 04:13:56 UTC 2016 Modified Files: src/sys/netinet: if_arp.c if_inarp.h Log Message: Constify rtentry of arpresolve We don't need to (rather shouldn't) modify rtentry in there. To generate a diff of this commit: cvs rdiff -u -r1.207 -r1.208 src/sys/netinet/if_arp.c cvs rdiff -u -r1.48 -r1.49 src/sys/netinet/if_inarp.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: ozaki-r Date: Mon Apr 18 02:24:42 UTC 2016 Modified Files: src/sys/netinet: if_arp.c Log Message: Fix panic on receiving an ARP request The panic happened if an ARP request has a spa (i.e., IP address) whose ARP entry already exists in the table as a static ARP entry. To generate a diff of this commit: cvs rdiff -u -r1.206 -r1.207 src/sys/netinet/if_arp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/if_arp.c diff -u src/sys/netinet/if_arp.c:1.206 src/sys/netinet/if_arp.c:1.207 --- src/sys/netinet/if_arp.c:1.206 Wed Apr 13 00:47:01 2016 +++ src/sys/netinet/if_arp.c Mon Apr 18 02:24:42 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: if_arp.c,v 1.206 2016/04/13 00:47:01 ozaki-r Exp $ */ +/* $NetBSD: if_arp.c,v 1.207 2016/04/18 02:24:42 ozaki-r Exp $ */ /*- * Copyright (c) 1998, 2000, 2008 The NetBSD Foundation, Inc. @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.206 2016/04/13 00:47:01 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.207 2016/04/18 02:24:42 ozaki-r Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -1223,10 +1223,11 @@ in_arpinput(struct mbuf *m) KASSERT(sizeof(la->ll_addr) >= ifp->if_addrlen); (void)memcpy(>ll_addr, ar_sha(ah), ifp->if_addrlen); la->la_flags |= LLE_VALID; - la->la_expire = time_uptime + arpt_keep; + if ((la->la_flags & LLE_STATIC) == 0) { + la->la_expire = time_uptime + arpt_keep; + arp_settimer(la, arpt_keep); + } la->la_asked = 0; - KASSERT((la->la_flags & LLE_STATIC) == 0); - arp_settimer(la, arpt_keep); /* rt->rt_flags &= ~RTF_REJECT; */ if (la->la_hold != NULL) {
CVS commit: src/sys/netinet
Module Name:src Committed By: ozaki-r Date: Mon Apr 18 02:24:42 UTC 2016 Modified Files: src/sys/netinet: if_arp.c Log Message: Fix panic on receiving an ARP request The panic happened if an ARP request has a spa (i.e., IP address) whose ARP entry already exists in the table as a static ARP entry. To generate a diff of this commit: cvs rdiff -u -r1.206 -r1.207 src/sys/netinet/if_arp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: ozaki-r Date: Mon Apr 18 01:28:06 UTC 2016 Modified Files: src/sys/netinet: ip_output.c Log Message: Get rid of meaningless RTF_UP check from ip_hresolv_output The check is meaningless because - An obtained rtentry is ensured that it's always RTF_UP by rtcache, rtalloc1 and rtlookup. If the rtentry isn't changed (i.e., RTF_UP gets dropped) during processing, the check should be unnecessary - Even if not, i.e., an obtained rtentry can be changed during processing, checking only at the point doesn't help; the rtentry can be changed after the check Instead we have to ensure that RTF_UP isn't dropped if someone is using it somehow. Note that we already ensure that a rtentry being used isn't freed by rt_refcnt. Proposed on tech-kern and tech-net. To generate a diff of this commit: cvs rdiff -u -r1.248 -r1.249 src/sys/netinet/ip_output.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/ip_output.c diff -u src/sys/netinet/ip_output.c:1.248 src/sys/netinet/ip_output.c:1.249 --- src/sys/netinet/ip_output.c:1.248 Wed Jan 20 22:12:22 2016 +++ src/sys/netinet/ip_output.c Mon Apr 18 01:28:06 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: ip_output.c,v 1.248 2016/01/20 22:12:22 riastradh Exp $ */ +/* $NetBSD: ip_output.c,v 1.249 2016/04/18 01:28:06 ozaki-r Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -91,7 +91,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.248 2016/01/20 22:12:22 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.249 2016/04/18 01:28:06 ozaki-r Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -202,50 +202,20 @@ klock_if_output(struct ifnet * const ifp * calling ifp's output routine. */ int -ip_hresolv_output(struct ifnet * const ifp0, struct mbuf * const m, -const struct sockaddr * const dst, struct rtentry *rt00) +ip_hresolv_output(struct ifnet * const ifp, struct mbuf * const m, +const struct sockaddr * const dst, struct rtentry *rt0) { int error = 0; - struct ifnet *ifp = ifp0; - struct rtentry *rt, *rt0, *gwrt; + struct rtentry *rt = rt0, *gwrt; #define RTFREE_IF_NEEDED(_rt) \ - if ((_rt) != NULL && (_rt) != rt00) \ + if ((_rt) != NULL && (_rt) != rt0) \ rtfree((_rt)); - rt0 = rt00; -retry: - if (!ip_hresolv_needed(ifp)) { - rt = rt0; + if (!ip_hresolv_needed(ifp)) goto out; - } - - if (rt0 == NULL) { - rt = NULL; - goto out; - } - - rt = rt0; - - /* - * The following block is highly questionable. How did we get here - * with a !RTF_UP route? Does rtalloc1() always return an RTF_UP - * route? - */ - if ((rt->rt_flags & RTF_UP) == 0) { - rt = rtalloc1(dst, 1); - if (rt == NULL) { - error = EHOSTUNREACH; - goto bad; - } - rt0 = rt; - if (rt->rt_ifp != ifp) { - ifp = rt->rt_ifp; - goto retry; - } - } - if ((rt->rt_flags & RTF_GATEWAY) == 0) + if (rt == NULL || (rt->rt_flags & RTF_GATEWAY) == 0) goto out; gwrt = rt_get_gwroute(rt);
CVS commit: src/sys/netinet
Module Name:src Committed By: ozaki-r Date: Mon Apr 18 01:28:06 UTC 2016 Modified Files: src/sys/netinet: ip_output.c Log Message: Get rid of meaningless RTF_UP check from ip_hresolv_output The check is meaningless because - An obtained rtentry is ensured that it's always RTF_UP by rtcache, rtalloc1 and rtlookup. If the rtentry isn't changed (i.e., RTF_UP gets dropped) during processing, the check should be unnecessary - Even if not, i.e., an obtained rtentry can be changed during processing, checking only at the point doesn't help; the rtentry can be changed after the check Instead we have to ensure that RTF_UP isn't dropped if someone is using it somehow. Note that we already ensure that a rtentry being used isn't freed by rt_refcnt. Proposed on tech-kern and tech-net. To generate a diff of this commit: cvs rdiff -u -r1.248 -r1.249 src/sys/netinet/ip_output.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: rjs Date: Thu Apr 14 18:36:56 UTC 2016 Modified Files: src/sys/netinet: sctp_pcb.c Log Message: Remove stray debug printf(). To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/netinet/sctp_pcb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/sctp_pcb.c diff -u src/sys/netinet/sctp_pcb.c:1.2 src/sys/netinet/sctp_pcb.c:1.3 --- src/sys/netinet/sctp_pcb.c:1.2 Sun Apr 3 09:57:40 2016 +++ src/sys/netinet/sctp_pcb.c Thu Apr 14 18:36:56 2016 @@ -1,5 +1,5 @@ /* $KAME: sctp_pcb.c,v 1.39 2005/06/16 18:29:25 jinmei Exp $ */ -/* $NetBSD: sctp_pcb.c,v 1.2 2016/04/03 09:57:40 mlelstv Exp $ */ +/* $NetBSD: sctp_pcb.c,v 1.3 2016/04/14 18:36:56 rjs Exp $ */ /* * Copyright (c) 2001, 2002, 2003, 2004 Cisco Systems, Inc. @@ -33,7 +33,7 @@ * SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: sctp_pcb.c,v 1.2 2016/04/03 09:57:40 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sctp_pcb.c,v 1.3 2016/04/14 18:36:56 rjs Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -1312,7 +1312,6 @@ sctp_inpcb_alloc(struct socket *so) error = 0; - printf("sctp_inpcb_alloc: starting\n"); /* Hack alert: * * This code audits the entire INP list to see if
CVS commit: src/sys/netinet
Module Name:src Committed By: rjs Date: Thu Apr 14 18:36:56 UTC 2016 Modified Files: src/sys/netinet: sctp_pcb.c Log Message: Remove stray debug printf(). To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/netinet/sctp_pcb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: mlelstv Date: Sun Apr 3 09:57:40 UTC 2016 Modified Files: src/sys/netinet: sctp_asconf.c sctp_output.c sctp_pcb.c sctp_usrreq.c sctputil.c Log Message: Replace generic queue macros with IFNET/IFADDR macros. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/netinet/sctp_asconf.c \ src/sys/netinet/sctp_output.c src/sys/netinet/sctp_pcb.c cvs rdiff -u -r1.2 -r1.3 src/sys/netinet/sctp_usrreq.c cvs rdiff -u -r1.3 -r1.4 src/sys/netinet/sctputil.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/sctp_asconf.c diff -u src/sys/netinet/sctp_asconf.c:1.1 src/sys/netinet/sctp_asconf.c:1.2 --- src/sys/netinet/sctp_asconf.c:1.1 Tue Oct 13 21:28:35 2015 +++ src/sys/netinet/sctp_asconf.c Sun Apr 3 09:57:40 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: sctp_asconf.c,v 1.1 2015/10/13 21:28:35 rjs Exp $ */ +/* $NetBSD: sctp_asconf.c,v 1.2 2016/04/03 09:57:40 mlelstv Exp $ */ /* $KAME: sctp_asconf.c,v 1.25 2005/06/16 20:44:24 jinmei Exp $ */ /* @@ -30,7 +30,7 @@ * SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: sctp_asconf.c,v 1.1 2015/10/13 21:28:35 rjs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sctp_asconf.c,v 1.2 2016/04/03 09:57:40 mlelstv Exp $"); #ifdef _KERNEL_OPT #include "opt_ipsec.h" @@ -2116,7 +2116,7 @@ sctp_find_valid_localaddr(struct sctp_tc struct ifnet *ifn; struct ifaddr *ifa, *nifa; - TAILQ_FOREACH(ifn, _list, if_list) { + IFNET_FOREACH(ifn) { if (stcb->asoc.loopback_scope == 0 && ifn->if_type == IFT_LOOP) { /* Skip if loopback_scope not set */ continue; @@ -2774,14 +2774,14 @@ sctp_check_address_list_all(struct sctp_ struct ifaddr *ifa; /* go through all our known interfaces */ - TAILQ_FOREACH(ifn, _list, if_list) { + IFNET_FOREACH(ifn) { if (loopback_scope == 0 && ifn->if_type == IFT_LOOP) { /* skip loopback interface */ continue; } /* go through each interface address */ - TAILQ_FOREACH(ifa, >if_addrlist, ifa_list) { + IFADDR_FOREACH(ifa, ifn) { /* do i have it implicitly? */ if (sctp_cmpaddr(ifa->ifa_addr, init_addr)) { #ifdef SCTP_DEBUG Index: src/sys/netinet/sctp_output.c diff -u src/sys/netinet/sctp_output.c:1.1 src/sys/netinet/sctp_output.c:1.2 --- src/sys/netinet/sctp_output.c:1.1 Tue Oct 13 21:28:35 2015 +++ src/sys/netinet/sctp_output.c Sun Apr 3 09:57:40 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: sctp_output.c,v 1.1 2015/10/13 21:28:35 rjs Exp $ */ +/* $NetBSD: sctp_output.c,v 1.2 2016/04/03 09:57:40 mlelstv Exp $ */ /* $KAME: sctp_output.c,v 1.48 2005/06/16 18:29:24 jinmei Exp $ */ /* @@ -30,7 +30,7 @@ * SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: sctp_output.c,v 1.1 2015/10/13 21:28:35 rjs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sctp_output.c,v 1.2 2016/04/03 09:57:40 mlelstv Exp $"); #ifdef _KERNEL_OPT #include "opt_ipsec.h" @@ -546,7 +546,7 @@ sctp_choose_v4_boundspecific_inp(struct ifn = rt->rt_ifp; if (ifn) { /* is a prefered one on the interface we route out? */ - TAILQ_FOREACH(ifa, >if_addrlist, ifa_list) { + IFADDR_FOREACH(ifa, ifn) { sin = sctp_is_v4_ifa_addr_prefered (ifa, loopscope, ipv4_scope, _loop, _local); if (sin == NULL) continue; @@ -555,7 +555,7 @@ sctp_choose_v4_boundspecific_inp(struct } } /* is an acceptable one on the interface we route out? */ - TAILQ_FOREACH(ifa, >if_addrlist, ifa_list) { + IFADDR_FOREACH(ifa, ifn) { sin = sctp_is_v4_ifa_addr_acceptable (ifa, loopscope, ipv4_scope, _loop, _local); if (sin == NULL) continue; @@ -648,7 +648,7 @@ sctp_choose_v4_boundspecific_stcb(struct */ if (ifn) { /* first try for an prefered address on the ep */ - TAILQ_FOREACH(ifa, >if_addrlist, ifa_list) { + IFADDR_FOREACH(ifa, ifn) { if (sctp_is_addr_in_ep(inp, ifa)) { sin = sctp_is_v4_ifa_addr_prefered (ifa, loopscope, ipv4_scope, _loop, _local); if (sin == NULL) @@ -662,7 +662,7 @@ sctp_choose_v4_boundspecific_stcb(struct } } /* next try for an acceptable address on the ep */ - TAILQ_FOREACH(ifa, >if_addrlist, ifa_list) { + IFADDR_FOREACH(ifa, ifn) { if (sctp_is_addr_in_ep(inp, ifa)) { sin = sctp_is_v4_ifa_addr_acceptable (ifa, loopscope, ipv4_scope, _loop, _local); if (sin == NULL) @@ -762,7 +762,7 @@ sctp_choose_v4_boundspecific_stcb(struct continue; /* first question, is laddr->ifa an address associated with the emit interface */ if (ifn) { -TAILQ_FOREACH(ifa, >if_addrlist, ifa_list) { +IFADDR_FOREACH(ifa, ifn) { if (laddr->ifa == ifa) { sin = (struct sockaddr_in *)laddr->ifa->ifa_addr; return (sin->sin_addr); @@ -786,7 +786,7 @@ sctp_choose_v4_boundspecific_stcb(struct continue; /* first question, is laddr->ifa an address associated with the emit interface */ if (ifn) { -TAILQ_FOREACH(ifa, >if_addrlist, ifa_list) { +IFADDR_FOREACH(ifa, ifn)
CVS commit: src/sys/netinet
Module Name:src Committed By: mlelstv Date: Sun Apr 3 09:57:40 UTC 2016 Modified Files: src/sys/netinet: sctp_asconf.c sctp_output.c sctp_pcb.c sctp_usrreq.c sctputil.c Log Message: Replace generic queue macros with IFNET/IFADDR macros. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/netinet/sctp_asconf.c \ src/sys/netinet/sctp_output.c src/sys/netinet/sctp_pcb.c cvs rdiff -u -r1.2 -r1.3 src/sys/netinet/sctp_usrreq.c cvs rdiff -u -r1.3 -r1.4 src/sys/netinet/sctputil.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: christos Date: Sun Mar 6 19:46:05 UTC 2016 Modified Files: src/sys/netinet: sctputil.c Log Message: PR/50899: David Binderman: optimize memset To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/netinet/sctputil.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/sctputil.c diff -u src/sys/netinet/sctputil.c:1.2 src/sys/netinet/sctputil.c:1.3 --- src/sys/netinet/sctputil.c:1.2 Mon Feb 15 14:00:42 2016 +++ src/sys/netinet/sctputil.c Sun Mar 6 14:46:05 2016 @@ -1,5 +1,5 @@ /* $KAME: sctputil.c,v 1.39 2005/06/16 20:54:06 jinmei Exp $ */ -/* $NetBSD: sctputil.c,v 1.2 2016/02/15 19:00:42 rtr Exp $ */ +/* $NetBSD: sctputil.c,v 1.3 2016/03/06 19:46:05 christos Exp $ */ /* * Copyright (c) 2001, 2002, 2003, 2004 Cisco Systems, Inc. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sctputil.c,v 1.2 2016/02/15 19:00:42 rtr Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sctputil.c,v 1.3 2016/03/06 19:46:05 christos Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -844,9 +844,10 @@ sctp_expand_mapping_array(struct sctp_as { /* mapping array needs to grow */ u_int8_t *new_array; - uint16_t new_size; + uint16_t new_size, old_size; - new_size = asoc->mapping_array_size + SCTP_MAPPING_ARRAY_INCR; + old_size = asoc->mapping_array_size; + new_size = old_size + SCTP_MAPPING_ARRAY_INCR; new_array = malloc(new_size, M_PCB, M_NOWAIT); if (new_array == NULL) { /* can't get more, forget it */ @@ -854,8 +855,8 @@ sctp_expand_mapping_array(struct sctp_as new_size); return (-1); } - memset(new_array, 0, new_size); - memcpy(new_array, asoc->mapping_array, asoc->mapping_array_size); + memcpy(new_array, asoc->mapping_array, old_size); + memset(new_array + old_size, 0, SCTP_MAPPING_ARRAY_INCR); free(asoc->mapping_array, M_PCB); asoc->mapping_array = new_array; asoc->mapping_array_size = new_size;
CVS commit: src/sys/netinet
Module Name:src Committed By: christos Date: Sun Mar 6 19:46:05 UTC 2016 Modified Files: src/sys/netinet: sctputil.c Log Message: PR/50899: David Binderman: optimize memset To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/netinet/sctputil.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: ozaki-r Date: Thu Feb 25 06:00:01 UTC 2016 Modified Files: src/sys/netinet: in.c Log Message: Use callout_halt instead of callout_stop To generate a diff of this commit: cvs rdiff -u -r1.163 -r1.164 src/sys/netinet/in.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/in.c diff -u src/sys/netinet/in.c:1.163 src/sys/netinet/in.c:1.164 --- src/sys/netinet/in.c:1.163 Thu Nov 26 01:41:20 2015 +++ src/sys/netinet/in.c Thu Feb 25 06:00:01 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: in.c,v 1.163 2015/11/26 01:41:20 ozaki-r Exp $ */ +/* $NetBSD: in.c,v 1.164 2016/02/25 06:00:01 ozaki-r Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -91,7 +91,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: in.c,v 1.163 2015/11/26 01:41:20 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: in.c,v 1.164 2016/02/25 06:00:01 ozaki-r Exp $"); #include "arp.h" @@ -1620,7 +1620,7 @@ in_lltable_free_entry(struct lltable *ll } /* cancel timer */ - if (callout_stop(>lle_timer)) + if (callout_halt(>lle_timer, >lle_lock)) LLE_REMREF(lle); /* Drop hold queue */
CVS commit: src/sys/netinet
Module Name:src Committed By: ozaki-r Date: Thu Feb 25 06:00:01 UTC 2016 Modified Files: src/sys/netinet: in.c Log Message: Use callout_halt instead of callout_stop To generate a diff of this commit: cvs rdiff -u -r1.163 -r1.164 src/sys/netinet/in.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: rtr Date: Mon Feb 15 19:00:42 UTC 2016 Modified Files: src/sys/netinet: sctp_indata.c sctputil.c Log Message: Fix building of IPv4-Mapped IPv6 addresses. As discussed on tech-net@ use in6_sin_2_v4mapsin6() to build mapped addresses. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/netinet/sctp_indata.c cvs rdiff -u -r1.1 -r1.2 src/sys/netinet/sctputil.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/sctp_indata.c diff -u src/sys/netinet/sctp_indata.c:1.2 src/sys/netinet/sctp_indata.c:1.3 --- src/sys/netinet/sctp_indata.c:1.2 Sun Dec 13 18:53:57 2015 +++ src/sys/netinet/sctp_indata.c Mon Feb 15 19:00:42 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: sctp_indata.c,v 1.2 2015/12/13 18:53:57 christos Exp $ */ +/* $NetBSD: sctp_indata.c,v 1.3 2016/02/15 19:00:42 rtr Exp $ */ /* $KAME: sctp_indata.c,v 1.36 2005/03/06 16:04:17 itojun Exp $ */ /* @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sctp_indata.c,v 1.2 2015/12/13 18:53:57 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sctp_indata.c,v 1.3 2016/02/15 19:00:42 rtr Exp $"); #ifdef _KERNEL_OPT #include "opt_ipsec.h" @@ -424,13 +424,7 @@ sctp_deliver_data(struct sctp_tcb *stcb, const struct sockaddr_in *sin; sin = (const struct sockaddr_in *)to; - memset(, 0, sizeof(sin6)); - sin6.sin6_family = AF_INET6; - sin6.sin6_len = sizeof(struct sockaddr_in6); - sin6.sin6_addr.s6_addr16[2] = 0x; - bcopy(>sin_addr, _addr.s6_addr16[3], - sizeof(sin6.sin6_addr.s6_addr16[3])); - sin6.sin6_port = sin->sin_port; + in6_sin_2_v4mapsin6(sin, ); to = (struct sockaddr *) } /* check and strip embedded scope junk */ @@ -653,14 +647,7 @@ sctp_service_reassembly(struct sctp_tcb const struct sockaddr_in *sin; sin = satocsin(to); -memset(, 0, sizeof(sin6)); -sin6.sin6_family = AF_INET6; -sin6.sin6_len = sizeof(struct sockaddr_in6); -sin6.sin6_addr.s6_addr16[2] = 0x; -bcopy(>sin_addr, - _addr.s6_addr16[3], - sizeof(sin6.sin6_addr.s6_addr16[3])); -sin6.sin6_port = sin->sin_port; +in6_sin_2_v4mapsin6(sin, ); to = (struct sockaddr *) } /* check and strip embedded scope junk */ @@ -1962,14 +1949,7 @@ sctp_process_a_data_chunk(struct sctp_tc const struct sockaddr_in *sin; sin = satocsin(to); - memset(, 0, sizeof(sin6)); - sin6.sin6_family = AF_INET6; - sin6.sin6_len = sizeof(struct sockaddr_in6); - sin6.sin6_addr.s6_addr16[2] = 0x; - bcopy(>sin_addr, - _addr.s6_addr16[3], - sizeof(sin6.sin6_addr.s6_addr16[3])); - sin6.sin6_port = sin->sin_port; + in6_sin_2_v4mapsin6(sin, ); to = (struct sockaddr *) } Index: src/sys/netinet/sctputil.c diff -u src/sys/netinet/sctputil.c:1.1 src/sys/netinet/sctputil.c:1.2 --- src/sys/netinet/sctputil.c:1.1 Tue Oct 13 21:28:35 2015 +++ src/sys/netinet/sctputil.c Mon Feb 15 19:00:42 2016 @@ -1,5 +1,5 @@ /* $KAME: sctputil.c,v 1.39 2005/06/16 20:54:06 jinmei Exp $ */ -/* $NetBSD: sctputil.c,v 1.1 2015/10/13 21:28:35 rjs Exp $ */ +/* $NetBSD: sctputil.c,v 1.2 2016/02/15 19:00:42 rtr Exp $ */ /* * Copyright (c) 2001, 2002, 2003, 2004 Cisco Systems, Inc. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sctputil.c,v 1.1 2015/10/13 21:28:35 rjs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sctputil.c,v 1.2 2016/02/15 19:00:42 rtr Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -2087,13 +2087,7 @@ sctp_notify_assoc_change(u_int32_t event const struct sockaddr_in *sin; sin = (const struct sockaddr_in *)to; - memset(, 0, sizeof(sin6)); - sin6.sin6_family = AF_INET6; - sin6.sin6_len = sizeof(struct sockaddr_in6); - sin6.sin6_addr.s6_addr16[2] = 0x; - memcpy(_addr.s6_addr16[3], >sin_addr, - sizeof(sin6.sin6_addr.s6_addr16[3])); - sin6.sin6_port = sin->sin_port; + in6_sin_2_v4mapsin6(sin, ); to = (struct sockaddr *) } /* check and strip embedded scope junk */ @@ -2179,13 +2173,7 @@ sctp_notify_peer_addr_change(struct sctp const struct sockaddr_in *sin; sin = (const struct sockaddr_in *)to; - memset(, 0, sizeof(sin6)); - sin6.sin6_family = AF_INET6; - sin6.sin6_len = sizeof(struct sockaddr_in6); - sin6.sin6_addr.s6_addr16[2] = 0x; - bcopy(>sin_addr, _addr.s6_addr16[3], - sizeof(sin6.sin6_addr.s6_addr16[3])); - sin6.sin6_port = sin->sin_port; + in6_sin_2_v4mapsin6(sin, ); to = (struct sockaddr *) } /* check and strip embedded scope junk */ @@ -2279,13 +2267,7 @@ sctp_notify_send_failed(struct sctp_tcb const struct sockaddr_in *sin; sin = satocsin(to); - memset(, 0, sizeof(sin6)); - sin6.sin6_family = AF_INET6; - sin6.sin6_len = sizeof(struct sockaddr_in6); - sin6.sin6_addr.s6_addr16[2] = 0x; - bcopy(>sin_addr, _addr.s6_addr16[3], - sizeof(sin6.sin6_addr.s6_addr16[3])); - sin6.sin6_port = sin->sin_port; +
CVS commit: src/sys/netinet
Module Name:src Committed By: rtr Date: Mon Feb 15 19:00:42 UTC 2016 Modified Files: src/sys/netinet: sctp_indata.c sctputil.c Log Message: Fix building of IPv4-Mapped IPv6 addresses. As discussed on tech-net@ use in6_sin_2_v4mapsin6() to build mapped addresses. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/netinet/sctp_indata.c cvs rdiff -u -r1.1 -r1.2 src/sys/netinet/sctputil.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: rtr Date: Sun Feb 14 23:47:57 UTC 2016 Modified Files: src/sys/netinet: tcp_usrreq.c Log Message: remove duplicated #include of To generate a diff of this commit: cvs rdiff -u -r1.209 -r1.210 src/sys/netinet/tcp_usrreq.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/tcp_usrreq.c diff -u src/sys/netinet/tcp_usrreq.c:1.209 src/sys/netinet/tcp_usrreq.c:1.210 --- src/sys/netinet/tcp_usrreq.c:1.209 Mon Aug 24 22:21:26 2015 +++ src/sys/netinet/tcp_usrreq.c Sun Feb 14 23:47:57 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: tcp_usrreq.c,v 1.209 2015/08/24 22:21:26 pooka Exp $ */ +/* $NetBSD: tcp_usrreq.c,v 1.210 2016/02/14 23:47:57 rtr Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -99,7 +99,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.209 2015/08/24 22:21:26 pooka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.210 2016/02/14 23:47:57 rtr Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -136,9 +136,6 @@ __KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c #include #ifdef INET6 -#ifndef INET -#include -#endif #include #include #include
CVS commit: src/sys/netinet
Module Name:src Committed By: rtr Date: Sun Feb 14 23:47:57 UTC 2016 Modified Files: src/sys/netinet: tcp_usrreq.c Log Message: remove duplicated #include of To generate a diff of this commit: cvs rdiff -u -r1.209 -r1.210 src/sys/netinet/tcp_usrreq.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: CVS commit: src/sys/netinet
A possible fix has been committed. If the panic still happens, please let me know. Thanks, ozaki-r On Mon, Jan 25, 2016 at 7:15 PM, Ryota Ozakiwrote: > Module Name:src > Committed By: ozaki-r > Date: Mon Jan 25 10:15:39 UTC 2016 > > Modified Files: > src/sys/netinet: if_arp.c > > Log Message: > Remove unnecessary LLE_REMREF > > The code around it was copied from arptimer, but LLE_REMREF > is unnecessary because it is needed only for arptimer that > is called after LLE_ADDREF. > > This is a possible fix for PR#50548, PR#50702 and PR#50704. > > > To generate a diff of this commit: > cvs rdiff -u -r1.202 -r1.203 src/sys/netinet/if_arp.c > > Please note that diffs are not public domain; they are subject to the > copyright notices on the relevant files. >
CVS commit: src/sys/netinet
Module Name:src Committed By: ozaki-r Date: Mon Jan 25 10:15:39 UTC 2016 Modified Files: src/sys/netinet: if_arp.c Log Message: Remove unnecessary LLE_REMREF The code around it was copied from arptimer, but LLE_REMREF is unnecessary because it is needed only for arptimer that is called after LLE_ADDREF. This is a possible fix for PR#50548, PR#50702 and PR#50704. To generate a diff of this commit: cvs rdiff -u -r1.202 -r1.203 src/sys/netinet/if_arp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: christos Date: Sat Jan 23 02:58:13 UTC 2016 Modified Files: src/sys/netinet: in_gif.c Log Message: fix compilation To generate a diff of this commit: cvs rdiff -u -r1.71 -r1.72 src/sys/netinet/in_gif.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/in_gif.c diff -u src/sys/netinet/in_gif.c:1.71 src/sys/netinet/in_gif.c:1.72 --- src/sys/netinet/in_gif.c:1.71 Fri Jan 22 18:27:12 2016 +++ src/sys/netinet/in_gif.c Fri Jan 22 21:58:13 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: in_gif.c,v 1.71 2016/01/22 23:27:12 riastradh Exp $ */ +/* $NetBSD: in_gif.c,v 1.72 2016/01/23 02:58:13 christos Exp $ */ /* $KAME: in_gif.c,v 1.66 2001/07/29 04:46:09 itojun Exp $ */ /* @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: in_gif.c,v 1.71 2016/01/22 23:27:12 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: in_gif.c,v 1.72 2016/01/23 02:58:13 christos Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -391,6 +391,7 @@ in_gif_attach(struct gif_softc *sc) return 0; } +#ifdef notdef int in_gif_pause(struct gif_softc *sc) { @@ -402,6 +403,7 @@ in_gif_pause(struct gif_softc *sc) return error; } +#endif int in_gif_detach(struct gif_softc *sc)
CVS commit: src/sys/netinet
Module Name:src Committed By: christos Date: Sat Jan 23 02:58:13 UTC 2016 Modified Files: src/sys/netinet: in_gif.c Log Message: fix compilation To generate a diff of this commit: cvs rdiff -u -r1.71 -r1.72 src/sys/netinet/in_gif.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: riastradh Date: Wed Jan 20 22:02:54 UTC 2016 Modified Files: src/sys/netinet: ip_var.h raw_ip.c Log Message: Give proper prototype to rip_output. To generate a diff of this commit: cvs rdiff -u -r1.108 -r1.109 src/sys/netinet/ip_var.h cvs rdiff -u -r1.153 -r1.154 src/sys/netinet/raw_ip.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: riastradh Date: Wed Jan 20 22:12:22 UTC 2016 Modified Files: src/sys/netinet: ip_output.c ip_var.h Log Message: Give proper prototype to ip_output. To generate a diff of this commit: cvs rdiff -u -r1.247 -r1.248 src/sys/netinet/ip_output.c cvs rdiff -u -r1.109 -r1.110 src/sys/netinet/ip_var.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: riastradh Date: Wed Jan 20 22:12:22 UTC 2016 Modified Files: src/sys/netinet: ip_output.c ip_var.h Log Message: Give proper prototype to ip_output. To generate a diff of this commit: cvs rdiff -u -r1.247 -r1.248 src/sys/netinet/ip_output.c cvs rdiff -u -r1.109 -r1.110 src/sys/netinet/ip_var.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/ip_output.c diff -u src/sys/netinet/ip_output.c:1.247 src/sys/netinet/ip_output.c:1.248 --- src/sys/netinet/ip_output.c:1.247 Wed Sep 2 11:35:11 2015 +++ src/sys/netinet/ip_output.c Wed Jan 20 22:12:22 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: ip_output.c,v 1.247 2015/09/02 11:35:11 ozaki-r Exp $ */ +/* $NetBSD: ip_output.c,v 1.248 2016/01/20 22:12:22 riastradh Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -91,7 +91,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.247 2015/09/02 11:35:11 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.248 2016/01/20 22:12:22 riastradh Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -332,7 +332,8 @@ exit: * The mbuf opt, if present, will not be freed. */ int -ip_output(struct mbuf *m0, ...) +ip_output(struct mbuf *m0, struct mbuf *opt, struct route *ro, int flags, +struct ip_moptions *imo, struct socket *so) { struct rtentry *rt; struct ip *ip; @@ -344,13 +345,8 @@ ip_output(struct mbuf *m0, ...) const struct sockaddr_in *dst; struct in_ifaddr *ia; int isbroadcast; - struct mbuf *opt; - struct route *ro; - int flags, sw_csum; + int sw_csum; u_long mtu; - struct ip_moptions *imo; - struct socket *so; - va_list ap; #ifdef IPSEC struct secpolicy *sp = NULL; #endif @@ -365,13 +361,6 @@ ip_output(struct mbuf *m0, ...) */ len = 0; - va_start(ap, m0); - opt = va_arg(ap, struct mbuf *); - ro = va_arg(ap, struct route *); - flags = va_arg(ap, int); - imo = va_arg(ap, struct ip_moptions *); - so = va_arg(ap, struct socket *); - va_end(ap); MCLAIM(m, _tx_mowner); Index: src/sys/netinet/ip_var.h diff -u src/sys/netinet/ip_var.h:1.109 src/sys/netinet/ip_var.h:1.110 --- src/sys/netinet/ip_var.h:1.109 Wed Jan 20 22:02:54 2016 +++ src/sys/netinet/ip_var.h Wed Jan 20 22:12:22 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: ip_var.h,v 1.109 2016/01/20 22:02:54 riastradh Exp $ */ +/* $NetBSD: ip_var.h,v 1.110 2016/01/20 22:12:22 riastradh Exp $ */ /* * Copyright (c) 1982, 1986, 1993 @@ -210,7 +210,8 @@ void ip_drainstub(void); void ip_freemoptions(struct ip_moptions *); int ip_optcopy(struct ip *, struct ip *); u_int ip_optlen(struct inpcb *); -int ip_output(struct mbuf *, ...); +int ip_output(struct mbuf *, struct mbuf *, struct route *, int, + struct ip_moptions *, struct socket *); int ip_fragment(struct mbuf *, struct ifnet *, u_long); void ip_reass_init(void);
CVS commit: src/sys/netinet
Module Name:src Committed By: riastradh Date: Wed Jan 20 22:02:54 UTC 2016 Modified Files: src/sys/netinet: ip_var.h raw_ip.c Log Message: Give proper prototype to rip_output. To generate a diff of this commit: cvs rdiff -u -r1.108 -r1.109 src/sys/netinet/ip_var.h cvs rdiff -u -r1.153 -r1.154 src/sys/netinet/raw_ip.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/ip_var.h diff -u src/sys/netinet/ip_var.h:1.108 src/sys/netinet/ip_var.h:1.109 --- src/sys/netinet/ip_var.h:1.108 Thu Jun 4 09:20:00 2015 +++ src/sys/netinet/ip_var.h Wed Jan 20 22:02:54 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: ip_var.h,v 1.108 2015/06/04 09:20:00 ozaki-r Exp $ */ +/* $NetBSD: ip_var.h,v 1.109 2016/01/20 22:02:54 riastradh Exp $ */ /* * Copyright (c) 1982, 1986, 1993 @@ -230,7 +230,7 @@ void * rip_ctlinput(int, const struct s int rip_ctloutput(int, struct socket *, struct sockopt *); void rip_init(void); void rip_input(struct mbuf *, ...); -int rip_output(struct mbuf *, ...); +int rip_output(struct mbuf *, struct inpcb *); int rip_usrreq(struct socket *, int, struct mbuf *, struct mbuf *, struct mbuf *, struct lwp *); Index: src/sys/netinet/raw_ip.c diff -u src/sys/netinet/raw_ip.c:1.153 src/sys/netinet/raw_ip.c:1.154 --- src/sys/netinet/raw_ip.c:1.153 Mon Aug 24 22:21:26 2015 +++ src/sys/netinet/raw_ip.c Wed Jan 20 22:02:54 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: raw_ip.c,v 1.153 2015/08/24 22:21:26 pooka Exp $ */ +/* $NetBSD: raw_ip.c,v 1.154 2016/01/20 22:02:54 riastradh Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -65,7 +65,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: raw_ip.c,v 1.153 2015/08/24 22:21:26 pooka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: raw_ip.c,v 1.154 2016/01/20 22:02:54 riastradh Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -311,17 +311,11 @@ rip_ctlinput(int cmd, const struct socka * Tack on options user may have setup with control call. */ int -rip_output(struct mbuf *m, ...) +rip_output(struct mbuf *m, struct inpcb *inp) { - struct inpcb *inp; struct ip *ip; struct mbuf *opts; int flags; - va_list ap; - - va_start(ap, m); - inp = va_arg(ap, struct inpcb *); - va_end(ap); flags = (inp->inp_socket->so_options & SO_DONTROUTE) | IP_ALLOWBROADCAST
CVS commit: src/sys/netinet
Module Name:src Committed By: riastradh Date: Wed Jan 20 22:01:18 UTC 2016 Modified Files: src/sys/netinet: udp_usrreq.c udp_var.h Log Message: Give proper prototype to udp_output. To generate a diff of this commit: cvs rdiff -u -r1.222 -r1.223 src/sys/netinet/udp_usrreq.c cvs rdiff -u -r1.40 -r1.41 src/sys/netinet/udp_var.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/udp_usrreq.c diff -u src/sys/netinet/udp_usrreq.c:1.222 src/sys/netinet/udp_usrreq.c:1.223 --- src/sys/netinet/udp_usrreq.c:1.222 Mon Aug 24 22:21:26 2015 +++ src/sys/netinet/udp_usrreq.c Wed Jan 20 22:01:18 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: udp_usrreq.c,v 1.222 2015/08/24 22:21:26 pooka Exp $ */ +/* $NetBSD: udp_usrreq.c,v 1.223 2016/01/20 22:01:18 riastradh Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -66,7 +66,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: udp_usrreq.c,v 1.222 2015/08/24 22:21:26 pooka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: udp_usrreq.c,v 1.223 2016/01/20 22:01:18 riastradh Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -775,19 +775,14 @@ end: int -udp_output(struct mbuf *m, ...) +udp_output(struct mbuf *m, struct inpcb *inp) { - struct inpcb *inp; struct udpiphdr *ui; struct route *ro; int len = m->m_pkthdr.len; int error = 0; - va_list ap; MCLAIM(m, _tx_mowner); - va_start(ap, m); - inp = va_arg(ap, struct inpcb *); - va_end(ap); /* * Calculate data length and get a mbuf Index: src/sys/netinet/udp_var.h diff -u src/sys/netinet/udp_var.h:1.40 src/sys/netinet/udp_var.h:1.41 --- src/sys/netinet/udp_var.h:1.40 Sun May 18 14:46:16 2014 +++ src/sys/netinet/udp_var.h Wed Jan 20 22:01:18 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: udp_var.h,v 1.40 2014/05/18 14:46:16 rmind Exp $ */ +/* $NetBSD: udp_var.h,v 1.41 2016/01/20 22:01:18 riastradh Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -96,7 +96,7 @@ int udp_ctloutput(int, struct socket *, void udp_init(void); void udp_init_common(void); void udp_input(struct mbuf *, ...); -int udp_output(struct mbuf *, ...); +int udp_output(struct mbuf *, struct inpcb *); int udp_sysctl(int *, u_int, void *, size_t *, void *, size_t); int udp_input_checksum(int af, struct mbuf *, const struct udphdr *, int,
CVS commit: src/sys/netinet
Module Name:src Committed By: riastradh Date: Wed Jan 20 22:01:18 UTC 2016 Modified Files: src/sys/netinet: udp_usrreq.c udp_var.h Log Message: Give proper prototype to udp_output. To generate a diff of this commit: cvs rdiff -u -r1.222 -r1.223 src/sys/netinet/udp_usrreq.c cvs rdiff -u -r1.40 -r1.41 src/sys/netinet/udp_var.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: knakahara Date: Wed Jan 20 05:58:49 UTC 2016 Modified Files: src/sys/netinet: ip_encap.c Log Message: remove unused variable. To generate a diff of this commit: cvs rdiff -u -r1.47 -r1.48 src/sys/netinet/ip_encap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/ip_encap.c diff -u src/sys/netinet/ip_encap.c:1.47 src/sys/netinet/ip_encap.c:1.48 --- src/sys/netinet/ip_encap.c:1.47 Wed Dec 9 06:00:51 2015 +++ src/sys/netinet/ip_encap.c Wed Jan 20 05:58:49 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: ip_encap.c,v 1.47 2015/12/09 06:00:51 knakahara Exp $ */ +/* $NetBSD: ip_encap.c,v 1.48 2016/01/20 05:58:49 knakahara Exp $ */ /* $KAME: ip_encap.c,v 1.73 2001/10/02 08:30:58 itojun Exp $ */ /* @@ -64,13 +64,10 @@ * * The code assumes that radix table code can handle non-continuous netmask, * as it will pass radix table memory region with (src + dst) sockaddr pair. - * - * FreeBSD is excluded here as they make max_keylen a static variable, and - * thus forbid definition of radix table other than proper domains. */ #include -__KERNEL_RCSID(0, "$NetBSD: ip_encap.c,v 1.47 2015/12/09 06:00:51 knakahara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ip_encap.c,v 1.48 2016/01/20 05:58:49 knakahara Exp $"); #ifdef _KERNEL_OPT #include "opt_mrouting.h" @@ -127,7 +124,6 @@ static void encap_fillarg(struct mbuf *, LIST_HEAD(, encaptab) encaptab = LIST_HEAD_INITIALIZER(); -extern int max_keylen; /* radix.c */ struct radix_node_head *encap_head[2]; /* 0 for AF_INET, 1 for AF_INET6 */ void
CVS commit: src/sys/netinet
Module Name:src Committed By: knakahara Date: Wed Jan 20 05:58:49 UTC 2016 Modified Files: src/sys/netinet: ip_encap.c Log Message: remove unused variable. To generate a diff of this commit: cvs rdiff -u -r1.47 -r1.48 src/sys/netinet/ip_encap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: christos Date: Sun Jan 17 15:08:10 UTC 2016 Modified Files: src/sys/netinet: ip_mroute.c Log Message: PR/50670: David Binderman: Tidy up debugging printfs to avoid if else confusion. To generate a diff of this commit: cvs rdiff -u -r1.132 -r1.133 src/sys/netinet/ip_mroute.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: christos Date: Sun Jan 17 15:08:10 UTC 2016 Modified Files: src/sys/netinet: ip_mroute.c Log Message: PR/50670: David Binderman: Tidy up debugging printfs to avoid if else confusion. To generate a diff of this commit: cvs rdiff -u -r1.132 -r1.133 src/sys/netinet/ip_mroute.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/ip_mroute.c diff -u src/sys/netinet/ip_mroute.c:1.132 src/sys/netinet/ip_mroute.c:1.133 --- src/sys/netinet/ip_mroute.c:1.132 Mon Aug 24 18:21:26 2015 +++ src/sys/netinet/ip_mroute.c Sun Jan 17 10:08:10 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: ip_mroute.c,v 1.132 2015/08/24 22:21:26 pooka Exp $ */ +/* $NetBSD: ip_mroute.c,v 1.133 2016/01/17 15:08:10 christos Exp $ */ /* * Copyright (c) 1992, 1993 @@ -93,7 +93,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ip_mroute.c,v 1.132 2015/08/24 22:21:26 pooka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ip_mroute.c,v 1.133 2016/01/17 15:08:10 christos Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -182,8 +182,11 @@ u_int mrtdebug = 0; /* debug level * u_int tbfdebug = 0; /* tbf debug level */ #ifdef RSVP_ISI u_int rsvpdebug = 0; /* rsvp debug level */ +#define RSVP_DPRINTF(a) do if (rsvpdebug) printf a; while (/*CONSTCOND*/0) extern struct socket *ip_rsvpd; extern int rsvp_on; +#else +#define RSVP_DPRINTF(a) do {} while (/*CONSTCOND*/0) #endif /* RSVP_ISI */ /* vif attachment using sys/netinet/ip_encap.c */ @@ -1339,17 +1342,19 @@ ip_mforward(struct mbuf *m, struct ifnet if (imo && ((vifi = imo->imo_multicast_vif) < numvifs)) { if (ip->ip_ttl < MAXTTL) ip->ip_ttl++; /* compensate for -1 in *_send routines */ - if (rsvpdebug && ip->ip_p == IPPROTO_RSVP) { + if (ip->ip_p == IPPROTO_RSVP) { struct vif *vifp = viftable + vifi; - printf("Sending IPPROTO_RSVP from %x to %x on vif %d (%s%s)\n", + RSVP_DPRINTF(("%s: Sending IPPROTO_RSVP from %x to %x" + " on vif %d (%s%s)\n", __func__, ntohl(ip->ip_src), ntohl(ip->ip_dst), vifi, (vifp->v_flags & VIFF_TUNNEL) ? "tunnel on " : "", - vifp->v_ifp->if_xname); + vifp->v_ifp->if_xname)); } return (ip_mdq(m, ifp, NULL, vifi)); } - if (rsvpdebug && ip->ip_p == IPPROTO_RSVP) { - printf("Warning: IPPROTO_RSVP from %x to %x without vif option\n", + if (ip->ip_p == IPPROTO_RSVP) { + RSVP_DPRINTF(("%s: Warning: IPPROTO_RSVP from %x to %x" + " without vif option\n", __func__, ntohl(ip->ip_src), ntohl(ip->ip_dst)); } #endif /* RSVP_ISI */ @@ -2207,9 +2212,8 @@ ip_rsvp_vif_init(struct socket *so, stru { int vifi, s; - if (rsvpdebug) - printf("ip_rsvp_vif_init: so_type = %d, pr_protocol = %d\n", - so->so_type, so->so_proto->pr_protocol); + RSVP_DPRINTF(("%s: so_type = %d, pr_protocol = %d\n", __func__ + so->so_type, so->so_proto->pr_protocol)); if (so->so_type != SOCK_RAW || so->so_proto->pr_protocol != IPPROTO_RSVP) @@ -2221,9 +2225,7 @@ ip_rsvp_vif_init(struct socket *so, stru } vifi = *(mtod(m, int *)); - if (rsvpdebug) - printf("ip_rsvp_vif_init: vif = %d rsvp_on = %d\n", - vifi, rsvp_on); + RSVP_DPRINTF(("%s: vif = %d rsvp_on = %d\n", __func__, vifi, rsvp_on)); s = splsoftnet(); @@ -2258,9 +2260,8 @@ ip_rsvp_vif_done(struct socket *so, stru { int vifi, s; - if (rsvpdebug) - printf("ip_rsvp_vif_done: so_type = %d, pr_protocol = %d\n", - so->so_type, so->so_proto->pr_protocol); + RSVP_DPRINTF(("%s: so_type = %d, pr_protocol = %d\n", __func__, + so->so_type, so->so_proto->pr_protocol)); if (so->so_type != SOCK_RAW || so->so_proto->pr_protocol != IPPROTO_RSVP) @@ -2280,9 +2281,8 @@ ip_rsvp_vif_done(struct socket *so, stru return (EADDRNOTAVAIL); } - if (rsvpdebug) - printf("ip_rsvp_vif_done: v_rsvpd = %x so = %x\n", - viftable[vifi].v_rsvpd, so); + RSVP_DPRINTF(("%s: v_rsvpd = %x so = %x\n", __func__, + viftable[vifi].v_rsvpd, so)); viftable[vifi].v_rsvpd = NULL; /* @@ -2340,8 +2340,7 @@ rsvp_input(struct mbuf *m, struct ifnet struct ip *ip = mtod(m, struct ip *); struct sockaddr_in rsvp_src; - if (rsvpdebug) - printf("rsvp_input: rsvp_on %d\n", rsvp_on); + RSVP_DPRINTF(("%s: rsvp_on %d\n", __func__, rsvp_on)); /* * Can still get packets with rsvp_on = 0 if there is a local member @@ -2358,17 +2357,15 @@ rsvp_input(struct mbuf *m, struct ifnet * it and ignore the new ones. */ if (ip_rsvpd != NULL) { - if (rsvpdebug) - printf("rsvp_input: " - "Sending packet up old-style socket\n"); + RSVP_DPRINTF(("%s: Sending packet up old-style socket\n", + __func__)); rip_input(m); /*XXX*/ return; } s = splsoftnet(); - if (rsvpdebug) - printf("rsvp_input: check vifs\n"); + RSVP_DPRINTF(("%s: check vifs\n", __func__)); /* Find which vif the packet arrived on. */ for (vifi = 0; vifi < numvifs; vifi++) { @@ -2378,25
CVS commit: src/sys/netinet
Module Name:src Committed By: ozaki-r Date: Tue Jan 5 05:37:06 UTC 2016 Modified Files: src/sys/netinet: if_arp.c Log Message: Make revarprequest static To generate a diff of this commit: cvs rdiff -u -r1.198 -r1.199 src/sys/netinet/if_arp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: ozaki-r Date: Tue Jan 5 05:37:06 UTC 2016 Modified Files: src/sys/netinet: if_arp.c Log Message: Make revarprequest static To generate a diff of this commit: cvs rdiff -u -r1.198 -r1.199 src/sys/netinet/if_arp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/if_arp.c diff -u src/sys/netinet/if_arp.c:1.198 src/sys/netinet/if_arp.c:1.199 --- src/sys/netinet/if_arp.c:1.198 Thu Dec 17 02:38:33 2015 +++ src/sys/netinet/if_arp.c Tue Jan 5 05:37:06 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: if_arp.c,v 1.198 2015/12/17 02:38:33 ozaki-r Exp $ */ +/* $NetBSD: if_arp.c,v 1.199 2016/01/05 05:37:06 ozaki-r Exp $ */ /*- * Copyright (c) 1998, 2000, 2008 The NetBSD Foundation, Inc. @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.198 2015/12/17 02:38:33 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.199 2016/01/05 05:37:06 ozaki-r Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -1973,7 +1973,7 @@ out: * Send a RARP request for the ip address of the specified interface. * The request should be RFC 903-compliant. */ -void +static void revarprequest(struct ifnet *ifp) { struct sockaddr sa;
CVS commit: src/sys/netinet
Module Name:src Committed By: christos Date: Sun Dec 13 18:58:13 UTC 2015 Modified Files: src/sys/netinet: sctp_usrreq.c Log Message: PR/50529: David Binderman: Remove double sizeof To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/netinet/sctp_usrreq.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/sctp_usrreq.c diff -u src/sys/netinet/sctp_usrreq.c:1.1 src/sys/netinet/sctp_usrreq.c:1.2 --- src/sys/netinet/sctp_usrreq.c:1.1 Tue Oct 13 17:28:35 2015 +++ src/sys/netinet/sctp_usrreq.c Sun Dec 13 13:58:13 2015 @@ -1,5 +1,5 @@ /* $KAME: sctp_usrreq.c,v 1.50 2005/06/16 20:45:29 jinmei Exp $ */ -/* $NetBSD: sctp_usrreq.c,v 1.1 2015/10/13 21:28:35 rjs Exp $ */ +/* $NetBSD: sctp_usrreq.c,v 1.2 2015/12/13 18:58:13 christos Exp $ */ /* * Copyright (c) 2001, 2002, 2003, 2004 Cisco Systems, Inc. @@ -33,7 +33,7 @@ * SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: sctp_usrreq.c,v 1.1 2015/10/13 21:28:35 rjs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sctp_usrreq.c,v 1.2 2015/12/13 18:58:13 christos Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -980,7 +980,7 @@ sctp_fill_up_addresses(struct sctp_inpcb in6_sin_2_v4mapsin6(sin, (struct sockaddr_in6 *)sas); ((struct sockaddr_in6 *)sas)->sin6_port = inp->sctp_lport; sas = (struct sockaddr_storage *)((vaddr_t)sas + sizeof(struct sockaddr_in6)); - actual += sizeof(sizeof(struct sockaddr_in6)); + actual += sizeof(struct sockaddr_in6); } else { memcpy(sas, sin, sizeof(*sin)); ((struct sockaddr_in *)sas)->sin_port = inp->sctp_lport;
CVS commit: src/sys/netinet
Module Name:src Committed By: christos Date: Sun Dec 13 18:58:13 UTC 2015 Modified Files: src/sys/netinet: sctp_usrreq.c Log Message: PR/50529: David Binderman: Remove double sizeof To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/netinet/sctp_usrreq.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: christos Date: Sun Dec 13 18:53:57 UTC 2015 Modified Files: src/sys/netinet: sctp_indata.c Log Message: PR/50528: David Binderman: remove sizeof(sizeof(x)) To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/netinet/sctp_indata.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: christos Date: Sun Dec 13 18:53:57 UTC 2015 Modified Files: src/sys/netinet: sctp_indata.c Log Message: PR/50528: David Binderman: remove sizeof(sizeof(x)) To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/netinet/sctp_indata.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/sctp_indata.c diff -u src/sys/netinet/sctp_indata.c:1.1 src/sys/netinet/sctp_indata.c:1.2 --- src/sys/netinet/sctp_indata.c:1.1 Tue Oct 13 17:28:35 2015 +++ src/sys/netinet/sctp_indata.c Sun Dec 13 13:53:57 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: sctp_indata.c,v 1.1 2015/10/13 21:28:35 rjs Exp $ */ +/* $NetBSD: sctp_indata.c,v 1.2 2015/12/13 18:53:57 christos Exp $ */ /* $KAME: sctp_indata.c,v 1.36 2005/03/06 16:04:17 itojun Exp $ */ /* @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sctp_indata.c,v 1.1 2015/10/13 21:28:35 rjs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sctp_indata.c,v 1.2 2015/12/13 18:53:57 christos Exp $"); #ifdef _KERNEL_OPT #include "opt_ipsec.h" @@ -3756,7 +3756,7 @@ sctp_handle_sack(struct sctp_sack_chunk /* always set this up to cum-ack */ asoc->this_sack_highest_gap = last_tsn; - if (((num_seg * sizeof (sizeof(struct sctp_gap_ack_block))) + sizeof(struct sctp_sack_chunk)) > sack_length) { + if (num_seg * sizeof(struct sctp_gap_ack_block) + sizeof(struct sctp_sack_chunk) > sack_length) { /* skip corrupt segments */ strike_enabled = 0; goto skip_segments;
CVS commit: src/sys/netinet
Module Name:src Committed By: ozaki-r Date: Fri Dec 11 01:15:00 UTC 2015 Modified Files: src/sys/netinet: if_arp.c Log Message: Introduce arp_settimer No functional change. To generate a diff of this commit: cvs rdiff -u -r1.195 -r1.196 src/sys/netinet/if_arp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/if_arp.c diff -u src/sys/netinet/if_arp.c:1.195 src/sys/netinet/if_arp.c:1.196 --- src/sys/netinet/if_arp.c:1.195 Mon Nov 30 06:45:38 2015 +++ src/sys/netinet/if_arp.c Fri Dec 11 01:15:00 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: if_arp.c,v 1.195 2015/11/30 06:45:38 ozaki-r Exp $ */ +/* $NetBSD: if_arp.c,v 1.196 2015/12/11 01:15:00 ozaki-r Exp $ */ /*- * Copyright (c) 1998, 2000, 2008 The NetBSD Foundation, Inc. @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.195 2015/11/30 06:45:38 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.196 2015/12/11 01:15:00 ozaki-r Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -161,6 +161,7 @@ static struct sockaddr *arp_setgate(stru const struct sockaddr *); static void arptfree(struct rtentry *); static void arptimer(void *); +static void arp_settimer(struct llentry *, int); static struct llentry *arplookup(struct ifnet *, struct mbuf *, const struct in_addr *, int, int, int, struct rtentry *); static void in_arpinput(struct mbuf *); @@ -374,6 +375,15 @@ arptimer(void *arg) IF_AFDATA_UNLOCK(ifp); } +static void +arp_settimer(struct llentry *la, int sec) +{ + + LLE_WLOCK_ASSERT(la); + LLE_ADDREF(la); + callout_reset(>la_timer, hz * sec, arptimer, la); +} + /* * We set the gateway for RTF_CLONING routes to a "prototype" * link-layer sockaddr whose interface type (if_type) and interface @@ -974,10 +984,8 @@ notfound: CLLADDR(rt->rt_ifp->if_sadl): #endif CLLADDR(ifp->if_sadl); - LLE_ADDREF(la); la->la_expire = time_uptime; - callout_reset(>la_timer, hz * arpt_down, - arptimer, la); + arp_settimer(la, arpt_down); la->la_asked++; LLE_WUNLOCK(la); @@ -1338,8 +1346,7 @@ in_arpinput(struct mbuf *m) rt->rt_expire = time_uptime + arpt_keep; KASSERT((la->la_flags & LLE_STATIC) == 0); - LLE_ADDREF(la); - callout_reset(>la_timer, hz * arpt_keep, arptimer, la); + arp_settimer(la, arpt_keep); } rt->rt_flags &= ~RTF_REJECT; la->la_asked = 0;
CVS commit: src/sys/netinet
Module Name:src Committed By: ozaki-r Date: Fri Dec 11 01:15:00 UTC 2015 Modified Files: src/sys/netinet: if_arp.c Log Message: Introduce arp_settimer No functional change. To generate a diff of this commit: cvs rdiff -u -r1.195 -r1.196 src/sys/netinet/if_arp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: knakahara Date: Wed Dec 9 06:00:51 UTC 2015 Modified Files: src/sys/netinet: ip_encap.c Log Message: ip_encap uses kmem_alloc APIs instead of malloc. To generate a diff of this commit: cvs rdiff -u -r1.46 -r1.47 src/sys/netinet/ip_encap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/ip_encap.c diff -u src/sys/netinet/ip_encap.c:1.46 src/sys/netinet/ip_encap.c:1.47 --- src/sys/netinet/ip_encap.c:1.46 Mon Aug 24 22:21:26 2015 +++ src/sys/netinet/ip_encap.c Wed Dec 9 06:00:51 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: ip_encap.c,v 1.46 2015/08/24 22:21:26 pooka Exp $ */ +/* $NetBSD: ip_encap.c,v 1.47 2015/12/09 06:00:51 knakahara Exp $ */ /* $KAME: ip_encap.c,v 1.73 2001/10/02 08:30:58 itojun Exp $ */ /* @@ -70,7 +70,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ip_encap.c,v 1.46 2015/08/24 22:21:26 pooka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ip_encap.c,v 1.47 2015/12/09 06:00:51 knakahara Exp $"); #ifdef _KERNEL_OPT #include "opt_mrouting.h" @@ -85,6 +85,7 @@ __KERNEL_RCSID(0, "$NetBSD: ip_encap.c,v #include #include #include +#include #include #include @@ -492,17 +493,17 @@ encap_attach(int af, int proto, } /* M_NETADDR ok? */ - ep = malloc(sizeof(*ep), M_NETADDR, M_NOWAIT|M_ZERO); + ep = kmem_zalloc(sizeof(*ep), KM_NOSLEEP); if (ep == NULL) { error = ENOBUFS; goto fail; } - ep->addrpack = malloc(l, M_NETADDR, M_NOWAIT|M_ZERO); + ep->addrpack = kmem_zalloc(l, KM_NOSLEEP); if (ep->addrpack == NULL) { error = ENOBUFS; goto gc; } - ep->maskpack = malloc(l, M_NETADDR, M_NOWAIT|M_ZERO); + ep->maskpack = kmem_zalloc(l, KM_NOSLEEP); if (ep->maskpack == NULL) { error = ENOBUFS; goto gc; @@ -550,11 +551,11 @@ encap_attach(int af, int proto, gc: if (ep->addrpack) - free(ep->addrpack, M_NETADDR); + kmem_free(ep->addrpack, l); if (ep->maskpack) - free(ep->maskpack, M_NETADDR); + kmem_free(ep->maskpack, l); if (ep) - free(ep, M_NETADDR); + kmem_free(ep, sizeof(*ep)); fail: splx(s); return NULL; @@ -580,7 +581,7 @@ encap_attach_func(int af, int proto, if (error) goto fail; - ep = malloc(sizeof(*ep), M_NETADDR, M_NOWAIT); /*XXX*/ + ep = kmem_alloc(sizeof(*ep), KM_NOSLEEP); /*XXX*/ if (ep == NULL) { error = ENOBUFS; goto fail; @@ -701,10 +702,10 @@ encap_detach(const struct encaptab *cook if (error) return error; if (!ep->func) { -free(p->addrpack, M_NETADDR); -free(p->maskpack, M_NETADDR); +kmem_free(p->addrpack, ep->addrpack->sa_len); +kmem_free(p->maskpack, ep->maskpack->sa_len); } - free(p, M_NETADDR); /*XXX*/ + kmem_free(p, sizeof(*p)); /*XXX*/ return 0; } }
CVS commit: src/sys/netinet
Module Name:src Committed By: knakahara Date: Wed Dec 9 06:00:51 UTC 2015 Modified Files: src/sys/netinet: ip_encap.c Log Message: ip_encap uses kmem_alloc APIs instead of malloc. To generate a diff of this commit: cvs rdiff -u -r1.46 -r1.47 src/sys/netinet/ip_encap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: ozaki-r Date: Mon Nov 30 06:45:38 UTC 2015 Modified Files: src/sys/netinet: if_arp.c Log Message: Get rid of a big block in in_arpinput No functional change. To generate a diff of this commit: cvs rdiff -u -r1.194 -r1.195 src/sys/netinet/if_arp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/if_arp.c diff -u src/sys/netinet/if_arp.c:1.194 src/sys/netinet/if_arp.c:1.195 --- src/sys/netinet/if_arp.c:1.194 Thu Nov 19 03:03:04 2015 +++ src/sys/netinet/if_arp.c Mon Nov 30 06:45:38 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: if_arp.c,v 1.194 2015/11/19 03:03:04 ozaki-r Exp $ */ +/* $NetBSD: if_arp.c,v 1.195 2015/11/30 06:45:38 ozaki-r Exp $ */ /*- * Copyright (c) 1998, 2000, 2008 The NetBSD Foundation, Inc. @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.194 2015/11/19 03:03:04 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.195 2015/11/30 06:45:38 ozaki-r Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -1250,121 +1250,122 @@ in_arpinput(struct mbuf *m) if (rt != NULL) sdl = satosdl(rt->rt_gateway); } - if (sdl != NULL) { - if (sdl->sdl_alen && - memcmp(ar_sha(ah), CLLADDR(sdl), sdl->sdl_alen)) { - if (rt->rt_flags & RTF_STATIC) { -ARP_STATINC(ARP_STAT_RCVOVERPERM); -if (!log_permanent_modify) - goto out; -log(LOG_INFO, -"%s tried to overwrite permanent arp info" -" for %s\n", -lla_snprintf(ar_sha(ah), ah->ar_hln), -in_fmtaddr(isaddr)); + if (sdl == NULL) + goto reply; + + if (sdl->sdl_alen && memcmp(ar_sha(ah), CLLADDR(sdl), sdl->sdl_alen)) { + if (rt->rt_flags & RTF_STATIC) { + ARP_STATINC(ARP_STAT_RCVOVERPERM); + if (!log_permanent_modify) goto out; - } else if (rt->rt_ifp != ifp) { -ARP_STATINC(ARP_STAT_RCVOVERINT); -if (!log_wrong_iface) - goto out; -log(LOG_INFO, -"%s on %s tried to overwrite " -"arp info for %s on %s\n", -lla_snprintf(ar_sha(ah), ah->ar_hln), -ifp->if_xname, in_fmtaddr(isaddr), -rt->rt_ifp->if_xname); -goto out; - } else { -ARP_STATINC(ARP_STAT_RCVOVER); -if (log_movements) - log(LOG_INFO, "arp info overwritten " - "for %s by %s\n", - in_fmtaddr(isaddr), - lla_snprintf(ar_sha(ah), - ah->ar_hln)); - } - } - /* - * sanity check for the address length. - * XXX this does not work for protocols with variable address - * length. -is - */ - if (sdl->sdl_alen && - sdl->sdl_alen != ah->ar_hln) { - ARP_STATINC(ARP_STAT_RCVLENCHG); - log(LOG_WARNING, - "arp from %s: new addr len %d, was %d\n", - in_fmtaddr(isaddr), ah->ar_hln, sdl->sdl_alen); - } - if (ifp->if_addrlen != ah->ar_hln) { - ARP_STATINC(ARP_STAT_RCVBADLEN); - log(LOG_WARNING, - "arp from %s: addr len: new %d, i/f %d (ignored)\n", - in_fmtaddr(isaddr), ah->ar_hln, - ifp->if_addrlen); - goto reply; + log(LOG_INFO, + "%s tried to overwrite permanent arp info" + " for %s\n", + lla_snprintf(ar_sha(ah), ah->ar_hln), + in_fmtaddr(isaddr)); + goto out; + } else if (rt->rt_ifp != ifp) { + ARP_STATINC(ARP_STAT_RCVOVERINT); + if (!log_wrong_iface) +goto out; + log(LOG_INFO, + "%s on %s tried to overwrite " + "arp info for %s on %s\n", + lla_snprintf(ar_sha(ah), ah->ar_hln), + ifp->if_xname, in_fmtaddr(isaddr), + rt->rt_ifp->if_xname); +goto out; + } else { + ARP_STATINC(ARP_STAT_RCVOVER); + if (log_movements) +log(LOG_INFO, "arp info overwritten " +"for %s by %s\n", +in_fmtaddr(isaddr), +lla_snprintf(ar_sha(ah), +ah->ar_hln)); } + } + + /* + * sanity check for the address length. + * XXX this does not work for protocols with variable address + * length. -is + */ + if (sdl->sdl_alen && sdl->sdl_alen != ah->ar_hln) { + ARP_STATINC(ARP_STAT_RCVLENCHG); + log(LOG_WARNING, + "arp from %s: new addr len %d, was %d\n", + in_fmtaddr(isaddr), ah->ar_hln, sdl->sdl_alen); + } + if (ifp->if_addrlen != ah->ar_hln) { + ARP_STATINC(ARP_STAT_RCVBADLEN); + log(LOG_WARNING, + "arp from %s: addr len: new %d, i/f %d (ignored)\n", + in_fmtaddr(isaddr), ah->ar_hln, + ifp->if_addrlen); + goto reply; + } + #if NTOKEN > 0 - /* - * XXX uses m_data and assumes the complete answer including - * XXX token-ring headers is in the same buf - */ - if (ifp->if_type == IFT_ISO88025) { - struct token_header *trh; + /* + * XXX uses m_data and assumes the complete answer including + * XXX token-ring headers is in the same buf + */ + if (ifp->if_type == IFT_ISO88025) { + struct token_header *trh; - trh = (struct token_header *)M_TRHSTART(m); - if (trh->token_shost[0] & TOKEN_RI_PRESENT) { -struct token_rif *rif; -size_t riflen; - -rif = TOKEN_RIF(trh); -
CVS commit: src/sys/netinet
Module Name:src Committed By: ozaki-r Date: Mon Nov 30 06:45:38 UTC 2015 Modified Files: src/sys/netinet: if_arp.c Log Message: Get rid of a big block in in_arpinput No functional change. To generate a diff of this commit: cvs rdiff -u -r1.194 -r1.195 src/sys/netinet/if_arp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: ozaki-r Date: Thu Nov 19 03:03:04 UTC 2015 Modified Files: src/sys/netinet: if_arp.c Log Message: Restore softnet_lock and KERNEL_LOCK for rtrequest and rtfree We still need them for rt operations. To generate a diff of this commit: cvs rdiff -u -r1.193 -r1.194 src/sys/netinet/if_arp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/if_arp.c diff -u src/sys/netinet/if_arp.c:1.193 src/sys/netinet/if_arp.c:1.194 --- src/sys/netinet/if_arp.c:1.193 Fri Nov 6 08:55:49 2015 +++ src/sys/netinet/if_arp.c Thu Nov 19 03:03:04 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: if_arp.c,v 1.193 2015/11/06 08:55:49 ozaki-r Exp $ */ +/* $NetBSD: if_arp.c,v 1.194 2015/11/19 03:03:04 ozaki-r Exp $ */ /*- * Copyright (c) 1998, 2000, 2008 The NetBSD Foundation, Inc. @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.193 2015/11/06 08:55:49 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.194 2015/11/19 03:03:04 ozaki-r Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -1443,8 +1443,15 @@ out: static void arptfree(struct rtentry *rt) { + /* We still need to hold the locks */ + mutex_enter(softnet_lock); + KERNEL_LOCK(1, NULL); + rtrequest(RTM_DELETE, rt_getkey(rt), NULL, rt_mask(rt), 0, NULL); rtfree(rt); + + KERNEL_UNLOCK_ONE(NULL); + mutex_exit(softnet_lock); } /*
CVS commit: src/sys/netinet
Module Name:src Committed By: ozaki-r Date: Thu Nov 19 03:03:04 UTC 2015 Modified Files: src/sys/netinet: if_arp.c Log Message: Restore softnet_lock and KERNEL_LOCK for rtrequest and rtfree We still need them for rt operations. To generate a diff of this commit: cvs rdiff -u -r1.193 -r1.194 src/sys/netinet/if_arp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: ozaki-r Date: Mon Nov 16 05:39:39 UTC 2015 Modified Files: src/sys/netinet: in.c Log Message: Add missing rtfree To generate a diff of this commit: cvs rdiff -u -r1.161 -r1.162 src/sys/netinet/in.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/in.c diff -u src/sys/netinet/in.c:1.161 src/sys/netinet/in.c:1.162 --- src/sys/netinet/in.c:1.161 Mon Aug 31 16:46:14 2015 +++ src/sys/netinet/in.c Mon Nov 16 05:39:39 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: in.c,v 1.161 2015/08/31 16:46:14 ozaki-r Exp $ */ +/* $NetBSD: in.c,v 1.162 2015/11/16 05:39:39 ozaki-r Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -91,7 +91,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: in.c,v 1.161 2015/08/31 16:46:14 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: in.c,v 1.162 2015/11/16 05:39:39 ozaki-r Exp $"); #include "arp.h" #include "ether.h" @@ -1699,6 +1699,7 @@ in_lltable_rtcheck(struct ifnet *ifp, u_ error = 0; error: + rtfree(rt); return error; }
CVS commit: src/sys/netinet
Module Name:src Committed By: ozaki-r Date: Mon Nov 16 05:39:39 UTC 2015 Modified Files: src/sys/netinet: in.c Log Message: Add missing rtfree To generate a diff of this commit: cvs rdiff -u -r1.161 -r1.162 src/sys/netinet/in.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: CVS commit: src/sys/netinet
On 11/11/2015 07:26, Ryota Ozaki wrote: > On Tue, Nov 10, 2015 at 10:30 PM, Roy Marpleswrote: >> On 10/11/2015 09:56, Ryota Ozaki wrote: Certainly in our arp and ndp code the assumption is made that if a matching route is not marked RTF_CLONING then it is not a neighbour. >>> >>> Just confirmation, do you mean s/not a neighbour/a neighbour/? >> >> I believe it's like so: >> rt = find_route_for_address(); >> if (rt->rt_flags & (RTF_CLONING | RTF_CLONED)) { >> /* We're a neighbour */ >> } > > Now I got it. I misused "neighbor". I thought it matches RTF_LLINFO > routes... Great! ARP and NDP use that to add know if they should create LLINFO entries. When FreeBSD dropped RTF_CLONING they added the assertation that advertised routes from rtadvd(8) are neighbours also, but this is currently not possible to state from userland. https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=194485 >>> >>> Hmm, I don't notice this case. Does it indicate that it is possible >>> that a route has both RTF_LLINFO and RTF_CLONING? Or just we can >>> think a route with RTF_CLONING as a neighbor? >> >> The latter. A subnet route would not have RTF_LLINFO. >> >>> Could you clarify what does dhcpcd actually require on routes (and >>> routing flags)? >> >> if (is_a_subnet_route) { >> #ifdef RTF_CLONING >> rtm.hdr.rtm_flags |= RTF_CLONING; >> #endif >> #ifdef RTP_CONNECTED >> /* OpenBSD */ >> rtm.hdr.rtm_priority = RTP_CONNECTED; >> #endif >> } > > Thanks. I can find it in dhcpcd. > > BTW RTF_CONNECTED can be used in OpenBSD case now? No, OpenBSD has RTP_CONNECTED, a flag for route priority. We don't have route priorities, so it would need to be RTF_*. This leads me back to my question - should all added network routes, regardless of source match neighbour tests or do they need to be explicitly marked as such? This has nothing todo with cloning, which is the real purpose of the flag. >>> >>> Well, I don't have an answer yet. I think I don't know enough >>> about userland requirements. How do you think of that? >> >> So the current situation is OpenBSD have RTP_CONNECTED, FreeBSD have >> nothing but seems to be implied within the kernel (certainly for IPv6, >> not checked IPv4) and we are abusing RTF_CLONING. >> >> I know that your long term goal is to drop RTF_CLONING like FreeBSD, >> hence asking about this. I suppose the easy approach would be to rename >> RTF_CLONING to RTF_CONNECTED. > > And handle RTF_CONNECTED in the kernel like you try to do in FreeBSD > after we drop RTF_CLONING. Sound reasonable to me. Nice. > Let's back to talking about rarpd case. In general, we have to treat > adding a route with RTF_CLONING from userland. OTOH rarpd adds only > ARP entries (nexthop routes). So we don't need to change rarpd to > handle RTF_CLONING? I've looked at the rarpd code and I don't think it needs changing because it relies on an existing subnet route marked RTF_CLONING to already exist, so each route it RTM_GETs will be marked RTF_CLONED and thus considered a neighbour. Also, we only care about it being a neighbour in the kernel when we want to create LLINFO entries from ARP or NDP messages (iirc), so the direct manipulation here bypassses that check. Adding / removing ARP entries via arp(8) would have the same effect. Saying that I've not actually run or tested rarpd, nor inspected the routing table modifications it makes when running. My analysis could be wrong! Roy
Re: CVS commit: src/sys/netinet
On Fri, Nov 6, 2015 at 7:01 PM, Roy Marpleswrote: > On 06/11/2015 09:24, Ryota Ozaki wrote: >> On Fri, Nov 6, 2015 at 6:09 PM, Roy Marples wrote: >>> On 06/11/2015 08:38, Ryota Ozaki wrote: Module Name: src Committed By: ozaki-r Date: Fri Nov 6 08:38:43 UTC 2015 Modified Files: src/sys/netinet: if_arp.c Log Message: Fix inappropriate rt_flags check It depended on either RTF_CLONED or RTF_CLONING must be set, however, the assumption didn't meet for userland problems that create a route via RTM_ADD. >>> >>> Userland can set RTF_CLONING on any route. >>> This fixes an issue that running rarpd causes the following kernel panic reported by nonaka@: panic: kernel diagnostic assertion "(la->la_flags & LLE_STATIC) == 0" failed: file "/usr/src/sys/netinet/if_arp.c", line 1339 >>> >>> While I agree that the panic should be fixed, should rarpd be fixed too >>> add the RTF_CLONING flag if indeed it is a subnet route on the attached >>> network or should userland never care about this flag and all added >>> routes should be considered as attached (keep in mind we want similar >>> semantics for IPv6 routes). >> >> I prefer the latter because allowing userland programs freely setting >> flags (and other parameters) easily breaks consistency in the kernel >> (IOW that makes keeping consistency hard). Do we need some policies on >> manipulating routes from userland? Let me know if there is already. > > I doubt we have any policy as such, but I would like all facets of a > route to be set from userland. During netbsd-6 development I recall > fixing the kernel so that userland could at least manipulate routes > including the automaticly added subnet route. > > Certainly in our arp and ndp code the assumption is made that if a > matching route is not marked RTF_CLONING then it is not a neighbour. Just confirmation, do you mean s/not a neighbour/a neighbour/? > When FreeBSD dropped RTF_CLONING they added the assertation that > advertised routes from rtadvd(8) are neighbours also, but this is > currently not possible to state from userland. > https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=194485 Hmm, I don't notice this case. Does it indicate that it is possible that a route has both RTF_LLINFO and RTF_CLONING? Or just we can think a route with RTF_CLONING as a neighbor? Could you clarify what does dhcpcd actually require on routes (and routing flags)? > > This leads me back to my question - should all added network routes, > regardless of source match neighbour tests or do they need to be > explicitly marked as such? This has nothing todo with cloning, which is > the real purpose of the flag. Well, I don't have an answer yet. I think I don't know enough about userland requirements. How do you think of that? ozaki-r
Re: CVS commit: src/sys/netinet
On Tue, Nov 10, 2015 at 10:30 PM, Roy Marpleswrote: > On 10/11/2015 09:56, Ryota Ozaki wrote: >>> Certainly in our arp and ndp code the assumption is made that if a >>> matching route is not marked RTF_CLONING then it is not a neighbour. >> >> Just confirmation, do you mean s/not a neighbour/a neighbour/? > > I believe it's like so: > rt = find_route_for_address(); > if (rt->rt_flags & (RTF_CLONING | RTF_CLONED)) { > /* We're a neighbour */ > } Now I got it. I misused "neighbor". I thought it matches RTF_LLINFO routes... > >> >>> When FreeBSD dropped RTF_CLONING they added the assertation that >>> advertised routes from rtadvd(8) are neighbours also, but this is >>> currently not possible to state from userland. >>> https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=194485 >> >> Hmm, I don't notice this case. Does it indicate that it is possible >> that a route has both RTF_LLINFO and RTF_CLONING? Or just we can >> think a route with RTF_CLONING as a neighbor? > > The latter. A subnet route would not have RTF_LLINFO. > >> Could you clarify what does dhcpcd actually require on routes (and >> routing flags)? > > if (is_a_subnet_route) { > #ifdef RTF_CLONING > rtm.hdr.rtm_flags |= RTF_CLONING; > #endif > #ifdef RTP_CONNECTED > /* OpenBSD */ > rtm.hdr.rtm_priority = RTP_CONNECTED; > #endif > } Thanks. I can find it in dhcpcd. BTW RTF_CONNECTED can be used in OpenBSD case now? > >>> This leads me back to my question - should all added network routes, >>> regardless of source match neighbour tests or do they need to be >>> explicitly marked as such? This has nothing todo with cloning, which is >>> the real purpose of the flag. >> >> Well, I don't have an answer yet. I think I don't know enough >> about userland requirements. How do you think of that? > > So the current situation is OpenBSD have RTP_CONNECTED, FreeBSD have > nothing but seems to be implied within the kernel (certainly for IPv6, > not checked IPv4) and we are abusing RTF_CLONING. > > I know that your long term goal is to drop RTF_CLONING like FreeBSD, > hence asking about this. I suppose the easy approach would be to rename > RTF_CLONING to RTF_CONNECTED. And handle RTF_CONNECTED in the kernel like you try to do in FreeBSD after we drop RTF_CLONING. Sound reasonable to me. Let's back to talking about rarpd case. In general, we have to treat adding a route with RTF_CLONING from userland. OTOH rarpd adds only ARP entries (nexthop routes). So we don't need to change rarpd to handle RTF_CLONING? ozaki-r
Re: CVS commit: src/sys/netinet
On 10/11/2015 09:56, Ryota Ozaki wrote: >> Certainly in our arp and ndp code the assumption is made that if a >> matching route is not marked RTF_CLONING then it is not a neighbour. > > Just confirmation, do you mean s/not a neighbour/a neighbour/? I believe it's like so: rt = find_route_for_address(); if (rt->rt_flags & (RTF_CLONING | RTF_CLONED)) { /* We're a neighbour */ } > >> When FreeBSD dropped RTF_CLONING they added the assertation that >> advertised routes from rtadvd(8) are neighbours also, but this is >> currently not possible to state from userland. >> https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=194485 > > Hmm, I don't notice this case. Does it indicate that it is possible > that a route has both RTF_LLINFO and RTF_CLONING? Or just we can > think a route with RTF_CLONING as a neighbor? The latter. A subnet route would not have RTF_LLINFO. > Could you clarify what does dhcpcd actually require on routes (and > routing flags)? if (is_a_subnet_route) { #ifdef RTF_CLONING rtm.hdr.rtm_flags |= RTF_CLONING; #endif #ifdef RTP_CONNECTED /* OpenBSD */ rtm.hdr.rtm_priority = RTP_CONNECTED; #endif } >> This leads me back to my question - should all added network routes, >> regardless of source match neighbour tests or do they need to be >> explicitly marked as such? This has nothing todo with cloning, which is >> the real purpose of the flag. > > Well, I don't have an answer yet. I think I don't know enough > about userland requirements. How do you think of that? So the current situation is OpenBSD have RTP_CONNECTED, FreeBSD have nothing but seems to be implied within the kernel (certainly for IPv6, not checked IPv4) and we are abusing RTF_CLONING. I know that your long term goal is to drop RTF_CLONING like FreeBSD, hence asking about this. I suppose the easy approach would be to rename RTF_CLONING to RTF_CONNECTED. Roy
re: CVS commit: src/sys/netinet
On 2015-11-06 20:07, matthew green wrote: Roy Marples writes: On 06/11/2015 08:38, Ryota Ozaki wrote: > Module Name: src > Committed By: ozaki-r > Date: Fri Nov 6 08:38:43 UTC 2015 > > Modified Files: >src/sys/netinet: if_arp.c > > Log Message: > Fix inappropriate rt_flags check > > It depended on either RTF_CLONED or RTF_CLONING must be set, however, > the assumption didn't meet for userland problems that create a route > via RTM_ADD. Userland can set RTF_CLONING on any route. > > This fixes an issue that running rarpd causes the following kernel panic > reported by nonaka@: > panic: kernel diagnostic assertion "(la->la_flags & LLE_STATIC) == 0" > failed: file "/usr/src/sys/netinet/if_arp.c", line 1339 While I agree that the panic should be fixed, should rarpd be fixed too add the RTF_CLONING flag if indeed it is a subnet route on the attached network or should userland never care about this flag and all added routes should be considered as attached (keep in mind we want similar semantics for IPv6 routes). rarpd might need to be changed, but it shouldn't need to be "fixed" otherwise we've broken binary compatibility. It was more fixing the intent of the code if the added subnet route allows neighbours, or if we want to continue using RTF_CLONING to mean that. I'm not suggesting, or implying, we want to break binary compat. Roy
CVS commit: src/sys/netinet
Module Name:src Committed By: ozaki-r Date: Fri Nov 6 08:38:43 UTC 2015 Modified Files: src/sys/netinet: if_arp.c Log Message: Fix inappropriate rt_flags check It depended on either RTF_CLONED or RTF_CLONING must be set, however, the assumption didn't meet for userland problems that create a route via RTM_ADD. This fixes an issue that running rarpd causes the following kernel panic reported by nonaka@: panic: kernel diagnostic assertion "(la->la_flags & LLE_STATIC) == 0" failed: file "/usr/src/sys/netinet/if_arp.c", line 1339 To generate a diff of this commit: cvs rdiff -u -r1.191 -r1.192 src/sys/netinet/if_arp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: ozaki-r Date: Fri Nov 6 08:38:43 UTC 2015 Modified Files: src/sys/netinet: if_arp.c Log Message: Fix inappropriate rt_flags check It depended on either RTF_CLONED or RTF_CLONING must be set, however, the assumption didn't meet for userland problems that create a route via RTM_ADD. This fixes an issue that running rarpd causes the following kernel panic reported by nonaka@: panic: kernel diagnostic assertion "(la->la_flags & LLE_STATIC) == 0" failed: file "/usr/src/sys/netinet/if_arp.c", line 1339 To generate a diff of this commit: cvs rdiff -u -r1.191 -r1.192 src/sys/netinet/if_arp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/if_arp.c diff -u src/sys/netinet/if_arp.c:1.191 src/sys/netinet/if_arp.c:1.192 --- src/sys/netinet/if_arp.c:1.191 Tue Oct 20 07:46:59 2015 +++ src/sys/netinet/if_arp.c Fri Nov 6 08:38:43 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: if_arp.c,v 1.191 2015/10/20 07:46:59 ozaki-r Exp $ */ +/* $NetBSD: if_arp.c,v 1.192 2015/11/06 08:38:43 ozaki-r Exp $ */ /*- * Copyright (c) 1998, 2000, 2008 The NetBSD Foundation, Inc. @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.191 2015/10/20 07:46:59 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.192 2015/11/06 08:38:43 ozaki-r Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -621,7 +621,7 @@ arp_rtrequest(int req, struct rtentry *r * add with a LL address. */ flags = LLE_EXCLUSIVE; - if ((rt->rt_flags & RTF_CLONED) == 0) + if ((rt->rt_flags & RTF_CLONING) != 0) flags |= LLE_IFADDR; IF_AFDATA_WLOCK(ifp);
Re: CVS commit: src/sys/netinet
On 06/11/2015 09:24, Ryota Ozaki wrote: > On Fri, Nov 6, 2015 at 6:09 PM, Roy Marpleswrote: >> On 06/11/2015 08:38, Ryota Ozaki wrote: >>> Module Name: src >>> Committed By: ozaki-r >>> Date: Fri Nov 6 08:38:43 UTC 2015 >>> >>> Modified Files: >>> src/sys/netinet: if_arp.c >>> >>> Log Message: >>> Fix inappropriate rt_flags check >>> >>> It depended on either RTF_CLONED or RTF_CLONING must be set, however, >>> the assumption didn't meet for userland problems that create a route >>> via RTM_ADD. >> >> Userland can set RTF_CLONING on any route. >> >>> >>> This fixes an issue that running rarpd causes the following kernel panic >>> reported by nonaka@: >>> panic: kernel diagnostic assertion "(la->la_flags & LLE_STATIC) == 0" >>> failed: file "/usr/src/sys/netinet/if_arp.c", line 1339 >> >> While I agree that the panic should be fixed, should rarpd be fixed too >> add the RTF_CLONING flag if indeed it is a subnet route on the attached >> network or should userland never care about this flag and all added >> routes should be considered as attached (keep in mind we want similar >> semantics for IPv6 routes). > > I prefer the latter because allowing userland programs freely setting > flags (and other parameters) easily breaks consistency in the kernel > (IOW that makes keeping consistency hard). Do we need some policies on > manipulating routes from userland? Let me know if there is already. I doubt we have any policy as such, but I would like all facets of a route to be set from userland. During netbsd-6 development I recall fixing the kernel so that userland could at least manipulate routes including the automaticly added subnet route. Certainly in our arp and ndp code the assumption is made that if a matching route is not marked RTF_CLONING then it is not a neighbour. When FreeBSD dropped RTF_CLONING they added the assertation that advertised routes from rtadvd(8) are neighbours also, but this is currently not possible to state from userland. https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=194485 This leads me back to my question - should all added network routes, regardless of source match neighbour tests or do they need to be explicitly marked as such? This has nothing todo with cloning, which is the real purpose of the flag. Roy
CVS commit: src/sys/netinet
Module Name:src Committed By: ozaki-r Date: Fri Nov 6 08:55:50 UTC 2015 Modified Files: src/sys/netinet: if_arp.c Log Message: Fix db_print_llinfo rt_llinfo is now struct llentry. To generate a diff of this commit: cvs rdiff -u -r1.192 -r1.193 src/sys/netinet/if_arp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: CVS commit: src/sys/netinet
On 06/11/2015 08:38, Ryota Ozaki wrote: > Module Name: src > Committed By: ozaki-r > Date: Fri Nov 6 08:38:43 UTC 2015 > > Modified Files: > src/sys/netinet: if_arp.c > > Log Message: > Fix inappropriate rt_flags check > > It depended on either RTF_CLONED or RTF_CLONING must be set, however, > the assumption didn't meet for userland problems that create a route > via RTM_ADD. Userland can set RTF_CLONING on any route. > > This fixes an issue that running rarpd causes the following kernel panic > reported by nonaka@: > panic: kernel diagnostic assertion "(la->la_flags & LLE_STATIC) == 0" > failed: file "/usr/src/sys/netinet/if_arp.c", line 1339 While I agree that the panic should be fixed, should rarpd be fixed too add the RTF_CLONING flag if indeed it is a subnet route on the attached network or should userland never care about this flag and all added routes should be considered as attached (keep in mind we want similar semantics for IPv6 routes). Roy
CVS commit: src/sys/netinet
Module Name:src Committed By: ozaki-r Date: Fri Nov 6 08:55:50 UTC 2015 Modified Files: src/sys/netinet: if_arp.c Log Message: Fix db_print_llinfo rt_llinfo is now struct llentry. To generate a diff of this commit: cvs rdiff -u -r1.192 -r1.193 src/sys/netinet/if_arp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/if_arp.c diff -u src/sys/netinet/if_arp.c:1.192 src/sys/netinet/if_arp.c:1.193 --- src/sys/netinet/if_arp.c:1.192 Fri Nov 6 08:38:43 2015 +++ src/sys/netinet/if_arp.c Fri Nov 6 08:55:49 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: if_arp.c,v 1.192 2015/11/06 08:38:43 ozaki-r Exp $ */ +/* $NetBSD: if_arp.c,v 1.193 2015/11/06 08:55:49 ozaki-r Exp $ */ /*- * Copyright (c) 1998, 2000, 2008 The NetBSD Foundation, Inc. @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.192 2015/11/06 08:38:43 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.193 2015/11/06 08:55:49 ozaki-r Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -202,7 +202,7 @@ static struct ifnet *myip_ifp = NULL; #ifdef DDB static void db_print_sa(const struct sockaddr *); static void db_print_ifa(struct ifaddr *); -static void db_print_llinfo(void *); +static void db_print_llinfo(struct llentry *); static int db_show_rtentry(struct rtentry *, void *); #endif @@ -2069,15 +2069,13 @@ db_print_ifa(struct ifaddr *ifa) } static void -db_print_llinfo(void *li) +db_print_llinfo(struct llentry *la) { - struct llinfo_arp *la; - - if (li == NULL) + if (la == NULL) return; - la = (struct llinfo_arp *)li; - db_printf(" la_rt=%p la_hold=%p, la_asked=0x%lx\n", + db_printf(" la_rt=%p la_hold=%p, la_asked=%d\n", la->la_rt, la->la_hold, la->la_asked); + db_printf(" la_flags=0x%x\n", la->la_flags); } /*
Re: CVS commit: src/sys/netinet
On Fri, Nov 6, 2015 at 6:09 PM, Roy Marpleswrote: > On 06/11/2015 08:38, Ryota Ozaki wrote: >> Module Name: src >> Committed By: ozaki-r >> Date: Fri Nov 6 08:38:43 UTC 2015 >> >> Modified Files: >> src/sys/netinet: if_arp.c >> >> Log Message: >> Fix inappropriate rt_flags check >> >> It depended on either RTF_CLONED or RTF_CLONING must be set, however, >> the assumption didn't meet for userland problems that create a route >> via RTM_ADD. > > Userland can set RTF_CLONING on any route. > >> >> This fixes an issue that running rarpd causes the following kernel panic >> reported by nonaka@: >> panic: kernel diagnostic assertion "(la->la_flags & LLE_STATIC) == 0" >> failed: file "/usr/src/sys/netinet/if_arp.c", line 1339 > > While I agree that the panic should be fixed, should rarpd be fixed too > add the RTF_CLONING flag if indeed it is a subnet route on the attached > network or should userland never care about this flag and all added > routes should be considered as attached (keep in mind we want similar > semantics for IPv6 routes). I prefer the latter because allowing userland programs freely setting flags (and other parameters) easily breaks consistency in the kernel (IOW that makes keeping consistency hard). Do we need some policies on manipulating routes from userland? Let me know if there is already. ozaki-r
re: CVS commit: src/sys/netinet
Roy Marples writes: > On 06/11/2015 08:38, Ryota Ozaki wrote: > > Module Name:src > > Committed By: ozaki-r > > Date: Fri Nov 6 08:38:43 UTC 2015 > > > > Modified Files: > > src/sys/netinet: if_arp.c > > > > Log Message: > > Fix inappropriate rt_flags check > > > > It depended on either RTF_CLONED or RTF_CLONING must be set, however, > > the assumption didn't meet for userland problems that create a route > > via RTM_ADD. > > Userland can set RTF_CLONING on any route. > > > > > This fixes an issue that running rarpd causes the following kernel panic > > reported by nonaka@: > > panic: kernel diagnostic assertion "(la->la_flags & LLE_STATIC) == 0" > > failed: file "/usr/src/sys/netinet/if_arp.c", line 1339 > > While I agree that the panic should be fixed, should rarpd be fixed too > add the RTF_CLONING flag if indeed it is a subnet route on the attached > network or should userland never care about this flag and all added > routes should be considered as attached (keep in mind we want similar > semantics for IPv6 routes). rarpd might need to be changed, but it shouldn't need to be "fixed" otherwise we've broken binary compatibility. .mrg.
CVS commit: src/sys/netinet
Module Name:src Committed By: ozaki-r Date: Tue Oct 20 07:46:59 UTC 2015 Modified Files: src/sys/netinet: if_arp.c Log Message: Stop callout in arp_rtrequest(RTM_DELETE) This change fixes arptimer panic after removing an interface (say by drvctl -d), which is reported by Takahiro Hayashi. This change also fixes llentry's reference counting; we have to take into account rtentry#rt_llinfo as well as arptimer. To generate a diff of this commit: cvs rdiff -u -r1.190 -r1.191 src/sys/netinet/if_arp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: ozaki-r Date: Tue Oct 20 07:46:59 UTC 2015 Modified Files: src/sys/netinet: if_arp.c Log Message: Stop callout in arp_rtrequest(RTM_DELETE) This change fixes arptimer panic after removing an interface (say by drvctl -d), which is reported by Takahiro Hayashi. This change also fixes llentry's reference counting; we have to take into account rtentry#rt_llinfo as well as arptimer. To generate a diff of this commit: cvs rdiff -u -r1.190 -r1.191 src/sys/netinet/if_arp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/if_arp.c diff -u src/sys/netinet/if_arp.c:1.190 src/sys/netinet/if_arp.c:1.191 --- src/sys/netinet/if_arp.c:1.190 Tue Oct 20 07:35:15 2015 +++ src/sys/netinet/if_arp.c Tue Oct 20 07:46:59 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: if_arp.c,v 1.190 2015/10/20 07:35:15 ozaki-r Exp $ */ +/* $NetBSD: if_arp.c,v 1.191 2015/10/20 07:46:59 ozaki-r Exp $ */ /*- * Copyright (c) 1998, 2000, 2008 The NetBSD Foundation, Inc. @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.190 2015/10/20 07:35:15 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.191 2015/10/20 07:46:59 ozaki-r Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -635,6 +635,7 @@ arp_rtrequest(int req, struct rtentry *r break; } rt->rt_llinfo = la; + LLE_ADDREF(la); switch (ifp->if_type) { #if NTOKEN > 0 case IFT_ISO88025: @@ -662,17 +663,14 @@ arp_rtrequest(int req, struct rtentry *r rt->rt_llinfo = NULL; rt->rt_flags &= ~RTF_LLINFO; + /* Have to do before IF_AFDATA_WLOCK to avoid deadlock */ + callout_halt(>la_timer, >lle_lock); + /* XXX: LOR avoidance. We still have ref on lle. */ LLE_RUNLOCK(la); flags |= LLE_EXCLUSIVE; IF_AFDATA_WLOCK(ifp); - - la = lla_lookup(LLTABLE(ifp), flags, rt_getkey(rt)); - /* This shouldn't happen */ - if (la == NULL) { - IF_AFDATA_WUNLOCK(ifp); - break; - } + LLE_WLOCK(la); if (la->la_opaque != NULL) { switch (ifp->if_type) { @@ -695,10 +693,20 @@ arp_rtrequest(int req, struct rtentry *r la->la_rt->rt_refcnt--; la->la_rt = NULL; } - llentry_free(la); - IF_AFDATA_WUNLOCK(ifp); + /* Guard against race with other llentry_free(). */ + if (la->la_flags & LLE_LINKED) { + size_t pkts_dropped; + + LLE_REMREF(la); + pkts_dropped = llentry_free(la); + ARP_STATADD(ARP_STAT_DFRDROPPED, pkts_dropped); + } else { + LLE_FREE_LOCKED(la); + } la = NULL; + + IF_AFDATA_WUNLOCK(ifp); } if (la != NULL) {
CVS commit: src/sys/netinet
Module Name:src Committed By: roy Date: Wed Oct 14 11:22:55 UTC 2015 Modified Files: src/sys/netinet: if_arp.c Log Message: In the event of an error within arpresolve(), delete the cloned route otherwise it would never be deleted. To generate a diff of this commit: cvs rdiff -u -r1.188 -r1.189 src/sys/netinet/if_arp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/if_arp.c diff -u src/sys/netinet/if_arp.c:1.188 src/sys/netinet/if_arp.c:1.189 --- src/sys/netinet/if_arp.c:1.188 Wed Oct 14 11:17:57 2015 +++ src/sys/netinet/if_arp.c Wed Oct 14 11:22:55 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: if_arp.c,v 1.188 2015/10/14 11:17:57 roy Exp $ */ +/* $NetBSD: if_arp.c,v 1.189 2015/10/14 11:22:55 roy Exp $ */ /*- * Copyright (c) 1998, 2000, 2008 The NetBSD Foundation, Inc. @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.188 2015/10/14 11:17:57 roy Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.189 2015/10/14 11:22:55 roy Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -840,8 +840,8 @@ notfound: if (ifp->if_flags & _IFF_NOARP) { if (la != NULL) LLE_RUNLOCK(la); - m_freem(m); - return ENOTSUP; + error = ENOTSUP; + goto bad; } #undef _IFF_NOARP if (la == NULL) { @@ -859,13 +859,13 @@ notfound: IF_AFDATA_RUNLOCK(ifp); } + error = EINVAL; if (la == NULL) { log(LOG_DEBUG, "%s: failed to %s llentry for %s on %s\n", __func__, create_lookup, inet_ntoa(satocsin(dst)->sin_addr), ifp->if_xname); - m_freem(m); - return EINVAL; + goto bad; } /* Just in case */ @@ -875,8 +875,7 @@ notfound: "%s: valid llentry has no rtentry for %s on %s\n", __func__, inet_ntoa(satocsin(dst)->sin_addr), ifp->if_xname); - m_freem(m); - return EINVAL; + goto bad; } rt = la->la_rt; @@ -917,11 +916,11 @@ notfound: } if (la->la_flags & LLE_STATIC) { /* should not happen! */ + LLE_RUNLOCK(la); log(LOG_DEBUG, "arpresolve: ouch, empty static llinfo for %s\n", inet_ntoa(satocsin(dst)->sin_addr)); - m_freem(m); error = EINVAL; - goto done; + goto bad; } renew = (la->la_asked == 0 || la->la_expire != time_uptime); @@ -983,9 +982,16 @@ notfound: (dst)->sin_addr, enaddr); return error; } -done: + LLE_RUNLOCK(la); + return error; +bad: + m_freem(m); + if (rt != NULL && (rt->rt_flags & RTF_CLONED) != 0) { + rtrequest(RTM_DELETE, rt_getkey(rt), + rt->rt_gateway, rt_mask(rt), rt->rt_flags, NULL); + } return error; }
CVS commit: src/sys/netinet
Module Name:src Committed By: roy Date: Wed Oct 14 11:22:55 UTC 2015 Modified Files: src/sys/netinet: if_arp.c Log Message: In the event of an error within arpresolve(), delete the cloned route otherwise it would never be deleted. To generate a diff of this commit: cvs rdiff -u -r1.188 -r1.189 src/sys/netinet/if_arp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: roy Date: Wed Oct 14 11:17:57 UTC 2015 Modified Files: src/sys/netinet: if_arp.c Log Message: Save and clear the la route while we have a write lock To generate a diff of this commit: cvs rdiff -u -r1.187 -r1.188 src/sys/netinet/if_arp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: roy Date: Wed Oct 14 11:17:57 UTC 2015 Modified Files: src/sys/netinet: if_arp.c Log Message: Save and clear the la route while we have a write lock To generate a diff of this commit: cvs rdiff -u -r1.187 -r1.188 src/sys/netinet/if_arp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/if_arp.c diff -u src/sys/netinet/if_arp.c:1.187 src/sys/netinet/if_arp.c:1.188 --- src/sys/netinet/if_arp.c:1.187 Tue Oct 13 12:33:07 2015 +++ src/sys/netinet/if_arp.c Wed Oct 14 11:17:57 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: if_arp.c,v 1.187 2015/10/13 12:33:07 roy Exp $ */ +/* $NetBSD: if_arp.c,v 1.188 2015/10/14 11:17:57 roy Exp $ */ /*- * Copyright (c) 1998, 2000, 2008 The NetBSD Foundation, Inc. @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.187 2015/10/13 12:33:07 roy Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.188 2015/10/14 11:17:57 roy Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -315,6 +315,7 @@ arptimer(void *arg) { struct llentry *lle = arg; struct ifnet *ifp; + struct rtentry *rt; mutex_enter(softnet_lock); @@ -345,16 +346,17 @@ arptimer(void *arg) goto out; } ifp = lle->lle_tbl->llt_ifp; + rt = lle->la_rt; + lle->la_rt = NULL; callout_stop(>la_timer); /* XXX: LOR avoidance. We still have ref on lle. */ LLE_WUNLOCK(lle); - if (lle->la_rt != NULL) { + if (rt != NULL) { /* We have to call arptfree w/o IF_AFDATA_LOCK */ - arptfree(lle->la_rt); - lle->la_rt = NULL; + arptfree(rt); } IF_AFDATA_LOCK(ifp);
CVS commit: src/sys/netinet
Module Name:src Committed By: roy Date: Tue Oct 13 09:46:42 UTC 2015 Modified Files: src/sys/netinet: ip_input.c Log Message: Include arp.h to restore the sysctl net.inet.ip.dad_count. Fixes PR kern/49883 thanks to HITOSHI Osada. To generate a diff of this commit: cvs rdiff -u -r1.324 -r1.325 src/sys/netinet/ip_input.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: roy Date: Tue Oct 13 09:46:42 UTC 2015 Modified Files: src/sys/netinet: ip_input.c Log Message: Include arp.h to restore the sysctl net.inet.ip.dad_count. Fixes PR kern/49883 thanks to HITOSHI Osada. To generate a diff of this commit: cvs rdiff -u -r1.324 -r1.325 src/sys/netinet/ip_input.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/ip_input.c diff -u src/sys/netinet/ip_input.c:1.324 src/sys/netinet/ip_input.c:1.325 --- src/sys/netinet/ip_input.c:1.324 Mon Aug 24 22:21:26 2015 +++ src/sys/netinet/ip_input.c Tue Oct 13 09:46:42 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: ip_input.c,v 1.324 2015/08/24 22:21:26 pooka Exp $ */ +/* $NetBSD: ip_input.c,v 1.325 2015/10/13 09:46:42 roy Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -91,7 +91,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.324 2015/08/24 22:21:26 pooka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.325 2015/10/13 09:46:42 roy Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -103,6 +103,8 @@ __KERNEL_RCSID(0, "$NetBSD: ip_input.c,v #include "opt_inet_csum.h" #endif +#include "arp.h" + #include #include #include
CVS commit: src/sys/netinet
Module Name:src Committed By: roy Date: Tue Oct 13 09:33:35 UTC 2015 Modified Files: src/sys/netinet: if_arp.c Log Message: Simplify la handling in arpresolve() by asking arplookup() not to create a la. If a la is needed arpresolve() will then create it or mark the current la as writable. To generate a diff of this commit: cvs rdiff -u -r1.184 -r1.185 src/sys/netinet/if_arp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/if_arp.c diff -u src/sys/netinet/if_arp.c:1.184 src/sys/netinet/if_arp.c:1.185 --- src/sys/netinet/if_arp.c:1.184 Thu Oct 8 08:17:37 2015 +++ src/sys/netinet/if_arp.c Tue Oct 13 09:33:35 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: if_arp.c,v 1.184 2015/10/08 08:17:37 roy Exp $ */ +/* $NetBSD: if_arp.c,v 1.185 2015/10/13 09:33:35 roy Exp $ */ /*- * Copyright (c) 1998, 2000, 2008 The NetBSD Foundation, Inc. @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.184 2015/10/08 08:17:37 roy Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.185 2015/10/13 09:33:35 roy Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -791,26 +791,17 @@ arpresolve(struct ifnet *ifp, struct rte { struct llentry *la; const struct sockaddr_dl *sdl; - int renew; - int flags = 0; + const char *create_lookup; + bool renew; int error; KASSERT(m != NULL); - la = arplookup(ifp, m, (dst)->sin_addr, 1, 0, 0, rt); - if (la != NULL) - rt = la->la_rt; + la = arplookup(ifp, m, (dst)->sin_addr, 0, 0, 0, rt); + if (la == NULL || la->la_rt == NULL) + goto notfound; - if (la == NULL || rt == NULL) { - ARP_STATINC(ARP_STAT_ALLOCFAIL); - log(LOG_DEBUG, - "arpresolve: can't allocate llinfo on %s for %s\n", - ifp->if_xname, in_fmtaddr(satocsin(dst)->sin_addr)); - m_freem(m); - if (la != NULL) - LLE_RUNLOCK(la); - return 0; - } + rt = la->la_rt; sdl = satocsdl(rt->rt_gateway); /* * Check the address family and length is valid, the address @@ -837,69 +828,82 @@ arpresolve(struct ifnet *ifp, struct rte } #endif -retry: +notfound: if (la == NULL) { - IF_AFDATA_RLOCK(ifp); - la = lla_lookup(LLTABLE(ifp), flags, dst); - IF_AFDATA_RUNLOCK(ifp); - } - #ifdef IFF_STATICARP /* FreeBSD */ #define _IFF_NOARP (IFF_NOARP | IFF_STATICARP) #else #define _IFF_NOARP IFF_NOARP #endif - if ((la == NULL) && ((flags & LLE_EXCLUSIVE) == 0) - && ((ifp->if_flags & _IFF_NOARP) == 0)) - { - flags |= LLE_EXCLUSIVE; + if (ifp->if_flags & _IFF_NOARP) { + m_freem(m); + return 0; + } +#undef _IFF_NOARP + create_lookup = "create"; IF_AFDATA_WLOCK(ifp); - la = lla_create(LLTABLE(ifp), flags, dst); + la = lla_create(LLTABLE(ifp), LLE_EXCLUSIVE, dst); IF_AFDATA_WUNLOCK(ifp); - - if (la == NULL) { - log(LOG_DEBUG, - "%s: failed to create llentry for %s on %s\n", - __func__, inet_ntoa(satocsin(dst)->sin_addr), - ifp->if_xname); - } + if (la == NULL) + ARP_STATINC(ARP_STAT_ALLOCFAIL); + } else if (LLE_TRY_UPGRADE(la) == 0) { + create_lookup = "lookup"; + LLE_RUNLOCK(la); + IF_AFDATA_RLOCK(ifp); + la = lla_lookup(LLTABLE(ifp), LLE_EXCLUSIVE, dst); + IF_AFDATA_RUNLOCK(ifp); } -#undef _IFF_NOARP if (la == NULL) { + log(LOG_DEBUG, + "%s: failed to %s llentry for %s on %s\n", + __func__, create_lookup, inet_ntoa(satocsin(dst)->sin_addr), + ifp->if_xname); m_freem(m); return 0; } + /* Just in case */ + if (la->la_rt == NULL) { + log(LOG_DEBUG, + "%s: valid llentry has no rtentry for %s on %s\n", + __func__, inet_ntoa(satocsin(dst)->sin_addr), + ifp->if_xname); + m_freem(m); + return 0; + } + rt = la->la_rt; + if ((la->la_flags & LLE_VALID) && - ((la->la_flags & LLE_STATIC) || la->la_expire > time_uptime)) { + ((la->la_flags & LLE_STATIC) || la->la_expire > time_uptime)) + { + sdl = satocsdl(rt->rt_gateway); memcpy(desten, CLLADDR(sdl), min(sdl->sdl_alen, ifp->if_addrlen)); - renew = 0; + renew = false; /* * If entry has an expiry time and it is approaching, * see if we need to send an ARP request within this * arpt_down interval. */ if (!(la->la_flags & LLE_STATIC) && - time_uptime + la->la_preempt > la->la_expire) { - renew = 1; + time_uptime + la->la_preempt > la->la_expire) + { + renew = true; la->la_preempt--; } - if (flags & LLE_EXCLUSIVE) - LLE_WUNLOCK(la); - else - LLE_RUNLOCK(la); + LLE_WUNLOCK(la); - if (renew == 1) { + if (renew) { const u_int8_t *enaddr = #if NCARP > 0 (rt->rt_ifp->if_type == IFT_CARP) ? CLLADDR(rt->rt_ifp->if_sadl): #endif CLLADDR(ifp->if_sadl); - arprequest(ifp, (rt->rt_ifa->ifa_addr)->sin_addr, + arprequest(ifp, + (rt->rt_ifa->ifa_addr)->sin_addr, (dst)->sin_addr, enaddr); } @@ -915,12 +919,6 @@ retry: } renew = (la->la_asked == 0 || la->la_expire != time_uptime); - if (renew && (flags &
CVS commit: src/sys/netinet
Module Name:src Committed By: roy Date: Tue Oct 13 09:33:35 UTC 2015 Modified Files: src/sys/netinet: if_arp.c Log Message: Simplify la handling in arpresolve() by asking arplookup() not to create a la. If a la is needed arpresolve() will then create it or mark the current la as writable. To generate a diff of this commit: cvs rdiff -u -r1.184 -r1.185 src/sys/netinet/if_arp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: roy Date: Tue Oct 13 11:13:37 UTC 2015 Modified Files: src/sys/netinet: if_arp.c Log Message: Move the NOARP check up a bit so that it works when an la is created but hasn't been resolved yet. Fixes PR kern/17611. To generate a diff of this commit: cvs rdiff -u -r1.185 -r1.186 src/sys/netinet/if_arp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/if_arp.c diff -u src/sys/netinet/if_arp.c:1.185 src/sys/netinet/if_arp.c:1.186 --- src/sys/netinet/if_arp.c:1.185 Tue Oct 13 09:33:35 2015 +++ src/sys/netinet/if_arp.c Tue Oct 13 11:13:37 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: if_arp.c,v 1.185 2015/10/13 09:33:35 roy Exp $ */ +/* $NetBSD: if_arp.c,v 1.186 2015/10/13 11:13:37 roy Exp $ */ /*- * Copyright (c) 1998, 2000, 2008 The NetBSD Foundation, Inc. @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.185 2015/10/13 09:33:35 roy Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.186 2015/10/13 11:13:37 roy Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -829,17 +829,19 @@ arpresolve(struct ifnet *ifp, struct rte #endif notfound: - if (la == NULL) { #ifdef IFF_STATICARP /* FreeBSD */ #define _IFF_NOARP (IFF_NOARP | IFF_STATICARP) #else #define _IFF_NOARP IFF_NOARP #endif - if (ifp->if_flags & _IFF_NOARP) { - m_freem(m); - return 0; - } + if (ifp->if_flags & _IFF_NOARP) { + if (la != NULL) + LLE_RUNLOCK(la); + m_freem(m); + return 0; + } #undef _IFF_NOARP + if (la == NULL) { create_lookup = "create"; IF_AFDATA_WLOCK(ifp); la = lla_create(LLTABLE(ifp), LLE_EXCLUSIVE, dst);
CVS commit: src/sys/netinet
Module Name:src Committed By: roy Date: Tue Oct 13 11:13:37 UTC 2015 Modified Files: src/sys/netinet: if_arp.c Log Message: Move the NOARP check up a bit so that it works when an la is created but hasn't been resolved yet. Fixes PR kern/17611. To generate a diff of this commit: cvs rdiff -u -r1.185 -r1.186 src/sys/netinet/if_arp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: roy Date: Thu Oct 8 08:17:37 UTC 2015 Modified Files: src/sys/netinet: if_arp.c Log Message: Create a temporary define involving IFF_STATICARP if we have it instead of just testing for __FreeBSD__. No functional change. ok: ozaki-r@ To generate a diff of this commit: cvs rdiff -u -r1.183 -r1.184 src/sys/netinet/if_arp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/if_arp.c diff -u src/sys/netinet/if_arp.c:1.183 src/sys/netinet/if_arp.c:1.184 --- src/sys/netinet/if_arp.c:1.183 Wed Oct 7 00:33:27 2015 +++ src/sys/netinet/if_arp.c Thu Oct 8 08:17:37 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: if_arp.c,v 1.183 2015/10/07 00:33:27 ozaki-r Exp $ */ +/* $NetBSD: if_arp.c,v 1.184 2015/10/08 08:17:37 roy Exp $ */ /*- * Copyright (c) 1998, 2000, 2008 The NetBSD Foundation, Inc. @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.183 2015/10/07 00:33:27 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.184 2015/10/08 08:17:37 roy Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -844,12 +844,14 @@ retry: IF_AFDATA_RUNLOCK(ifp); } - if ((la == NULL) && ((flags & LLE_EXCLUSIVE) == 0) -#ifdef __FreeBSD__ - && ((ifp->if_flags & (IFF_NOARP | IFF_STATICARP)) == 0)) { +#ifdef IFF_STATICARP /* FreeBSD */ +#define _IFF_NOARP (IFF_NOARP | IFF_STATICARP) #else - && ((ifp->if_flags & IFF_NOARP) == 0)) { +#define _IFF_NOARP IFF_NOARP #endif + if ((la == NULL) && ((flags & LLE_EXCLUSIVE) == 0) + && ((ifp->if_flags & _IFF_NOARP) == 0)) + { flags |= LLE_EXCLUSIVE; IF_AFDATA_WLOCK(ifp); la = lla_create(LLTABLE(ifp), flags, dst); @@ -862,6 +864,7 @@ retry: ifp->if_xname); } } +#undef _IFF_NOARP if (la == NULL) { m_freem(m);
CVS commit: src/sys/netinet
Module Name:src Committed By: roy Date: Thu Oct 8 08:17:37 UTC 2015 Modified Files: src/sys/netinet: if_arp.c Log Message: Create a temporary define involving IFF_STATICARP if we have it instead of just testing for __FreeBSD__. No functional change. ok: ozaki-r@ To generate a diff of this commit: cvs rdiff -u -r1.183 -r1.184 src/sys/netinet/if_arp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: ozaki-r Date: Wed Oct 7 00:33:28 UTC 2015 Modified Files: src/sys/netinet: if_arp.c Log Message: Create an llentry after fixing an interface to store In case of RTF_LOCAL routes, we change an output interface of a route from original one to lo0ifp. An llentry also has to be stored to lo0ifp in such cases. Problem reported by roy@ To generate a diff of this commit: cvs rdiff -u -r1.182 -r1.183 src/sys/netinet/if_arp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/if_arp.c diff -u src/sys/netinet/if_arp.c:1.182 src/sys/netinet/if_arp.c:1.183 --- src/sys/netinet/if_arp.c:1.182 Mon Oct 5 08:17:31 2015 +++ src/sys/netinet/if_arp.c Wed Oct 7 00:33:27 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: if_arp.c,v 1.182 2015/10/05 08:17:31 ozaki-r Exp $ */ +/* $NetBSD: if_arp.c,v 1.183 2015/10/07 00:33:27 ozaki-r Exp $ */ /*- * Copyright (c) 1998, 2000, 2008 The NetBSD Foundation, Inc. @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.182 2015/10/05 08:17:31 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.183 2015/10/07 00:33:27 ozaki-r Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -576,43 +576,6 @@ arp_rtrequest(int req, struct rtentry *r if (rt->rt_flags & RTF_BROADCAST) break; - /* - * Case 2: This route may come from cloning, or a manual route - * add with a LL address. - */ - flags = LLE_EXCLUSIVE; - if ((rt->rt_flags & RTF_CLONED) == 0) - flags |= LLE_IFADDR; - - IF_AFDATA_WLOCK(ifp); - la = lla_create(LLTABLE(ifp), flags, rt_getkey(rt)); - IF_AFDATA_WUNLOCK(ifp); - - if (la == NULL) { - log(LOG_DEBUG, "%s: lla_create failed\n", - __func__); - rt->rt_llinfo = NULL; - break; - } - rt->rt_llinfo = la; - switch (ifp->if_type) { -#if NTOKEN > 0 - case IFT_ISO88025: - la->la_opaque = kmem_alloc(sizeof(struct token_rif), - KM_SLEEP); - break; -#endif /* NTOKEN > 0 */ - default: - break; - } - la->la_rt = rt; - rt->rt_refcnt++; - rt->rt_flags |= RTF_LLINFO; - arp_inuse++, arp_allocated++; - - LLE_WUNLOCK(la); - la = NULL; - INADDR_TO_IA(satocsin(rt_getkey(rt))->sin_addr, ia); while (ia && ia->ia_ifp != ifp) NEXT_IA_WITH_SAME_ADDR(ia); @@ -655,6 +618,44 @@ arp_rtrequest(int req, struct rtentry *r if (ifa != rt->rt_ifa) rt_replace_ifa(rt, ifa); } + + /* + * Case 2: This route may come from cloning, or a manual route + * add with a LL address. + */ + flags = LLE_EXCLUSIVE; + if ((rt->rt_flags & RTF_CLONED) == 0) + flags |= LLE_IFADDR; + + IF_AFDATA_WLOCK(ifp); + la = lla_create(LLTABLE(ifp), flags, rt_getkey(rt)); + IF_AFDATA_WUNLOCK(ifp); + + if (la == NULL) { + log(LOG_DEBUG, "%s: lla_create failed\n", + __func__); + rt->rt_llinfo = NULL; + break; + } + rt->rt_llinfo = la; + switch (ifp->if_type) { +#if NTOKEN > 0 + case IFT_ISO88025: + la->la_opaque = kmem_alloc(sizeof(struct token_rif), + KM_SLEEP); + break; +#endif /* NTOKEN > 0 */ + default: + break; + } + la->la_rt = rt; + rt->rt_refcnt++; + rt->rt_flags |= RTF_LLINFO; + arp_inuse++, arp_allocated++; + + LLE_WUNLOCK(la); + la = NULL; + break; case RTM_DELETE:
CVS commit: src/sys/netinet
Module Name:src Committed By: ozaki-r Date: Wed Oct 7 00:33:28 UTC 2015 Modified Files: src/sys/netinet: if_arp.c Log Message: Create an llentry after fixing an interface to store In case of RTF_LOCAL routes, we change an output interface of a route from original one to lo0ifp. An llentry also has to be stored to lo0ifp in such cases. Problem reported by roy@ To generate a diff of this commit: cvs rdiff -u -r1.182 -r1.183 src/sys/netinet/if_arp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: ozaki-r Date: Mon Oct 5 08:17:32 UTC 2015 Modified Files: src/sys/netinet: if_arp.c Log Message: Fix arplookup logic It should first lookup and then create an entry if not found (and if creation is requested). To generate a diff of this commit: cvs rdiff -u -r1.181 -r1.182 src/sys/netinet/if_arp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/if_arp.c diff -u src/sys/netinet/if_arp.c:1.181 src/sys/netinet/if_arp.c:1.182 --- src/sys/netinet/if_arp.c:1.181 Fri Sep 11 10:33:32 2015 +++ src/sys/netinet/if_arp.c Mon Oct 5 08:17:31 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: if_arp.c,v 1.181 2015/09/11 10:33:32 roy Exp $ */ +/* $NetBSD: if_arp.c,v 1.182 2015/10/05 08:17:31 ozaki-r Exp $ */ /*- * Copyright (c) 1998, 2000, 2008 The NetBSD Foundation, Inc. @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.181 2015/09/11 10:33:32 roy Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.182 2015/10/05 08:17:31 ozaki-r Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -1471,14 +1471,14 @@ arplookup(struct ifnet *ifp, struct mbuf struct llentry *la; int flags = wlock ? LLE_EXCLUSIVE : 0; - if (create) { + IF_AFDATA_RLOCK(ifp); + la = lla_lookup(LLTABLE(ifp), flags, rt_getkey(rt)); + IF_AFDATA_RUNLOCK(ifp); + + if (la == NULL && create) { IF_AFDATA_WLOCK(ifp); la = lla_create(LLTABLE(ifp), flags, rt_getkey(rt)); IF_AFDATA_WUNLOCK(ifp); - } else { - IF_AFDATA_RLOCK(ifp); - la = lla_lookup(LLTABLE(ifp), flags, rt_getkey(rt)); - IF_AFDATA_RUNLOCK(ifp); } return la;
CVS commit: src/sys/netinet
Module Name:src Committed By: ozaki-r Date: Mon Oct 5 08:17:32 UTC 2015 Modified Files: src/sys/netinet: if_arp.c Log Message: Fix arplookup logic It should first lookup and then create an entry if not found (and if creation is requested). To generate a diff of this commit: cvs rdiff -u -r1.181 -r1.182 src/sys/netinet/if_arp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: skrll Date: Mon Sep 21 13:32:26 UTC 2015 Modified Files: src/sys/netinet: in_selsrc.c Log Message: Make this compile again To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/netinet/in_selsrc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/in_selsrc.c diff -u src/sys/netinet/in_selsrc.c:1.15 src/sys/netinet/in_selsrc.c:1.16 --- src/sys/netinet/in_selsrc.c:1.15 Mon Aug 31 08:02:44 2015 +++ src/sys/netinet/in_selsrc.c Mon Sep 21 13:32:26 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: in_selsrc.c,v 1.15 2015/08/31 08:02:44 ozaki-r Exp $ */ +/* $NetBSD: in_selsrc.c,v 1.16 2015/09/21 13:32:26 skrll Exp $ */ /*- * Copyright (c) 2005 David Young. All rights reserved. @@ -29,7 +29,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: in_selsrc.c,v 1.15 2015/08/31 08:02:44 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: in_selsrc.c,v 1.16 2015/09/21 13:32:26 skrll Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -312,7 +312,7 @@ in_getifa(struct ifaddr *ifa, const stru ifp = ifa->ifa_ifp; KASSERT(ifp->if_afdata[AF_INET] != NULL); - isc = ifp->if_afdata[AF_INET]->ii_selsrc; + isc = ((struct in_ifinfo *)(ifp)->if_afdata[AF_INET])->ii_selsrc; if (isc != NULL && isc->isc_selsrc != NULL && isc->isc_selsrc->iss_score_src[0] != NULL) iss = isc->isc_selsrc;
CVS commit: src/sys/netinet
Module Name:src Committed By: ozaki-r Date: Wed Sep 9 01:22:28 UTC 2015 Modified Files: src/sys/netinet: if_arp.c Log Message: Revert v1.176 for further proper fix To generate a diff of this commit: cvs rdiff -u -r1.178 -r1.179 src/sys/netinet/if_arp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/if_arp.c diff -u src/sys/netinet/if_arp.c:1.178 src/sys/netinet/if_arp.c:1.179 --- src/sys/netinet/if_arp.c:1.178 Mon Sep 7 01:18:27 2015 +++ src/sys/netinet/if_arp.c Wed Sep 9 01:22:28 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: if_arp.c,v 1.178 2015/09/07 01:18:27 ozaki-r Exp $ */ +/* $NetBSD: if_arp.c,v 1.179 2015/09/09 01:22:28 ozaki-r Exp $ */ /*- * Copyright (c) 1998, 2000, 2008 The NetBSD Foundation, Inc. @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.178 2015/09/07 01:18:27 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.179 2015/09/09 01:22:28 ozaki-r Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -1427,20 +1427,7 @@ static void arptfree(struct llentry *la) { struct rtentry *rt = la->la_rt; -#ifdef notyet - /* - * This is racy; arptfree() is called without a lock from - * arptimer(), and something can delete the route before - * we get here. This happens for me when a ppp interface - * gets deleted. - */ KASSERT(rt != NULL); -#else - if (rt == NULL) { - aprint_error("%s: llentry without rt\n", __func__); - return; - } -#endif if (la->la_rt != NULL) { rtfree(la->la_rt);
CVS commit: src/sys/netinet
Module Name:src Committed By: ozaki-r Date: Wed Sep 9 01:22:28 UTC 2015 Modified Files: src/sys/netinet: if_arp.c Log Message: Revert v1.176 for further proper fix To generate a diff of this commit: cvs rdiff -u -r1.178 -r1.179 src/sys/netinet/if_arp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/netinet
Module Name:src Committed By: ozaki-r Date: Wed Sep 9 01:24:01 UTC 2015 Modified Files: src/sys/netinet: if_arp.c Log Message: Remove wrong KASSERT in arptfree la_rt can be NULL because arptimer that calls arptfree doesn't always free llentry so llentry can remain with la_rt == NULL. So we instead check whether la_rt is NULL or not and do arptfree if not. This fixes PR kern/50184 (confirmed by martin@) and PR kern/50186 (maybe). To generate a diff of this commit: cvs rdiff -u -r1.179 -r1.180 src/sys/netinet/if_arp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.