Skip to content

Commit

Permalink
perf: use link alias to filter packet
Browse files Browse the repository at this point in the history
Veth will be renamed to `eth0` in container, use alias to store the origin name for filter

(cherry picked from commit 44a8b4f)
  • Loading branch information
oilbeater committed Sep 6, 2021
1 parent af4a198 commit 4cabb12
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/daemon/ovs.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,12 @@ func configureContainerNic(nicName, ifName string, ipAddr, gateway string, macAd
return fmt.Errorf("can not find container nic %s %v", nicName, err)
}

// Set link alias to its origin link name for fastpath to recognize and bypass netfilter
if err := netlink.LinkSetAlias(containerLink, nicName); err != nil {
klog.Errorf("failed to set link alias for container nic %s: %v", nicName, err)
return err
}

if err = netlink.LinkSetNsFd(containerLink, int(netns.Fd())); err != nil {
return fmt.Errorf("failed to link netns %v", err)
}
Expand Down

0 comments on commit 4cabb12

Please sign in to comment.