Skip to content

Commit

Permalink
eguard: clear trivial code
Browse files Browse the repository at this point in the history
  • Loading branch information
chriskaliX committed Nov 13, 2023
1 parent dadec54 commit 08ffe8c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 22 deletions.
6 changes: 3 additions & 3 deletions plugins/eguard/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ tc:
action: LOG # DENY/LOG
level: INFO
dns:
# - name: "eguard_egress_test_dns"
# action: DENY
# domain: "grpc.hades.store"
- name: "eguard_egress_test_dns"
action: DENY
domain: "grpc.hades.store"
- name: "eguard_egress_test_dns_1"
action: DENY
domain: "*.baidu.com"
19 changes: 0 additions & 19 deletions plugins/eguard/src/bpf/eguard.bpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,5 @@ int hades_ingress(struct __sk_buff *skb)
return tc_probe(skb, true);
}

SEC("kprobe/udp_sendmsg")
int BPF_KPROBE(kprobe_udp_sendmsg)
{
struct sock *sk = (struct sock *)PT_REGS_PARM1(ctx);
struct msghdr *msg = (struct msghdr *)PT_REGS_PARM2(ctx);
struct inet_sock *inet = (struct inet_sock *) sk;
struct sockaddr_in *sin = READ_KERN(msg->msg_name);

u16 dport;
if (sin)
dport = READ_KERN(sin->sin_port);
else
dport = READ_KERN(inet->inet_dport);
if (dport != 13568 && dport != 59668 && dport != 0)
return 0;
return dns_resolve(ctx, sk, msg);
}


// DNS-based packet drop
char LICENSE[] SEC("license") = "GPL";

0 comments on commit 08ffe8c

Please sign in to comment.