mirror of
https://github.com/vishvananda/netlink
synced 2024-12-29 02:02:21 +00:00
Broadcast address can be specified when adding address.
This commit is contained in:
parent
3c27c1c1e3
commit
6b895203a7
9
addr.go
9
addr.go
@ -10,10 +10,11 @@ import (
|
||||
// include a mask, so it stores the address as a net.IPNet.
|
||||
type Addr struct {
|
||||
*net.IPNet
|
||||
Label string
|
||||
Flags int
|
||||
Scope int
|
||||
Peer *net.IPNet
|
||||
Label string
|
||||
Flags int
|
||||
Scope int
|
||||
Peer *net.IPNet
|
||||
Broadcast net.IP
|
||||
}
|
||||
|
||||
// String returns $ip/$netmask $label
|
||||
|
@ -90,6 +90,10 @@ func (h *Handle) addrHandle(link Link, addr *Addr, req *nl.NetlinkRequest) error
|
||||
}
|
||||
}
|
||||
|
||||
if addr.Broadcast != nil {
|
||||
req.AddData(nl.NewRtAttr(syscall.IFA_BROADCAST, addr.Broadcast))
|
||||
}
|
||||
|
||||
if addr.Label != "" {
|
||||
labelData := nl.NewRtAttr(syscall.IFA_LABEL, nl.ZeroTerminated(addr.Label))
|
||||
req.AddData(labelData)
|
||||
|
Loading…
Reference in New Issue
Block a user