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

Function table_do_lookup

tools/ipfw/tables.c:1112–1143  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1110}
1111
1112static int
1113table_do_lookup(ipfw_obj_header *oh, char *key, ipfw_xtable_info *xi,
1114 ipfw_obj_tentry *xtent)
1115{
1116 char xbuf[sizeof(ipfw_obj_header) + sizeof(ipfw_obj_tentry)];
1117 ipfw_obj_tentry *tent;
1118 uint8_t type;
1119 uint32_t vmask;
1120 size_t sz;
1121
1122 memcpy(xbuf, oh, sizeof(*oh));
1123 oh = (ipfw_obj_header *)xbuf;
1124 tent = (ipfw_obj_tentry *)(oh + 1);
1125
1126 memset(tent, 0, sizeof(*tent));
1127 tent->head.length = sizeof(*tent);
1128 tent->idx = 1;
1129
1130 tentry_fill_key(oh, tent, key, 0, &type, &vmask, xi);
1131 oh->ntlv.type = type;
1132
1133 sz = sizeof(xbuf);
1134 if (do_get3(IP_FW_TABLE_XFIND, &oh->opheader, &sz) != 0)
1135 return (errno);
1136
1137 if (sz < sizeof(xbuf))
1138 return (EINVAL);
1139
1140 *xtent = *tent;
1141
1142 return (0);
1143}
1144
1145static void
1146table_lookup(ipfw_obj_header *oh, int ac, char *av[])

Callers 1

table_lookupFunction · 0.85

Calls 4

memsetFunction · 0.85
tentry_fill_keyFunction · 0.85
do_get3Function · 0.85
memcpyFunction · 0.50

Tested by

no test coverage detected