Skip to content

Commit

Permalink
Fix invalid LinkMessage family (#144)
Browse files Browse the repository at this point in the history
Signed-off-by: Pawel Zmarzly <pzmarzly@fb.com>
  • Loading branch information
pzmarzly committed Jul 20, 2022
1 parent 896a106 commit 0377538
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion example_link_setdown_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func Example_setLinkDown() {

// Set the interface operationally Down
err = conn.Link.Set(&rtnetlink.LinkMessage{
Family: msg.Family,
Family: 0x0,
Type: msg.Type,
Index: uint32(iface.Index),
Flags: 0x0,
Expand Down
2 changes: 1 addition & 1 deletion example_link_sethwaddr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func Example_setLinkHWAddr() {

// Set the hw address of the interfaces
err = conn.Link.Set(&rtnetlink.LinkMessage{
Family: msg.Family,
Family: 0x0,
Type: msg.Type,
Index: uint32(iface.Index),
Flags: msg.Flags,
Expand Down
2 changes: 1 addition & 1 deletion example_link_setup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func Example_setLinkUp() {

// Set the interface operationally UP
err = conn.Link.Set(&rtnetlink.LinkMessage{
Family: msg.Family,
Family: unix.AF_UNSPEC,
Type: msg.Type,
Index: uint32(iface.Index),
Flags: unix.IFF_UP,
Expand Down
4 changes: 2 additions & 2 deletions rtnl/link.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func (c *Conn) LinkUp(ifc *net.Interface) error {
return err
}
tx := &rtnetlink.LinkMessage{
Family: rx.Family,
Family: unix.AF_UNSPEC,
Type: rx.Type,
Index: uint32(ifc.Index),
Flags: unix.IFF_UP,
Expand All @@ -108,7 +108,7 @@ func (c *Conn) LinkDown(ifc *net.Interface) error {
return err
}
tx := &rtnetlink.LinkMessage{
Family: rx.Family,
Family: unix.AF_UNSPEC,
Type: rx.Type,
Index: uint32(ifc.Index),
Flags: 0,
Expand Down

0 comments on commit 0377538

Please sign in to comment.