source: trunk/target/linux/lantiq/base-files/etc/uci-defaults/network @ 29292

Last change on this file since 29292 was 29292, checked in by blogic, 5 years ago

lantiq:

  • fixes ath5k eeprom handling
  • fixes sx76x
  • adds sx76x to userland api
  • minor style cleanups

Signed-of-by: Andrej Vlašić <andrej.vlasic0@…>

  • Property svn:executable set to *
File size: 2.3 KB
Line 
1#!/bin/sh
2#
3# Copyright (C) 2011 OpenWrt.org
4#
5
6set_interface_loopback() {
7        uci batch <<EOF
8set network.loopback='interface'
9set network.loopback.ifname='lo'
10set network.loopback.proto='static'
11set network.loopback.ipaddr='127.0.0.1'
12set network.loopback.netmask='255.0.0.0'
13EOF
14}
15
16set_interface_raw() {
17        local cfg=$1
18        local ifname=$2
19
20        uci batch <<EOF
21set network.$cfg='interface'
22set network.$cfg.ifname='$ifname'
23set network.$cfg.proto='none'
24EOF
25}
26
27set_interface_lan() {
28        local ifname=$1
29
30        uci batch <<EOF
31set network.lan='interface'
32set network.lan.ifname='$ifname'
33set network.lan.type='bridge'
34set network.lan.proto='static'
35set network.lan.ipaddr='192.168.1.1'
36set network.lan.netmask='255.255.255.0'
37EOF
38}
39
40set_interface_wan() {
41        local ifname=$1
42
43        uci batch <<EOF
44set network.wan='interface'
45set network.wan.ifname='$ifname'
46set network.wan.proto='dhcp'
47EOF
48}
49
50set_atm_wan() {
51        local vpi=$1
52        local vci=$2
53        local encaps=$3
54        local payload=$4
55
56        uci batch <<EOF
57set network.atm='atm-bridge'
58set network.atm.unit='0'
59set network.atm.vpi='$vpi'
60set network.atm.vci='$vci'
61set network.atm.encaps='$encaps'
62set network.atm.payload='$payload'
63set network.wan='interface'
64set network.wan.ifname='nas0'
65set network.wan.proto='pppoe'
66set network.wan.username='foo'
67set network.wan.password='bar'
68EOF
69}
70
71set_interfaces_lan_wan() {
72        local lan_ifname=$1
73        local wan_ifname=$2
74
75        set_interface_lan "$lan_ifname"
76        set_interface_wan "$wan_ifname"
77}
78
79add_switch() {
80        local name=$1
81        local reset=$2
82        local enable=$3
83        uci batch <<EOF
84add network switch
85set network.@switch[-1].name='$name'
86set network.@switch[-1].reset='$reset'
87set network.@switch[-1].enable_vlan='$enable'
88EOF
89}
90
91add_switch_vlan() {
92        local device=$1
93        local vlan=$2
94        local ports=$3
95        uci batch <<EOF
96add network switch_vlan
97set network.@switch_vlan[-1].device='$device'
98set network.@switch_vlan[-1].vlan='$vlan'
99set network.@switch_vlan[-1].ports='$ports'
100EOF
101}
102
103[ -e /etc/config/network ] && exit 0
104
105. /lib/lantiq.sh
106
107touch /etc/config/network
108
109set_interface_loopback
110set_interface_lan 'eth0'
111
112dsl=$(lantiq_soc_has_adsl)
113[ -z "$dsl" ] || set_atm_wan '1' '32' 'llc' 'bridged'
114
115board=$(lantiq_board_name)
116
117case "$board" in
118GIGASX76X)
119        set_interface_lan "eth0.1"
120        add_switch "eth0" "1" "1"
121        add_switch_vlan "eth0" "1" "1 2 3 4 5t"
122        set_atm_wan "1" "32" "llc" "bridged"
123        ;;
124
125*)
126        # custom foo goes here
127        true
128        ;;
129esac
130
131uci commit network
132
133exit 0
Note: See TracBrowser for help on using the repository browser.