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

Function parse_rt_4

dpdk/app/test-fib/main.c:471–503  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

469}
470
471static int
472parse_rt_4(FILE *f)
473{
474 int ret, i, j = 0;
475 char *s, *sp, *in[RT_NUM];
476 static const char *dlm = " \t\n";
477 int string_tok_nb = RTE_DIM(in);
478 struct rt_rule_4 *rt;
479
480 rt = (struct rt_rule_4 *)config.rt;
481
482 while (fgets(line, sizeof(line), f) != NULL) {
483 s = line;
484 for (i = 0; i != string_tok_nb; i++) {
485 in[i] = strtok_r(s, dlm, &sp);
486 if (in[i] == NULL)
487 return -EINVAL;
488 s = NULL;
489 }
490
491 ret = _inet_net_pton(AF_INET, in[RT_PREFIX], &rt[j].addr);
492 if (ret == -1)
493 return -errno;
494
495 rt[j].addr = rte_be_to_cpu_32(rt[j].addr);
496 rt[j].depth = ret;
497 config.nb_routes_per_depth[ret]++;
498 GET_CB_FIELD(in[RT_NEXTHOP], rt[j].nh, 0,
499 UINT32_MAX, 0);
500 j++;
501 }
502 return 0;
503}
504
505static int
506parse_rt_6(FILE *f)

Callers 1

mainFunction · 0.85

Calls 1

_inet_net_ptonFunction · 0.85

Tested by

no test coverage detected