Exemple #1
0
static int main_prog (struct __sk_buff *skb)
{
	int from = skb->cb[0];
	
	int me = 0;
	if (from == 0) me = 1;
	else me = 2;	
	char msg [] = "In module of container: %d\n";
    bpf_trace_printk(msg, sizeof(msg), me);
	
    if (me == 2) {
        bpf_redirect(skb->ifindex, 1);
    }
	skb->cb[0] = me;
	bpf_tail_call(skb, &jmp_table, 0);
    return 0;
}
int xdp_redirect_to_222(struct xdp_md *xdp)
{
	return bpf_redirect(222, 0);
}
int xdp_redirect_to_111(struct xdp_md *xdp)
{
	return bpf_redirect(111, 0);
}