From 4677827f9263bd6f838a875394956e7d7ce9ba90 Mon Sep 17 00:00:00 2001 From: Razziell Date: Mon, 7 Jun 2021 21:35:07 +0700 Subject: [PATCH] Add support for TTL Signed-off-by: rezaadi0105 --- include/linux/netfilter_ipv4/ipt_TTL.h | 16 ++++++++++++++++ include/linux/netfilter_ipv6/ip6t_HL.h | 19 +++++++++++++++++++ net/netfilter/Makefile | 3 +++ 3 files changed, 38 insertions(+) create mode 100644 include/linux/netfilter_ipv4/ipt_TTL.h create mode 100644 include/linux/netfilter_ipv6/ip6t_HL.h diff --git a/include/linux/netfilter_ipv4/ipt_TTL.h b/include/linux/netfilter_ipv4/ipt_TTL.h new file mode 100644 index 000000000000..0c954ad597f1 --- /dev/null +++ b/include/linux/netfilter_ipv4/ipt_TTL.h @@ -0,0 +1,16 @@ +/* TTL modification module for IP tables +* (C) 2000 by Harald Welte */ +#ifndef _IPT_TTL_H +#define _IPT_TTL_H +#include +enum { + IPT_TTL_SET = 0, + IPT_TTL_INC, + IPT_TTL_DEC + }; +#define IPT_TTL_MAXMODE IPT_TTL_DEC +struct ipt_TTL_info { + __u8 mode; + __u8 ttl; + }; +#endif diff --git a/include/linux/netfilter_ipv6/ip6t_HL.h b/include/linux/netfilter_ipv6/ip6t_HL.h new file mode 100644 index 000000000000..01960a45b5c3 --- /dev/null +++ b/include/linux/netfilter_ipv6/ip6t_HL.h @@ -0,0 +1,19 @@ +/* TTL modification module for IP tables +* (C) 2000 by Harald Welte */ +#ifndef _IP6T_HL_H +#define _IP6T_HL_H +#include + +enum { + IP6T_HL_SET = 0, + IP6T_HL_INC, + IP6T_HL_DEC +}; + +#define IP6T_HL_MAXMODE IP6T_HL_DEC + +struct ip6t_HL_info { + __u8 mode; + __u8 hop_limit; +}; +#endif diff --git a/net/netfilter/Makefile b/net/netfilter/Makefile index aeaaf2522674..f7601c48cd26 100644 --- a/net/netfilter/Makefile +++ b/net/netfilter/Makefile @@ -110,6 +110,9 @@ obj-$(CONFIG_NFT_FWD_NETDEV) += nft_fwd_netdev.o # generic X tables obj-$(CONFIG_NETFILTER_XTABLES) += x_tables.o xt_tcpudp.o +# TTL +obj-$(CONFIG_IP_NF_TARGET_TTL) += xt_HL.o + # combos obj-$(CONFIG_NETFILTER_XT_MARK) += xt_mark.o obj-$(CONFIG_NETFILTER_XT_CONNMARK) += xt_connmark.o