Reimplement next-node configuration based on the new netifd version

pull/1/head
Matthias Schiffer 9 years ago
parent 4d8d989980
commit 4efe5575fe
  1. 26
      gluon/gluon-next-node/generate/etc/init.d/gluon-next-node
  2. 37
      gluon/gluon-next-node/generate/lib/gluon/upgrade/next-node/invariant/010-next-node

@ -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
}

@ -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
Loading…
Cancel
Save