--- ../patch-o-matic-ng/patchlets/time/iptables/extensions/libipt_time.c.orig 2006-12-04 12:15:20.000000000 +0100 +++ ../patch-o-matic-ng/patchlets/time/iptables/extensions/libipt_time.c 2008-03-14 01:23:54.000000000 +0100 @@ -10,7 +10,7 @@ #include #include -static int globaldays; +static unsigned int globaldays; /* Function which prints out usage message. */ static void @@ -43,17 +43,17 @@ } static struct option opts[] = { - { "timestart", 1, 0, '1' }, - { "timestop", 1, 0, '2' }, - { "days", 1, 0, '3'}, - { "datestart", 1, 0, '4' }, - { "datestop", 1, 0, '5' }, - {0} + { .name = "timestart", .has_arg = 1, .flag = 0, .val = '1' }, + { .name = "timestop", .has_arg = 1, .flag = 0, .val = '2' }, + { .name = "days", .has_arg = 1, .flag = 0, .val = '3'}, + { .name = "datestart", .has_arg = 1, .flag = 0, .val = '4' }, + { .name = "datestop", .has_arg = 1, .flag = 0, .val = '5' }, + { .name = NULL } }; /* Initialize the match. */ static void -init(struct ipt_entry_match *m, unsigned int *nfcache) +init(struct xt_entry_match *m) { struct ipt_time_info *info = (struct ipt_time_info *)m->data; globaldays = 0; @@ -105,7 +105,7 @@ } static int -parse_number(char *str, int num_min, int num_max, int *number) +parse_number(char *str, unsigned int num_min, unsigned int num_max, void *number) { /* if the number starts with 0, replace it with a space else string_to_number() will interpret it as octal !! */ @@ -119,7 +119,7 @@ } static void -parse_time_string(int *hour, int *minute, const char *time) +parse_time_string(unsigned int *hour, unsigned int *minute, const char *time) { char *hours; char *minutes; @@ -151,11 +151,11 @@ /* return 1->ok, return 0->error */ static int -parse_day(int *days, int from, int to, const char *string) +parse_day(unsigned int *days, unsigned int from, unsigned int to, const char *string) { char *dayread; char *days_str[7] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}; - unsigned short int days_of_week[7] = {64, 32, 16, 8, 4, 2, 1}; + unsigned short int days_of_week[7] = {1 << 6, 1 << 5, 1 << 4, 1 << 3, 1 << 2, 1 << 1, 1 << 0}; unsigned int i; dayread = (char *)malloc(4); @@ -179,7 +179,7 @@ } static void -parse_days_string(int *days, const char *daystring) +parse_days_string(unsigned int *days, const char *daystring) { int len; int i=0; @@ -334,12 +334,11 @@ ate an option */ static int parse(int c, char **argv, int invert, unsigned int *flags, - const struct ipt_entry *entry, - unsigned int *nfcache, - struct ipt_entry_match **match) + const void *entry, + struct xt_entry_match **match) { struct ipt_time_info *timeinfo = (struct ipt_time_info *)(*match)->data; - int hours, minutes; + unsigned int hours, minutes; time_t temp_date; switch (c) @@ -425,7 +424,7 @@ print_days(int daynum) { char *days[7] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}; - unsigned short int days_of_week[7] = {64, 32, 16, 8, 4, 2, 1}; + unsigned short int days_of_week[7] = {1 << 6, 1 << 5, 1 << 4, 1 << 3, 1 << 2, 1 << 1, 1 << 0}; unsigned short int i, nbdays=0; for (i=0; i<7; i++) { @@ -467,8 +466,8 @@ /* Prints out the matchinfo. */ static void -print(const struct ipt_ip *ip, - const struct ipt_entry_match *match, +print(const void *ip, + const struct xt_entry_match *match, int numeric) { struct ipt_time_info *time = ((struct ipt_time_info *)match->data); @@ -500,7 +499,7 @@ /* Saves the data in parsable form to stdout. */ static void -save(const struct ipt_ip *ip, const struct ipt_entry_match *match) +save(const void *ip, const struct xt_entry_match *match) { struct ipt_time_info *time = ((struct ipt_time_info *)match->data); int hour_start, hour_stop, minute_start, minute_stop; @@ -528,7 +527,7 @@ /* have to use offsetof() instead of IPT_ALIGN(), since kerneltime must not * be compared when user deletes rule with '-D' */ static -struct iptables_match timestruct = { +struct xtables_match timestruct = { .next = NULL, .name = "time", .version = IPTABLES_VERSION,