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

Function ff_rtioctl_old

lib/ff_route.c:1236–1595  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1234
1235#if 0
1236int
1237ff_rtioctl_old(int fibnum, void *data, unsigned *plen, unsigned maxlen)
1238{
1239 struct rt_msghdr *rtm = NULL;
1240 struct rtentry *rt = NULL;
1241 struct rib_head *rnh;
1242 struct rt_addrinfo info;
1243 union sockaddr_union saun;
1244 sa_family_t saf = AF_UNSPEC;
1245 struct sockaddr_storage ss;
1246 struct walkarg w;
1247 int error = 0, alloc_len = 0, len;
1248 struct ifnet *ifp = NULL;
1249
1250#ifdef INET6
1251 struct sockaddr_in6 *sin6;
1252 int i, rti_need_deembed = 0;
1253#endif
1254
1255#define senderr(e) { error = e; goto flush;}
1256
1257 len = *plen;
1258 /*
1259 * Most of current messages are in range 200-240 bytes,
1260 * minimize possible re-allocation on reply using larger size
1261 * buffer aligned on 1k boundaty.
1262 */
1263 alloc_len = roundup2(len, 1024);
1264 if ((rtm = malloc(alloc_len, M_TEMP, M_NOWAIT)) == NULL)
1265 senderr(ENOBUFS);
1266 bcopy(data, (caddr_t)rtm, len);
1267
1268 if (len < sizeof(*rtm) || len != rtm->rtm_msglen)
1269 senderr(EINVAL);
1270
1271 bzero(&info, sizeof(info));
1272 bzero(&w, sizeof(w));
1273
1274 if (rtm->rtm_version != RTM_VERSION)
1275 senderr(EPROTONOSUPPORT);
1276
1277 /*
1278 * Starting from here, it is possible
1279 * to alter original message and insert
1280 * caller PID and error value.
1281 */
1282
1283 rtm->rtm_pid = curproc->p_pid;
1284 info.rti_addrs = rtm->rtm_addrs;
1285
1286 info.rti_mflags = rtm->rtm_inits;
1287 info.rti_rmx = &rtm->rtm_rmx;
1288
1289 /*
1290 * rt_xaddrs() performs s6_addr[2] := sin6_scope_id for AF_INET6
1291 * link-local address because rtrequest requires addresses with
1292 * embedded scope id.
1293 */

Callers

nothing calls this directly

Calls 15

mallocFunction · 0.85
bzeroFunction · 0.85
rib_lookup_infoFunction · 0.85
rib_free_infoFunction · 0.85
lla_rt_outputFunction · 0.85
rt_tables_get_rnhFunction · 0.85
ifa_ifwithnetFunction · 0.85
rt_maskedcopyFunction · 0.85
sa6_recoverscopeFunction · 0.85
ff_os_errnoFunction · 0.85
rt_xaddrsFunction · 0.70
jailed_without_vnetFunction · 0.70

Tested by

no test coverage detected