Changeset View
Changeset View
Standalone View
Standalone View
sbin/ifconfig/iflagg.c
Show First 20 Lines • Show All 213 Lines • ▼ Show 20 Lines | lacp_format_peer(struct lacp_opreq *req, const char *sep) | ||||
return(lacpbuf); | return(lacpbuf); | ||||
} | } | ||||
static void | static void | ||||
lagg_status(int s) | lagg_status(int s) | ||||
{ | { | ||||
struct lagg_protos protos[] = LAGG_PROTOS; | struct lagg_protos protos[] = LAGG_PROTOS; | ||||
ifconfig_handle_t *lifh; | |||||
struct ifconfig_lagg_status *lagg; | struct ifconfig_lagg_status *lagg; | ||||
struct lagg_reqall *ra; | struct lagg_reqall *ra; | ||||
struct lagg_reqflags *rf; | struct lagg_reqflags *rf; | ||||
struct lagg_reqopts *ro; | struct lagg_reqopts *ro; | ||||
struct lagg_reqport *ports; | struct lagg_reqport *ports; | ||||
struct lacp_opreq *lp; | struct lacp_opreq *lp; | ||||
const char *proto; | const char *proto; | ||||
lifh = ifconfig_open(); | if (ifconfig_lagg_get_lagg_status(lifh, name, &lagg) == -1) | ||||
if (lifh == NULL) | |||||
return; | return; | ||||
if (ifconfig_lagg_get_lagg_status(lifh, name, &lagg) == -1) | |||||
goto close; | |||||
ra = lagg->ra; | ra = lagg->ra; | ||||
rf = lagg->rf; | rf = lagg->rf; | ||||
ro = lagg->ro; | ro = lagg->ro; | ||||
ports = ra->ra_port; | ports = ra->ra_port; | ||||
proto = "<unknown>"; | proto = "<unknown>"; | ||||
for (size_t i = 0; i < nitems(protos); ++i) { | for (size_t i = 0; i < nitems(protos); ++i) { | ||||
if (ra->ra_proto == protos[i].lpr_proto) { | if (ra->ra_proto == protos[i].lpr_proto) { | ||||
▲ Show 20 Lines • Show All 46 Lines • ▼ Show 20 Lines | if (verbose && ra->ra_proto == LAGG_PROTO_LACP) | ||||
printb(" state", lp->actor_state, LACP_STATE_BITS); | printb(" state", lp->actor_state, LACP_STATE_BITS); | ||||
putchar('\n'); | putchar('\n'); | ||||
if (verbose && ra->ra_proto == LAGG_PROTO_LACP) | if (verbose && ra->ra_proto == LAGG_PROTO_LACP) | ||||
printf("\t\t%s\n", | printf("\t\t%s\n", | ||||
lacp_format_peer(lp, "\n\t\t ")); | lacp_format_peer(lp, "\n\t\t ")); | ||||
} | } | ||||
ifconfig_lagg_free_lagg_status(lagg); | ifconfig_lagg_free_lagg_status(lagg); | ||||
close: | |||||
ifconfig_close(lifh); | |||||
} | } | ||||
static | static | ||||
DECL_CMD_FUNC(setlaggtype, arg, d) | DECL_CMD_FUNC(setlaggtype, arg, d) | ||||
{ | { | ||||
static const struct lagg_types lt[] = LAGG_TYPES; | static const struct lagg_types lt[] = LAGG_TYPES; | ||||
int i; | int i; | ||||
▲ Show 20 Lines • Show All 53 Lines • Show Last 20 Lines |