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

Function table_lookup

tools/ipfw/tables.c:1145–1176  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1143}
1144
1145static void
1146table_lookup(ipfw_obj_header *oh, int ac, char *av[])
1147{
1148 ipfw_obj_tentry xtent;
1149 ipfw_xtable_info xi;
1150 char key[64];
1151 int error;
1152
1153 if (ac == 0)
1154 errx(EX_USAGE, "address required");
1155
1156 strlcpy(key, *av, sizeof(key));
1157
1158 memset(&xi, 0, sizeof(xi));
1159 error = table_do_lookup(oh, key, &xi, &xtent);
1160
1161 switch (error) {
1162 case 0:
1163 break;
1164 case ESRCH:
1165 errx(EX_UNAVAILABLE, "Table %s not found", oh->ntlv.name);
1166 case ENOENT:
1167 errx(EX_UNAVAILABLE, "Entry %s not found", *av);
1168 case ENOTSUP:
1169 errx(EX_UNAVAILABLE, "Table %s algo does not support "
1170 "\"lookup\" method", oh->ntlv.name);
1171 default:
1172 err(EX_OSERR, "getsockopt(IP_FW_TABLE_XFIND)");
1173 }
1174
1175 table_show_entry(&xi, &xtent);
1176}
1177
1178static void
1179tentry_fill_key_type(char *arg, ipfw_obj_tentry *tentry, uint8_t type,

Callers 1

ipfw_table_handlerFunction · 0.70

Calls 4

memsetFunction · 0.85
table_do_lookupFunction · 0.85
table_show_entryFunction · 0.85
strlcpyFunction · 0.50

Tested by

no test coverage detected