Add support for bridging iwn(4) based wlan(4)
Documented in iwn(4), "Only one virtual interface may be configured at any time." However, netgraph with a cloned MAC address is able to communicate over an ng_eiface attached to an ng_bridge linked to the wlan(4) interface. While here, introduce syntax to specify the MAC address is to be cloned if the named interface begins with equals [=].
This commit is contained in:
parent
f0d593add5
commit
7632f2245f
@ -265,7 +265,7 @@ mustberoot_to_continue()
|
||||
fi
|
||||
}
|
||||
|
||||
jng_bridge_usage="bridge [-b BRIDGE_NAME] NAME interface0 [interface1 ...]"
|
||||
jng_bridge_usage="bridge [-b BRIDGE_NAME] NAME [=]iface0 [[=]iface1 ...]"
|
||||
jng_bridge_descr="Create ng0_NAME [ng1_NAME ...]"
|
||||
jng_bridge()
|
||||
{
|
||||
@ -286,10 +286,15 @@ jng_bridge()
|
||||
|
||||
mustberoot_to_continue
|
||||
|
||||
local iface eiface eiface_devid
|
||||
local new num quad i=0
|
||||
local iface parent eiface eiface_devid
|
||||
local new clone_mac num quad i=0
|
||||
for iface in $*; do
|
||||
|
||||
clone_mac=
|
||||
case "$iface" in
|
||||
=*) iface=${iface#=} clone_mac=1 ;;
|
||||
esac
|
||||
|
||||
# 0. Make sure the interface doesn't exist already
|
||||
eiface=ng${i}_$name
|
||||
ngctl msg "$eiface:" getifname > /dev/null 2>&1 && continue
|
||||
@ -347,7 +352,23 @@ jng_bridge()
|
||||
# 6. Set the MAC address of the new interface using a sensible
|
||||
# algorithm to prevent conflicts on the network.
|
||||
#
|
||||
derive_mac $iface "$name" eiface_devid
|
||||
case "$iface" in
|
||||
wlan[0-9]*)
|
||||
parent=$( sysctl -n net.wlan.${iface#wlan}.%parent )
|
||||
case "$parent" in
|
||||
iwn[0-9]*)
|
||||
# iwn(4) supports only 1 virtual net at a time
|
||||
# NB: Cloning MAC allows new interface to work
|
||||
clone_mac=1 ;;
|
||||
esac
|
||||
esac
|
||||
if [ "$clone_mac" ]; then
|
||||
eiface_devid=$(
|
||||
ifconfig $iface ether | awk '/ether/,$0=$2'
|
||||
)
|
||||
else
|
||||
derive_mac $iface "$name" eiface_devid
|
||||
fi
|
||||
ifconfig $eiface ether $eiface_devid
|
||||
|
||||
i=$(( $i + 1 )) # on to next ng{i}_name
|
||||
|
Loading…
x
Reference in New Issue
Block a user