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

Function setdefif

tools/ndp/ndp.c:1377–1401  ·  view source on GitHub ↗

XXX: check SIOCGDEFIFACE_IN6 as well? */

Source from the content-addressed store, hash-verified

1375
1376#ifdef SIOCSDEFIFACE_IN6 /* XXX: check SIOCGDEFIFACE_IN6 as well? */
1377static void
1378setdefif(char *ifname)
1379{
1380 struct in6_ndifreq ndifreq;
1381 unsigned int ifindex;
1382 int sock;
1383
1384 if (strcasecmp(ifname, "delete") == 0)
1385 ifindex = 0;
1386 else {
1387 if ((ifindex = if_nametoindex(ifname)) == 0)
1388 err(1, "failed to resolve i/f index for %s", ifname);
1389 }
1390
1391 if ((sock = socket(AF_INET6, SOCK_DGRAM, 0)) < 0)
1392 err(1, "socket");
1393
1394 strlcpy(ndifreq.ifname, "lo0", sizeof(ndifreq.ifname)); /* dummy */
1395 ndifreq.ifindex = ifindex;
1396
1397 if (ioctl(sock, SIOCSDEFIFACE_IN6, (caddr_t)&ndifreq) < 0)
1398 err(1, "ioctl(SIOCSDEFIFACE_IN6)");
1399
1400 close(sock);
1401}
1402
1403static void
1404getdefif()

Callers 1

mainFunction · 0.85

Calls 6

strcasecmpFunction · 0.85
if_nametoindexFunction · 0.85
socketClass · 0.50
strlcpyFunction · 0.50
ioctlFunction · 0.50
closeFunction · 0.50

Tested by

no test coverage detected