svn commit: r342887 - head/sys/net

Mark Johnston markj at FreeBSD.org
Wed Jan 9 16:47:17 UTC 2019


Author: markj
Date: Wed Jan  9 16:47:16 2019
New Revision: 342887
URL: https://svnweb.freebsd.org/changeset/base/342887

Log:
  Stop setting if_linkmib in vlan(4) ifnets.
  
  There are several reasons:
  - The structure being exported via IFDATA_LINKSPECIFIC doesn't appear
    to be a standard MIB.
  - The structure being exported is private to the kernel and always
    has been.
  - No other drivers in common use set the if_linkmib field.
  - Because IFDATA_LINKSPECIFIC can be used to overwrite the linkmib
    structure, a privileged user could use it to corrupt internal
    vlan(4) state. [1]
  
  PR:		219472
  Reported by:	CTurt <ecturt at gmail.com> [1]
  Reviewed by:	kp (previous version)
  MFC after:	1 week
  Sponsored by:	The FreeBSD Foundation
  Differential Revision:	https://reviews.freebsd.org/D18779

Modified:
  head/sys/net/if_vlan.c

Modified: head/sys/net/if_vlan.c
==============================================================================
--- head/sys/net/if_vlan.c	Wed Jan  9 15:03:54 2019	(r342886)
+++ head/sys/net/if_vlan.c	Wed Jan  9 16:47:16 2019	(r342887)
@@ -156,7 +156,7 @@ struct vlan_mc_entry {
 	struct epoch_context		mc_epoch_ctx;
 };
 
-struct	ifvlan {
+struct ifvlan {
 	struct	ifvlantrunk *ifv_trunk;
 	struct	ifnet *ifv_ifp;
 #define	TRUNK(ifv)	((ifv)->ifv_trunk)
@@ -164,28 +164,19 @@ struct	ifvlan {
 	void	*ifv_cookie;
 	int	ifv_pflags;	/* special flags we have set on parent */
 	int	ifv_capenable;
-	struct	ifv_linkmib {
-		int	ifvm_encaplen;	/* encapsulation length */
-		int	ifvm_mtufudge;	/* MTU fudged by this much */
-		int	ifvm_mintu;	/* min transmission unit */
-		uint16_t ifvm_proto;	/* encapsulation ethertype */
-		uint16_t ifvm_tag;	/* tag to apply on packets leaving if */
-              	uint16_t ifvm_vid;	/* VLAN ID */
-		uint8_t	ifvm_pcp;	/* Priority Code Point (PCP). */
-	}	ifv_mib;
+	int	ifv_encaplen;	/* encapsulation length */
+	int	ifv_mtufudge;	/* MTU fudged by this much */
+	int	ifv_mintu;	/* min transmission unit */
+	uint16_t ifv_proto;	/* encapsulation ethertype */
+	uint16_t ifv_tag;	/* tag to apply on packets leaving if */
+	uint16_t ifv_vid;	/* VLAN ID */
+	uint8_t	ifv_pcp;	/* Priority Code Point (PCP). */
 	struct task lladdr_task;
 	CK_SLIST_HEAD(, vlan_mc_entry) vlan_mc_listhead;
 #ifndef VLAN_ARRAY
 	CK_SLIST_ENTRY(ifvlan) ifv_list;
 #endif
 };
-#define	ifv_proto	ifv_mib.ifvm_proto
-#define	ifv_tag		ifv_mib.ifvm_tag
-#define	ifv_vid 	ifv_mib.ifvm_vid
-#define	ifv_pcp		ifv_mib.ifvm_pcp
-#define	ifv_encaplen	ifv_mib.ifvm_encaplen
-#define	ifv_mtufudge	ifv_mib.ifvm_mtufudge
-#define	ifv_mintu	ifv_mib.ifvm_mintu
 
 /* Special flags we should propagate to parent. */
 static struct {
@@ -1049,10 +1040,6 @@ vlan_clone_create(struct if_clone *ifc, char *name, si
 	strlcpy(ifp->if_xname, name, IFNAMSIZ);
 	ifp->if_dname = vlanname;
 	ifp->if_dunit = unit;
-	/* NB: flags are not set here */
-	ifp->if_linkmib = &ifv->ifv_mib;
-	ifp->if_linkmiblen = sizeof(ifv->ifv_mib);
-	/* NB: mtu is not set here */
 
 	ifp->if_init = vlan_init;
 	ifp->if_transmit = vlan_transmit;


More information about the svn-src-head mailing list