Repository navigation
Commit b426ce8
bpf: Add classid helper only based on skb->sk
Similarly to 5a52ae4 ("bpf: Allow to retrieve cgroup v1 classid
from v2 hooks"), add a helper to retrieve cgroup v1 classid solely
based on the skb->sk, so it can be used as key as part of BPF map
lookups out of tc from host ns, in particular given the skb->sk is
retained these days when crossing net ns thanks to 9c4c325
("skbuff: preserve sock reference when scrubbing the skb."). This
is similar to bpf_skb_cgroup_id() which implements the same for v2.
Kubernetes ecosystem is still operating on v1 however, hence net_cls
needs to be used there until this can be dropped in with the v2
helper of bpf_skb_cgroup_id().
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Link: https://lore.kernel.org/bpf/ed633cf27a1c620e901c5aa99ebdefb028dce600.1601477936.git.daniel@iogearbox.net1 parent 963ec27 commit b426ce8
3 files changed
Lines changed: 41 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3643 | 3643 | | |
3644 | 3644 | | |
3645 | 3645 | | |
| 3646 | + | |
| 3647 | + | |
| 3648 | + | |
| 3649 | + | |
| 3650 | + | |
| 3651 | + | |
| 3652 | + | |
| 3653 | + | |
| 3654 | + | |
3646 | 3655 | | |
3647 | 3656 | | |
3648 | 3657 | | |
| |||
3796 | 3805 | | |
3797 | 3806 | | |
3798 | 3807 | | |
| 3808 | + | |
3799 | 3809 | | |
3800 | 3810 | | |
3801 | 3811 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2707 | 2707 | | |
2708 | 2708 | | |
2709 | 2709 | | |
| 2710 | + | |
| 2711 | + | |
| 2712 | + | |
| 2713 | + | |
| 2714 | + | |
| 2715 | + | |
| 2716 | + | |
| 2717 | + | |
| 2718 | + | |
| 2719 | + | |
| 2720 | + | |
| 2721 | + | |
| 2722 | + | |
| 2723 | + | |
| 2724 | + | |
| 2725 | + | |
| 2726 | + | |
2710 | 2727 | | |
2711 | 2728 | | |
2712 | 2729 | | |
| |||
6772 | 6789 | | |
6773 | 6790 | | |
6774 | 6791 | | |
| 6792 | + | |
| 6793 | + | |
| 6794 | + | |
| 6795 | + | |
6775 | 6796 | | |
6776 | 6797 | | |
6777 | 6798 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3643 | 3643 | | |
3644 | 3644 | | |
3645 | 3645 | | |
| 3646 | + | |
| 3647 | + | |
| 3648 | + | |
| 3649 | + | |
| 3650 | + | |
| 3651 | + | |
| 3652 | + | |
| 3653 | + | |
| 3654 | + | |
3646 | 3655 | | |
3647 | 3656 | | |
3648 | 3657 | | |
| |||
3796 | 3805 | | |
3797 | 3806 | | |
3798 | 3807 | | |
| 3808 | + | |
3799 | 3809 | | |
3800 | 3810 | | |
3801 | 3811 | | |
| |||
0 commit comments