diff options
author | Robin H. Johnson <robbat2@gentoo.org> | 2012-07-20 10:20:19 -0700 |
---|---|---|
committer | Robin H. Johnson <robbat2@gentoo.org> | 2012-07-20 10:20:19 -0700 |
commit | a6db2374fe69704ec55de86d815b127432328f24 (patch) | |
tree | 8347012b577dc0e09b4264fc3211b8fb81b5ab10 /net | |
parent | 2e3715bb6922b9bb8c7a4c85e5a8dd1fb034b6d3 (diff) |
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@gentoo.org>
Diffstat (limited to 'net')
-rw-r--r-- | net/vlan.sh | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/net/vlan.sh b/net/vlan.sh index ff63dfd0..b29af801 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}" |