Skip to contentSkip to conversation

New ipt_TTL target

PATCH In review Harald Welte 3 participants 8 messages Aug 26, 2005 – Aug 28, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 New ipt_TTL target

Hi Dave,

please apply to net-2.6.14

Signature · 5 lines
- Harald Welte <[email protected]>                 http://netfilter.org/
============================================================================
  "Fragmentation is like classful addressing -- an interesting early
   architectural error that shows how much experimentation was going
   on while IP was being designed."                    -- Paul Vixie

[NETFILTER] Add new iptables TTL target

This new iptables target allows manipulation of the TTL of an IPv4 packet.

---
commit cc7aa6d99761490f788fa3c61135e477172f1133
tree 4037f3264dbe6371d4cf68249804a4ca095eaa08
parent 2a4bde3e92bd6856a8b8ad479e90d7b0a41cda22
author Harald Welte <[email protected]> Fr, 26 Aug 2005 20:17:31 +0200 committer Harald Welte <[email protected]> Fr, 26 Aug 2005 20:17:31 +0200

 include/linux/netfilter_ipv4/ipt_TTL.h |   21 +++++
 net/ipv4/netfilter/Kconfig             |   20 +++++
 net/ipv4/netfilter/Makefile            |    1 
 net/ipv4/netfilter/ipt_TTL.c           |  135 ++++++++++++++++++++++++++++++++
 4 files changed, 177 insertions(+), 0 deletions(-)
include/linux/netfilter_ipv4/ipt_TTL.h new file +21 -0
new file mode 100644
@@ -0,0 +1,21 @@
+/* TTL modification module for IP tables
+ * (C) 2000 by Harald Welte <[email protected]> */
+
+#ifndef _IPT_TTL_H
+#define _IPT_TTL_H
+
+enum {
+	IPT_TTL_SET = 0,
+	IPT_TTL_INC,
+	IPT_TTL_DEC
+};
+
+#define IPT_TTL_MAXMODE	IPT_TTL_DEC
+
+struct ipt_TTL_info {
+	u_int8_t	mode;
+	u_int8_t	ttl;
+};
+
+
+#endif
net/ipv4/netfilter/Kconfig +20 -0
@@ -664,6 +664,26 @@ config IP_NF_TARGET_CLASSIFY
 
 	  To compile it as a module, choose M here.  If unsure, say N.
 
+config IP_NF_TARGET_TTL
+	tristate  'TTL target support'
+	depends on IP_NF_MANGLE
+	help
+	  This option adds a `TTL' target, which enables the user to decrement
+	  the TTL value of the IP header or set it to a given (lower) value.
+	
+	  If you want to compile it as a module, say M here and read
+	  Documentation/modules.txt.  If unsure, say `N'.
+
+config IP_NF_TARGET_TTL_INC
+	bool  'TTL incrementing support (DANGEROUS)'
+	depends on IP_NF_TARGET_TTL
+	help
+	  This option enables functionality to increment and set the TTL
+	  value of the IP header to arbitrary values.  This is EXTREMELY
+	  DANGEROUS since you can easily create immortal packets that loop
+	  forever on the network.  Please only enable if you really know
+	  that you will need it.
+
 config IP_NF_TARGET_CONNMARK
 	tristate  'CONNMARK target support'
 	depends on IP_NF_CONNTRACK_MARK && IP_NF_MANGLE
net/ipv4/netfilter/Makefile +1 -0
@@ -85,6 +85,7 @@ obj-$(CONFIG_IP_NF_TARGET_ULOG) += ipt_U
 obj-$(CONFIG_IP_NF_TARGET_TCPMSS) += ipt_TCPMSS.o
 obj-$(CONFIG_IP_NF_TARGET_NOTRACK) += ipt_NOTRACK.o
 obj-$(CONFIG_IP_NF_TARGET_CLUSTERIP) += ipt_CLUSTERIP.o
+obj-$(CONFIG_IP_NF_TARGET_TTL) += ipt_TTL.o
 
 # generic ARP tables
 obj-$(CONFIG_IP_NF_ARPTABLES) += arp_tables.o
