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:
commit
42fed751fb
|
@ -88,6 +88,18 @@ func SetInterfaceIp(name string, rawIp string) error {
|
||||||
return netlink.NetworkLinkAddIp(iface, ip, ipNet)
|
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 {
|
func SetMtu(name string, mtu int) error {
|
||||||
iface, err := net.InterfaceByName(name)
|
iface, err := net.InterfaceByName(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue