Skip to content

Commit bc516ff

Browse files
committed
src: print ingress/egress prog direction
On DEBUG=1, print the attached direction (egress/ingress) to make it easier to debug.
1 parent d19d3cd commit bc516ff

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/common.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@
1212

1313
#define COMPILATION_ASSERT(COND, MSG) _Static_assert(COND, MSG)
1414

15+
#if INGRESS == 1
16+
#define DIR_STR "ingress"
17+
#else
18+
#define DIR_STR "egress"
19+
#endif
20+
1521
//Constants
1622
#define AF_INET 2
1723
#define AF_INET6 10

src/ip4.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ int proc_ip4(struct __sk_buff* skb, bool ingress, __u8* eth, struct iphdr* ip){
330330
if(skb->mark&PKT_REDIR_EGRESS)
331331
return gso_reinject_egress_pkt(skb, ip);
332332

333-
PRINTK("[%d:0x%p] Processing redirected pkt from %s, mark: 0x%x",
333+
PRINTK("[%d:0x%p][" DIR_STR "] Processing redirected pkt from %s, mark: 0x%08x",
334334
skb->ifindex,
335335
skb,
336336
skb->mark&PKT_REDIR_INGRESS? "INGRESS" : "EGRESS",
@@ -366,7 +366,7 @@ int proc_ip4(struct __sk_buff* skb, bool ingress, __u8* eth, struct iphdr* ip){
366366
//Can never happen, but make verifier happy.
367367
hdrs.sport = hdrs.dport = 0x0;
368368
}
369-
PRINTK("[%d:0x%p] Looking up IP4/%s, size %d", skb->ifindex,
369+
PRINTK("[%d:0x%p][" DIR_STR "] Looking up IP4/%s, size %d", skb->ifindex,
370370
skb,
371371
(ip->protocol == IPPROTO_UDP)?
372372
"UDP" : "TCP",

0 commit comments

Comments
 (0)