source: freewrt/package/busybox/files/vlan.pre-up

freewrt_2_0
Last change on this file was 82d7141, checked in by Waldemar Brodkorb <wbx@…>, 4 months ago

enable bridging and 802.1q, add a swconfig pre-up file

  • Property mode set to 100644
File size: 1.1 KB
Line 
1#!/bin/sh
2
3case "$IFACE" in
4 vlan0*)
5 vconfig set_name_type VLAN_PLUS_VID
6 VLANID=`echo $IFACE|sed "s/vlan0*//"`
7 ;;
8 vlan*)
9 vconfig set_name_type VLAN_PLUS_VID_NO_PAD
10 VLANID=`echo $IFACE|sed "s/vlan*//"`
11 ;;
12 eth*.0?*)
13 vconfig set_name_type DEV_PLUS_VID
14 VLANID=`echo $IFACE|sed "s/eth[0-9][0-9]*\.0*//g"`
15 IF_VLAN_RAW_DEVICE=`echo $IFACE|sed "s/\(eth[0-9][0-9]*\)\..*/\1/"`
16 ;;
17 eth*.*)
18 vconfig set_name_type DEV_PLUS_VID_NO_PAD
19 VLANID=`echo $IFACE|sed "s/eth[0-9][0-9]*\.*//g"`
20 IF_VLAN_RAW_DEVICE=`echo $IFACE|sed "s/\(eth[0-9][0-9]*\)\..*/\1/"`
21 ;;
22 *) exit 0
23 ;;
24esac
25
26if [ "$IF_VLAN_RAW_DEVICE" != "" ]
27then
28 [ -x /sbin/vconfig ] || exit 0
29 if ! grep -q "$IF_VLAN_RAW_DEVICE" /proc/net/dev
30 then
31 echo "$IF_VLAN_RAW_DEVICE does not exist, unable to create $IFACE"
32 exit 1
33 fi
34
35 ip link set up dev $IF_VLAN_RAW_DEVICE
36 vconfig add $IF_VLAN_RAW_DEVICE $VLANID
37 # change mac link layer address
38 if [ "$IF_MAC_ADDRESS" != "" ]
39 then
40 ip link set $IF_VLAN_RAW_DEVICE.$VLANID address $IF_MAC_ADDRESS
41 fi
42 ip link set up dev $IF_VLAN_RAW_DEVICE.$VLANID
43fi
Note: See TracBrowser for help on using the repository browser.