From 18e1eeea806c552911332ef2b339c740f2c103d0 Mon Sep 17 00:00:00 2001 From: mzz2017 <2017@duck.com> Date: Wed, 1 Feb 2023 10:24:11 +0800 Subject: [PATCH] fix: problem that cannot proxy lan_interface --- README.md | 1 + component/control/bpf_utils.go | 2 +- component/control/control_plane.go | 4 ++-- component/control/kern/tproxy.c | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index d17113a..fc68971 100644 --- a/README.md +++ b/README.md @@ -53,4 +53,5 @@ See [example.dae](https://github.com/v2rayA/dae/blob/main/example.dae). 1. Handle the case that nodes do not support UDP. 1. L4Checksum problem. 1. Config support list like: `wan_interface: [wlp5s0, eth0]`. +1. MACv2 extension extraction. 1. ... diff --git a/component/control/bpf_utils.go b/component/control/bpf_utils.go index e052944..947ce7f 100644 --- a/component/control/bpf_utils.go +++ b/component/control/bpf_utils.go @@ -104,7 +104,7 @@ type bpfObjectsLan struct { bpfMaps } -func AssignBpfPrograms(to *bpfObjects, from interface{}) { +func AssignBpfObjects(to *bpfObjects, from interface{}) { vTo := reflect.Indirect(reflect.ValueOf(to)) vFrom := reflect.Indirect(reflect.ValueOf(from)) tFrom := vFrom.Type() diff --git a/component/control/control_plane.go b/component/control/control_plane.go index 2995343..c29a1b7 100644 --- a/component/control/control_plane.go +++ b/component/control/control_plane.go @@ -125,7 +125,7 @@ retryLoadBpf: } if kernelVersion.Less(consts.FtraceFeatureVersion) { // Reverse takeover. - AssignBpfPrograms(&bpf, &bpfLan) + AssignBpfObjects(&bpf, &bpfLan) } // Write params. @@ -581,7 +581,7 @@ func (c *ControlPlane) ListenAndServe(port uint16) (err error) { go func() { defer cancel() for { - var buf [65536]byte + var buf [65535]byte n, lAddrPort, err := lConn.ReadFromUDPAddrPort(buf[:]) if err != nil { if !strings.Contains(err.Error(), "use of closed network connection") { diff --git a/component/control/kern/tproxy.c b/component/control/kern/tproxy.c index 42546ff..4dd74a4 100644 --- a/component/control/kern/tproxy.c +++ b/component/control/kern/tproxy.c @@ -566,7 +566,7 @@ static __always_inline int get_tproxy_ip(__u8 ipversion, __u32 ifindex, return 0; } -static __always_inline int ip_is_host(bool ipversion, __u32 ifindex, +static __always_inline int ip_is_host(__u8 ipversion, __u32 ifindex, __be32 ip[4], __be32 tproxy_ip[4]) { if (tproxy_ip) { int ret;