Skip to content

Commit

Permalink
bpf: Remove lan_egress bpf
Browse files Browse the repository at this point in the history
With daeuniverse#383, dae no longer encap
UDP, leaving this decap UDP logic obsolete.

Removal of lan_egress also ends up with several helper functions unused,
this commit deletes them as well.

As for scenario of LAN==WAN, after this commit only wan_egress will be
attached on LAN. Wan_egress therefore will pass all traffic sent from
dae because pid_is_control_plane() gives true, so it looks like no
concerns.
  • Loading branch information
jschwinger233 committed Jan 4, 2024
1 parent 35094f3 commit 3a117f8
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 432 deletions.
32 changes: 0 additions & 32 deletions control/control_plane_core.go
Original file line number Diff line number Diff line change
Expand Up @@ -471,38 +471,6 @@ func (c *controlPlaneCore) _bindLan(ifname string) error {
}
return nil
})

// Insert filters.
filterEgress := &netlink.BpfFilter{
FilterAttrs: netlink.FilterAttrs{
LinkIndex: link.Attrs().Index,
Parent: netlink.HANDLE_MIN_EGRESS,
Handle: netlink.MakeHandle(0x2023, 0b010+uint16(c.flip)),
Protocol: unix.ETH_P_ALL,
// Priority should be front of WAN's
Priority: 1,
},
Fd: c.bpf.bpfPrograms.TproxyLanEgress.FD(),
Name: consts.AppName + "_lan_egress",
DirectAction: true,
}
// Remove and add.
_ = netlink.FilterDel(filterEgress)
if !c.isReload {
// Clean up thoroughly.
filterEgressFlipped := deepcopy.Copy(filterEgress).(*netlink.BpfFilter)
filterEgressFlipped.FilterAttrs.Handle ^= 1
_ = netlink.FilterDel(filterEgressFlipped)
}
if err := netlink.FilterAdd(filterEgress); err != nil {
return fmt.Errorf("cannot attach ebpf object to filter egress: %w", err)
}
c.deferFuncs = append(c.deferFuncs, func() error {
if err := netlink.FilterDel(filterEgress); err != nil {
return fmt.Errorf("FilterDel(%v:%v): %w", ifname, filterEgress.Name, err)
}
return nil
})
return nil
}

Expand Down
Loading

0 comments on commit 3a117f8

Please sign in to comment.