// the following can't be moved inside update_tlv_pad because the // bpf verifier has some issues with it
pad_off += sizeof(*itlv) + itlv->len;
partial_srh_len = pad_off - srh_off;
len_remaining = partial_srh_len % 8;
new_pad = 8 - len_remaining;
if (new_pad == 1) // cannot pad for 1 byte only
new_pad = 9; elseif (new_pad == 8)
new_pad = 0;
if (bpf_skb_load_bytes(skb, tlv_offset + 4, &egr_addr, 16)) return0;
// check if egress TLV value is correct if (bpf_be64_to_cpu(egr_addr.hi) == 0xfd00000000000000 &&
bpf_be64_to_cpu(egr_addr.lo) == 0x4) return1;
}
return0;
}
// This function will push a SRH with segments fd00::1, fd00::2, fd00::3, // fd00::4
SEC("encap_srh") int __encap_srh(struct __sk_buff *skb)
{ unsignedlonglong hi = 0xfd00000000000000; struct ip6_addr_t *seg; struct ip6_srh_t *srh; char srh_buf[72]; // room for 4 segments int err;
// Add an Egress TLV fc00::4, add the flag A, // and apply End.X action to fc42::1
SEC("add_egr_x") int __add_egr_x(struct __sk_buff *skb)
{ unsignedlonglong hi = 0xfc42000000000000; unsignedlonglong lo = 0x1; struct ip6_srh_t *srh = get_srh(skb);
uint8_t new_flags = SR6_FLAG_ALERT; struct ip6_addr_t addr; int err, offset;
// Pop the Egress TLV, reset the flags, change the tag 2442 and finally do a // simple End action
SEC("pop_egr") int __pop_egr(struct __sk_buff *skb)
{ struct ip6_srh_t *srh = get_srh(skb);
uint16_t new_tag = bpf_htons(2442);
uint8_t new_flags = 0; int err, offset;
if (srh == NULL) return BPF_DROP;
if (srh->flags != SR6_FLAG_ALERT) return BPF_DROP;
// Inspect if the Egress TLV and flag have been removed, if the tag is correct, // then apply a End.T action to reach the last segment
SEC("inspect_t") int __inspect_t(struct __sk_buff *skb)
{ struct ip6_srh_t *srh = get_srh(skb); int table = 117; int err;
if (srh == NULL) return BPF_DROP;
if (srh->flags != 0) return BPF_DROP;
if (srh->tag != bpf_htons(2442)) return BPF_DROP;
if (srh->hdrlen != 8) // 4 segments return BPF_DROP;
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.0Bemerkung:
(vorverarbeitet am 2026-06-08)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.