70 if (node->
val && strcmp(node->
val,
"eve-log") == 0) {
73 const char *ethernet =
100 SCLogError(
"Unable to allocate MacSet memory");
120 static inline void MacUpdateEntry(
123 switch (ms->
state[side]) {
132 if (ms->
buf[side] == NULL) {
146 memcpy(ms->
buf[side] + 1, addr,
sizeof(
MacAddr));
160 if (ms->
last[side] > 0) {
165 for (
int i = ms->
last[side] - 1; i >= 0; i--) {
166 uint8_t *addr2 = (uint8_t*) ((ms->
buf[side]) + i);
201 switch (ms->
state[side]) {
205 ret = IterFunc((uint8_t*) ms->
singles[side], side, data);
211 for (
int i = 0; i < ms->
last[side]; i++) {
212 ret = IterFunc((uint8_t*) ms->
buf[side][i], side, data);
228 ret = MacSetIterateSide(ms, IterFunc,
MAC_SET_SRC, data);
232 return MacSetIterateSide(ms, IterFunc,
MAC_SET_DST, data);
237 switch (ms->
state[side]) {
241 return (uint8_t *)ms->
singles[side];
243 return (uint8_t *)ms->
buf[side][0];
281 size_t total_free = 0;
293 total_free +=
sizeof(*ms);
299 static int CheckTest1Membership(uint8_t *addr,
MacSetSide side,
void *data)
301 int *i = (
int*) data;
304 if (addr[5] != 1)
return 1;
307 if (addr[5] != 2)
return 1;
310 if (addr[5] != 3)
return 1;
317 static int MacSetTest01(
void)
321 MacAddr addr1 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x1},
322 addr2 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x2},
323 addr3 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x3};
350 static int MacSetTest02(
void)
360 for (i = 1; i < 100; i++) {
361 MacAddr addr1 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x1},
362 addr2 = {0x1, 0x0, 0x0, 0x0, 0x0, 0x2};
374 static int MacSetTest03(
void)
383 for (uint8_t i = 1; i < 100; i++) {
384 MacAddr addr1 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x1},
385 addr2 = {0x1, 0x0, 0x0, 0x0, 0x0, 0x1};
396 static int MacSetTest04(
void)
407 static int MacSetTest05(
void)
417 for (uint8_t i = 1; i < 100; i++) {
418 MacAddr addr1 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x1},
419 addr2 = {0x1, 0x0, 0x0, 0x0, 0x0, 0x1};
434 static int MacSetTest06(
void)
445 MacAddr addr1 = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x1 }, addr2 = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x2 },
446 addr3 = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x3 }, addr4 = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x4 };