pf-tools commit: r594 [ccaillet-guest] - in /trunk: debian/changelog lib/PFTools/Bridge.pm
parmelan-guest at users.alioth.debian.org
parmelan-guest at users.alioth.debian.org
Tue Apr 29 14:16:19 UTC 2008
Author: ccaillet-guest
Date: Tue Apr 29 14:16:19 2008
New Revision: 594
URL: http://svn.debian.org/wsvn/pf-tools/?sc=1&rev=594
Log:
* Adding commands when creating primary bridge on Bridge.pm (miscallenous
settings on bridge and options on $ETHTRUNK
Modified:
trunk/debian/changelog
trunk/lib/PFTools/Bridge.pm
Modified: trunk/debian/changelog
URL: http://svn.debian.org/wsvn/pf-tools/trunk/debian/changelog?rev=594&op=diff
==============================================================================
--- trunk/debian/changelog (original)
+++ trunk/debian/changelog Tue Apr 29 14:16:19 2008
@@ -50,6 +50,8 @@
* Exporting more functions from Net.pm needed by tool umlaunch
* Adding first version of Bridge.pm for managing bridge for uml or xen or
what is used for virtualization
+ * Adding commands when creating primary bridge on Bridge.pm (miscallenous
+ settings on bridge and options on $ETHTRUNK
[ Thomas Parmelan ]
* lib-net: if no comment is specified in a zone, network or server
@@ -62,7 +64,7 @@
* Merge the remaining changes from 0.32.47-1 and 0.32.48-1.
* Bugfix for hosts without shortname definition.
- -- Christophe Caillet <quadchris at free.fr> Tue, 29 Apr 2008 14:00:13 +0200
+ -- Christophe Caillet <quadchris at free.fr> Tue, 29 Apr 2008 16:14:59 +0200
pf-tools (0.32.48-1) unstable; urgency=low
Modified: trunk/lib/PFTools/Bridge.pm
URL: http://svn.debian.org/wsvn/pf-tools/trunk/lib/PFTools/Bridge.pm?rev=594&op=diff
==============================================================================
--- trunk/lib/PFTools/Bridge.pm (original)
+++ trunk/lib/PFTools/Bridge.pm Tue Apr 29 14:16:19 2008
@@ -29,7 +29,7 @@
|| `which tunctl 2>/dev/null` eq ""
|| `which ip 2>/dev/null` eq "" )
{
- die "Sorry, I need vlan, bridge-utils, uml-utilities and iproute" ;
+ die "Sorry, I need vlan, bridge-utils, uml-utilities and iproute2" ;
}
}
@@ -62,6 +62,7 @@
my $vconf_cmd = '/sbin/vconfig' ;
my $DEBUG = 1 ;
+my $VLAN_MTU = 1496 ;
my $ETHTRUNK = 'eth1' ;
my $XEN_CFG_DIR = '' ;
my $XEN_USER = 'root' ;
@@ -128,15 +129,40 @@
$primary =~ /^br([\d]+)$/ ;
my $tag = $1 ;
+ # Adding bridge
my $cmd = $brctl_cmd." addbr ".$primary ;
if ( ! Sysexec ( $cmd ) ) {
warn "Unable to add primary bridge ".$primary."\n" ;
return 0 ;
}
+ # Setting spanning tree on bridge off
+ if ( ! Sysexec ( $brctl_cmd." stp ".$primary." off " ) ) {
+ warn "Unable to deactivate spanning tree protocol on ".$primary."\n" ;
+ }
+ # Setting some timeout on bridge
+ foreach my $act ( 'setfd', 'sethello' ) {
+ if ( ! Sysexec ( $brctl_cmd." ".$act." ".$primary." 1" ) ) {
+ warn "Unablr to set timeout for action ".$act." on bridge ".$primary."\n" ;
+ }
+ }
+
if ( ! Sysexec ( $ip_cmd." addr show dev ".$ETHTRUNK.".".$tag ) ) {
print "Need to add vlan tagged as ".$tag." on iface ".$ETHTRUNK."\n" ;
+ if ( ! Sysexec ( $vconf_cmd."set_name_type DEV_PLUS_VID_NO_PAD" ) ) {
+ warn "Unable to set_name_type for vconfig creation\n" ;
+ }
if ( ! Sysexec ( $vconf_cmd." add ".$ETHTRUNK." ".$tag ) ) {
warn "Unable to add vlan tagged as ".$tag." on ".$ETHTRUNK."\n" ;
+ return 0 ;
+ }
+ print "Activating promiscuous mode for ".$ETHTRUNK.".".$tag."\n" ;
+ if ( ! Sysexec ( $ip_cmd." link set ".$ETHTRUNK.".".$tag." up promisc on mtu ".$VLAN_MTU ) ) {
+ warn "Unable to set promiscuous mode and mtu on interface ".$ETHTRUNK.".".$tag."\n" ;
+ return 0 ;
+ }
+ print "Setting ip address for ".$ETHTRUNK.".".$tag."\n" ;
+ if ( ! Sysexec ( $ip_cmd." addr add 0.0.0.0 dev ".$ETHTRUNK.".".$tag ) ) {
+ warn "Unable to set ip address for ".$ETHTRUNK.".".$tag."\n" ;
return 0 ;
}
}
More information about the pf-tools-commits
mailing list