Merge pull request #297 from optiflows/delete_interface_ip

Adding a function that allows to remove an address set on an interface
This commit is contained in:
Mrunal Patel 2014-12-14 22:18:22 -08:00
commit 42fed751fb
1 changed files with 12 additions and 0 deletions

View File

@ -88,6 +88,18 @@ func SetInterfaceIp(name string, rawIp string) error {
return netlink.NetworkLinkAddIp(iface, ip, ipNet)
}
func DeleteInterfaceIp(name string, rawIp string) error {
iface, err := net.InterfaceByName(name)
if err != nil {
return err
}
ip, ipNet, err := net.ParseCIDR(rawIp)
if err != nil {
return err
}
return netlink.NetworkLinkDelIp(iface, ip, ipNet)
}
func SetMtu(name string, mtu int) error {
iface, err := net.InterfaceByName(name)
if err != nil {