aboutsummaryrefslogtreecommitdiff
path: root/sbin/ifconfig
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2020-01-09 14:58:41 +0000
committerMark Johnston <markj@FreeBSD.org>2020-01-09 14:58:41 +0000
commitc23df8eafae7df124ac3110d5e00bb7615173f11 (patch)
tree5a26fc5dbfe49c0c6183fe7372d84123d6a3e17a /sbin/ifconfig
parentf8c319da667b0c889a490bccfcf57e1d198f6551 (diff)
downloadsrc-c23df8eafae7df124ac3110d5e00bb7615173f11.tar.gz
src-c23df8eafae7df124ac3110d5e00bb7615173f11.zip
lagg: Further cleanup of the rr_limit option.
Add an option flag so that arbitrary updates to a lagg's configuration do not clear sc_stride. Preseve compatibility for old ifconfig binaries. Update ifconfig to use the new flag and improve the casting used when parsing the option parameter. Modify the RR transmit function to avoid locklessly reading sc_stride twice. Ensure that sc_stride is always 1 or greater. Reviewed by: hselasky MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D23092
Notes
Notes: svn path=/head/; revision=356554
Diffstat (limited to 'sbin/ifconfig')
-rw-r--r--sbin/ifconfig/iflagg.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sbin/ifconfig/iflagg.c b/sbin/ifconfig/iflagg.c
index 3b9e900605b5..2abd34be19fa 100644
--- a/sbin/ifconfig/iflagg.c
+++ b/sbin/ifconfig/iflagg.c
@@ -114,10 +114,13 @@ setlaggrr_limit(const char *val, int d, int s, const struct afswtch *afp)
bzero(&ro, sizeof(ro));
strlcpy(ro.ro_ifname, name, sizeof(ro.ro_ifname));
- ro.ro_bkt = (int)strtol(val, NULL, 10);
+ ro.ro_opts = LAGG_OPT_RR_LIMIT;
+ ro.ro_bkt = (uint32_t)strtoul(val, NULL, 10);
+ if (ro.ro_bkt == 0)
+ errx(1, "Invalid round-robin stride: %s", val);
if (ioctl(s, SIOCSLAGGOPTS, &ro) != 0)
- err(1, "SIOCSLAGG");
+ err(1, "SIOCSLAGGOPTS");
}
static void