net/ipv4/netfilter/ipt_TTL.c new file +135 -0

135 lines not on this page · raw message

maintainer
#1 lore raw

From: Harald Welte <[email protected]>
Date: Fri, 26 Aug 2005 20:31:51 +0200

net/ipv4/netfilter/Kconfig config IP_NF_TARGET_CLASSIFY · line 686

Quoted 10 lines
net/ipv4/netfilter/Kconfig +10 -0
+config IP_NF_TARGET_TTL_INC
+	bool  'TTL incrementing support (DANGEROUS)'
+	depends on IP_NF_TARGET_TTL
+	help
+	  This option enables functionality to increment and set the TTL
+	  value of the IP header to arbitrary values.  This is EXTREMELY
+	  DANGEROUS since you can easily create immortal packets that loop
+	  forever on the network.  Please only enable if you really know
+	  that you will need it.
+

I think it's best to kill this option. Just put the "this is DANGEROUS" comment into the help text for IP_NF_TARGET_TTL, ok?

Similarly for the ipv6 hoplimit target too.

Thanks.

#2 lore raw
Quoted 19 lines · David S. Miller

From: Harald Welte <[email protected]>
Date: Fri, 26 Aug 2005 20:31:51 +0200

net/ipv4/netfilter/Kconfig config IP_NF_TARGET_CLASSIFY · line 686

Quoted 10 lines
net/ipv4/netfilter/Kconfig +10 -0
+config IP_NF_TARGET_TTL_INC
+	bool  'TTL incrementing support (DANGEROUS)'
+	depends on IP_NF_TARGET_TTL
+	help
+	  This option enables functionality to increment and set the TTL
+	  value of the IP header to arbitrary values.  This is EXTREMELY
+	  DANGEROUS since you can easily create immortal packets that loop
+	  forever on the network.  Please only enable if you really know
+	  that you will need it.
+

I think it's best to kill this option. Just put the "this is DANGEROUS" comment into the help text for IP_NF_TARGET_TTL, ok?

Quoted 1 line

Similarly for the ipv6 hoplimit target too.

If we want to make sure, we simply print a message in the iptables userspace command when someone uses this option. If this is too extreme, a comment in the man-page will probably help to reach more people than in the kernel-help text.

maintainer
#3 lore raw

From: Patrick McHardy <[email protected]>
Date: Sat, 27 Aug 2005 05:31:00 +0200

Quoted 4 lines

If we want to make sure, we simply print a message in the iptables userspace command when someone uses this option. If this is too extreme, a comment in the man-page will probably help to reach more people than in the kernel-help text.

Whatever you guys think works best.

#4 lore raw
In reply to David S. Miller
Quoted 16 lines · David S. Miller

From: Harald Welte <[email protected]>
Date: Fri, 26 Aug 2005 20:31:51 +0200

net/ipv4/netfilter/Kconfig config IP_NF_TARGET_CLASSIFY · line 686

Quoted 10 lines
net/ipv4/netfilter/Kconfig +10 -0
+config IP_NF_TARGET_TTL_INC
+	bool  'TTL incrementing support (DANGEROUS)'
+	depends on IP_NF_TARGET_TTL
+	help
+	  This option enables functionality to increment and set the TTL
+	  value of the IP header to arbitrary values.  This is EXTREMELY
+	  DANGEROUS since you can easily create immortal packets that loop
+	  forever on the network.  Please only enable if you really know
+	  that you will need it.
+

I think it's best to kill this option. Just put the "this is DANGEROUS" comment into the help text for IP_NF_TARGET_TTL, ok?

ok, I thought you would consider this as a "quality of implementation issue" ;)

I'll re-send without the #ifdef and config option later today.

Signature · 5 lines
- Harald Welte <[email protected]>                 http://netfilter.org/
============================================================================
  "Fragmentation is like classful addressing -- an interesting early
   architectural error that shows how much experimentation was going
   on while IP was being designed."                    -- Paul Vixie
#5 lore raw

PATCH 1/2 New ipt_TTL target

In reply to David S. Miller

