svn commit: trunk/busybox: include networking/libiproute

aldot at busybox.net aldot at busybox.net
Tue Oct 7 17:00:59 UTC 2008


Author: aldot
Date: 2008-10-07 10:00:58 -0700 (Tue, 07 Oct 2008)
New Revision: 23618

Log:
- route metric support (Natanael Copa)
  Adds about 75b


Modified:
   trunk/busybox/include/usage.h
   trunk/busybox/networking/libiproute/iproute.c


Changeset:
Modified: trunk/busybox/include/usage.h
===================================================================
--- trunk/busybox/include/usage.h	2008-10-07 16:05:03 UTC (rev 23617)
+++ trunk/busybox/include/usage.h	2008-10-07 17:00:58 UTC (rev 23618)
@@ -1992,7 +1992,8 @@
        "			[oif STRING]  [tos TOS]\n" \
        "iproute { add | del | change | append | replace | monitor } ROUTE\n" \
        "			SELECTOR := [root PREFIX] [match PREFIX] [proto RTPROTO]\n" \
-       "			ROUTE := [TYPE] PREFIX [tos TOS] [proto RTPROTO]" \
+       "			ROUTE := [TYPE] PREFIX [tos TOS] [proto RTPROTO]\n" \
+       "				[metric METRIC]" \
 
 #define iprule_trivial_usage \
        "{[list | add | del] RULE}"

Modified: trunk/busybox/networking/libiproute/iproute.c
===================================================================
--- trunk/busybox/networking/libiproute/iproute.c	2008-10-07 16:05:03 UTC (rev 23617)
+++ trunk/busybox/networking/libiproute/iproute.c	2008-10-07 17:00:58 UTC (rev 23618)
@@ -291,7 +291,7 @@
 {
 	static const char keywords[] ALIGN1 =
 		"src\0""via\0""mtu\0""lock\0""protocol\0"USE_FEATURE_IP_RULE("table\0")
-		"dev\0""oif\0""to\0";
+		"dev\0""oif\0""to\0""metric\0";
 	enum {
 		ARG_src,
 		ARG_via,
@@ -300,7 +300,8 @@
 USE_FEATURE_IP_RULE(ARG_table,)
 		ARG_dev,
 		ARG_oif,
-		ARG_to
+		ARG_to,
+		ARG_metric,
 	};
 	enum {
 		gw_ok = 1 << 0,
@@ -387,6 +388,12 @@
 		} else if (arg == ARG_dev || arg == ARG_oif) {
 			NEXT_ARG();
 			d = *argv;
+		} else if (arg == ARG_metric) {
+			uint32_t metric;
+			NEXT_ARG();
+			if (get_u32(&metric, *argv, 0))
+				invarg(*argv, "metric");
+			addattr32(&req.n, sizeof(req), RTA_PRIORITY, metric);
 		} else {
 			int type;
 			inet_prefix dst;




More information about the busybox-cvs mailing list