if (len <= offsetof(struct BPF_PROG_LOAD_struct, prog_ifindex))
break;
PRINT_FIELD_IFINDEX(", ", attr, prog_ifindex);
+
+ /*
+ * expected_attach_type was added in Linux commit
+ * v4.17-rc1~148^2~19^2^2~8.
+ */
+ if (len <= offsetof(struct BPF_PROG_LOAD_struct, expected_attach_type))
+ break;
+ PRINT_FIELD_XVAL(", ", attr, expected_attach_type, bpf_attach_type,
+ "BPF_???");
}
END_BPF_CMD_DECODER(RVAL_DECODED | RVAL_FD)
uint32_t prog_flags;
char prog_name[BPF_OBJ_NAME_LEN];
uint32_t prog_ifindex;
+ uint32_t expected_attach_type;
};
#define BPF_PROG_LOAD_struct_size \
- offsetofend(struct BPF_PROG_LOAD_struct, prog_ifindex)
-#define expected_BPF_PROG_LOAD_struct_size 68
+ offsetofend(struct BPF_PROG_LOAD_struct, expected_attach_type)
+#define expected_BPF_PROG_LOAD_struct_size 72
struct BPF_OBJ_PIN_struct {
uint64_t ATTRIBUTE_ALIGNED(8) pathname;
", license=\"%s\", log_level=2718281828, log_size=4096"
", log_buf=%p, kern_version=KERNEL_VERSION(51966, 240, 13)"
", prog_flags=BPF_F_STRICT_ALIGNMENT|0x2"
- ", prog_name=\"0123456789abcde\"..., prog_ifindex=%s",
+ ", prog_name=\"0123456789abcde\"..., prog_ifindex=%s"
+ ", expected_attach_type=BPF_CGROUP_INET6_BIND",
(unsigned int) ARRAY_SIZE(insns), insns,
license, log_buf, IFINDEX_LO_STR);
}
.kern_version = 0xcafef00d,
.prog_flags = 3,
.prog_name = "0123456789abcdef",
+ .expected_attach_type = 9,
} },
- .size = offsetofend(struct BPF_PROG_LOAD_struct, prog_ifindex),
+ .size = offsetofend(struct BPF_PROG_LOAD_struct,
+ expected_attach_type),
.init_fn = init_BPF_PROG_LOAD_attr4,
.print_fn = print_BPF_PROG_LOAD_attr4
},