diff options
author | Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com> | 2014-05-06 13:28:33 +0200 |
---|---|---|
committer | Arturo Borrero Gonzalez <aborrero@cica.es> | 2014-05-07 17:09:29 +0200 |
commit | caa1cf2960db0d0a01e707f5a82a05d0718ff498 (patch) | |
tree | daad2ad6efadd88271a9351b52e7ee50049ac555 /src/main.c | |
parent | c179ee88d91a84fc75dc4602cca500e8fa72ed66 (diff) |
nft-sync: complete --fetch operation
This patch complete the --fetch operation in the server side.
By now, the format of the ruleset is XML. In further patches we can include
additional config options to let the admin choose one of XML/JSON.
Signed-off-by: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>
Acked-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -24,6 +24,7 @@ #include "logging.h" #include "msg_buff.h" #include "proto.h" +#include "mnl.h" struct nft_sync_inst nfts_inst; @@ -99,6 +100,14 @@ int main(int argc, char *argv[]) strerror(errno)); goto err; } + + if (nfts_socket_open(&nfts_inst) < 0) { + nfts_log(NFTS_LOG_FATAL, + "Cannot open Netlink query socket: %s\n", + strerror(errno)); + goto err; + } + nfts_log(NFTS_LOG_INFO, "listening at %s", inet_ntoa(nfts_inst.tcp.server.ipv4.inet_addr)); } @@ -126,6 +135,9 @@ int main(int argc, char *argv[]) nft_sync_event_fini(); + if (nfts_inst.mode & NFTS_MODE_SERVER) + nfts_socket_close(&nfts_inst); + ret = EXIT_SUCCESS; err: nft_sync_log_fini(&nfts_inst); |