--- ebtables-v2.0pre3.001/ebtables.c Fri Apr 19 22:07:46 2002 +++ ebtables-v2.0pre3.002/ebtables.c Fri Apr 19 23:43:05 2002 @@ -62,6 +62,8 @@ { "policy" , required_argument, 0, 'P' }, { "in-interface" , required_argument, 0, 'i' }, { "in-if" , required_argument, 0, 'i' }, + { "logical-in" , required_argument, 0, 1 }, + { "logical-out" , required_argument, 0, 2 }, { "out-interface" , required_argument, 0, 'o' }, { "out-if" , required_argument, 0, 'o' }, { "version" , no_argument , 0, 'V' }, @@ -481,6 +483,16 @@ printf("! "); printf("in-if: %s, ", hlp->in); } + if (hlp->logical_in[0] != '\0') { + if (hlp->invflags & EBT_ILOGICALIN) + printf("! "); + printf("logical in-if: %s, ", hlp->logical_in); + } + if (hlp->logical_out[0] != '\0') { + if (hlp->invflags & EBT_ILOGICALOUT) + printf("! "); + printf("logical out-if: %s, ", hlp->logical_out); + } if (hlp->out[0] != '\0') { if (hlp->invflags & EBT_IOUT) printf("! "); @@ -560,6 +572,8 @@ "--dst -d [!] address : destination mac address\n" "--in-if -i [!] name : network input interface name\n" "--out-if -o [!] name : network output interface name\n" +"--logical-in [!] name : logical bridge input interface name\n" +"--logical-out [!] name : logical bridge output interface name\n" "--version -V : print package version\n" "\n" , prog_name, @@ -1095,15 +1109,17 @@ *flags |= mask; } -#define OPT_COMMAND 0x01 -#define OPT_TABLE 0x02 -#define OPT_IN 0x04 -#define OPT_OUT 0x08 -#define OPT_JUMP 0x10 -#define OPT_PROTOCOL 0x20 -#define OPT_SOURCE 0x40 -#define OPT_DEST 0x80 -#define OPT_ZERO 0x100 +#define OPT_COMMAND 0x01 +#define OPT_TABLE 0x02 +#define OPT_IN 0x04 +#define OPT_OUT 0x08 +#define OPT_JUMP 0x10 +#define OPT_PROTOCOL 0x20 +#define OPT_SOURCE 0x40 +#define OPT_DEST 0x80 +#define OPT_ZERO 0x100 +#define OPT_LOGICALIN 0x200 +#define OPT_LOGICALOUT 0x400 // the main thing int main(int argc, char *argv[]) { @@ -1261,7 +1277,9 @@ break; case 'i': // input interface + case 1 : // logical input interface case 'o': // output interface + case 2 : // logical output interface case 'j': // target case 'p': // net family protocol case 's': // source mac @@ -1287,6 +1305,23 @@ strcpy(new_entry->in, argv[optind - 1]); break; } + if (c == 1) { + check_option(&replace.flags, OPT_LOGICALIN); + if (replace.selected_hook > 2) + print_error("Use logical in-interface " + "only in INPUT, FORWARD and " + "PREROUTING chains"); + if (check_inverse(optarg)) + new_entry->invflags |= EBT_ILOGICALIN; + + if (optind > argc) + print_error("No logical in-interface " + "specified"); + if (strlen(argv[optind - 1]) >= IFNAMSIZ) + print_error("Illegal interfacelength"); + strcpy(new_entry->logical_in, argv[optind - 1]); + break; + } if (c == 'o') { check_option(&replace.flags, OPT_OUT); if (replace.selected_hook < 2) @@ -1304,6 +1339,26 @@ print_error("Illegal interface " "length"); strcpy(new_entry->out, argv[optind - 1]); + break; + } + if (c == 2) { + check_option(&replace.flags, OPT_LOGICALOUT); + if (replace.selected_hook < 2) + print_error("Use logical out-interface " + "only in OUTPUT, FORWARD and " + "POSTROUTING chains"); + if (check_inverse(optarg)) + new_entry->invflags |= EBT_ILOGICALOUT; + + if (optind > argc) + print_error("No logical out-interface " + "specified"); + + if (strlen(argv[optind - 1]) >= IFNAMSIZ) + print_error("Illegal interface " + "length"); + strcpy(new_entry->logical_out, + argv[optind - 1]); break; } if (c == 'j') { --- ebtables-v2.0pre3.001/communication.c Fri Apr 19 22:07:46 2002 +++ ebtables-v2.0pre3.002/communication.c Fri Apr 19 22:57:13 2002 @@ -115,6 +115,10 @@ tmp->ethproto = e->ethproto; memcpy(tmp->in, e->in, sizeof(tmp->in)); memcpy(tmp->out, e->out, sizeof(tmp->out)); + memcpy(tmp->logical_in, e->logical_in, + sizeof(tmp->logical_in)); + memcpy(tmp->logical_out, e->logical_out, + sizeof(tmp->logical_out)); memcpy(tmp->sourcemac, e->sourcemac, sizeof(tmp->sourcemac)); memcpy(tmp->destmac, e->destmac, sizeof(tmp->destmac)); @@ -298,6 +302,10 @@ new->ethproto = e->ethproto; memcpy(new->in, e->in, sizeof(new->in)); memcpy(new->out, e->out, sizeof(new->out)); + memcpy(new->logical_in, e->logical_in, + sizeof(new->logical_in)); + memcpy(new->logical_out, e->logical_out, + sizeof(new->logical_out)); memcpy(new->sourcemac, e->sourcemac, sizeof(new->sourcemac)); memcpy(new->destmac, e->destmac, sizeof(new->destmac)); new->m_list = NULL; --- ebtables-v2.0pre3.001/ebtables.8 Fri Apr 19 22:07:46 2002 +++ ebtables-v2.0pre3.002/ebtables.8 Fri Apr 19 23:28:06 2002 @@ -184,6 +184,14 @@ .B --in-if is an alias for this option. .TP +.BR "--logical-in " "[!] \fIname\fP" +The (logical) bridge interface via which a frame is received (for the +.BR INPUT , +.B FORWARD +and +.B PREROUTING +chains). +.TP .BR "-o, --out-interface " "[!] \fIname\fP" The interface via which a frame is going to be sent (for the .BR OUTPUT , @@ -193,6 +201,15 @@ chains). The flag .B --out-if is an alias for this option. +.TP +.BR "--logical-out " "[!] \fIname\fP" +The (logical) bridge interface via which a frame is going to be sent (for +the +.BR OUTPUT , +.B FORWARD +and +.B POSTROUTING +chains). .TP .BR "-s, --source " "[!] \fIaddress\fP" The source mac address. The flag --- ebtables-v2.0pre3.001/include/ebtables_u.h Wed Apr 10 22:29:01 2002 +++ ebtables-v2.0pre3.002/include/ebtables_u.h Fri Apr 19 22:55:15 2002 @@ -82,7 +82,9 @@ __u32 invflags; __u16 ethproto; __u8 in[IFNAMSIZ]; + __u8 logical_in[IFNAMSIZ]; __u8 out[IFNAMSIZ]; + __u8 logical_out[IFNAMSIZ]; __u8 sourcemac[ETH_ALEN]; __u8 destmac[ETH_ALEN]; struct ebt_u_match_list *m_list;