Skip to content

Commit c0543b2

Browse files
authored
Unpin block IPv6 map only if IPV6 is enabled (#82)
There's no need to try to unpin the map if its not enabled at first. Just to prevent: [WARNING] Failed to un-pin BPF map 'map_block6' from file system (1)
1 parent a924233 commit c0543b2

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/loader/prog.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ static void unpin_needed_maps(config__t* cfg, struct bpf_object* obj, int ignore
4949
log_msg(cfg, 1, 0, "[WARNING] Failed to un-pin BPF map 'map_block' from file system (%d).", ret);
5050
}
5151
}
52-
52+
#ifdef ENABLE_IPV6
5353
// Unpin block (IPv6) map.
5454
if ((ret = unpin_bpf_map(obj, XDP_MAP_PIN_DIR, "map_block6")) != 0)
5555
{
@@ -58,6 +58,7 @@ static void unpin_needed_maps(config__t* cfg, struct bpf_object* obj, int ignore
5858
log_msg(cfg, 1, 0, "[WARNING] Failed to un-pin BPF map 'map_block6' from file system (%d).", ret);
5959
}
6060
}
61+
#endif
6162

6263
#ifdef ENABLE_IP_RANGE_DROP
6364
// Unpin IPv4 range drop map.
@@ -545,4 +546,4 @@ int main(int argc, char *argv[])
545546

546547
// Exit program successfully.
547548
return EXIT_SUCCESS;
548-
}
549+
}

0 commit comments

Comments
 (0)