staticint bpf_test_sockopt(void *ctx, conststruct sock *sk, int expected)
{ int tmp, new = SK_BPF_CB_TX_TIMESTAMPING; int opt = SK_BPF_CB_FLAGS; int level = SOL_SOCKET;
if (bpf_setsockopt(ctx, level, opt, &new, sizeof(new)) != expected) return 1;
staticbool bpf_test_access_load_hdr_opt(struct bpf_sock_ops *skops)
{
u8 opt[3] = {0}; int load_flags = 0; int ret;
ret = bpf_load_hdr_opt(skops, opt, sizeof(opt), load_flags); if (ret != -EOPNOTSUPP) returntrue;
returnfalse;
}
staticbool bpf_test_access_cb_flags_set(struct bpf_sock_ops *skops)
{ int ret;
ret = bpf_sock_ops_cb_flags_set(skops, 0); if (ret != -EOPNOTSUPP) returntrue;
returnfalse;
}
/* In the timestamping callbacks, we're not allowed to call the following * BPF CALLs for the safety concern. Return false if expected.
*/ staticbool bpf_test_access_bpf_calls(struct bpf_sock_ops *skops, conststruct sock *sk)
{ if (bpf_test_access_sockopt(skops, sk)) returntrue;
if (bpf_test_access_load_hdr_opt(skops)) returntrue;
if (bpf_test_access_cb_flags_set(skops)) returntrue;
/* Since it's the last one, remove from the map after latency check */ if (skops->op == BPF_SOCK_OPS_TSTAMP_ACK_CB)
bpf_map_delete_elem(&time_map, &key);
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.