mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-27 10:50:50 +08:00
route changes + primary addr on node
This commit is contained in:
@@ -19,6 +19,14 @@ func deleteRoute(iface string, addr *net.IPNet, address string) error {
|
||||
}
|
||||
|
||||
func setCidr(iface, address string, addr *net.IPNet) {
|
||||
cidr := ipaddr.NewIPAddressString(addr.String()).GetAddress()
|
||||
if cidr.IsIPv4() {
|
||||
ncutils.RunCmd("route add -net "+addr.String()+" -interface "+iface, false)
|
||||
} else if cidr.IsIPv6() {
|
||||
ncutils.RunCmd("route add -net -inet6 "+addr.String()+" -interface "+iface, false)
|
||||
} else {
|
||||
logger.Log(1, "could not parse address: "+addr.String())
|
||||
}
|
||||
ncutils.RunCmd("route add -net "+addr.String()+" -interface "+iface, false)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user