MCPcopy Index your code
hub / github.com/F-Stack/f-stack / lagg_status

Function lagg_status

tools/ifconfig/iflagg.c:216–306  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

214}
215
216static void
217lagg_status(int s)
218{
219 struct lagg_protos lpr[] = LAGG_PROTOS;
220 struct lagg_reqport rpbuf[LAGG_MAX_PORTS];
221 struct lagg_reqall ra;
222 struct lagg_reqopts ro;
223 struct lagg_reqflags rf;
224 struct lacp_opreq *lp;
225 const char *proto = "<unknown>";
226 int i;
227
228 bzero(&ra, sizeof(ra));
229 bzero(&ro, sizeof(ro));
230
231 strlcpy(ra.ra_ifname, name, sizeof(ra.ra_ifname));
232 ra.ra_size = sizeof(rpbuf);
233 ra.ra_port = rpbuf;
234
235 strlcpy(ro.ro_ifname, name, sizeof(ro.ro_ifname));
236 ioctl(s, SIOCGLAGGOPTS, &ro);
237
238 strlcpy(rf.rf_ifname, name, sizeof(rf.rf_ifname));
239 if (ioctl(s, SIOCGLAGGFLAGS, &rf) != 0)
240 rf.rf_flags = 0;
241
242 if (ioctl(s, SIOCGLAGG, &ra) == 0) {
243 lp = (struct lacp_opreq *)&ra.ra_lacpreq;
244
245 for (i = 0; i < nitems(lpr); i++) {
246 if (ra.ra_proto == lpr[i].lpr_proto) {
247 proto = lpr[i].lpr_name;
248 break;
249 }
250 }
251
252 printf("\tlaggproto %s", proto);
253 if (rf.rf_flags & LAGG_F_HASHMASK) {
254 const char *sep = "";
255
256 printf(" lagghash ");
257 if (rf.rf_flags & LAGG_F_HASHL2) {
258 printf("%sl2", sep);
259 sep = ",";
260 }
261 if (rf.rf_flags & LAGG_F_HASHL3) {
262 printf("%sl3", sep);
263 sep = ",";
264 }
265 if (rf.rf_flags & LAGG_F_HASHL4) {
266 printf("%sl4", sep);
267 sep = ",";
268 }
269 }
270 putchar('\n');
271 if (verbose) {
272 printf("\tlagg options:\n");
273 printb("\t\tflags", ro.ro_opts, LAGG_OPT_BITS);

Callers

nothing calls this directly

Calls 7

bzeroFunction · 0.85
putcharFunction · 0.85
lacp_format_peerFunction · 0.85
printbFunction · 0.70
strlcpyFunction · 0.50
ioctlFunction · 0.50
printfFunction · 0.50

Tested by

no test coverage detected