Skip to content

Commit 3022f83

Browse files
wengzhexiaoxiang781216
authored andcommitted
netlib/ip6tables: Add functions for ip6tables & filter table
Signed-off-by: Zhe Weng <[email protected]>
1 parent 8ae0646 commit 3022f83

File tree

4 files changed

+792
-5
lines changed

4 files changed

+792
-5
lines changed

include/netutils/netlib.h

+33-5
Original file line numberDiff line numberDiff line change
@@ -390,8 +390,11 @@ int netlib_obtain_ipv6addr(FAR const char *ifname);
390390

391391
struct ipt_replace; /* Forward reference */
392392
struct ipt_entry; /* Forward reference */
393+
struct ip6t_replace; /* Forward reference */
394+
struct ip6t_entry; /* Forward reference */
393395
enum nf_inet_hooks; /* Forward reference */
394396

397+
# ifdef CONFIG_NET_IPv4
395398
FAR struct ipt_replace *netlib_ipt_prepare(FAR const char *table);
396399
int netlib_ipt_commit(FAR const struct ipt_replace *repl);
397400
int netlib_ipt_flush(FAR const char *table, enum nf_inet_hooks hook);
@@ -409,15 +412,40 @@ int netlib_ipt_delete(FAR struct ipt_replace *repl,
409412
int netlib_ipt_fillifname(FAR struct ipt_entry *entry,
410413
FAR const char *inifname,
411414
FAR const char *outifname);
412-
# ifdef CONFIG_NET_NAT
415+
# ifdef CONFIG_NET_NAT
413416
FAR struct ipt_entry *netlib_ipt_masquerade_entry(FAR const char *ifname);
414-
# endif
415-
# ifdef CONFIG_NET_IPFILTER
417+
# endif
418+
# ifdef CONFIG_NET_IPFILTER
416419
FAR struct ipt_entry *netlib_ipt_filter_entry(FAR const char *target,
417420
int verdict,
418421
uint8_t match_proto);
419-
# endif
420-
#endif
422+
# endif
423+
# endif /* CONFIG_NET_IPv4 */
424+
# ifdef CONFIG_NET_IPv6
425+
FAR struct ip6t_replace *netlib_ip6t_prepare(FAR const char *table);
426+
int netlib_ip6t_commit(FAR const struct ip6t_replace *repl);
427+
int netlib_ip6t_flush(FAR const char *table, enum nf_inet_hooks hook);
428+
int netlib_ip6t_policy(FAR const char *table, enum nf_inet_hooks hook,
429+
int verdict);
430+
int netlib_ip6t_append(FAR struct ip6t_replace **repl,
431+
FAR const struct ip6t_entry *entry,
432+
enum nf_inet_hooks hook);
433+
int netlib_ip6t_insert(FAR struct ip6t_replace **repl,
434+
FAR const struct ip6t_entry *entry,
435+
enum nf_inet_hooks hook, int rulenum);
436+
int netlib_ip6t_delete(FAR struct ip6t_replace *repl,
437+
FAR const struct ip6t_entry *entry,
438+
enum nf_inet_hooks hook, int rulenum);
439+
int netlib_ip6t_fillifname(FAR struct ip6t_entry *entry,
440+
FAR const char *inifname,
441+
FAR const char *outifname);
442+
# ifdef CONFIG_NET_IPFILTER
443+
FAR struct ip6t_entry *netlib_ip6t_filter_entry(FAR const char *target,
444+
int verdict,
445+
uint8_t match_proto);
446+
# endif
447+
# endif /* CONFIG_NET_IPv6 */
448+
#endif /* CONFIG_NET_IPTABLES */
421449

422450
#ifdef CONFIG_NETLINK_NETFILTER
423451
/* Netfilter connection tracking support */

netutils/netlib/CMakeLists.txt

+3
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ if(CONFIG_NETUTILS_NETLIB)
7373
if(CONFIG_NETLINK_ROUTE)
7474
list(APPEND SRCS netlib_getnbtab.c)
7575
endif()
76+
if(CONFIG_NET_IPTABLES)
77+
list(APPEND SRCS netlib_ip6tables.c)
78+
endif()
7679
endif()
7780

7881
# Device support

netutils/netlib/Makefile

+3
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ endif
7474
ifeq ($(CONFIG_NETLINK_ROUTE),y)
7575
CSRCS += netlib_getnbtab.c
7676
endif
77+
ifeq ($(CONFIG_NET_IPTABLES),y)
78+
CSRCS += netlib_ip6tables.c
79+
endif
7780
endif
7881

7982
# Device support

0 commit comments

Comments
 (0)