static __always_inline int is_valid_tlv_boundary(struct __sk_buff *skb, struct ip6_srh_t *srh,
uint32_t *tlv_off,
uint32_t *pad_size,
uint32_t *pad_off)
{
uint32_t srh_off, cur_off; int offset_valid = 0; int err;
srh_off = (char *)srh - (char *)(long)skb->data; // cur_off = end of segments, start of possible TLVs
cur_off = srh_off + sizeof(*srh) + sizeof(struct ip6_addr_t) * (srh->first_segment + 1);
*pad_off = 0;
// we can only go as far as ~10 TLVs due to the BPF max stack size // workaround: define induction variable "i" as "long" instead // of "int" to prevent alu32 sub-register spilling.
__pragma_loop_no_unroll for (long i = 0; i < 100; i++) { struct sr6_tlv_t tlv;
// 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;
// Add an Egress TLV fc00::4, add the flag A, // and apply End.X action to fc42::1
SEC("lwt_seg6local") 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;
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.