[package] libpcap: explicitely disable libnl support to prevent different build resul...
[openwrt.git] / package / base-files / files / lib / functions / uci-defaults.sh
1 #!/bin/sh
2 # Copyright (C) 2011 OpenWrt.org
3
4 ucidef_set_interface_loopback() {
5 uci batch <<EOF
6 set network.loopback='interface'
7 set network.loopback.ifname='lo'
8 set network.loopback.proto='static'
9 set network.loopback.ipaddr='127.0.0.1'
10 set network.loopback.netmask='255.0.0.0'
11 EOF
12 }
13
14 ucidef_set_interface_raw() {
15 local cfg=$1
16 local ifname=$2
17
18 uci batch <<EOF
19 set network.$cfg='interface'
20 set network.$cfg.ifname='$ifname'
21 set network.$cfg.proto='none'
22 EOF
23 }
24
25 ucidef_set_interface_lan() {
26 local ifname=$1
27
28 uci batch <<EOF
29 set network.lan='interface'
30 set network.lan.ifname='$ifname'
31 set network.lan.type='bridge'
32 set network.lan.proto='static'
33 set network.lan.ipaddr='192.168.1.1'
34 set network.lan.netmask='255.255.255.0'
35 EOF
36 }
37
38 ucidef_set_interface_wan() {
39 local ifname=$1
40
41 uci batch <<EOF
42 set network.wan='interface'
43 set network.wan.ifname='$ifname'
44 set network.wan.proto='dhcp'
45 EOF
46 }
47
48 ucidef_set_interfaces_lan_wan() {
49 local lan_ifname=$1
50 local wan_ifname=$2
51
52 ucidef_set_interface_lan "$lan_ifname"
53 ucidef_set_interface_wan "$wan_ifname"
54 }
55
56 ucidef_set_interface_macaddr() {
57 local ifname=$1
58 local mac=$2
59
60 uci batch <<EOF
61 set network.$ifname.macaddr='$mac'
62 EOF
63 }
64
65 ucidef_add_switch() {
66 local name=$1
67 local reset=$2
68 local enable=$3
69 uci batch <<EOF
70 add network switch
71 set network.@switch[-1].name='$name'
72 set network.@switch[-1].reset='$reset'
73 set network.@switch[-1].enable_vlan='$enable'
74 EOF
75 }
76
77 ucidef_add_switch_vlan() {
78 local device=$1
79 local vlan=$2
80 local ports=$3
81 uci batch <<EOF
82 add network switch_vlan
83 set network.@switch_vlan[-1].device='$device'
84 set network.@switch_vlan[-1].vlan='$vlan'
85 set network.@switch_vlan[-1].ports='$ports'
86 EOF
87 }
88
This page took 0.045449 seconds and 5 git commands to generate.