Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F152506250
D56335.id175230.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D56335.id175230.diff
View Options
diff --git a/sbin/route/keywords b/sbin/route/keywords
--- a/sbin/route/keywords
+++ b/sbin/route/keywords
@@ -50,6 +50,7 @@
static
sticky
weight
+metric
x25
xns
xresolve
diff --git a/sbin/route/route.c b/sbin/route/route.c
--- a/sbin/route/route.c
+++ b/sbin/route/route.c
@@ -813,6 +813,7 @@
caseof(K_RTT, RTV_RTT, rmx_rtt);
caseof(K_RTTVAR, RTV_RTTVAR, rmx_rttvar);
caseof(K_WEIGHT, RTV_WEIGHT, rmx_weight);
+ caseof(K_METRIC, RTV_METRIC, rmx_metric);
}
rtm_inits |= flag;
if (lockrest || locking)
@@ -825,6 +826,14 @@
errno = EINVAL;
if (errno)
err(EX_USAGE, "%s", value);
+ if (flag & RTV_METRIC && *valp > RT_MAX_METRIC) {
+ errno = EINVAL;
+ errx(EX_USAGE, "invalid metric, maximum allowed is %d", RT_MAX_METRIC);
+ }
+ if (flag & RTV_WEIGHT && *valp > RT_MAX_WEIGHT) {
+ errno = EINVAL;
+ errx(EX_USAGE, "invalid weight, maximum allowed is %d", RT_MAX_WEIGHT);
+ }
if (flag & RTV_EXPIRE && (value[0] == '+' || value[0] == '-')) {
struct timespec ts;
@@ -999,6 +1008,7 @@
case K_RTT:
case K_RTTVAR:
case K_WEIGHT:
+ case K_METRIC:
if (!--argc)
usage(NULL);
set_metric(*++argv, key);
diff --git a/sbin/route/route_netlink.c b/sbin/route/route_netlink.c
--- a/sbin/route/route_netlink.c
+++ b/sbin/route/route_netlink.c
@@ -270,6 +270,8 @@
if (rt_metrics->rmx_expire > 0)
snl_add_msg_attr_u32(&nw, NL_RTA_EXPIRES, rt_metrics->rmx_expire);
+ if (rt_metrics->rmx_metric > 0)
+ snl_add_msg_attr_u8(&nw, NL_RTA_PRIORITY, rt_metrics->rmx_metric);
if (rt_metrics->rmx_weight > 0)
snl_add_msg_attr_u32(&nw, NL_RTA_WEIGHT, rt_metrics->rmx_weight);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Apr 16, 9:42 AM (11 h, 25 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31467415
Default Alt Text
D56335.id175230.diff (1 KB)
Attached To
Mode
D56335: route(8): Add metric argument
Attached
Detach File
Event Timeline
Log In to Comment