if (info.value_size != expectedValueSize) {
throw std::runtime_error("Error checking the size of eBPF map: value size mismatch (" + std::to_string(info.value_size) + " VS " + std::to_string(expectedValueSize) + ")");
}
-
}
int bpf_update_elem(int fd, void *key, void *value, unsigned long long flags)
}
int bpf_prog_load(enum bpf_prog_type prog_type,
- const struct bpf_insn *insns, int prog_len,
- const char *license, int kern_version)
+ const struct bpf_insn *insns, int prog_len,
+ const char *license, int kern_version)
{
char log_buf[65535];
union bpf_attr attr;
if (d_config.d_type == MapType::IPv4) {
uint32_t key = 0;
- int res = bpf_get_next_key(d_fd.getHandle(), &key, &key);
- while (res == 0) {
+ while (bpf_get_next_key(d_fd.getHandle(), &key, &key) == 0) {
++d_count;
- res = bpf_get_next_key(d_fd.getHandle(), &key, &key);
}
}
else if (d_config.d_type == MapType::IPv6) {
KeyV6 key;
memset(&key, 0, sizeof(key));
- int res = bpf_get_next_key(d_fd.getHandle(), &key, &key);
- while (res == 0) {
+ while (bpf_get_next_key(d_fd.getHandle(), &key, &key) == 0) {
++d_count;
- res = bpf_get_next_key(d_fd.getHandle(), &key, &key);
}
}
else if (d_config.d_type == MapType::QNames) {
if (format == MapFormat::Legacy) {
QNameKey key;
memset(&key, 0, sizeof(key));
- int res = bpf_get_next_key(d_fd.getHandle(), &key, &key);
- while (res == 0) {
+ while (bpf_get_next_key(d_fd.getHandle(), &key, &key) == 0) {
++d_count;
- res = bpf_get_next_key(d_fd.getHandle(), &key, &key);
}
}
else {
QNameAndQTypeKey key;
memset(&key, 0, sizeof(key));
- int res = bpf_get_next_key(d_fd.getHandle(), &key, &key);
- while (res == 0) {
+ while (bpf_get_next_key(d_fd.getHandle(), &key, &key) == 0) {
++d_count;
- res = bpf_get_next_key(d_fd.getHandle(), &key, &key);
}
}
}
This function now supports a table for each parameters, and the ability to use pinned eBPF maps.
Return a new eBPF socket filter with a maximum of maxV4 IPv4, maxV6 IPv6 and maxQNames qname entries in the block tables.
- Maps can be pinned to a filesystem path, which makes their content persistent across restarts and allows external programs to read their content and to add new entries. dnsdist will try to load maps that are pinned to a filesystem path on startups, inheriting any existing entries, and fall back to creating them if they do not exist yet. Note that the user dnsdist is running under must have the right privileges to read and write to the given file, and to go through all the directories in the path leading to that file.
+ Maps can be pinned to a filesystem path, which makes their content persistent across restarts and allows external programs to read their content and to add new entries. dnsdist will try to load maps that are pinned to a filesystem path on startups, inheriting any existing entries, and fall back to creating them if they do not exist yet. Note that the user dnsdist is running under must have the right privileges to read and write to the given file, and to go through all the directories in the path leading to that file. The pinned path must be on a filesystem of type ``BPF``, usually below ``/sys/fs/bpf/``.
:param int maxV4: Maximum number of IPv4 entries in this filter
:param int maxV6: Maximum number of IPv6 entries in this filter
Options:
* ``maxItems``: int - The maximum number of entries in a given map. Default is 0 which will not allow any entry at all.
- * ``pinnedPaths``: str - The filesystem path this map should be pinned to.
+ * ``pinnedPath``: str - The filesystem path this map should be pinned to.
.. function:: newDynBPFFilter(bpf) -> DynBPFFilter