Page MenuHomeFreeBSD

D14385.id.diff
No OneTemporary

D14385.id.diff

Index: sys/net/if_vlan.c
===================================================================
--- sys/net/if_vlan.c
+++ sys/net/if_vlan.c
@@ -333,6 +333,8 @@
static int vlan_setflags(struct ifnet *ifp, int status);
static int vlan_setmulti(struct ifnet *ifp);
static int vlan_transmit(struct ifnet *ifp, struct mbuf *m);
+static int vlan_output(struct ifnet *ifp, struct mbuf *m,
+ const struct sockaddr *dst, struct route *ro);
static void vlan_unconfig(struct ifnet *ifp);
static void vlan_unconfig_locked(struct ifnet *ifp, int departing);
static int vlan_config(struct ifvlan *ifv, struct ifnet *p, uint16_t tag);
@@ -1270,6 +1272,27 @@
return (error);
}
+static int
+vlan_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst,
+ struct route *ro)
+{
+ struct ifvlan *ifv;
+ struct ifnet *p;
+ VLAN_LOCK_READER;
+
+ VLAN_RLOCK();
+ ifv = ifp->if_softc;
+ if (TRUNK(ifv) == NULL) {
+ VLAN_RUNLOCK();
+ m_freem(m);
+ return (ENETDOWN);
+ }
+ p = PARENT(ifv);
+ VLAN_RUNLOCK();
+ return p->if_output(ifp, m, dst, ro);
+}
+
+
/*
* The ifp->if_qflush entry point for vlan(4) is a no-op.
*/
@@ -1486,12 +1509,17 @@
*/
ifp->if_mtu = p->if_mtu - ifv->ifv_mtufudge;
ifp->if_baudrate = p->if_baudrate;
- ifp->if_output = p->if_output;
ifp->if_input = p->if_input;
ifp->if_resolvemulti = p->if_resolvemulti;
ifp->if_addrlen = p->if_addrlen;
ifp->if_broadcastaddr = p->if_broadcastaddr;
+ /*
+ * We wrap the parent's if_output using vlan_output to ensure that it
+ * can't become stale.
+ */
+ ifp->if_output = vlan_output;
+
/*
* Copy only a selected subset of flags from the parent.
* Other flags are none of our business.

File Metadata

Mime Type
text/plain
Expires
Wed, Nov 19, 3:19 AM (15 h, 12 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
25567154
Default Alt Text
D14385.id.diff (1 KB)

Event Timeline