Skip to content

Commit

Permalink
Add support for link up/down for packet handlers (#520)
Browse files Browse the repository at this point in the history
  • Loading branch information
DanG100 authored Jan 8, 2025
1 parent bdbdf90 commit 2eef855
Show file tree
Hide file tree
Showing 6 changed files with 277 additions and 99 deletions.
4 changes: 4 additions & 0 deletions dataplane/kernel/genetlink/genetlink.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ func (p GenetlinkPort) Delete() error {
return nil
}

func (t GenetlinkPort) SetAdminState(up bool) error {
return nil
}

func init() {
pktiohandler.Register(pktiopb.PortType_PORT_TYPE_GENETLINK, New)
}
11 changes: 11 additions & 0 deletions dataplane/kernel/tap/tap.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,17 @@ func (t *TapInterface) IfIndex() int {
return t.ifIndex
}

func (t *TapInterface) SetAdminState(up bool) error {
l, err := netlink.LinkByName(t.name)
if err != nil {
return err
}
if up {
return netlink.LinkSetUp(l)
}
return netlink.LinkSetDown(l)
}

func init() {
pktiohandler.Register(pktiopb.PortType_PORT_TYPE_NETDEV, New)
}
Loading

0 comments on commit 2eef855

Please sign in to comment.