2015-02-22 21:32:48 -08:00
|
|
|
package bridge
|
|
|
|
|
2015-05-14 14:56:15 -07:00
|
|
|
import (
|
2015-05-28 16:30:36 -07:00
|
|
|
"os"
|
|
|
|
|
2015-05-14 14:56:15 -07:00
|
|
|
log "github.com/Sirupsen/logrus"
|
2015-05-28 16:30:36 -07:00
|
|
|
"github.com/vishvananda/netlink"
|
2015-05-14 14:56:15 -07:00
|
|
|
)
|
2015-02-22 21:32:48 -08:00
|
|
|
|
2015-05-22 10:56:36 -07:00
|
|
|
func setupFixedCIDRv6(config *networkConfiguration, i *bridgeInterface) error {
|
2015-04-15 05:25:42 +00:00
|
|
|
log.Debugf("Using IPv6 subnet: %v", config.FixedCIDRv6)
|
|
|
|
if err := ipAllocator.RegisterSubnet(config.FixedCIDRv6, config.FixedCIDRv6); err != nil {
|
2015-05-14 14:56:15 -07:00
|
|
|
return &FixedCIDRv6Error{Net: config.FixedCIDRv6, Err: err}
|
2015-02-24 18:49:08 -08:00
|
|
|
}
|
|
|
|
|
2015-05-28 16:30:36 -07:00
|
|
|
// Setting route to global IPv6 subnet
|
|
|
|
log.Debugf("Adding route to IPv6 network %s via device %s", config.FixedCIDRv6.String(), config.BridgeName)
|
|
|
|
err := netlink.RouteAdd(&netlink.Route{
|
|
|
|
Scope: netlink.SCOPE_UNIVERSE,
|
|
|
|
LinkIndex: i.Link.Attrs().Index,
|
|
|
|
Dst: config.FixedCIDRv6,
|
|
|
|
})
|
|
|
|
if err != nil && !os.IsExist(err) {
|
|
|
|
log.Errorf("Could not add route to IPv6 network %s via device %s", config.FixedCIDRv6.String(), config.BridgeName)
|
|
|
|
}
|
2015-02-24 18:49:08 -08:00
|
|
|
return nil
|
2015-02-22 21:32:48 -08:00
|
|
|
}
|