Commit 7025644f authored by Marc Ariberti's avatar Marc Ariberti

* first commit of the new vlanbridge with a little doc to prepare the release

* useful scripts have been added

* the two main file are :
    - vlb-against-linux-2.4.x.diff
    - brctl-vlb.diff

* the first one is a patch for linux 2.4.x kernels
    (only x>=10 have been tested)

* the second one is a patch to the brctl configuration utility,
    it adds configuration options to configure the VLANbridge features.
    The base version is brctl-0.9.3
parent 3608746b
brctl-vlb.tar.gz
bridge-utils
bridge-utils-vlb
bridge-utils-0.9.3.tar.gz
linux*
diff -urN bridge-utils/Makefile bridge-utils-vlb/Makefile
--- bridge-utils/Makefile Fri Jun 22 21:59:02 2001
+++ bridge-utils-vlb/Makefile Sun Oct 28 03:25:56 2001
@@ -14,7 +14,7 @@
brctl/brctld: brctl/brctld.c brctl/brctl.h brctl/brctl_cmd.c brctl/brctl_disp.c libbridge/libbridge.a libbridge/libbridge.h
make -C brctl
-libbridge/libbridge.a: libbridge/if_index.c libbridge/libbridge.h libbridge/libbridge_compat.c libbridge/libbridge_devif.c libbridge/libbridge_if.c libbridge/libbridge_init.c libbridge/libbridge_misc.c libbridge/libbridge_private.h
+libbridge/libbridge.a: libbridge/if_index.c libbridge/libbridge.h libbridge/libbridge_compat.c libbridge/libbridge_devif.c libbridge/libbridge_if.c libbridge/libbridge_init.c libbridge/libbridge_misc.c libbridge/libbridge_private.h libbridge/libbridge_vlb.c
make -C libbridge
misc/bidi: misc/bidi.c
@@ -22,3 +22,6 @@
misc/tap: misc/tap.c
make -C misc
+
+install: brctl/brctl
+ cp brctl/brctl /usr/local/sbin
diff -urN bridge-utils/brctl/brctl.c bridge-utils-vlb/brctl/brctl.c
--- bridge-utils/brctl/brctl.c Fri Jun 22 21:59:02 2001
+++ bridge-utils-vlb/brctl/brctl.c Sat Nov 17 22:23:59 2001
@@ -42,7 +42,23 @@
"\tsetmaxage\t<bridge> <time>\t\tset max message age\n"
"\tsetpathcost\t<bridge> <port> <cost>\tset path cost\n"
"\tsetportprio\t<bridge> <port> <prio>\tset port priority\n"
-"\tstp\t\t<bridge> <state>\tturn stp on/off\n";
+"\tstp\t\t<bridge> <state>\tturn stp on/off\n"
+/*** VLB BEGIN ***/
+"\n"
+"VLANBridge specific commands :\n"
+"\tsetsubnet\t<bridge> <subnet>/<netmask bits> <router mac>\n"
+"\tgetsubnet\t<bridge>\n"
+"\tgetdenylist\t<bridge>\t\tShows the list of denied macs\n"
+"\tflushdenylist\t<bridge>\t\tFlushes the deny list\n"
+"\tadddeny\t\t<bridge> <mac> [<flags>] Add a mac to the deny list\n"
+"\tdeldeny\t\t<bridge> <mac>\t\tRemove a mac from the deny list\n"
+"\tsettimeoutstate\t<bridge> enable|disable\tEnable timeout in the proxy database\n"
+"\tgettimeoutstate\t<bridge>\t\tGet the current timeout state\n"
+"\tgetproxydb\t<bridge>\n"
+"\tsetloglevel\t<bridge> <loglevel>\tSet the desired log level (0=none..7=debug)\n"
+"\tgetloglevel\t<bridge>\n"
+/*** VLB END ***/
+"\n";
void help()
{
diff -urN bridge-utils/brctl/brctl_cmd.c bridge-utils-vlb/brctl/brctl_cmd.c
--- bridge-utils/brctl/brctl_cmd.c Fri Jun 22 21:59:02 2001
+++ bridge-utils-vlb/brctl/brctl_cmd.c Tue Nov 27 14:51:20 2001
@@ -24,13 +24,26 @@
#include <asm/param.h>
#include "libbridge.h"
#include "brctl.h"
+/*** VLB BEGIN ***/
+#include <linux/if_vlb.h>
+/*** VLB END ***/
void br_cmd_addbr(struct bridge *br, char *brname, char *arg1)
{
int err;
- if ((err = br_add_bridge(brname)) == 0)
+/*** VLB BEGIN ***/
+/* if ((err = br_add_bridge(brname)) == 0)
+ return;*/
+ if (strcmp(arg1, "vlanbridge")==0) {
+ err = br_add_bridge(brname, 1);//use vlb on that bridge
+ } else {
+ err = br_add_bridge(brname, 0);
+ }
+ if (err==0) {
return;
+ }
+/*** VLB END ***/
switch (err) {
case EEXIST:
@@ -294,6 +307,237 @@
}
}
+/*** VLB BEGIN ***/
+void br_cmd_set_subnet(struct bridge *br, char *arg0, char *arg1)
+{
+ unsigned int a,b,c,d, netmask_len;
+ unsigned long subnet, netmask;
+ unsigned int h1,h2,h3,h4,h5,h6;
+ struct mac router_addr;
+
+ if (sscanf(arg0,"%u.%u.%u.%u/%u", &a, &b, &c, &d, &netmask_len)<5) {
+ fprintf(stderr,"Invalid argument : %s\n", arg0);
+ return;
+ }
+ if (a>255 || b>255 || c>255 || d>255 || netmask_len>32) {
+ fprintf(stderr,"Invalid subnet definition\n");
+ return;
+ }
+ subnet=(a<<24)+(b<<16)+(c<<8)+d;
+ netmask = ~((1<<(32-netmask_len))-1);
+
+ if (sscanf(arg1,"%x:%x:%x:%x:%x:%x",&h1,&h2,&h3,&h4,&h5,&h6)<6) {
+ fprintf(stderr, "Invalid MAC address : %s\n", arg0);
+ return;
+ }
+ router_addr.addr[0]=h1;
+ router_addr.addr[1]=h2;
+ router_addr.addr[2]=h3;
+ router_addr.addr[3]=h4;
+ router_addr.addr[4]=h5;
+ router_addr.addr[5]=h6;
+
+ br_set_subnet(br, subnet, netmask, router_addr.addr);
+}
+
+void br_cmd_get_subnet(struct bridge *br, char *arg0, char *arg1)
+{
+ unsigned long subnet, netmask;
+ struct mac router_addr;
+ br_get_subnet(br, &subnet, &netmask, router_addr.addr);
+
+ printf("Adresse de rseau : %u.%u.%u.%u\n",
+ (unsigned char)((subnet>>24)&0xff),
+ (unsigned char)((subnet>>16)&0xff),
+ (unsigned char)((subnet>>8)&0xff),
+ (unsigned char)(subnet&0xff) );
+ printf("Masque de rseau : %u.%u.%u.%u\n",
+ (unsigned char)((netmask>>24)&0xff),
+ (unsigned char)((netmask>>16)&0xff),
+ (unsigned char)((netmask>>8)&0xff),
+ (unsigned char)(netmask&0xff) );
+ printf("Addresse MAC du routeur : %02X:%02X:%02X:%02X:%02X:%02X\n",
+ router_addr.addr[0],
+ router_addr.addr[1],
+ router_addr.addr[2],
+ router_addr.addr[3],
+ router_addr.addr[4],
+ router_addr.addr[5] );
+
+}
+
+void br_cmd_add_deny(struct bridge *br, char *arg0, char *arg1)
+{
+ unsigned int h1,h2,h3,h4,h5,h6;
+ unsigned int flags=0;
+ struct mac deny_addr;
+
+ if (sscanf(arg0,"%x:%x:%x:%x:%x:%x",&h1,&h2,&h3,&h4,&h5,&h6)<6) {
+ fprintf(stderr, "Invalid MAC address : %s\n", arg0);
+ return;
+ }
+
+ deny_addr.addr[0]=h1;
+ deny_addr.addr[1]=h2;
+ deny_addr.addr[2]=h3;
+ deny_addr.addr[3]=h4;
+ deny_addr.addr[4]=h5;
+ deny_addr.addr[5]=h6;
+
+ if (arg1!=NULL) {
+ if (!strcmp(arg1,"allow_unicast")) {
+ flags|=VLB_DENY_ALLOW_UNICAST;
+ } else {
+ fprintf(stderr, "Invalid flag \"%s\": supported flags are\n- \"allow_unicast\"\n", arg1);
+ return;
+ }
+ }
+
+ br_add_deny(br, deny_addr.addr, flags);
+}
+
+void br_cmd_del_deny(struct bridge *br, char *arg0, char *arg1)
+{
+ unsigned int h1,h2,h3,h4,h5,h6;
+ struct mac deny_addr;
+
+ if (sscanf(arg0,"%x:%x:%x:%x:%x:%x",&h1,&h2,&h3,&h4,&h5,&h6)<6) {
+ fprintf(stderr, "Invalid MAC address : %s\n", arg0);
+ return;
+ }
+
+ deny_addr.addr[0]=h1;
+ deny_addr.addr[1]=h2;
+ deny_addr.addr[2]=h3;
+ deny_addr.addr[3]=h4;
+ deny_addr.addr[4]=h5;
+ deny_addr.addr[5]=h6;
+
+ br_del_deny(br, deny_addr.addr);
+}
+
+void br_cmd_flush_deny_list(struct bridge *br, char *arg0, char *arg1)
+{
+ br_flush_deny_list(br);
+}
+
+void br_cmd_get_deny_list(struct bridge *br, char *arg0, char *arg1)
+{
+ struct vlb_deny_entry_info list[10];
+ unsigned int size, offset;
+ unsigned int i,num;
+
+ size=br_get_deny_list_size(br);
+ if (size==0) {
+ printf("No MAC adress denied\n");
+ return;
+ }
+ printf("Number of denied MACs : %u\n", size);
+ printf("List of denied mac addresses :\n");
+ for(offset=0;offset<size;offset+=10) {
+ num=br_get_deny_list(br, list, 10, offset);
+ for(i=0;i<num;i++)
+ {
+ printf("%02X:%02X:%02X:%02X:%02X:%02X",
+ list[i].addr[0],
+ list[i].addr[1],
+ list[i].addr[2],
+ list[i].addr[3],
+ list[i].addr[4],
+ list[i].addr[5]);
+ if (list[i].flags & VLB_DENY_ALLOW_UNICAST) {
+ printf("\tallow_unicast");
+ }
+ printf("\n");
+ }
+ }
+}
+
+void br_cmd_set_timeout_state(struct bridge *br, char *arg0, char *arg1)
+{
+ int enable;
+
+ if (arg0==NULL) {
+ printf("Syntax error : should be \"settimeoutstate br0 enable|disable\"\n");
+ return;
+ }
+
+ if (!strcmp(arg0, "enable")) {
+ enable=1;
+ } else {
+ if (!strcmp(arg0, "disable")) {
+ enable=0;
+ } else {
+ printf("Syntax error : should be \"settimeoutstate br0 enable|disable\"\n");
+ return;
+ }
+ }
+
+ br_set_timeout_state(br, enable);
+}
+
+void br_cmd_get_timeout_state(struct bridge *br, char *arg0, char *arg1)
+{
+ if (br_get_timeout_state(br)) {
+ printf("timeout enabled\n");
+ } else {
+ printf("timeout disabled\n");
+ }
+}
+
+void br_cmd_get_proxy_db(struct bridge *br, char *arg0, char *arg1)
+{
+ struct vlb_entry_info list[10];
+ unsigned int size, offset;
+ unsigned int i,num;
+
+ size=br_get_proxy_db_size(br);
+ if (size==0) {
+ printf("Proxy DB empty\n");
+ return;
+ }
+ printf("Size of Proxy DB : %u\n", size);
+ printf("List of known mac addresses :\n");
+ printf("IP\t\tMAC\t\t\tAgeing time\n");
+ for(offset=0;offset<size;offset+=10) {
+ num=br_get_proxy_db(br, list, 10, offset);
+ for(i=0;i<num;i++)
+ {
+ printf("%u.%u.%u.%u\t",
+ (unsigned char)((list[i].ip>>24)&0xff),
+ (unsigned char)((list[i].ip>>16)&0xff),
+ (unsigned char)((list[i].ip>>8)&0xff),
+ (unsigned char)(list[i].ip&0xff) );
+ printf("%02X:%02X:%02X:%02X:%02X:%02X\t",
+ list[i].addr[0],
+ list[i].addr[1],
+ list[i].addr[2],
+ list[i].addr[3],
+ list[i].addr[4],
+ list[i].addr[5] );
+ printf("%lu\n", list[i].ageing_time);
+ }
+ }
+}
+
+void br_cmd_set_log_level(struct bridge *br, char *arg0, char *arg1)
+{
+ int a;
+ if (sscanf(arg0,"%i", &a)<1) {
+ fprintf(stderr,"Invalid argument : %s\n", arg0);
+ return;
+ }
+ br_set_log_level(br, a);
+}
+
+void br_cmd_get_log_level(struct bridge *br, char *arg0, char *arg1)
+{
+ int a;
+ a=br_get_log_level(br);
+ printf("Log level (0=none..7=debug): %i\n", a);
+}
+/*** VLB END***/
+
static struct command commands[] = {
{0, "addbr", br_cmd_addbr},
{1, "addif", br_cmd_addif},
@@ -311,6 +555,19 @@
{1, "showmacs", br_cmd_showmacs},
{1, "showstp", br_cmd_showstp},
{1, "stp", br_cmd_stp},
+/*** VLB BEGIN ***/
+ {1, "setsubnet", br_cmd_set_subnet},
+ {1, "getsubnet", br_cmd_get_subnet},
+ {1, "adddeny", br_cmd_add_deny},
+ {1, "deldeny", br_cmd_del_deny},
+ {1, "flushdenylist", br_cmd_flush_deny_list},
+ {1, "getdenylist", br_cmd_get_deny_list},
+ {1, "settimeoutstate", br_cmd_set_timeout_state},
+ {1, "gettimeoutstate", br_cmd_get_timeout_state},
+ {1, "getproxydb", br_cmd_get_proxy_db},
+ {1, "setloglevel", br_cmd_set_log_level},
+ {1, "getloglevel", br_cmd_get_log_level},
+/*** VLB END ***/
};
struct command *br_command_lookup(char *cmd)
diff -urN bridge-utils/brctl/brctld.c bridge-utils-vlb/brctl/brctld.c
--- bridge-utils/brctl/brctld.c Fri Jun 22 21:59:02 2001
+++ bridge-utils-vlb/brctl/brctld.c Sat Nov 17 22:24:56 2001
@@ -49,6 +49,21 @@
"showstp\t\t\t\t\tshow bridge stp info\n"
"stp\t\t\t<state>\t\tturn stp on/off\n"
"quit\t\t\t\t\texit this session\n"
+/*** VLB BEGIN ***/
+"\n"
+"VLANBridge specific commands :\n"
+"\tsetsubnet\t<bridge> <subnet>/<netmask bits> <router mac>\n"
+"\tgetsubnet\t<bridge>\n"
+"\tgetdenylist\t<bridge>\t\tShows the list of denied macs\n"
+"\tflushdenylist\t<bridge>\t\tFlushes the deny list\n"
+"\tadddeny\t\t<bridge> <mac> [<flags>] Add a mac to the deny list\n"
+"\tdeldeny\t\t<bridge> <mac>\t\tRemove a mac from the deny list\n"
+"\tsettimeoutstate\t<bridge> enable|disable\tEnable timeout in the proxy database\n"
+"\tgettimeoutstate\t<bridge>\t\tGet the current timeout state\n"
+"\tgetproxydb\t<bridge>\n"
+"\tsetloglevel\t<bridge> <loglevel>\tSet the desired log level (0=none..7=debug)\n"
+"\tgetloglevel\t<bridge>\n"
+/*** VLB END ***/
"\n";
void help()
diff -urN bridge-utils/libbridge/Makefile bridge-utils-vlb/libbridge/Makefile
--- bridge-utils/libbridge/Makefile Fri Jun 22 21:59:03 2001
+++ bridge-utils-vlb/libbridge/Makefile Fri Oct 19 14:54:00 2001
@@ -9,8 +9,8 @@
rm -f *.o
rm -f libbridge.a
-libbridge.a: libbridge_compat.o libbridge_devif.o libbridge_if.o libbridge_init.o libbridge_misc.o
- ar rcs libbridge.a libbridge_compat.o libbridge_devif.o libbridge_if.o libbridge_init.o libbridge_misc.o
+libbridge.a: libbridge_compat.o libbridge_devif.o libbridge_if.o libbridge_init.o libbridge_misc.o libbridge_vlb.o
+ ar rcs libbridge.a libbridge_compat.o libbridge_devif.o libbridge_if.o libbridge_init.o libbridge_misc.o libbridge_vlb.o
ranlib libbridge.a
libbridge_compat.o: libbridge_compat.c if_index.c
@@ -27,3 +27,6 @@
libbridge_misc.o: libbridge_misc.c libbridge.h libbridge_private.h
$(CC) $(CFLAGS) -c libbridge_misc.c
+
+libbridge_vlb.o: libbridge_vlb.c libbridge.h libbridge_private.h
+ $(CC) $(CFLAGS) -c libbridge_vlb.c
diff -urN bridge-utils/libbridge/libbridge.h bridge-utils-vlb/libbridge/libbridge.h
--- bridge-utils/libbridge/libbridge.h Fri Jun 22 21:59:03 2001
+++ bridge-utils-vlb/libbridge/libbridge.h Sat Nov 17 22:27:41 2001
@@ -21,6 +21,9 @@
#include <net/if.h>
#include <linux/if_bridge.h>
+/*** VLB BEGIN ***/
+#include <linux/if_vlb.h>
+/*** VLB END ***/
struct bridge;
struct bridge_info;
@@ -102,6 +105,11 @@
struct port_info info;
};
+struct mac
+{
+ unsigned char addr[6];
+};
+
extern struct bridge *bridge_list;
int br_init(void);
@@ -110,7 +118,10 @@
struct port *br_find_port(struct bridge *br, char *portname);
char *br_get_state_name(int state);
-int br_add_bridge(char *brname);
+/*** VLB BEGIN ***/
+//int br_add_bridge(char *brname);
+int br_add_bridge(char *brname, int use_vlb);
+/*** VLB END ***/
int br_del_bridge(char *brname);
int br_add_interface(struct bridge *br, int ifindex);
int br_del_interface(struct bridge *br, int ifindex);
@@ -124,6 +135,21 @@
int br_set_port_priority(struct port *p, int port_priority);
int br_set_path_cost(struct port *p, int path_cost);
int br_read_fdb(struct bridge *br, struct fdb_entry *fdbs, int offset, int num);
+/*** VLB BEGIN ***/
+int br_set_subnet(struct bridge *br, unsigned long subnet, unsigned long netmask, unsigned char *router_addr);
+int br_get_subnet(struct bridge *br, unsigned long *subnet, unsigned long *netmask, unsigned char *router_addr);
+int br_add_deny(struct bridge *br, unsigned char *deny_addr,unsigned int flags);
+int br_del_deny(struct bridge *br, unsigned char *deny_addr);
+int br_flush_deny_list(struct bridge *br);
+int br_get_deny_list_size(struct bridge *br);
+int br_get_deny_list(struct bridge *br, struct vlb_deny_entry_info *buff,long num, long offset);
+int br_set_timeout_state(struct bridge *br, int enable);
+int br_get_timeout_state(struct bridge *br);
+int br_get_proxy_db_size(struct bridge *br);
+int br_get_proxy_db(struct bridge *br, struct vlb_entry_info *buff,long num, long offset);
+int br_set_log_level(struct bridge *br, int log_level);
+int br_get_log_level(struct bridge *br);
+/*** VLB END ***/
/* libc5 combatability */
char *if_indextoname(unsigned int __ifindex, char *__ifname);
diff -urN bridge-utils/libbridge/libbridge_if.c bridge-utils-vlb/libbridge/libbridge_if.c
--- bridge-utils/libbridge/libbridge_if.c Fri Jun 22 21:59:03 2001
+++ bridge-utils-vlb/libbridge/libbridge_if.c Thu Oct 25 14:14:51 2001
@@ -42,12 +42,18 @@
return br_ioctl(BRCTL_GET_VERSION, 0, 0);
}
-int br_add_bridge(char *brname)
+/*** VLB BEGIN ***/
+//int br_add_bridge(char *brname)
+int br_add_bridge(char *brname, int use_vlb)
+/*** VLB END ***/
{
char _br[IFNAMSIZ];
memcpy(_br, brname, IFNAMSIZ);
- if (br_ioctl(BRCTL_ADD_BRIDGE, (unsigned long)_br, 0) < 0)
+/*** VLB BEGIN ***/
+// if (br_ioctl(BRCTL_ADD_BRIDGE, (unsigned long)_br, 0) < 0)
+ if (br_ioctl(BRCTL_ADD_BRIDGE, (unsigned long)_br, use_vlb) < 0)
+/*** VLB END ***/
return errno;
return 0;
diff -urN bridge-utils/libbridge/libbridge_vlb.c bridge-utils-vlb/libbridge/libbridge_vlb.c
--- bridge-utils/libbridge/libbridge_vlb.c Thu Jan 1 01:00:00 1970
+++ bridge-utils-vlb/libbridge/libbridge_vlb.c Sat Nov 17 22:28:45 2001
@@ -0,0 +1,128 @@
+/*** VLB BEGIN ***/
+/*
+ * Copyright (C) 2001
+ * Marc Ariberti <marcari@via.ecp.fr>
+ * Boris Dores <babal@via.ecp.fr>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <string.h>
+#include <sys/fcntl.h>
+#include <sys/ioctl.h>
+#include <sys/time.h>
+#include "libbridge.h"
+#include "libbridge_private.h"
+#include <linux/if_vlb.h>
+
+int br_vlb_ioctl(struct bridge *br, unsigned long arg0, unsigned long arg1, unsigned long arg2, unsigned long arg3)
+{
+ unsigned long args[4];
+ struct ifreq ifr;
+
+ args[0] = arg0;
+ args[1] = arg1;
+ args[2] = arg2;
+ args[3] = arg3;
+
+ memcpy(ifr.ifr_name, br->ifname, IFNAMSIZ);
+ ((unsigned long *)(&ifr.ifr_data))[0] = (unsigned long)args;
+
+ return ioctl(br_socket_fd, SIOCDEVPRIVATE, &ifr);
+}
+
+int br_set_subnet(struct bridge *br, unsigned long subnet, unsigned long netmask, unsigned char * router_addr)
+{
+ if (br_vlb_ioctl(br, BRCTL_VLB_SET_SUBNET, subnet, netmask, (long) router_addr)<0)
+ return errno;
+
+ return 0;
+}
+
+int br_get_subnet(struct bridge *br, unsigned long *subnet, unsigned long *netmask, unsigned char * router_addr)
+{
+ if (br_vlb_ioctl(br, BRCTL_VLB_GET_SUBNET, (long)subnet, (long)netmask, (long) router_addr)<0)
+ return errno;
+
+ return 0;
+}
+
+int br_add_deny(struct bridge *br, unsigned char *deny_addr, unsigned int flags)
+{
+ if (br_vlb_ioctl(br, BRCTL_VLB_ADD_DENY, (long) deny_addr, flags, 0))
+ return errno;
+
+ return 0;
+}
+
+int br_del_deny(struct bridge *br, unsigned char *deny_addr)
+{
+ if (br_vlb_ioctl(br, BRCTL_VLB_DEL_DENY, (long) deny_addr,0,0))
+ return errno;
+
+ return 0;
+}
+
+int br_flush_deny_list(struct bridge *br)
+{
+ if (br_vlb_ioctl(br, BRCTL_VLB_FLUSH_DENY_LIST, 0,0,0))
+ return errno;
+
+ return 0;
+}
+
+int br_get_deny_list_size(struct bridge *br)
+{
+ return br_vlb_ioctl(br, BRCTL_VLB_GET_DENY_LIST_SIZE, 0,0,0);
+}
+
+int br_get_deny_list(struct bridge *br, struct vlb_deny_entry_info *buff,long num, long offset)
+{
+ return br_vlb_ioctl(br, BRCTL_VLB_GET_DENY_LIST, (long)buff, num, offset);
+}
+
+int br_set_timeout_state(struct bridge *br, int enable)
+{
+ return br_vlb_ioctl(br, BRCTL_VLB_SET_TIMEOUT_STATE, enable, 0,0);
+}
+
+int br_get_timeout_state(struct bridge *br)
+{
+ return br_vlb_ioctl(br, BRCTL_VLB_GET_TIMEOUT_STATE, 0,0,0);
+}
+
+int br_get_proxy_db_size(struct bridge *br)
+{
+ return br_vlb_ioctl(br, BRCTL_VLB_GET_PROXY_DB_SIZE, 0,0,0);
+}
+
+int br_get_proxy_db(struct bridge *br, struct vlb_entry_info *buff,long num, long offset)
+{
+ return br_vlb_ioctl(br, BRCTL_VLB_GET_PROXY_DB, (long)buff, num, offset);
+}
+
+int br_set_log_level(struct bridge *br, int log_level)
+{
+ return br_vlb_ioctl(br, BRCTL_VLB_SET_LOG_LEVEL, log_level,0,0);
+}
+
+int br_get_log_level(struct bridge *br)
+{
+ return br_vlb_ioctl(br, BRCTL_VLB_GET_LOG_LEVEL, 0,0,0);
+}
+/*** VLB END ***/
#!/bin/sh
#
# script pour construire le vlb.diff
#
DIR=tmp-vlb-diff
KERNEL=linux-2.4.12
copy()
{
if [ -e $KERNEL/$1 ]
then
cp -Rf "$KERNEL/$1" "$DIR/$KERNEL/$1"
fi
if [ -e $KERNEL-vlb/$1 ]
then
cp -Rf "$KERNEL-vlb/$1" "$DIR/$KERNEL-vlb/$1"
fi
}
cd /usr/src/$KERNEL
make clean > /dev/null
cd /usr/src/$KERNEL-vlb
make clean > /dev/null
cd /usr/src
rm -Rf $DIR
mkdir $DIR
mkdir $DIR/$KERNEL
mkdir $DIR/$KERNEL/net
mkdir $DIR/$KERNEL/include
mkdir $DIR/$KERNEL-vlb
mkdir $DIR/$KERNEL-vlb/net
mkdir $DIR/$KERNEL-vlb/include
copy "include/if_vlb.h"
copy "net/bridge"
copy "net/Config.in"
copy "net/Makefile"
cd $DIR
find . | grep '/\.' | xargs rm -f
diff -urN $KERNEL $KERNEL-vlb > ../vlb-against-linux-2.4.x.diff
cd ..
rm -Rf $DIR
exit 0
/bin/grep ARPWATCH /var/log/syslog.0 |
/bin/sed s/vlanbridge\ kernel\:\ ARPWATCH\ \:\ /-\ / |
/usr/bin/mail -s "[LOG] `/bin/date -d yesterday +%Y-%m-%d` [ARPWATCH]" diffs@via.ecp.fr
***********************************************
************* WARNING *************************
***********************************************
This software comes with absolutely no warranty.
This is software has been developed for network administrators.
If you do not understand what is told in this file, please do
not use VLANBridge, you can completely crash your network
if this is not configured properly.
You should inform yourself about the 802.1Q standard
before reading this document.
***********************************************
The VideoLAN project :
At the begining, the aim of the project was to broadcast high quality
video over a network using the MPEG2/TS standard.
The major problem is the following : How to send several 5Mbps stream over
a network that has 10Mbps terminal connections and a 155Mbps backbone ?
Two solutions appeared :
1 - multicast
2 - broadcast in only one VLAN
The first solution was not possible because the network devices in
the Ecole Centrale Paris did not support multicast at all, but support
very well the VLAN technology. So that one was chosen to be developed.
What is a VLAN ?
~~~~~~~~~~~~~~~~
VLAN means Virtual LAN. These allow to split a physical LAN (i.e. switches
connected together) into virtual LANs.
Here is an example of a 12-ports switch :
+--------------------+
| 111122 222222 |
+--------------------+
The first four ports are in the VLAN 1 and the following ones are in
the VLAN 2.
Packets received on a port in the VLAN 1 will NEVER be sent through a
port in a different VLAN : VLANs are completely isolated.
How VLANs are used by VideoLAN ?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Each stream is broadcasted in a different VLAN and people who want to see
that program just ask the VLANserver to change their port into a different
VLAN so that the switch will transmit the packets to them.
What happens with several switches ?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Let's look at the following example with two switches connected
together using their port number 12.
+--------------------+
| 422222 22222T | Switch-A
+-------------°------+
°
+-------------°------+
| 222222 22244T | Switch-B
+--------------------+
One VideoLAN server is connected on the first port of Switch-A and is
broadcasting a stream (VLAN 4).
One client on port of Switch-B asks for VLAN 4, the channel server
does a SNMP request on the switch and the result is the following :
+--------------------+
| 422222 22222T | Switch-A
+-------------°------+
°
+-------------°------+
| 222224 22244T | Switch-B
+--------------------+
Port 12 of Switch-A and Switch-B are configured to be in all the VLANs
that are needed. When a packet is sent through this port, the Switch
adds to the packet a tag indicating the VLAN which the packet belongs to.
The 802.1Q tagging is supported by the most part of the existing switches.
3com switches have a special tagging called vlt (vlantrunking), those
ports belongs to all the vlans.
So when a switch receives a packet on such a port, it can easily know
where it could send the packet or not.
Switch-A receives the stream on port 1 and sees it is sent in the VLAN 4,
it sends it through the port 12 with the tag 'VLAN 4'. Then Switch-B receives
it and sends it to the ports 6, 10 and 11.
NB: the switch sends the packet to every port because it is a broadcast
packet which is aimed to be received to anyone in the VLAN.
Why a VLANBridge ?
~~~~~~~~~~~~~~~~~~
+--------------------+
| 422222 22222T | Switch-A
+-------------°------+
°