Deleted Added
full compact
iflagg.c (288305) iflagg.c (294615)
1/*-
2 */
3
4#ifndef lint
5static const char rcsid[] =
1/*-
2 */
3
4#ifndef lint
5static const char rcsid[] =
6 "$FreeBSD: head/sbin/ifconfig/iflagg.c 288305 2015-09-27 07:51:18Z ngie $";
6 "$FreeBSD: head/sbin/ifconfig/iflagg.c 294615 2016-01-23 04:18:44Z araujo $";
7#endif /* not lint */
8
9#include <sys/param.h>
10#include <sys/ioctl.h>
11#include <sys/socket.h>
12#include <sys/sockio.h>
13
14#include <stdlib.h>

--- 80 unchanged lines hidden (view full) ---

95 if (ro.ro_flowid_shift & ~LAGG_OPT_FLOWIDSHIFT_MASK)
96 errx(1, "Invalid flowid_shift option: %s", val);
97
98 if (ioctl(s, SIOCSLAGGOPTS, &ro) != 0)
99 err(1, "SIOCSLAGGOPTS");
100}
101
102static void
7#endif /* not lint */
8
9#include <sys/param.h>
10#include <sys/ioctl.h>
11#include <sys/socket.h>
12#include <sys/sockio.h>
13
14#include <stdlib.h>

--- 80 unchanged lines hidden (view full) ---

95 if (ro.ro_flowid_shift & ~LAGG_OPT_FLOWIDSHIFT_MASK)
96 errx(1, "Invalid flowid_shift option: %s", val);
97
98 if (ioctl(s, SIOCSLAGGOPTS, &ro) != 0)
99 err(1, "SIOCSLAGGOPTS");
100}
101
102static void
103setlaggrr_limit(const char *val, int d, int s, const struct afswtch *afp)
104{
105 struct lagg_reqopts ro;
106
107 bzero(&ro, sizeof(ro));
108 strlcpy(ro.ro_ifname, name, sizeof(ro.ro_ifname));
109 ro.ro_bkt = (int)strtol(val, NULL, 10);
110
111 if (ioctl(s, SIOCSLAGGOPTS, &ro) != 0)
112 err(1, "SIOCSLAGG");
113}
114
115static void
103setlaggsetopt(const char *val, int d, int s, const struct afswtch *afp)
104{
105 struct lagg_reqopts ro;
106
107 bzero(&ro, sizeof(ro));
108 ro.ro_opts = d;
109 switch (ro.ro_opts) {
110 case LAGG_OPT_USE_FLOWID:

--- 136 unchanged lines hidden (view full) ---

247 if (isport)
248 printf(" laggdev %s", rp.rp_ifname);
249 putchar('\n');
250 if (verbose) {
251 printf("\tlagg options:\n");
252 printb("\t\tflags", ro.ro_opts, LAGG_OPT_BITS);
253 putchar('\n');
254 printf("\t\tflowid_shift: %d\n", ro.ro_flowid_shift);
116setlaggsetopt(const char *val, int d, int s, const struct afswtch *afp)
117{
118 struct lagg_reqopts ro;
119
120 bzero(&ro, sizeof(ro));
121 ro.ro_opts = d;
122 switch (ro.ro_opts) {
123 case LAGG_OPT_USE_FLOWID:

--- 136 unchanged lines hidden (view full) ---

260 if (isport)
261 printf(" laggdev %s", rp.rp_ifname);
262 putchar('\n');
263 if (verbose) {
264 printf("\tlagg options:\n");
265 printb("\t\tflags", ro.ro_opts, LAGG_OPT_BITS);
266 putchar('\n');
267 printf("\t\tflowid_shift: %d\n", ro.ro_flowid_shift);
268 if (ra.ra_proto == LAGG_PROTO_ROUNDROBIN)
269 printf("\t\trr_limit: %d\n", ro.ro_bkt);
255 printf("\tlagg statistics:\n");
256 printf("\t\tactive ports: %d\n", ro.ro_active);
257 printf("\t\tflapping: %u\n", ro.ro_flapping);
258 if (ra.ra_proto == LAGG_PROTO_LACP) {
259 printf("\tlag id: %s\n",
260 lacp_format_peer(lp, "\n\t\t "));
261 }
262 }

--- 30 unchanged lines hidden (view full) ---

293 DEF_CMD("-lacp_strict", -LAGG_OPT_LACP_STRICT, setlaggsetopt),
294 DEF_CMD("lacp_txtest", LAGG_OPT_LACP_TXTEST, setlaggsetopt),
295 DEF_CMD("-lacp_txtest", -LAGG_OPT_LACP_TXTEST, setlaggsetopt),
296 DEF_CMD("lacp_rxtest", LAGG_OPT_LACP_RXTEST, setlaggsetopt),
297 DEF_CMD("-lacp_rxtest", -LAGG_OPT_LACP_RXTEST, setlaggsetopt),
298 DEF_CMD("lacp_fast_timeout", LAGG_OPT_LACP_TIMEOUT, setlaggsetopt),
299 DEF_CMD("-lacp_fast_timeout", -LAGG_OPT_LACP_TIMEOUT, setlaggsetopt),
300 DEF_CMD_ARG("flowid_shift", setlaggflowidshift),
270 printf("\tlagg statistics:\n");
271 printf("\t\tactive ports: %d\n", ro.ro_active);
272 printf("\t\tflapping: %u\n", ro.ro_flapping);
273 if (ra.ra_proto == LAGG_PROTO_LACP) {
274 printf("\tlag id: %s\n",
275 lacp_format_peer(lp, "\n\t\t "));
276 }
277 }

--- 30 unchanged lines hidden (view full) ---

308 DEF_CMD("-lacp_strict", -LAGG_OPT_LACP_STRICT, setlaggsetopt),
309 DEF_CMD("lacp_txtest", LAGG_OPT_LACP_TXTEST, setlaggsetopt),
310 DEF_CMD("-lacp_txtest", -LAGG_OPT_LACP_TXTEST, setlaggsetopt),
311 DEF_CMD("lacp_rxtest", LAGG_OPT_LACP_RXTEST, setlaggsetopt),
312 DEF_CMD("-lacp_rxtest", -LAGG_OPT_LACP_RXTEST, setlaggsetopt),
313 DEF_CMD("lacp_fast_timeout", LAGG_OPT_LACP_TIMEOUT, setlaggsetopt),
314 DEF_CMD("-lacp_fast_timeout", -LAGG_OPT_LACP_TIMEOUT, setlaggsetopt),
315 DEF_CMD_ARG("flowid_shift", setlaggflowidshift),
316 DEF_CMD_ARG("rr_limit", setlaggrr_limit),
301};
302static struct afswtch af_lagg = {
303 .af_name = "af_lagg",
304 .af_af = AF_UNSPEC,
305 .af_other_status = lagg_status,
306};
307
308static __constructor void
309lagg_ctor(void)
310{
311 int i;
312
313 for (i = 0; i < nitems(lagg_cmds); i++)
314 cmd_register(&lagg_cmds[i]);
315 af_register(&af_lagg);
316}
317};
318static struct afswtch af_lagg = {
319 .af_name = "af_lagg",
320 .af_af = AF_UNSPEC,
321 .af_other_status = lagg_status,
322};
323
324static __constructor void
325lagg_ctor(void)
326{
327 int i;
328
329 for (i = 0; i < nitems(lagg_cmds); i++)
330 cmd_register(&lagg_cmds[i]);
331 af_register(&af_lagg);
332}