brctl-vlb.diff 18.1 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597
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 ***/