mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2026-03-04 04:47:30 +00:00
chore: hello mihomo
This commit is contained in:
@@ -173,7 +173,7 @@ static __always_inline bool is_lan_ip(__be32 addr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
SEC("tc_clash_auto_redir_ingress")
|
||||
SEC("tc_mihomo_auto_redir_ingress")
|
||||
int tc_redir_ingress_func(struct __sk_buff *skb) {
|
||||
void *data = (void *)(long)skb->data;
|
||||
void *data_end = (void *)(long)skb->data_end;
|
||||
@@ -264,7 +264,7 @@ int tc_redir_ingress_func(struct __sk_buff *skb) {
|
||||
return TC_ACT_OK;
|
||||
}
|
||||
|
||||
SEC("tc_clash_auto_redir_egress")
|
||||
SEC("tc_mihomo_auto_redir_egress")
|
||||
int tc_redir_egress_func(struct __sk_buff *skb) {
|
||||
void *data = (void *)(long)skb->data;
|
||||
void *data_end = (void *)(long)skb->data_end;
|
||||
@@ -276,10 +276,10 @@ int tc_redir_egress_func(struct __sk_buff *skb) {
|
||||
if (eth->h_proto != bpf_htons(ETH_P_IP))
|
||||
return TC_ACT_OK;
|
||||
|
||||
__u32 key = 0, *redir_ip, *redir_port; // *clash_mark
|
||||
__u32 key = 0, *redir_ip, *redir_port; // *mihomo_mark
|
||||
|
||||
// clash_mark = bpf_map_lookup_elem(&redir_params_map, &key);
|
||||
// if (clash_mark && *clash_mark != 0 && *clash_mark == skb->mark)
|
||||
// mihomo_mark = bpf_map_lookup_elem(&redir_params_map, &key);
|
||||
// if (mihomo_mark && *mihomo_mark != 0 && *mihomo_mark == skb->mark)
|
||||
// return TC_ACT_OK;
|
||||
|
||||
struct iphdr *iph = (struct iphdr *)(eth + 1);
|
||||
|
||||
@@ -38,7 +38,7 @@ static __always_inline bool is_lan_ip(__be32 addr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
SEC("tc_clash_redirect_to_tun")
|
||||
SEC("tc_mihomo_redirect_to_tun")
|
||||
int tc_tun_func(struct __sk_buff *skb) {
|
||||
void *data = (void *)(long)skb->data;
|
||||
void *data_end = (void *)(long)skb->data_end;
|
||||
@@ -50,13 +50,13 @@ int tc_tun_func(struct __sk_buff *skb) {
|
||||
if (eth->h_proto == bpf_htons(ETH_P_ARP))
|
||||
return TC_ACT_OK;
|
||||
|
||||
__u32 key = 0, *clash_mark, *tun_ifindex;
|
||||
__u32 key = 0, *mihomo_mark, *tun_ifindex;
|
||||
|
||||
clash_mark = bpf_map_lookup_elem(&tc_params_map, &key);
|
||||
if (!clash_mark)
|
||||
mihomo_mark = bpf_map_lookup_elem(&tc_params_map, &key);
|
||||
if (!mihomo_mark)
|
||||
return TC_ACT_OK;
|
||||
|
||||
if (skb->mark == *clash_mark)
|
||||
if (skb->mark == *mihomo_mark)
|
||||
return TC_ACT_OK;
|
||||
|
||||
if (eth->h_proto == bpf_htons(ETH_P_IP)) {
|
||||
|
||||
Reference in New Issue
Block a user