X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=extensions%2Flibipt_physdev.c;h=b6dae2ac86e8ba2709a0d6c6f1a3e3ebe5d13fdc;hb=6afea0b41dfbc3824956d11d960ad80097218feb;hp=9149d9031588462e3e1ebfcc6733371d1742a540;hpb=f7b70cf9e00324b89b02de213bcd0dde7044d035;p=iptables.git diff --git a/extensions/libipt_physdev.c b/extensions/libipt_physdev.c index 9149d90..b6dae2a 100644 --- a/extensions/libipt_physdev.c +++ b/extensions/libipt_physdev.c @@ -34,45 +34,6 @@ static struct option opts[] = { {0} }; -/* copied from iptables.c */ -static void -parse_interface(const char *arg, char *vianame, unsigned char *mask) -{ - int vialen = strlen(arg); - unsigned int i; - - memset(mask, 0, IFNAMSIZ); - memset(vianame, 0, IFNAMSIZ); - - if (vialen + 1 > IFNAMSIZ) - exit_error(PARAMETER_PROBLEM, - "interface name `%s' must be shorter than IFNAMSIZ" - " (%i)", arg, IFNAMSIZ-1); - - strcpy(vianame, arg); - if (vialen == 0) - memset(mask, 0, IFNAMSIZ); - else if (vianame[vialen - 1] == '+') { - memset(mask, 0xFF, vialen - 1); - memset(mask + vialen - 1, 0, IFNAMSIZ - vialen + 1); - /* Don't remove `+' here! -HW */ - } else { - /* Include nul-terminator in match */ - memset(mask, 0xFF, vialen + 1); - memset(mask + vialen + 1, 0, IFNAMSIZ - vialen - 1); - for (i = 0; vianame[i]; i++) { - if (!isalnum(vianame[i]) - && vianame[i] != '_' - && vianame[i] != '.') { - printf("Warning: wierd character in interface" - " `%s' (No aliases, :, ! or *).\n", - vianame); - break; - } - } - } -} - static void init(struct ipt_entry_match *m, unsigned int *nfcache) { @@ -210,20 +171,19 @@ static void save(const struct ipt_ip *ip, const struct ipt_entry_match *match) printf(" "); } -static -struct iptables_match physdev -= { NULL, - "physdev", - IPTABLES_VERSION, - IPT_ALIGN(sizeof(struct ipt_physdev_info)), - IPT_ALIGN(sizeof(struct ipt_physdev_info)), - &help, - &init, - &parse, - &final_check, - &print, - &save, - opts +static struct iptables_match physdev = { + .next = NULL, + .name = "physdev", + .version = IPTABLES_VERSION, + .size = IPT_ALIGN(sizeof(struct ipt_physdev_info)), + .userspacesize = IPT_ALIGN(sizeof(struct ipt_physdev_info)), + .help = &help, + .init = &init, + .parse = &parse, + .final_check = &final_check, + .print = &print, + .save = &save, + .extra_opts = opts }; void _init(void)