Skip to content

there are pointers in __sk_buff #93

@QiongwenXu

Description

@QiongwenXu
struct __sk_buff {
	__u32 len;
	__u32 pkt_type;
	__u32 mark;
	__u32 queue_mapping;
	__u32 protocol;
	__u32 vlan_present;
	__u32 vlan_tci;
	__u32 vlan_proto;
	__u32 priority;
	__u32 ingress_ifindex;
	__u32 ifindex;
	__u32 tc_index;
	__u32 cb[5];
	__u32 hash;
	__u32 tc_classid;
	__u32 data;             // pkt start
	__u32 data_end;         // pkt end
...

bpf bytecode example:
(cilium, bpf_overlay.o, section from-overlay)

       8:	61 62 50 00 00 00 00 00	r2 = *(u32 *)(r6 + 80) // pkt end
       9:	61 61 4c 00 00 00 00 00	r1 = *(u32 *)(r6 + 76) // pkt end
      10:	bf 13 00 00 00 00 00 00	r3 = r1
      11:	07 03 00 00 0e 00 00 00	r3 += 14
      12:	2d 23 71 00 00 00 00 00	if r3 > r2 goto +113 <LBB6_16>
      13:	71 12 0c 00 00 00 00 00	r2 = *(u8 *)(r1 + 12)
      14:	71 18 0d 00 00 00 00 00	r8 = *(u8 *)(r1 + 13)  // load from pkt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions