68 if (node->
val && strcmp(node->
val,
"eve-log") == 0) {
71 const char *ethernet =
97 SCLogError(
"Unable to allocate MacSet memory");
117 static inline void MacUpdateEntry(
120 switch (ms->
state[side]) {
129 if (ms->
buf[side] == NULL) {
143 memcpy(ms->
buf[side] + 1, addr,
sizeof(
MacAddr));
157 if (ms->
last[side] > 0) {
162 for (
int i = ms->
last[side] - 1; i >= 0; i--) {
163 uint8_t *addr2 = (uint8_t *)((ms->
buf[side]) + i);
194 static inline int MacSetIterateSide(
198 switch (ms->
state[side]) {
202 ret = IterFunc((uint8_t *)ms->
singles[side], side, data);
208 for (
int i = 0; i < ms->
last[side]; i++) {
209 ret = IterFunc((uint8_t *)ms->
buf[side][i], side, data);
225 ret = MacSetIterateSide(ms, IterFunc,
MAC_SET_SRC, data);
229 return MacSetIterateSide(ms, IterFunc,
MAC_SET_DST, data);
234 switch (ms->
state[side]) {
238 return (uint8_t *)ms->
singles[side];
240 return (uint8_t *)ms->
buf[side][0];
278 size_t total_free = 0;
290 total_free +=
sizeof(*ms);
306 ms->
state[1] = tmp_state;
310 ms->
buf[1] = tmp_buf;
312 int tmp_last = ms->
last[0];
314 ms->
last[1] = tmp_last;
319 static int CheckTest1Membership(uint8_t *addr,
MacSetSide side,
void *data)
321 int *i = (
int *)data;
340 static int MacSetTest01(
void)
344 MacAddr addr1 = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x1 }, addr2 = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x2 },
345 addr3 = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x3 };
372 static int MacSetTest02(
void)
382 for (i = 1; i < 100; i++) {
383 MacAddr addr1 = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x1 }, addr2 = { 0x1, 0x0, 0x0, 0x0, 0x0, 0x2 };
395 static int MacSetTest03(
void)
404 for (uint8_t i = 1; i < 100; i++) {
405 MacAddr addr1 = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x1 }, addr2 = { 0x1, 0x0, 0x0, 0x0, 0x0, 0x1 };
416 static int MacSetTest04(
void)
427 static int MacSetTest05(
void)
437 for (uint8_t i = 1; i < 100; i++) {
438 MacAddr addr1 = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x1 }, addr2 = { 0x1, 0x0, 0x0, 0x0, 0x0, 0x1 };
453 static int MacSetTest06(
void)
464 MacAddr addr1 = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x1 }, addr2 = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x2 },
465 addr3 = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x3 }, addr4 = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x4 };