| 1209 | } |
| 1210 | |
| 1211 | int |
| 1212 | main(int argc, char **argv) |
| 1213 | { |
| 1214 | int ret, af, rt_ent_sz, lookup_ent_sz; |
| 1215 | FILE *fr = NULL; |
| 1216 | FILE *fl = NULL; |
| 1217 | uint8_t depth_lim; |
| 1218 | |
| 1219 | ret = rte_eal_init(argc, argv); |
| 1220 | if (ret < 0) |
| 1221 | rte_panic("Cannot init EAL\n"); |
| 1222 | |
| 1223 | argc -= ret; |
| 1224 | argv += ret; |
| 1225 | |
| 1226 | config.prgname = argv[0]; |
| 1227 | |
| 1228 | parse_opts(argc, argv); |
| 1229 | |
| 1230 | ret = check_config(); |
| 1231 | if (ret != 0) |
| 1232 | rte_exit(-ret, "Bad configuration\n"); |
| 1233 | |
| 1234 | af = ((config.flags & IPV6_FLAG) == 0) ? AF_INET : AF_INET6; |
| 1235 | depth_lim = (af == AF_INET) ? 32 : 128; |
| 1236 | rt_ent_sz = (af == AF_INET) ? sizeof(struct rt_rule_4) : |
| 1237 | sizeof(struct rt_rule_6); |
| 1238 | lookup_ent_sz = (af == AF_INET) ? 4 : 16; |
| 1239 | |
| 1240 | /* Count number of rules in file*/ |
| 1241 | if (config.routes_file != NULL) { |
| 1242 | fr = fopen(config.routes_file, "r"); |
| 1243 | if (fr == NULL) |
| 1244 | rte_exit(-errno, "Can not open file with routes %s\n", |
| 1245 | config.routes_file); |
| 1246 | |
| 1247 | config.nb_routes = 0; |
| 1248 | while (fgets(line, sizeof(line), fr) != NULL) |
| 1249 | config.nb_routes++; |
| 1250 | |
| 1251 | if (config.nb_routes < config.print_fract) |
| 1252 | config.print_fract = config.nb_routes; |
| 1253 | |
| 1254 | rewind(fr); |
| 1255 | } |
| 1256 | |
| 1257 | /* Count number of ip's in file*/ |
| 1258 | if (config.lookup_ips_file != NULL) { |
| 1259 | fl = fopen(config.lookup_ips_file, "r"); |
| 1260 | if (fl == NULL) |
| 1261 | rte_exit(-errno, "Can not open file with ip's %s\n", |
| 1262 | config.lookup_ips_file); |
| 1263 | |
| 1264 | config.nb_lookup_ips = 0; |
| 1265 | while (fgets(line, sizeof(line), fl) != NULL) |
| 1266 | config.nb_lookup_ips++; |
| 1267 | rewind(fl); |
| 1268 | } |
nothing calls this directly
no test coverage detected