netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gilad Ben-Yossef <gilad@codefidence.com>
To: netdev@vger.kernel.org
Cc: ori@comsleep.com
Subject: [PATCH] iproute2 add hoplimit and reordering route options usage and parsing
Date: Mon, 05 Oct 2009 10:54:21 +0200	[thread overview]
Message-ID: <1254732861.015524.19779.nullmailer@watson.codefidence.com> (raw)

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.

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;

             reply	other threads:[~2009-10-05  8:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-05  8:54 Gilad Ben-Yossef [this message]
2009-10-06 11:41 ` [PATCH] iproute2 add hoplimit and reordering route options usage and parsing Andreas Henriksson
2009-10-06 12:37   ` Gilad Ben-Yossef
2009-10-06 13:40     ` [PATCH] iproute2 add hoplimit parsing and update usage and documentation Gilad Ben-Yossef
2009-10-06 17:14       ` Eric Dumazet
2009-10-06 17:34         ` Stephen Hemminger
2009-12-01 23:53       ` Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1254732861.015524.19779.nullmailer@watson.codefidence.com \
    --to=gilad@codefidence.com \
    --cc=netdev@vger.kernel.org \
    --cc=ori@comsleep.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).