diff options
author | Florian Westphal <fw@strlen.de> | 2020-09-15 19:58:44 +0200 |
---|---|---|
committer | Florian Westphal <fw@strlen.de> | 2020-12-16 00:35:56 +0100 |
commit | 761cf19d7bc4b5950caff33965508d9fb7bbb547 (patch) | |
tree | 62a913a54080a2680138582a4753f5a9b52705ff /src/nspawn/nspawn-expose-ports.h | |
parent | nspawn: pass userdata pointer, not inet_addr union (diff) | |
download | systemd-761cf19d7bc4b5950caff33965508d9fb7bbb547.tar.xz systemd-761cf19d7bc4b5950caff33965508d9fb7bbb547.zip |
firewall-util: introduce context structure
for planned nft backend we have three choices:
- open/close a new nfnetlink socket for every operation
- keep a nfnetlink socket open internally
- expose a opaque fw_ctx and stash all internal data here.
Originally I opted for the 2nd option, but during review it was
suggested to avoid static storage duration because of perceived
problems with threaded applications.
This adds fw_ctx and new/free functions, then converts the existing api
and nspawn and networkd to use it.
Diffstat (limited to 'src/nspawn/nspawn-expose-ports.h')
-rw-r--r-- | src/nspawn/nspawn-expose-ports.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/nspawn/nspawn-expose-ports.h b/src/nspawn/nspawn-expose-ports.h index d0c1cecbe8..c1677cb61b 100644 --- a/src/nspawn/nspawn-expose-ports.h +++ b/src/nspawn/nspawn-expose-ports.h @@ -3,6 +3,8 @@ #include <inttypes.h> +#include "firewall-util.h" + #include "sd-event.h" #include "sd-netlink.h" @@ -22,5 +24,5 @@ int expose_port_parse(ExposePort **l, const char *s); int expose_port_watch_rtnl(sd_event *event, int recv_fd, sd_netlink_message_handler_t handler, void *userdata, sd_netlink **ret); int expose_port_send_rtnl(int send_fd); -int expose_port_execute(sd_netlink *rtnl, ExposePort *l, union in_addr_union *exposed); -int expose_port_flush(ExposePort* l, union in_addr_union *exposed); +int expose_port_execute(sd_netlink *rtnl, FirewallContext **fw_ctx, ExposePort *l, union in_addr_union *exposed); +int expose_port_flush(FirewallContext **fw_ctx, ExposePort* l, union in_addr_union *exposed); |