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

Function ff_veth_set_gateway

lib/ff_veth.c:471–502  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

469}
470
471static int
472ff_veth_set_gateway(struct ff_veth_softc *sc, uint32_t fib_num)
473{
474 struct rt_addrinfo info;
475 struct rib_cmd_info rci;
476
477 bzero((caddr_t)&info, sizeof(info));
478 info.rti_flags = RTF_GATEWAY;
479
480 struct sockaddr_in gw;
481 bzero(&gw, sizeof(gw));
482 gw.sin_len = sizeof(gw);
483 gw.sin_family = AF_INET;
484 gw.sin_addr.s_addr = sc->gateway;
485 info.rti_info[RTAX_GATEWAY] = (struct sockaddr *)&gw;
486
487 struct sockaddr_in dst;
488 bzero(&dst, sizeof(dst));
489 dst.sin_len = sizeof(dst);
490 dst.sin_family = AF_INET;
491 dst.sin_addr.s_addr = 0;
492 info.rti_info[RTAX_DST] = (struct sockaddr *)&dst;
493
494 struct sockaddr_in nm;
495 bzero(&nm, sizeof(nm));
496 nm.sin_len = sizeof(nm);
497 nm.sin_family = AF_INET;
498 nm.sin_addr.s_addr = 0;
499 info.rti_info[RTAX_NETMASK] = (struct sockaddr *)&nm;
500
501 return rib_action(fib_num, RTM_ADD, &info, &rci);
502}
503
504static int
505ff_veth_setvaddr(struct ff_veth_softc *sc, struct ff_port_cfg *cfg, const char *if_name)

Callers 1

ff_veth_setup_interfaceFunction · 0.85

Calls 2

bzeroFunction · 0.85
rib_actionFunction · 0.85

Tested by

no test coverage detected