Module Name: src Committed By: bouyer Date: Thu Jul 17 10:46:58 UTC 2014
Modified Files: src/sys/net: if_mpls.c Log Message: Make sure to call ifp->if_output() with KERNEL_LOCK held. Should fix mpls-related atf tests. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/net/if_mpls.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/net/if_mpls.c diff -u src/sys/net/if_mpls.c:1.15 src/sys/net/if_mpls.c:1.16 --- src/sys/net/if_mpls.c:1.15 Wed Jul 9 14:41:42 2014 +++ src/sys/net/if_mpls.c Thu Jul 17 10:46:57 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: if_mpls.c,v 1.15 2014/07/09 14:41:42 rtr Exp $ */ +/* $NetBSD: if_mpls.c,v 1.16 2014/07/17 10:46:57 bouyer Exp $ */ /* * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_mpls.c,v 1.15 2014/07/09 14:41:42 rtr Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_mpls.c,v 1.16 2014/07/17 10:46:57 bouyer Exp $"); #include "opt_inet.h" #include "opt_mpls.h" @@ -205,6 +205,8 @@ mpls_output(struct ifnet *ifp, struct mb int err; uint psize = sizeof(struct sockaddr_mpls); + KASSERT(KERNEL_LOCKED_P()); + if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING)) { m_freem(m); return ENETDOWN; @@ -448,6 +450,7 @@ static int mpls_send_frame(struct mbuf *m, struct ifnet *ifp, struct rtentry *rt) { union mpls_shim msh; + int ret; if ((rt->rt_flags & RTF_GATEWAY) == 0) return EHOSTUNREACH; @@ -466,7 +469,10 @@ mpls_send_frame(struct mbuf *m, struct i case IFT_ETHER: case IFT_TUNNEL: case IFT_LOOP: - return (*ifp->if_output)(ifp, m, rt->rt_gateway, rt); + KERNEL_LOCK(1, NULL); + ret = (*ifp->if_output)(ifp, m, rt->rt_gateway, rt); + KERNEL_UNLOCK_ONE(NULL); + return ret; break; default: return ENETUNREACH;