Reimplement next-node configuration based on the new netifd version

This commit is contained in:
Matthias Schiffer 2014-01-10 22:33:42 +01:00
parent f8cdeaefd9
commit 0f5190bc6e
2 changed files with 37 additions and 26 deletions

View File

@ -1,26 +0,0 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2013 Project Gluon
START=95
start() {
ip link add link br-client name local-node type macvlan
echo 0 > /proc/sys/net/ipv6/conf/local-node/accept_ra
ip link set local-node address @next_node.mac@
ip address add @next_node.ip4@/32 dev local-node
ip route add @prefix4@ dev br-client
ip address add @next_node.ip6@/128 dev local-node
ip route add @prefix6@ dev br-client
ip link set local-node up
}
stop() {
ip route del @prefix4@ dev br-client
ip route del @prefix6@ dev br-client
ip link set local-node down
ip link del local-node
}

View File

@ -0,0 +1,37 @@
#!/bin/sh
. /lib/functions.sh
. /lib/gluon/functions/sysconfig.sh
uci_remove network local_node
uci_add network device local_node
uci_set network local_node name 'local-node'
uci_set network local_node ifname '@client'
uci_set network local_node type 'macvlan'
uci_set network local_node macaddr '@next_node.mac@'
uci_remove network local_node_if
uci_add network interface local_node_if
uci_set network local_node_if ifname 'local-node'
uci_set network local_node_if proto 'static'
uci_set network local_node_if ipaddr '@next_node.ip4@'
uci_set network local_node_if netmask '255.255.255.255'
uci_set network local_node_if ip6addr '@next_node.ip6@/128'
eval $(ipcalc.sh '@prefix4@')
uci_remove network local_node_route4
uci_add network route local_node_route4
uci_set network local_node_route4 interface 'client'
uci_set network local_node_route4 target "$IP"
uci_set network local_node_route4 netmask "$NETMASK"
uci_set network local_node_route4 gateway '0.0.0.0'
uci_remove network local_node_route6
uci_add network route6 local_node_route6
uci_set network local_node_route6 interface 'client'
uci_set network local_node_route6 target '@prefix6@'
uci_set network local_node_route6 gateway '::'
uci_commit network