Skip to content

Commit

Permalink
Merge branch 'master' of git.funtoo.org:corenetwork
Browse files Browse the repository at this point in the history
  • Loading branch information
danielrobbins committed Oct 16, 2013
2 parents 0fbeacf + 1ee060e commit 36de7e8
Showing 1 changed file with 59 additions and 0 deletions.
59 changes: 59 additions & 0 deletions netif.d/bridge-openvswitch
@@ -0,0 +1,59 @@
#!/bin/sh -x

netif_depend() {
need ovsdb-server
need ovs-controller
need ovs-vswitchd
}

netif_create() {
ovs-vsctl --may-exist add-br $interface
}

netif_destroy() {
ovs-vsctl --if-exists del-br $interface
}

netif_pre_down() {
local slave

if [ -n "$slaves" ]; then
for slave in ${slaves//netif./}; do
ovs-ofctl mod-port $interface ${slave} down
ovs-vsctl --if-exists del-port $interface ${slave}
done
fi

ovs-ofctl mod-port $interface $interface down
}

netif_pre_up() {
local slave
local bcast
if [ -n "$slaves" ]; then
for slave in ${slaves//netif./}; do
ovs-vsctl --may-exist add-port $interface ${slave}
ovs-ofctl mod-port $interface ${slave} up
done
fi

for ipnm in $ipaddr $ipaddrs; do
if [ -n "$(if_ipv4 $ipnm)" ]; then
bcast="broadcast $(get_option "$ipnm" broadcast +)"
else
bcast=""
fi

ip addr add $(get_ipnm_part "$ipnm") $bcast dev $interface || die "Couldn't add $ipnm to $interface"
done

if [ -n "$stp" ]; then
ovs-vsctl --if-exists set bridge $interface stp_enable=true
fi

if [ -n "$forwarding" ]; then
/sbin/sysctl net.ipv4.conf.${interface}.forwarding=${forwarding} >/dev/null 2>&1
fi

}

0 comments on commit 36de7e8

Please sign in to comment.