We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is it possible to create a struct as shown below in the XDP part and use it as a key, then write to this map in the packet processor part?
Note: Packet processor is being writing GoLang language.
BPF_MAP_DEF(blacklistmap) = { .map_type = BPF_MAP_TYPE_HASH, .key_size = sizeof(struct flowblack), .value_size = sizeof(int), // Change value size to sizeof(__u64) .max_entries = MAX_RULES, }; BPF_MAP_ADD(blacklistmap); struct flowblack { __u16 sourceport; __u16 destport; __u32 saddr; __u32 daddr; }; int xdp_dump(struct xdp_md *ctx) { // .... struct flowblack key = {0}; key.sourceport = tcp->source; key.destport = tcp->dest; key.saddr = ip->saddr; key.daddr = ip->daddr; __u64 *rule_idx = bpf_map_lookup_elem(&blacklistmap, &key); if (rule_idx) { return XDP_DROP; } // .... }
The text was updated successfully, but these errors were encountered:
Sorry, something went wrong.
I did, but no succeeded. I've changed the topology using AF_SOCKET. So no need to use it anymore. Thanks.
No branches or pull requests
Is it possible to create a struct as shown below in the XDP part and use it as a key, then write to this map in the packet processor part?
Note: Packet processor is being writing GoLang language.
The text was updated successfully, but these errors were encountered: