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);
183 uint16_t ctr_src, uint16_t ctr_dst)
200 switch (ms->
state[side]) {
204 ret = IterFunc((uint8_t*) ms->
singles[side], side, data);
210 for (
int i = 0; i < ms->
last[side]; i++) {
211 ret = IterFunc((uint8_t*) ms->
buf[side][i], side, data);
227 ret = MacSetIterateSide(ms, IterFunc,
MAC_SET_SRC, data);
231 return MacSetIterateSide(ms, IterFunc,
MAC_SET_DST, data);
236 switch (ms->
state[side]) {
240 return (uint8_t *)ms->
singles[side];
242 return (uint8_t *)ms->
buf[side][0];
280 size_t total_free = 0;
292 total_free +=
sizeof(*ms);
298 static int CheckTest1Membership(uint8_t *addr,
MacSetSide side,
void *data)
300 int *i = (
int*) data;
303 if (addr[5] != 1)
return 1;
306 if (addr[5] != 2)
return 1;
309 if (addr[5] != 3)
return 1;
316 static int MacSetTest01(
void)
320 MacAddr addr1 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x1},
321 addr2 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x2},
322 addr3 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x3};
349 static int MacSetTest02(
void)
359 for (i = 1; i < 100; i++) {
360 MacAddr addr1 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x1},
361 addr2 = {0x1, 0x0, 0x0, 0x0, 0x0, 0x2};
373 static int MacSetTest03(
void)
382 for (uint8_t i = 1; i < 100; i++) {
383 MacAddr addr1 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x1},
384 addr2 = {0x1, 0x0, 0x0, 0x0, 0x0, 0x1};
395 static int MacSetTest04(
void)
406 static int MacSetTest05(
void)
416 for (uint8_t i = 1; i < 100; i++) {
417 MacAddr addr1 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x1},
418 addr2 = {0x1, 0x0, 0x0, 0x0, 0x0, 0x1};
433 static int MacSetTest06(
void)
444 MacAddr addr1 = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x1 }, addr2 = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x2 },
445 addr3 = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x3 }, addr4 = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x4 };