MCPcopy Create free account
hub / github.com/F-Stack/f-stack / setnd6defif

Function setnd6defif

tools/ifconfig/af_nd6.c:113–144  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

111}
112
113void
114setnd6defif(const char *dummyaddr __unused,
115 int d, int s,
116 const struct afswtch *afp)
117{
118 struct in6_ndifreq ndifreq;
119 int ifindex;
120 int error;
121
122 memset(&ndifreq, 0, sizeof(ndifreq));
123 strlcpy(ndifreq.ifname, ifr.ifr_name, sizeof(ndifreq.ifname));
124
125 if (d < 0) {
126 if (isnd6defif(s)) {
127 /* ifindex = 0 means to remove default if */
128 ifindex = 0;
129 } else
130 return;
131 } else if ((ifindex = if_nametoindex(ndifreq.ifname)) == 0) {
132 warn("if_nametoindex(%s)", ndifreq.ifname);
133 return;
134 }
135
136 ndifreq.ifindex = ifindex;
137#ifndef FSTACK
138 error = ioctl(s, SIOCSDEFIFACE_IN6, (caddr_t)&ndifreq);
139#else
140 error = ioctl_va(s, SIOCSDEFIFACE_IN6, (caddr_t)&ndifreq, 1, AF_INET6);
141#endif
142 if (error)
143 warn("ioctl(SIOCSDEFIFACE_IN6)");
144}
145
146static int
147isnd6defif(int s)

Callers

nothing calls this directly

Calls 6

memsetFunction · 0.85
isnd6defifFunction · 0.85
if_nametoindexFunction · 0.85
ioctl_vaFunction · 0.85
strlcpyFunction · 0.50
ioctlFunction · 0.50

Tested by

no test coverage detected