net: Add ip rule save/restore

Add support for save and restore of ip rules. It uses new
functionality of iproute which is already in iproute git:

http://git.kernel.org/cgit/linux/kernel/git/shemminger/iproute2.git/commit/?id=2f4e171f7df22107b38fddcffa56c1ecb5e73359

v2: Use xstrdup() instead of strdup().
v3: Use open/close instead of helper.
v4: Return -1 on empty dump.

Signed-off-by: Kirill Tkhai <ktkhai@odin.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Kirill Tkhai 2015-10-23 20:06:00 +03:00 committed by Pavel Emelyanov
parent c51cdedcf9
commit c9afd17ad6
4 changed files with 56 additions and 0 deletions

View file

@ -40,6 +40,7 @@ enum {
CR_FD_IFADDR,
CR_FD_ROUTE,
CR_FD_ROUTE6,
CR_FD_RULE,
CR_FD_IPTABLES,
CR_FD_NETNS,
_CR_FD_NETNS_TO,

View file

@ -93,6 +93,7 @@
#define IFADDR_MAGIC RAW_IMAGE_MAGIC
#define ROUTE_MAGIC RAW_IMAGE_MAGIC
#define ROUTE6_MAGIC RAW_IMAGE_MAGIC
#define RULE_MAGIC RAW_IMAGE_MAGIC
#define TMPFS_IMG_MAGIC RAW_IMAGE_MAGIC
#define TMPFS_DEV_MAGIC RAW_IMAGE_MAGIC
#define IPTABLES_MAGIC RAW_IMAGE_MAGIC