Skip to contentSkip to conversation

iproute2 add hoplimit and reordering route options usage and parsing

PATCH In review Gilad Ben-Yossef 4 participants 7 messages Oct 5, 2009 – Dec 1, 2009

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

PATCH 1/1 iproute2 add hoplimit and reordering route options usage and parsing

From: Yuki Arbel <[email protected]>

iproute2 git HEAD (spotted originally on 2.6.26, so it's probably not new) does not parse the hoplimit route option when proccessing parameters, nor does it print hoplimit and reordering options in the usage lines. This patch fixes both.

Tested by setting hoplimit and be retreiving it via "show".

[ported to HEAD and fixed a bug with hoplimit lock handling in original]

---

Carved out from original patch by Yuki Arbel and Ori Finkelman from Comsleep Ltd. which I'm asssiting in mainlining.

ip/iproute.c +11 -1
index bf0f31b..4821a1d 100644
@@ -73,7 +73,7 @@ static void usage(void)
 	fprintf(stderr, "           [ rtt TIME ] [ rttvar TIME ]\n");
 	fprintf(stderr, "           [ window NUMBER] [ cwnd NUMBER ] [ initcwnd NUMBER ]\n");
 	fprintf(stderr, "           [ ssthresh NUMBER ] [ realms REALM ] [ src ADDRESS ]\n");
-	fprintf(stderr, "           [ rto_min TIME ]\n");
+	fprintf(stderr, "           [ rto_min TIME ] [ hoplimit NUMBER ] [ reordering NUMBER] \n");
 	fprintf(stderr, "TYPE := [ unicast | local | broadcast | multicast | throw |\n");
 	fprintf(stderr, "          unreachable | prohibit | blackhole | nat ]\n");
 	fprintf(stderr, "TABLE_ID := [ local | main | default | all | NUMBER ]\n");
@@ -768,6 +768,16 @@ int iproute_modify(int cmd, unsigned flags, int argc, char **argv)
 			if (get_unsigned(&mtu, *argv, 0))
 				invarg("\"mtu\" value is invalid\n", *argv);
 			rta_addattr32(mxrta, sizeof(mxbuf), RTAX_MTU, mtu);
+		} else if (strcmp(*argv, "hoplimit") == 0) {
+			unsigned hoplimit;
+			NEXT_ARG();
+			if (strcmp(*argv, "lock") == 0) {
+				mxlock |= (1<<RTAX_HOPLIMIT);
+				NEXT_ARG();
+			}
+			if (get_unsigned(&hoplimit, *argv, 0))
+				invarg("\"hoplimit\" value is invalid\n", *argv);
+			rta_addattr32(mxrta, sizeof(mxbuf), RTAX_HOPLIMIT, hoplimit);
 #ifdef RTAX_ADVMSS
 		} else if (strcmp(*argv, "advmss") == 0) {
 			unsigned mss;
#1 lore raw

Hello!

Quoted 3 lines · Gilad Ben-Yossef

iproute2 git HEAD (spotted originally on 2.6.26, so it's probably not new) does not parse the hoplimit route option when proccessing parameters, nor does it print hoplimit and reordering options in the usage lines.

I'm happy you brought this up and know the author. The Debian package has been carrying this code, which is now in the form of a patch available here:
http://git.debian.org/?p=collab-maint/pkg-iproute.git;a=blob;f=debian/patches/hoplimit.dpatch

I didn't know who the original author was which is why I haven't submitted it, but it seems you know the history....
The above patch also includes some minor documentation updates which you seem to be missing and might want to integrate in your version of the patch.

Looking forward to be able to drop the patch in the debian package!

Regards,
Andreas Henriksson

#2 lore raw
Quoted 7 lines · Andreas Henriksson

Hello!

Quoted 2 lines · Gilad Ben-Yossef

iproute2 git HEAD (spotted originally on 2.6.26, so it's probably not new) does not parse the hoplimit route option when proccessing parameters, nor does it print hoplimit and reordering options in the usage lines.

Quoted 8 lines

I'm happy you brought this up and know the author. The Debian package has been carrying this code, which is now in the form of a patch available here:
http://git.debian.org/?p=collab-maint/pkg-iproute.git;a=blob;f=debian/patches/hoplimit.dpatch

I didn't know who the original author was which is why I haven't submitted it, but it seems you know the history....

Not exactly. I know the history of the patch *I sent* (and btw, it seems I got the author name wrong). I don't think it is related to the one Debian is carrying.

Quoted 3 lines

The above patch also includes some minor documentation updates which you seem to be missing and might want to integrate in your version of the patch.

All right. I will add those documentation changes as well and resend as version 2.

Quoted 5 lines

Looking forward to be able to drop the patch in the debian package!

I take it you ACK the patch as the Debian package maintainer?

Thanks!
Gilad

Signature · 17 lines
Gilad Ben-Yossef
Chief Coffee Drinker & CTO
Codefidence Ltd.

Web:   http://codefidence.com
Cell:  +972-52-8260388
Skype: gilad_codefidence
Tel:   +972-8-9316883 ext. 201
Fax:   +972-8-9316884
Email: [email protected]

Check out our Open Source technology and training blog - http://tuxology.net

	"Now the world has gone to bed
	 Darkness won't engulf my head
	 I can see by infra-red
	 How I hate the night."
#3 lore raw

PATCH 1/1 iproute2 add hoplimit parsing and update usage and documentation

From: Gilad Ben-Yossef <[email protected]>

- Parse and handle the hoplimit ip route option and add it to the usage line and documentation.

- Add the missing reordering ip route option to the usage line.

- Add documentation for initcwnd ip route option.

Tested by setting hoplimit and retreiving it via "show".

[ported to HEAD, fixed a bug with hoplimit lock handling, added documentation]

---

Debian is carrying a patch with identical functionality for some time now it seems.

Parts of this patch carved out from original patch by Yony Amit and Ori Finkelman from Comsleep Ltd. with minor bug fixing and HEAD port by me.

Additional documentation bits inspired by Debian patch with unknown author provided by Andreas Henriksson <[email protected]>

doc/ip-cref.tex +13 -0
index bb4eb78..f81adc5 100644
@@ -1324,7 +1324,17 @@ peers are allowed to send to us.
     If it is not given, Linux uses the value selected with \verb|sysctl|
     variable \verb|net/ipv4/tcp_reordering|.
 
+\item \verb|hoplimit NUMBER|
 
+--- [2.5.74+ only] Maximum number of hops on the path to this destination. 
+    The default is the value selected with the \verb|sysctl| variable
+    \verb|net/ipv4/ip_default_ttl|.
+
+\item \verb|initcwnd NUMBER|
+--- [2.5.70+ only] Initial congestion window size for connections to 
+    this destination. Actual window size is this value multiplied by the
+    MSS (``Maximal Segment Size'') for same connection. The default is
+    zero, meaning to use the values specified in~\cite{RFC2414}.
 
 \item \verb|nexthop NEXTHOP|
 
@@ -2653,6 +2663,9 @@ http://www.cisco.com/univercd/cc/td/doc/product/software/ios120.
 \bibitem{RFC-DHCP} R.~Droms.
 ``Dynamic Host Configuration Protocol.'', RFC-2131
 
+\bibitem{RFC2414}  M.~Allman, S.~Floyd, C.~Partridge.
+``Increasing TCP's Initial Window'', RFC-2414.
+
 \end{thebibliography}
 
 
ip/iproute.c +16 -2
index bf0f31b..aeea93d 100644
@@ -13,6 +13,8 @@
  *
  * Rani Assaf <[email protected]> 980929:	resolve addresses
  * Kunihiro Ishiguro <[email protected]> 001102: rtnh_ifindex was not initialized
+ * Gilad Ben-Yossef <[email protected]> 091006: Add hoplimit option parsing 
+ * and correct usage
  */
 
 #include <stdio.h>
@@ -70,10 +72,10 @@ static void usage(void)
 	fprintf(stderr, "INFO_SPEC := NH OPTIONS FLAGS [ nexthop NH ]...\n");
 	fprintf(stderr, "NH := [ via ADDRESS ] [ dev STRING ] [ weight NUMBER ] NHFLAGS\n");
 	fprintf(stderr, "OPTIONS := FLAGS [ mtu NUMBER ] [ advmss NUMBER ]\n");
-	fprintf(stderr, "           [ rtt TIME ] [ rttvar TIME ]\n");
+	fprintf(stderr, "           [ rtt TIME ] [ rttvar TIME ] [reordering NUMBER ]\n");
 	fprintf(stderr, "           [ window NUMBER] [ cwnd NUMBER ] [ initcwnd NUMBER ]\n");
 	fprintf(stderr, "           [ ssthresh NUMBER ] [ realms REALM ] [ src ADDRESS ]\n");
-	fprintf(stderr, "           [ rto_min TIME ]\n");
+	fprintf(stderr, "           [ rto_min TIME ] [ hoplimit NUMBER ] \n");
 	fprintf(stderr, "TYPE := [ unicast | local | broadcast | multicast | throw |\n");
 	fprintf(stderr, "          unreachable | prohibit | blackhole | nat ]\n");
 	fprintf(stderr, "TABLE_ID := [ local | main | default | all | NUMBER ]\n");
@@ -768,6 +770,18 @@ int iproute_modify(int cmd, unsigned flags, int argc, char **argv)
 			if (get_unsigned(&mtu, *argv, 0))
 				invarg("\"mtu\" value is invalid\n", *argv);
 			rta_addattr32(mxrta, sizeof(mxbuf), RTAX_MTU, mtu);
+#ifdef RTAX_HOPLIMIT
+		} else if (strcmp(*argv, "hoplimit") == 0) {
+			unsigned hoplimit;
+			NEXT_ARG();
+			if (strcmp(*argv, "lock") == 0) {
+				mxlock |= (1<<RTAX_HOPLIMIT);
+				NEXT_ARG();
+			}
+			if (get_unsigned(&hoplimit, *argv, 0))
+				invarg("\"hoplimit\" value is invalid\n", *argv);
+			rta_addattr32(mxrta, sizeof(mxbuf), RTAX_HOPLIMIT, hoplimit);
+#endif
 #ifdef RTAX_ADVMSS
 		} else if (strcmp(*argv, "advmss") == 0) {
 			unsigned mss;
Acked-by on v1 1/1
#4 lore raw

Re: [PATCH] iproute2 add hoplimit parsing and update usage and documentation

Quoted 20 lines · Gilad Ben-Yossef

From: Gilad Ben-Yossef <[email protected]>

- Parse and handle the hoplimit ip route option and add it to the usage line and documentation.

- Add the missing reordering ip route option to the usage line.

- Add documentation for initcwnd ip route option.

Tested by setting hoplimit and retreiving it via "show".

[ported to HEAD, fixed a bug with hoplimit lock handling, added documentation]

ip/iproute.c line 17

Quoted 5 lines
ip/iproute.c +2 -0
@@ -13,6 +13,8 @@
  *
  * Rani Assaf <[email protected]> 980929:	resolve addresses
  * Kunihiro Ishiguro <[email protected]> 001102: rtnh_ifindex was not initialized
+ * Gilad Ben-Yossef <[email protected]> 091006: Add hoplimit option parsing 
+ * and correct usage

Well, git/web history is much better than this, you dont need to add this comment.

patch should be sent to iproute2 maintainer, Stephen Hemminger <[email protected]>

He might be too busy to catch netdev mails these days, I dont know :)

Thanks

#5 lore raw

Re: [PATCH] iproute2 add hoplimit parsing and update usage and documentation

Quoted 29 lines · On Tue, 06 Oct 2009 19:14:28 +0200 Eric Dumazet <[email protected]> wrote:
Quoted 20 lines · Gilad Ben-Yossef

From: Gilad Ben-Yossef <[email protected]>

- Parse and handle the hoplimit ip route option and add it to the usage line and documentation.

- Add the missing reordering ip route option to the usage line.

- Add documentation for initcwnd ip route option.

Tested by setting hoplimit and retreiving it via "show".

[ported to HEAD, fixed a bug with hoplimit lock handling, added documentation]

ip/iproute.c line 17

Quoted 5 lines
ip/iproute.c +2 -0
@@ -13,6 +13,8 @@
  *
  * Rani Assaf <[email protected]> 980929:	resolve addresses
  * Kunihiro Ishiguro <[email protected]> 001102: rtnh_ifindex was not initialized
+ * Gilad Ben-Yossef <[email protected]> 091006: Add hoplimit option parsing 
+ * and correct usage

Well, git/web history is much better than this, you dont need to add this comment.

Quoted 7 lines

patch should be sent to iproute2 maintainer, Stephen Hemminger <[email protected]>

He might be too busy to catch netdev mails these days, I dont know :)

Thanks

I catch them, but collect iproute patches and put them in batches around release time.

#6 lore raw

Re: [PATCH] iproute2 add hoplimit parsing and update usage and documentation

In reply to Gilad Ben-Yossef

ip/iproute.c line 19

Quoted 12 lines · On Tue, 06 Oct 2009 15:40:34 +0200 Gilad Ben-Yossef <[email protected]>…
ip/iproute.c +2 -0
index bf0f31b..aeea93d 100644
@@ -13,6 +13,8 @@
  *
  * Rani Assaf <[email protected]> 980929:	resolve addresses
  * Kunihiro Ishiguro <[email protected]> 001102: rtnh_ifindex was not initialized
+ * Gilad Ben-Yossef <[email protected]> 091006: Add hoplimit option parsing 
+ * and correct usage
  */
 

Applied except I removed the comment changelogs from all of iproute now to discourage individual source attribution. The contributor information exists in the git data.