summaryrefslogtreecommitdiff
path: root/package/base-files/extra/etc/network/if-pre-up.d/01-atm
blob: 5c168c0019ed3ab94fed3c001ceb533d81a8f4d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/sh

[ -x /usr/sbin/br2684ctl ] || exit 0

[ "${IFACE%%[0-9]*}" = "nas" ] || exit 0

[ "$IF_ATM_ENCAPS" ] || encap=0
[ "$IF_ATM_PAYLOAD" ] || payload=1
[ "$IF_ATM_VPI" ] || IF_ATM_VPI=1
[ "$IF_ATM_VCI" ] || IF_ATM_VCI=32

[ "$IF_ATM_PAYLOAD" ] && case "$IF_ATM_PAYLOAD" in
bridged)
        payload=1
        ;;
routed)
        payload=0
        ;;
*)
        echo "Wrong payload, use either bridged or routed"
        exit 1
        ;;
esac

[ "$IF_ATM_ENCAPS" ] && case "$IF_ATM_ENCAPS" in
llc)
        encap=0
        ;;
vc)
        encap=1
        ;;
*)
        echo "Wrong Encapsulation use either llc or vc"
        exit 1
        ;;
esac

br2684ctl -b -c ${IFACE##*[a-z]} -e $encap -p $payload -a $IF_ATM_VPI.$IF_ATM_VCI
ifconfig nas${IFACE##*[a-z]} up

exit 0