| lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 1 | #ifndef _LIBIPT_SET_H | 
|  | 2 | #define _LIBIPT_SET_H | 
|  | 3 |  | 
|  | 4 | #include <sys/types.h> | 
|  | 5 | #include <sys/socket.h> | 
|  | 6 | #include <errno.h> | 
|  | 7 |  | 
|  | 8 | #ifdef DEBUG | 
|  | 9 | #define DEBUGP(x, args...) fprintf(stderr, x, ## args) | 
|  | 10 | #else | 
|  | 11 | #define DEBUGP(x, args...) | 
|  | 12 | #endif | 
|  | 13 |  | 
|  | 14 | static void | 
|  | 15 | parse_bindings(const char *opt_arg, struct ipt_set_info *info) | 
|  | 16 | { | 
|  | 17 | char *saved = strdup(opt_arg); | 
|  | 18 | char *ptr, *tmp = saved; | 
|  | 19 | int i = 0; | 
|  | 20 |  | 
|  | 21 | while (i < (IP_SET_MAX_BINDINGS - 1) && tmp != NULL) { | 
|  | 22 | ptr = strsep(&tmp, ","); | 
|  | 23 | if (strncmp(ptr, "src", 3) == 0) | 
|  | 24 | info->flags[i++] |= IPSET_SRC; | 
|  | 25 | else if (strncmp(ptr, "dst", 3) == 0) | 
|  | 26 | info->flags[i++] |= IPSET_DST; | 
|  | 27 | else | 
|  | 28 | xtables_error(PARAMETER_PROBLEM, | 
|  | 29 | "You must spefify (the comma separated list of) 'src' or 'dst'."); | 
|  | 30 | } | 
|  | 31 |  | 
|  | 32 | if (tmp) | 
|  | 33 | xtables_error(PARAMETER_PROBLEM, | 
|  | 34 | "Can't follow bindings deeper than %i.", | 
|  | 35 | IP_SET_MAX_BINDINGS - 1); | 
|  | 36 |  | 
|  | 37 | free(saved); | 
|  | 38 | } | 
|  | 39 |  | 
|  | 40 | #endif /*_LIBIPT_SET_H*/ |