diff mbox

iproute2 add hoplimit and reordering route options usage and parsing

Message ID 1254732861.015524.19779.nullmailer@watson.codefidence.com
State Not Applicable, archived
Delegated to: David Miller
Headers show

Commit Message

Gilad Ben-Yossef Oct. 5, 2009, 8:54 a.m. UTC
From: Yuki Arbel <yuki@comsleep.com>

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".

Signed-off-by: Gilad Ben-Yossef <gilad@codefidence.com>
[ported to HEAD and fixed a bug with hoplimit lock handling in original]
Signed-off-by: Ori Finkelman <ori@comsleep.com>
Signed-off-by: Yuki Arbel <yuki@comsleep.com>

---

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

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Andreas Henriksson Oct. 6, 2009, 11:41 a.m. UTC | #1
Hello!

On Mon, Oct 05, 2009 at 10:54:21AM +0200, Gilad Ben-Yossef wrote:
> 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
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Gilad Ben-Yossef Oct. 6, 2009, 12:37 p.m. UTC | #2
Andreas Henriksson wrote:

> Hello!
>
> On Mon, Oct 05, 2009 at 10:54:21AM +0200, Gilad Ben-Yossef wrote:
>   
>> 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....
>   
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.
> 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.
> 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
diff mbox

Patch

diff --git a/ip/iproute.c b/ip/iproute.c
index bf0f31b..4821a1d 100644
--- a/ip/iproute.c
+++ b/ip/iproute.c
@@ -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;