/* ingress@veth_(src|dst)_fwd@ns_fwd priority 100 */
SEC("tc") int ingress_fwdns_prio100(struct __sk_buff *skb)
{ int skb_type;
skb_type = skb_get_type(skb); if (skb_type == -1) return TC_ACT_SHOT; if (!skb_type) return TC_ACT_OK;
/* delivery_time is only available to the ingress * if the tc-bpf checks the skb->tstamp_type.
*/ if (skb->tstamp == EGRESS_ENDHOST_MAGIC)
inc_errs(INGRESS_FWDNS_P100);
if (fwdns_clear_dtime())
skb->tstamp = 0;
return TC_ACT_UNSPEC;
}
/* egress@veth_(src|dst)_fwd@ns_fwd priority 100 */
SEC("tc") int egress_fwdns_prio100(struct __sk_buff *skb)
{ int skb_type;
skb_type = skb_get_type(skb); if (skb_type == -1) return TC_ACT_SHOT; if (!skb_type) return TC_ACT_OK;
/* delivery_time is always available to egress even * the tc-bpf did not use the tstamp_type.
*/ if (skb->tstamp == INGRESS_FWDNS_MAGIC)
inc_dtimes(EGRESS_FWDNS_P100); else
inc_errs(EGRESS_FWDNS_P100);
if (fwdns_clear_dtime())
skb->tstamp = 0;
return TC_ACT_UNSPEC;
}
/* ingress@veth_(src|dst)_fwd@ns_fwd priority 101 */
SEC("tc") int ingress_fwdns_prio101(struct __sk_buff *skb)
{ int skb_type;
skb_type = skb_get_type(skb); if (skb_type == -1 || !skb_type) /* Should have handled in prio100 */ return TC_ACT_SHOT;
if (skb->tstamp_type) { if (fwdns_clear_dtime() ||
(skb->tstamp_type != BPF_SKB_CLOCK_MONOTONIC &&
skb->tstamp_type != BPF_SKB_CLOCK_TAI) ||
skb->tstamp != EGRESS_ENDHOST_MAGIC)
inc_errs(INGRESS_FWDNS_P101); else
inc_dtimes(INGRESS_FWDNS_P101);
} else { if (!fwdns_clear_dtime())
inc_errs(INGRESS_FWDNS_P101);
}
if (skb->tstamp_type == BPF_SKB_CLOCK_MONOTONIC) {
skb->tstamp = INGRESS_FWDNS_MAGIC;
} else { if (bpf_skb_set_tstamp(skb, INGRESS_FWDNS_MAGIC,
BPF_SKB_CLOCK_MONOTONIC))
inc_errs(SET_DTIME);
}
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.