public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/openrc:openrc-0.10.x commit in: net/, doc/
@ 2012-09-10  0:17 William Hubbs
  0 siblings, 0 replies; only message in thread
From: William Hubbs @ 2012-09-10  0:17 UTC (permalink / raw
  To: gentoo-commits

commit:     84c12adb79ca6630e7c8adcd49517e446fac91c0
Author:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Fri Jul 20 17:20:19 2012 +0000
Commit:     William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Sun Sep  9 23:36:20 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=84c12adb

Bug #427152: Port of VLAN code to sysfs/iproue2 from vconfig lost the ability to create different vlans with the same ID but different interfaces on a single system. Implement it now.

Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>

---
 doc/net.example.Linux.in |   22 +++++++++++++++-------
 net/vlan.sh              |   31 +++++++++++++++++++++++--------
 2 files changed, 38 insertions(+), 15 deletions(-)

diff --git a/doc/net.example.Linux.in b/doc/net.example.Linux.in
index 870c794..31da4cb 100644
--- a/doc/net.example.Linux.in
+++ b/doc/net.example.Linux.in
@@ -552,26 +552,34 @@
 # You can also configure the VLAN - see for ip man page for more details
 # To change the vlan interface name. If not set, the standard "iface.vlanid"
 # will be used. This is the replacement for the old 'vconfig set_name_type'
-# functionality.
+# functionality. If you previously relied on the DEV_PLUS_VID or
+# DEV_PLUS_VID_NO_PAD options to have different VLANs with same ID value, on
+# different interfaces, please note that you need to use both the interface and
+# vlan number in the numbering. This applies for all of the options: name,
+# txqueuelen, mac, broadcast, mtu, ingress, egress, flags
 #vlan1_name="vlan1"
-#vlan2_name="eth0.2"
+#eth0_vlan2_name="eth0.2"
+#eth1_vlan2_name="eth1.2"
 
 # The following shows the old set_name_type setting and what new option to set:
 # Using eth9 & VLAN VID 26 as an example.
 # VLAN_PLUS_VID         vlan26_name="vlan0026"
 # VLAN_PLUS_VID_NO_PAD  vlan26_name="vlan26"
-# DEV_PLUS_VID          vlan26_name="eth9.0026"
-# DEV_PLUS_VID_NO_PAD   vlan26_name="eth9.26"
+# DEV_PLUS_VID          eth9_vlan26_name="eth9.0026"
+# DEV_PLUS_VID_NO_PAD   eth9_vlan26_name="eth9.26"
 
 # Set the vlan flags
 #vlan1_flags="reorder_hdr off gvrp on loose_binding on"
+#eth0_vlan1_flags="reorder_hdr off gvrp on loose_binding on"
 
 # Configure in/egress maps
 #vlan1_ingress="2:6 3:5"
-#vlan1_egress="1:2"
+#eth0_vlan1_egress="1:2"
 
-#config_vlan1="172.16.3.1/23"
-#config_vlan2="172.16.2.1/23"
+#config_vlan1="172.16.2.1/24"
+#config_vlan2="172.16.3.1/24"
+#config_eth0_1="172.16.4.1/24"
+#config_eth1_1="172.16.5.1/24"
 
 # NOTE: Vlans can be configured with a . in their interface names
 # When configuring vlans with this name type, you need to replace . with a _

diff --git a/net/vlan.sh b/net/vlan.sh
index ff63dfd..b29af80 100644
--- a/net/vlan.sh
+++ b/net/vlan.sh
@@ -66,26 +66,41 @@ vlan_post_start()
 		einfo "Adding VLAN ${vlan} to ${IFACE}"
 		# We need to gather all interface configuration options
 		# 1) naming. Default to the standard "${IFACE}.${vlan}" but it can be anything
-		eval vname=\$vlan${vlan}_name
+		eval vname=\$${IFACE}_vlan${vlan}_name
+		[ -z "${vname}" ] && eval vname=\$vlan${vlan}_name
 		[ -z "${vname}" ] && vname="${IFACE}.${vlan}"
 		# 2) flags
-		eval vflags=\$vlan${vlan}_flags
+		eval vflags=\$${IFACE}_vlan${vlan}_flags
+		[ -z "${vname}" ] && eval vflags=\$vlan${vlan}_flags
 		# 3) ingress/egress map
-		eval vingress=\$vlan${vlan}_ingress
+		eval vingress=\$${IFACE}_vlan${vlan}_ingress
+		[ -z "${vingress}" ] && eval vingress=\$vlan${vlan}_ingress
 		[ -z "${vingress}" ] || vingress="ingress-qos-map ${vingress}"
-		eval vegress=\$vlan${vlan}_egress
+		eval vegress=\$${IFACE}_vlan${vlan}_egress
+		[ -z "${vegress}" ] && eval vegress=\$vlan${vlan}_egress
 		[ -z "${vegress}" ] || vegress="egress-qos-map ${vegress}"
 
+		# txqueue
 		local txqueuelen=
-		eval txqueuelen=\$txqueuelen_vlan${vlan}
+		eval txqueuelen=\$txqueuelen_${IFACE}_vlan${vlan}
+		[ -z "${txqueuelen}" ] && eval txqueuelen=\$txqueuelen_vlan${vlan}
+		# mac
 		local mac=
-		eval mac=\$mac_vlan${vlan}
+		eval mac=\$mac_${IFACE}_vlan${vlan}
+		[ -z "${mac}" ] && eval mac=\$mac_vlan${vlan}
+		# broadcast
 		local broadcast=
-		eval broadcast=\$broadcast_vlan${vlan}
+		eval broadcast=\$broadcast_${IFACE}_vlan${vlan}
+		[ -z "${broadcast}" ] && eval broadcast=\$broadcast_vlan${vlan}
+		# mtu
 		local mtu=
-		eval mtu=\$mtu_vlan${vlan}
+		eval mtu=\$mtu_${IFACE}_vlan${vlan}
+		[ -z "${mtu}" ] && eval mtu=\$mtu_vlan${vlan}
+
+		# combine it all
 		local opts="${txqueuelen:+txqueuelen} ${txqueuelen} ${mac:+address} ${mac} ${broadcast:+broadcast} ${broadcast} ${mtu:+mtu} ${mtu}"
 
+		veinfo "ip link add link \"${IFACE}\" name \"${vname}\" ${opts} type vlan id \"${vlan}\" ${vflags} ${vingress} ${vegress}"
 		e="$(ip link add link "${IFACE}" name "${vname}" ${opts} type vlan id "${vlan}" ${vflags} ${vingress} ${vegress} 2>&1 1>/dev/null)"
 		if [ -n "${e}" ]; then
 			eend 1 "${e}"


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2012-09-10  0:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-10  0:17 [gentoo-commits] proj/openrc:openrc-0.10.x commit in: net/, doc/ William Hubbs

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox