diff options
author | Magnus Öberg <magnus.oberg@westermo.se> | 2016-04-06 12:53:04 (GMT) |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2022-05-27 07:50:29 (GMT) |
commit | df6e38b409f89c0c11934c96b8e937d59984515d (patch) | |
tree | e3134b61a23d7764857c682b84a087b961649cb8 /include | |
parent | 7304c422b3d0a85fdecf44aa9c1eb4e4e4e2d792 (diff) | |
download | libnl-df6e38b409f89c0c11934c96b8e937d59984515d.zip libnl-df6e38b409f89c0c11934c96b8e937d59984515d.tar.gz libnl-df6e38b409f89c0c11934c96b8e937d59984515d.tar.bz2 |
route/act: add NAT action
Signed-off-by: Magnus Öberg <magnus.oberg@westermo.se>
Signed-off-by: Volodymyr Bendiuga <volodymyr.bendiuga@gmail.com>
https://github.com/thom311/libnl/pull/317
Diffstat (limited to 'include')
-rw-r--r-- | include/linux-private/linux/tc_act/tc_nat.h | 27 | ||||
-rw-r--r-- | include/netlink/route/act/nat.h | 35 |
2 files changed, 62 insertions, 0 deletions
diff --git a/include/linux-private/linux/tc_act/tc_nat.h b/include/linux-private/linux/tc_act/tc_nat.h new file mode 100644 index 0000000..21399c2 --- /dev/null +++ b/include/linux-private/linux/tc_act/tc_nat.h @@ -0,0 +1,27 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef __LINUX_TC_NAT_H +#define __LINUX_TC_NAT_H + +#include <linux/pkt_cls.h> +#include <linux/types.h> + +enum { + TCA_NAT_UNSPEC, + TCA_NAT_PARMS, + TCA_NAT_TM, + TCA_NAT_PAD, + __TCA_NAT_MAX +}; +#define TCA_NAT_MAX (__TCA_NAT_MAX - 1) + +#define TCA_NAT_FLAG_EGRESS 1 + +struct tc_nat { + tc_gen; + __be32 old_addr; + __be32 new_addr; + __be32 mask; + __u32 flags; +}; + +#endif diff --git a/include/netlink/route/act/nat.h b/include/netlink/route/act/nat.h new file mode 100644 index 0000000..abe5c4d --- /dev/null +++ b/include/netlink/route/act/nat.h @@ -0,0 +1,35 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ +/* + * Copyright (c) 2016 Magnus Öberg <magnus.oberg@westermo.se> + */ + +#ifndef NETLINK_NAT_H_ +#define NETLINK_NAT_H_ + +#include <netlink/netlink.h> +#include <netlink/cache.h> +#include <netlink/route/action.h> +#include <linux/tc_act/tc_nat.h> + +#include <netinet/in.h> + +#ifdef __cplusplus +extern "C" { +#endif + +extern int rtnl_nat_set_old_addr(struct rtnl_act *act, in_addr_t addr); +extern int rtnl_nat_get_old_addr(struct rtnl_act *act, in_addr_t *addr); +extern int rtnl_nat_set_new_addr(struct rtnl_act *act, in_addr_t addr); +extern int rtnl_nat_get_new_addr(struct rtnl_act *act, in_addr_t *addr); +extern int rtnl_nat_set_mask(struct rtnl_act *act, in_addr_t bitmask); +extern int rtnl_nat_get_mask(struct rtnl_act *act, in_addr_t *bitmask); +extern int rtnl_nat_set_flags(struct rtnl_act *act, uint32_t flags); +extern int rtnl_nat_get_flags(struct rtnl_act *act, uint32_t *flags); +extern int rtnl_nat_set_action(struct rtnl_act *act, int action); +extern int rtnl_nat_get_action(struct rtnl_act *act, int *action); + +#ifdef __cplusplus +} +#endif + +#endif /* NETLINK_NAT_H */ |