Hi Dave,

here's the revised version with no extra-dangerous config option.

Please apply,

Signature · 5 lines
- Harald Welte <[email protected]>                 http://netfilter.org/
============================================================================
  "Fragmentation is like classful addressing -- an interesting early
   architectural error that shows how much experimentation was going
   on while IP was being designed."                    -- Paul Vixie

[NETFILTER] Add new iptables TTL target

This new iptables target allows manipulation of the TTL of an IPv4 packet.

---
commit 14d9d70998a369cb3806e570d653fc7b0a13a195
tree f240795aa48b1467b58c88432cdff6f1a5d0bb96
parent 2a4bde3e92bd6856a8b8ad479e90d7b0a41cda22
author Harald Welte <[email protected]> Sa, 27 Aug 2005 15:17:27 +0200 committer Harald Welte <[email protected]> Sa, 27 Aug 2005 15:17:27 +0200

 include/linux/netfilter_ipv4/ipt_TTL.h |   21 ++++++
 net/ipv4/netfilter/Kconfig             |   14 ++++
 net/ipv4/netfilter/Makefile            |    1 
 net/ipv4/netfilter/ipt_TTL.c           |  119 ++++++++++++++++++++++++++++++++
 4 files changed, 155 insertions(+), 0 deletions(-)
include/linux/netfilter_ipv4/ipt_TTL.h new file +21 -0
new file mode 100644
@@ -0,0 +1,21 @@
+/* TTL modification module for IP tables
+ * (C) 2000 by Harald Welte <[email protected]> */
+
+#ifndef _IPT_TTL_H
+#define _IPT_TTL_H
+
+enum {
+	IPT_TTL_SET = 0,
+	IPT_TTL_INC,
+	IPT_TTL_DEC
+};
+
+#define IPT_TTL_MAXMODE	IPT_TTL_DEC
+
+struct ipt_TTL_info {
+	u_int8_t	mode;
+	u_int8_t	ttl;
+};
+
+
+#endif
net/ipv4/netfilter/Kconfig +14 -0
@@ -664,6 +664,20 @@ config IP_NF_TARGET_CLASSIFY
 
 	  To compile it as a module, choose M here.  If unsure, say N.
 
