Skip to content

Commit 657c307

Browse files
conjonesvishvananda
conjones
authored andcommitted
Use Addrmsg when listing addrs, and RtMsg when listing routes
1 parent 083e92e commit 657c307

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

addr_linux.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ func AddrList(link Link, family int) ([]Addr, error) {
176176
// The list can be filtered by link and ip family.
177177
func (h *Handle) AddrList(link Link, family int) ([]Addr, error) {
178178
req := h.newNetlinkRequest(unix.RTM_GETADDR, unix.NLM_F_DUMP)
179-
msg := nl.NewIfInfomsg(family)
179+
msg := nl.NewIfAddrmsg(family)
180180
req.AddData(msg)
181181

182182
msgs, err := req.Execute(unix.NETLINK_ROUTE, unix.RTM_NEWADDR)

route_linux.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -1030,8 +1030,9 @@ func RouteListFiltered(family int, filter *Route, filterMask uint64) ([]Route, e
10301030
// All rules must be defined in RouteFilter struct
10311031
func (h *Handle) RouteListFiltered(family int, filter *Route, filterMask uint64) ([]Route, error) {
10321032
req := h.newNetlinkRequest(unix.RTM_GETROUTE, unix.NLM_F_DUMP)
1033-
infmsg := nl.NewIfInfomsg(family)
1034-
req.AddData(infmsg)
1033+
rtmsg := nl.NewRtMsg()
1034+
rtmsg.Family = uint8(family)
1035+
req.AddData(rtmsg)
10351036

10361037
msgs, err := req.Execute(unix.NETLINK_ROUTE, unix.RTM_NEWROUTE)
10371038
if err != nil {

0 commit comments

Comments
 (0)