Skip to content

Commit

Permalink
feat: support link/ppp & link/tun (#746)
Browse files Browse the repository at this point in the history
  • Loading branch information
LostAttractor authored Feb 17, 2025
1 parent ba19046 commit 2bd7504
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion control/control_plane_core.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ func (c *controlPlaneCore) mapLinkType(ifname string) error {
}
var linkHdrLen uint32
switch link.Attrs().EncapType {
case "none", "ipip":
case "none", "ipip", "ppp", "tun":
linkHdrLen = consts.LinkHdrLen_None
case "ether":
linkHdrLen = consts.LinkHdrLen_Ethernet
Expand Down
4 changes: 2 additions & 2 deletions control/kern/tproxy.c
Original file line number Diff line number Diff line change
Expand Up @@ -964,7 +964,7 @@ static __always_inline void prep_redirect_to_control_plane(
struct __sk_buff *skb, __u32 link_h_len, struct tuples *tuples,
__u8 l4proto, struct ethhdr *ethh, __u8 from_wan, struct tcphdr *tcph)
{
/* Redirect from L3 dev to L2 dev, e.g. wg0 -> veth */
/* Redirect from L3 dev to L2 dev, e.g. wg/ipip/ppp/tun -> veth */
if (!link_h_len) {
__u16 l3proto = skb->protocol;

Expand Down Expand Up @@ -1390,7 +1390,7 @@ int tproxy_wan_egress(struct __sk_buff *skb)
__u32 link_h_len;

if (get_link_h_len(skb->ifindex, &link_h_len))
return TC_ACT_OK;
return TC_ACT_PIPE;
bool tcp_state_syn;
int ret = parse_transport(skb, link_h_len, &ethh, &iph, &ipv6h, &icmp6h,
&tcph, &udph, &ihl, &l4proto);
Expand Down
4 changes: 4 additions & 0 deletions docs/en/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,10 @@ See more at [example.dae](https://github.com/daeuniverse/dae/blob/main/example.d

If you use PVE, refer to [#37](https://github.com/daeuniverse/dae/discussions/37).

## PPPoE Interface
If you want to proxy PPPoE interface, please set wan/lan_interface to the interface generated by pppd (i.e., ppp0 / pppoe-wan) instead of the physical interface.
If you just using PPPoE interface for wan, simply set wan_interface to "auto".

## Reload and suspend

When the configuration changes, it is convenient to use command to hot reload the configuration, and the existing connection will not be interrupted in the process. When you want to suspend dae, you can use command to pause.
Expand Down
2 changes: 1 addition & 1 deletion docs/en/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ sudo nft 'insert rule inet firewalld filter_INPUT mark 0x8000000 accept'

### Troubleshoot PPPoE

dae does not support PPPoE due to it is too complexity for a ebpf program. Binding to LAN for other machines should work fine. If you want to proxy the machine itself, see <<https://github.com/daeuniverse/dae/discussions/304>.
Old version of dae does not support PPPoE, Please use latest version.

## Binding to LAN but bad DNS in other machines

Expand Down
3 changes: 3 additions & 0 deletions docs/zh/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,9 @@ dns {

如果你使用 PVE,可以参考 [#37](https://github.com/daeuniverse/dae/discussions/37)

## PPPoE
如果希望代理 pppoe 接口, 请将 wan/lan_interface 设置为 pppd 生成的接口 (即 ppp0 / pppoe-wan) 而不是物理接口, 对于 wan 接口是 pppoe 的情况, 使用 auto 即可。

## 热重载和暂停

当配置变化时,可以方便使用命令进行配置的热重载,在该过程中不会中断已有连接。当想暂停代理时,可使用命令进行暂停。
Expand Down

1 comment on commit 2bd7504

@davidtall
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pppoe 重启接口或者运营商强制下线重拨后,本地就无法代理,需要重启dead 才能正常代理本机。

Please sign in to comment.