if (!crt || crt->cgroup_id == 0)
return;
- if (!u->manager->nfnl) {
- r = sd_nfnl_socket_open(&u->manager->nfnl);
- if (r < 0)
- return;
- }
-
CGroupContext *c = ASSERT_PTR(unit_get_cgroup_context(u));
FOREACH_ARRAY(nft_set, c->nft_set_context.sets, c->nft_set_context.n_sets) {
if (nft_set->source != NFT_SET_SOURCE_CGROUP)
continue;
+ if (!u->manager->nfnl) {
+ r = sd_nfnl_socket_open(&u->manager->nfnl);
+ if (r < 0)
+ return (void) log_once_errno(LOG_WARNING, r, "Failed to open NETLINK_NETFILTER socket, ignoring: %m");
+ }
+
uint64_t element = crt->cgroup_id;
r = nft_set_element_modify_any(u->manager->nfnl, add, nft_set->nfproto, nft_set->table, nft_set->set, &element, sizeof(element));
if (!c)
return;
- if (!u->manager->nfnl) {
- r = sd_nfnl_socket_open(&u->manager->nfnl);
- if (r < 0)
- return;
- }
-
FOREACH_ARRAY(nft_set, c->nft_set_context.sets, c->nft_set_context.n_sets) {
if (nft_set->source != source)
continue;
+ if (!u->manager->nfnl) {
+ r = sd_nfnl_socket_open(&u->manager->nfnl);
+ if (r < 0)
+ return (void) log_once_errno(LOG_WARNING, r, "Failed to open NETLINK_NETFILTER socket, ignoring: %m");
+ }
+
r = nft_set_element_modify_any(u->manager->nfnl, add, nft_set->nfproto, nft_set->table, nft_set->set, &element, sizeof(element));
if (r < 0)
log_warning_errno(r, "Failed to %s NFT set entry: family %s, table %s, set %s, ID %u, ignoring: %m",