+config IP_NF_TARGET_TTL
+	tristate  'TTL target support'
+	depends on IP_NF_MANGLE
+	help
+	  This option adds a `TTL' target, which enables the user to modify
+	  the TTL value of the IP header.
+
+	  While it is safe to decrement/lower the TTL, this target also enables
+	  functionality to increment and set the TTL value of the IP header to
+	  arbitrary values.  This is EXTREMELY DANGEROUS since you can easily
+	  create immortal packets that loop forever on the network.
+
+	  To compile it as a module, choose M here.  If unsure, say N.
+
 config IP_NF_TARGET_CONNMARK
 	tristate  'CONNMARK target support'
 	depends on IP_NF_CONNTRACK_MARK && IP_NF_MANGLE
net/ipv4/netfilter/Makefile +1 -0
@@ -85,6 +85,7 @@ obj-$(CONFIG_IP_NF_TARGET_ULOG) += ipt_U
 obj-$(CONFIG_IP_NF_TARGET_TCPMSS) += ipt_TCPMSS.o
 obj-$(CONFIG_IP_NF_TARGET_NOTRACK) += ipt_NOTRACK.o
 obj-$(CONFIG_IP_NF_TARGET_CLUSTERIP) += ipt_CLUSTERIP.o
+obj-$(CONFIG_IP_NF_TARGET_TTL) += ipt_TTL.o
 
 # generic ARP tables
 obj-$(CONFIG_IP_NF_ARPTABLES) += arp_tables.o
net/ipv4/netfilter/ipt_TTL.c new file +119 -0

119 lines not on this page · raw message

#6 lore raw

PATCH 2/2 New ip6t_HL target

In reply to David S. Miller

Hi Dave,

here's the revised version with no extra-dangerous config option.

Please apply,

Signature · 5 lines
- Harald Welte <[email protected]>                 http://netfilter.org/
============================================================================
  "Fragmentation is like classful addressing -- an interesting early
   architectural error that shows how much experimentation was going
   on while IP was being designed."                    -- Paul Vixie

[NETFILTER6] Add new ip6tables HOPLIMIT target

This target allows users to modify the hoplimit header field of the IPv6 header.

---
commit 733e40cdff92274036b6131c50196cc3d3741555
tree f18cd65100f97e9632d10837f531ef86c7f6aee9
parent 14d9d70998a369cb3806e570d653fc7b0a13a195
author Harald Welte <[email protected]> Sa, 27 Aug 2005 15:19:59 +0200 committer Harald Welte <[email protected]> Sa, 27 Aug 2005 15:19:59 +0200

 include/linux/netfilter_ipv6/ip6t_HL.h |   22 ++++++
 net/ipv6/netfilter/Kconfig             |   16 ++++
 net/ipv6/netfilter/Makefile            |    1 
 net/ipv6/netfilter/ip6t_HL.c           |  118 ++++++++++++++++++++++++++++++++
 4 files changed, 157 insertions(+), 0 deletions(-)
include/linux/netfilter_ipv6/ip6t_HL.h new file +22 -0
new file mode 100644
@@ -0,0 +1,22 @@
+/* Hop Limit modification module for ip6tables
+ * Maciej Soltysiak <[email protected]>
+ * Based on HW's TTL module */
+
+#ifndef _IP6T_HL_H
+#define _IP6T_HL_H
+
+enum {
+	IP6T_HL_SET = 0,
+	IP6T_HL_INC,
+	IP6T_HL_DEC
+};
+
+#define IP6T_HL_MAXMODE	IP6T_HL_DEC
+
+struct ip6t_HL_info {
+	u_int8_t	mode;
+	u_int8_t	hop_limit;
+};
+
+
+#endif
net/ipv6/netfilter/Kconfig +16 -0
@@ -239,6 +239,22 @@ config IP6_NF_TARGET_MARK
 
 	  To compile it as a module, choose M here.  If unsure, say N.
 
+config IP6_NF_TARGET_HL
+	tristate  'HL (hoplimit) target support'
+	depends on IP6_NF_MANGLE
+	help
+	  This option adds a `HL' target, which enables the user to decrement
+	  the hoplimit value of the IPv6 header or set it to a given (lower)
+	  value.
+	
+	  While it is safe to decrement the hoplimit value, this option also
+	  enables functionality to increment and set the hoplimit value of the
+	  IPv6 header to arbitrary values.  This is EXTREMELY DANGEROUS since
+	  you can easily create immortal packets that loop forever on the
+	  network.  
+
+	  To compile it as a module, choose M here.  If unsure, say N.
+
 #dep_tristate '  LOG target support' CONFIG_IP6_NF_TARGET_LOG $CONFIG_IP6_NF_IPTABLES
 config IP6_NF_RAW
 	tristate  'raw table support (required for TRACE)'
net/ipv6/netfilter/Makefile +1 -0
@@ -20,6 +20,7 @@ obj-$(CONFIG_IP6_NF_MATCH_PHYSDEV) += ip
 obj-$(CONFIG_IP6_NF_FILTER) += ip6table_filter.o
 obj-$(CONFIG_IP6_NF_MANGLE) += ip6table_mangle.o
 obj-$(CONFIG_IP6_NF_TARGET_MARK) += ip6t_MARK.o
+obj-$(CONFIG_IP6_NF_TARGET_HL) += ip6t_HL.o
 obj-$(CONFIG_IP6_NF_QUEUE) += ip6_queue.o
 obj-$(CONFIG_IP6_NF_TARGET_LOG) += ip6t_LOG.o
 obj-$(CONFIG_IP6_NF_RAW) += ip6table_raw.o
net/ipv6/netfilter/ip6t_HL.c new file +118 -0

118 lines not on this page · raw message

maintainer
#7 lore raw

Re: [PATCH 2/2] New ip6t_HL target

Both ipv4 and ipv6 patches applied, thanks for following up on this Harald.