From 837ab16070f3c26f66b2673f2a62eb9fe7537bbb Mon Sep 17 00:00:00 2001 From: Bart De Schuymer Date: Thu, 6 Jun 2002 17:22:55 +0000 Subject: *** empty log message *** --- .../incremental-patches/ebtables-v2.0pre7.001.diff | 263 +++++++++++++++++++++ 1 file changed, 263 insertions(+) create mode 100644 userspace/patches/incremental-patches/ebtables-v2.0pre7.001.diff (limited to 'userspace/patches/incremental-patches') diff --git a/userspace/patches/incremental-patches/ebtables-v2.0pre7.001.diff b/userspace/patches/incremental-patches/ebtables-v2.0pre7.001.diff new file mode 100644 index 0000000..697b1f9 --- /dev/null +++ b/userspace/patches/incremental-patches/ebtables-v2.0pre7.001.diff @@ -0,0 +1,263 @@ +--- ebtables-v2.0pre6/Makefile Thu May 30 18:39:04 2002 ++++ ebtables-v2.0pre7.001/Makefile Thu Jun 6 19:18:29 2002 +@@ -2,7 +2,7 @@ + + KERNEL_DIR?=/usr/src/linux + PROGNAME:=ebtables +-PROGVERSION:="2.0pre6 (May 2002)" ++PROGVERSION:="2.0pre7 (June 2002)" + + MANDIR?=/usr/local/man + CFLAGS:=-Wall -Wunused +@@ -29,6 +29,7 @@ + + .PHONY: symlink + symlink: ++ rm -f /usr/include/linux + ln -fs $(KERNEL_DIR)/include/linux /usr/include/linux + + communication.o: communication.c include/ebtables_u.h +@@ -53,6 +54,6 @@ + ebtables /etc/ethertypes + + clean: +- -rm -f ebtables ++ rm -f ebtables + rm -f *.o *.c~ + rm -f extensions/*.o extensions/*.c~ +--- ebtables-v2.0pre6/ebtables.c Fri May 3 21:33:55 2002 ++++ ebtables-v2.0pre7.001/ebtables.c Wed Jun 5 21:42:17 2002 +@@ -31,6 +31,7 @@ + #include + #include // the database + #include ++#include + #include + #include "include/ebtables_u.h" + +@@ -349,7 +350,7 @@ + return 0; + } + +-// helper function: processes a line of data from the file /etc/etherproto ++// helper function: processes a line of data from the file /etc/ethertypes + int get_a_line(char *buffer, char *value, FILE *ifp) + { + int i, hlp; +@@ -389,7 +390,7 @@ + break; + } + if (i == 5) return -1; +- /* discard comments at the end of a line */ ++ // discard comments at the end of a line + if (value[i] == '\t' || value[i] == ' ') + while (1) { + hlp = fscanf(ifp, "%c", &anotherhlp); +@@ -493,14 +494,12 @@ + printf("Broadcast"); + goto endsrc; + } +- for (j = 0; j < ETH_ALEN; j++) +- printf("%02x%s", hlp->sourcemac[j], +- (j == ETH_ALEN - 1) ? "" : ":"); ++ printf("%s", ether_ntoa((struct ether_addr *) ++ hlp->sourcemac)); + if (memcmp(hlp->sourcemsk, hlpmsk, 6)) { + printf("/"); +- for (j = 0; j < ETH_ALEN; j++) +- printf("%02x%s", hlp->sourcemsk[j], +- (j == ETH_ALEN - 1) ? "" : ":"); ++ printf("%s", ether_ntoa((struct ether_addr *) ++ hlp->sourcemsk)); + } + endsrc: + printf(", "); +@@ -526,14 +525,12 @@ + printf("Broadcast"); + goto enddst; + } +- for (j = 0; j < ETH_ALEN; j++) +- printf("%02x%s", hlp->destmac[j], +- (j == ETH_ALEN - 1) ? "" : ":"); ++ printf("%s", ether_ntoa((struct ether_addr *) ++ hlp->destmac)); + if (memcmp(hlp->destmsk, hlpmsk, 6)) { + printf("/"); +- for (j = 0; j < ETH_ALEN; j++) +- printf("%02x%s", hlp->destmsk[j], +- (j == ETH_ALEN - 1) ? "" : ":"); ++ printf("%s", ether_ntoa((struct ether_addr *) ++ hlp->destmsk)); + } + enddst: + printf(", "); +@@ -1132,31 +1129,11 @@ + } + + // put the mac address into 6 (ETH_ALEN) bytes +-int getmac(char *from, char *to) +-{ +- int i, tmp; +- char *buffer; +- +- if (strlen(from) != 3 * ETH_ALEN - 1) +- return -1; +- for (i = 1; i < ETH_ALEN; i++) { +- if (from[i*3 - 1] != ':') +- return -1; +- from[i*3 - 1] = '\0'; +- } +- for (i = 0; i < ETH_ALEN; i++) { +- tmp = strtol(from + i*3, &buffer, 16); +- if (*buffer != '\0' || tmp > 255 || tmp < 0) +- return -1; +- to[i] = (unsigned char) tmp; +- } +- return 0; +-} +- + int getmac_and_mask(char *from, char *to, char *mask) + { + char *p; + int i; ++ struct ether_addr *addr; + + if (strcasecmp(from, "Unicast") == 0) { + memcpy(to, mac_type_unicast, ETH_ALEN); +@@ -1175,12 +1152,14 @@ + } + if ( (p = strrchr(from, '/')) != NULL) { + *p = '\0'; +- if (getmac(p + 1, mask)) ++ if (!(addr = ether_aton(p + 1))) + return -1; ++ memcpy(mask, addr, ETH_ALEN); + } else + memset(mask, 0xff, ETH_ALEN); +- if (getmac(from, to)) ++ if (!(addr = ether_aton(from))) + return -1; ++ memcpy(to, addr, ETH_ALEN); + for (i = 0; i < ETH_ALEN; i++) + to[i] &= mask[i]; + return 0; +--- ebtables-v2.0pre6/communication.c Fri May 3 21:08:24 2002 ++++ ebtables-v2.0pre7.001/communication.c Wed Jun 5 20:17:25 2002 +@@ -172,8 +172,9 @@ + // give the data to the kernel + optlen = sizeof(struct ebt_replace) + repl->entries_size; + if (setsockopt(sockfd, IPPROTO_IP, EBT_SO_SET_ENTRIES, repl, optlen)) +- print_error("Couldn't update kernel chains, you probably need " +- "to insmod an extension"); ++ print_error("The kernel doesn't support a certain ebtables" ++ " extension, consider recompiling your kernel or insmod" ++ " the extension"); + } + + // gets executed after deliver_table +@@ -379,9 +380,9 @@ + optlen = sizeof(struct ebt_replace); + strcpy(repl.name, u_repl->name); + if (getsockopt(sockfd, IPPROTO_IP, EBT_SO_GET_INFO, &repl, &optlen)) +- print_error("A kernel module needed by your command is probably" +- " not loaded. Try insmod ebtables or" +- " insmod ebtable_%s", repl.name); ++ print_error("The %s table is not supported by the kernel," ++ " consider recompiling your kernel or try insmod ebt_%s", ++ repl.name, repl.name); + + if ( !(repl.entries = (char *) malloc(repl.entries_size)) ) + print_memory(); +--- ebtables-v2.0pre6/extensions/ebt_nat.c Sat Apr 27 22:31:21 2002 ++++ ebtables-v2.0pre7.001/extensions/ebt_nat.c Wed Jun 5 21:43:11 2002 +@@ -3,6 +3,7 @@ + #include + #include + #include ++#include + #include + #include + #include "../include/ebtables_u.h" +@@ -74,13 +75,15 @@ + { + int i; + struct ebt_nat_info *natinfo = (struct ebt_nat_info *)(*target)->data; ++ struct ether_addr *addr; + + switch (c) { + case NAT_S: + check_option(flags, OPT_SNAT); + to_source_supplied = 1; +- if (getmac(optarg, natinfo->mac)) ++ if (!(addr = ether_aton(optarg))) + print_error("Problem with specified to-source mac"); ++ memcpy(natinfo->mac, addr, ETH_ALEN); + break; + case NAT_S_TARGET: + check_option(flags, OPT_SNAT_TARGET); +@@ -106,14 +109,16 @@ + { + int i; + struct ebt_nat_info *natinfo = (struct ebt_nat_info *)(*target)->data; ++ struct ether_addr *addr; + + switch (c) { + case NAT_D: + check_option(flags, OPT_DNAT); + to_dest_supplied = 1; +- if (getmac(optarg, natinfo->mac)) ++ if (!(addr = ether_aton(optarg))) + print_error("Problem with specified " + "to-destination mac"); ++ memcpy(natinfo->mac, addr, ETH_ALEN); + break; + case NAT_D_TARGET: + check_option(flags, OPT_DNAT_TARGET); +@@ -155,12 +160,9 @@ + const struct ebt_entry_target *target) + { + struct ebt_nat_info *natinfo = (struct ebt_nat_info *)target->data; +- int i; + + printf("snat - to: "); +- for (i = 0; i < ETH_ALEN; i++) +- printf("%02x%s", +- natinfo->mac[i], (i == ETH_ALEN - 1) ? "" : ":"); ++ printf("%s", ether_ntoa((struct ether_addr *)natinfo->mac)); + printf(" --snat-target %s", standard_targets[natinfo->target]); + } + +@@ -168,12 +170,9 @@ + const struct ebt_entry_target *target) + { + struct ebt_nat_info *natinfo = (struct ebt_nat_info *)target->data; +- int i; + + printf("dnat - to: "); +- for (i = 0; i < ETH_ALEN; i++) +- printf("%02x%s", +- natinfo->mac[i], (i == ETH_ALEN - 1) ? "" : ":"); ++ printf("%s", ether_ntoa((struct ether_addr *)natinfo->mac)); + printf(" --dnat-target %s", standard_targets[natinfo->target]); + } + +--- ebtables-v2.0pre6/ChangeLog Mon May 20 13:49:27 2002 ++++ ebtables-v2.0pre7.001/ChangeLog Thu Jun 6 19:22:14 2002 +@@ -1,3 +1,6 @@ ++20020606 ++ * more useful message when the kernel can't find an ebtables module ++ * some minor code clean-up (no real impact). + 20020520 + * update help for -s and -d + * add VLAN in ethertypes +--- ebtables-v2.0pre6/include/ebtables_u.h Fri May 3 21:08:25 2002 ++++ ebtables-v2.0pre7.001/include/ebtables_u.h Wed Jun 5 21:43:27 2002 +@@ -185,7 +185,7 @@ + void get_dbinfo(struct brdb_dbinfo *nr); + void get_db(int len, struct brdb_dbentry *db); + void deliver_allowdb(__u16 *decision); +-int getmac(char *from, char *to); ++int name_to_protocol(char *name); + void check_option(unsigned int *flags, unsigned int mask); + int check_inverse(const char option[]); + #define print_bug(format, args...) \ -- cgit v1.2.3