Commit Graph
32 Commits
Author SHA1 Message Date
Alastair Tse b2bfd9596f Switch hotplug scripts to use /bin/bash rather than /bin/sh.
Hotplug scripts include certain bash-isms that are not supported under
some distros' default shell (eg. Ubuntu 6.10's use of dash)

Signed-off-by: Alastair Tse <atse@xensource.com>
2007-01-04 14:25:58 +00:00
kaf24@firebug.cl.cam.ac.uk ac85f84b53 [TOOLS] Clean up the network setup scripts. Create some
setup functions and use them everywhere.
Signed-off-by: Gerd Hoffmann <kraxel@suse.de>
2006-06-17 08:40:50 +01:00
kfraser@dhcp93.uk.xensource.com 1a59e1d7a7 network-bridge: fix syntax error
Signed-off-by: Keir Fraser <keir@xensource.com>
2006-06-01 11:25:02 +01:00
kfraser@dhcp93.uk.xensource.com 9ddb2b5be9 network-bridge: Fall back to eth0/xenbr0 if no default route.
From: Dave Lively <dave.lively@gmail.com>
Signed-off-by: Keir Fraser <keir@xensource.com>
2006-06-01 11:18:26 +01:00
cl349@firebug.cl.cam.ac.uk e9f340a6bc Don't require sed to support the -r option.
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
2006-05-19 22:08:32 +01:00
cl349@firebug.cl.cam.ac.uk 8a7ecff138 Make the latest network-bridge tweaks work in a busybox environment too.
Signed-off-by: David Lively <dlively@virtualiron.com>
2006-05-19 22:00:28 +01:00
cl349@firebug.cl.cam.ac.uk 8cc76e4aee Fix network bridge script to select the right interface when bridge already exists.
If the bridge is already configure, the default route will point
to a xenbr interface and not an eth interface.  Handle this case.

Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
2006-05-11 22:39:44 +01:00
cl349@firebug.cl.cam.ac.uk 3bd47fb5b6 Fix code which finds the default interface if there are static routes.
The current code will break if there are multiple scope global routes
since the "ip route list default" command doesn't use "default" as a
filter, and will output multiple devices which breaks the rest of the
script.
Also make the vif/xenbr/eth naming consistent, i.e. if your default
network interface is eth1, you get vif1 and xenbr1.

Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
2006-05-08 10:36:13 +01:00
emellor@leeni.uk.xensource.com 3f3e0cd4be Rather than require config changes if you aren't using eth0, use the
default network device available no matter the name. It can still
be configured if you want a specific network device.

Patch by Bill Nottingham <notting@redhat.com>.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
2006-02-10 02:03:24 +01:00
emellor@leeni.uk.xensource.com 41a061e28d Poll for peth0 coming up before trying to attach it to the bridge. This fixes
a problem seen with tg3's needing some time for auto-negotiation, and so the
script would fail.

Patch courtesy of someone who's name has been lost to history.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
2006-01-10 15:21:00 +00:00
emellor@leeni.uk.xensource.com d8efb64a3a Made network-bridge script work on ALL systems missing ifup/down.
This is done by defining ifup/down both to 'false' when they're
missing; then instead of attempting to parse the IP params from
the kernel command line, we get them from 'ip' instead.  So this
works even with (for example) ip=dhcp on the kernel command line.

Also made a few minor syntax changes (in particular, replaced "=="
with "=", and ">&foo" with ">foo 2>foo") so this works with more
limited shells.

Signed-off-by: Ben Thomas <bjthomas3@gmail.com>
2006-01-10 14:33:00 +00:00
emellor@leeni.uk.xensource.com 72bb6de0e0 Flush the addresses from the new eth0 before trying to add the new address to
it, when using ip on the kernel command line and not using the installed ifup /
ifdown.  This stops the script bailing out if there is already an address
attached to that device, which was leaving the device without routing (since
this has already been removed).

Fix the stop action under the same circumstances.  No attempt was made to
restore the kernel command line details to the interfaces if the ifdown failed
in that case.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-12-08 16:11:48 +00:00
emellor@leeni.uk.xensource.com 946f9a1879 Added link_exists function, for neatness. Check for the existence of the pdev
before issuing the diagnostic about the missing vdev.  Having a pdev but no
vdev is a strong indicator that the network-bridge script has run once already,
and so there is nothing to worry about.  Having the vdev and no corresponding
pdev is still diagnosed.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-11-15 15:54:51 +01:00
kaf24@firebug.cl.cam.ac.uk ea475aded3 nloopbacks default is now 8. So vifnum of greater than 7 requires
an adjustment to nloopbacks. Warning comment updated.

Signed-off-by: Nivedita Singhvi (niv@us.ibm.com)
2005-11-11 10:46:36 +01:00
kaf24@firebug.cl.cam.ac.uk b976b8510a Updates comments in network-bridge, removes dead code, minor typo fixes.
Signed-off-by: Nivedita Singhvi <niv@us.ibm.com>
2005-11-10 11:53:51 +01:00
emellor@leeni.uk.xensource.com 7aa98216f5 Increase the static constant default number of loopback interfaces, nloopbacks,
to 8.  These interfaces are very cheap, so there's no problem having a few
spare.  Anyone with more than 8 NICs can still use the kernel command line or
the module parameter line to pass a larger limit to this module.

Detail the kernel command line parameter for nloopbacks in the diagnostic in
network-bridge.

Closes bug #381.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-11-08 15:15:02 +01:00
emellor@leeni.uk.xensource.com ab6494f226 Fix misnamed call to legacy_mask_to_prefix. Thanks to Tim Moreton for finding
this.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-11-07 12:36:44 +01:00
emellor@leeni.uk.xensource.com 3d511563c0 Diagnostic for hitting the nloopbacks limit. This is presumably the cause of
all the "two bridges don't work" bugs that have been reported (bug #381).

Consideration will be given to raising the default limit -- this is just a
diagnostic of the problem.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-11-07 12:36:35 +01:00
emellor@leeni.uk.xensource.com af374bc7d2 Added xen-script-common.sh, for functions common to all scripts, not just the
hotplug ones.  Added evalVariables and findCommand functions to that, which we
use to clarify the handling of variables being passed in as command line
variables.

Make vif-bridge able to find the bridge for itself if only one bridge is in
use.  This means that it is not necessary to specify a bridge in many
configurations.  Allow the bridge to be specified on the command line, meaning
that a default may be provided in the xend-config.sxp if desired.

Added xenstore_read_default to xen-hotplug-common.sh, which reads from the
store but uses a given default if the path in the store is not present.  This
is used by vif-bridge to allow the store details (i.e. those given to xm create)
to override the default value given in the xend-config.sxp.

Remove vif-bridge setting -- the value can be specified on the vif-script
command line if necessary.

Added examples for network-nat/vif-nat.

Added lots of big comments.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-10-30 13:33:17 +01:00
emellor@leeni.uk.xensource.com 1033d025c4 Moved SuSE-specific getcfg call into a preiftransfer call. The semantics of
this aren't beautiful, but this gets the distro-specific code out of the body
of the network-bridge script and into a common place, while still preserving
the existing code behaviour.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-10-25 11:22:47 +01:00
emellor@leeni.uk.xensource.com e5edf96441 Break common network code in xen-network-common.sh, and common vif hotplugging
code into vif-common.sh.

Fix the antispoofing in network-bridge to allow forwarding from physical
device to bridge, and vif0.0 to eth0.

Change the interface between netback driver and vif hotplugging scripts.  The
mac address and bridge details are read from the store directly by the script,
so that the kernel driver does not need to get involved.

Remove an awful lot of cruft from vif-bridge.  Move the iptables handling into
vif-common.sh, and fix it so that the new vif can get past the antispoofing
entries.  Merge vif-nat and vif-route into this structure too.

Use ip instead of ifconfig to get necessary details.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-10-21 12:06:17 +01:00
emellor@leeni.uk.xensource.com e08da109cd Set antispoof default to yes, as this seems safer, and is the current behaviour
in VifCtl.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-10-20 14:06:07 +01:00
emellor@leeni.uk.xensource.com a77149f8e4 New network-bridge script and associated gubbins.
This is Kurt Garloff's reworked network-bridge script:

* we got rid of ifconfig
* it works for netdev != eth0
* arp on and off are symmetric as are ifdown and ifup
* ifup will be passed the ifcfg config file name if needed
  (the ifup may otherwise figure that the veth0 hardware is
   NOT the same as the original ${netdev} and not use the same
   config -- this happens on SUSE. Charles Coffing tracked this
   one down.)

Plus Kurt's avoid-dash patch:

the network setup scripts on SUSE have trouble with the bridge
name xen-br0; they don't expect the '-'.
Arguably this should be fixed.
But I assume there's more scripts out there which may not like it,
so I suggest the following patch to rename xen-br0 to xenbr0.

Plus Charles Duffy's patch to support multiple bridges:

The attached patch allows the network-bridge script to be used to
generate multiple bridges corresponding to different physical
interfaces. It adds a new parameter, "vifnum", used to refer both to
the loopback interface to be used and to set defaults regarding the
physical interface and bridge name.

Thus, if one wishes to start xenbr0 on eth0 and xenbr1 on eth1, one
need only call:

network-bridge start ## vifnum is 0 by default
network-bridge start vifnum=1

...well, that and set loopback.nloopbacks=2 in the Dom0 kernel
parameters.

Plus renaming of virtnum to vifnum in Charles' patch, as requested by Ian Pratt.

Plus a fix to DevController to allocate vif IDs starting from 0 (i.e. vif2.0
is now domain 2's first vif, as opposed to vif2.1 in the recent past).

Plus tidying up inside network-bridge using some helper variables.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-10-19 16:24:54 +01:00
kaf24@firebug.cl.cam.ac.uk 66041d1b9c Gentoo compatible stuff has to be done *before* the set -e. You could also do
the which in the if with a combination of ! and || after the set -e but I think
it's cleaner to just do it before the set -e.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2005-10-05 19:15:56 +01:00
kaf24@firebug.cl.cam.ac.uk 5b6b39d3e9 Add Gentoo handling to network-bridge. Based on patches
from Jon Mason and Anthony Liguori.
2005-10-05 14:14:04 +01:00
emellor@ewan d02cb884e0 Disable debugging-level output.
Signed-off-by: Ewan Mellor <ewan@xensource.com>
2005-09-21 15:13:26 +01:00
kaf24@firebug.cl.cam.ac.uk 7d4d9ab1dd During my attempts to get the latest bridge networking model working on my
system, I often invoked 'network-bridge stop' with total failure.  Attached 
is an updated version that works.

Signed-off-by: Andrew Theurer <habanero@us.ibm.com>
2005-09-14 16:49:23 +00:00
iap10@freefall.cl.cam.ac.uk 94c199e8fc Make antispoof default to 'no' in network-script as the default in xend is 'no'. Having them different only causes confusion.
Signed-off-by: ian@xensoure.com
2005-08-18 14:17:22 +00:00
iap10@freefall.cl.cam.ac.uk 34ef247301 Another tweak to the network-bridge script.
Signed-off-by: ian@xensource.com
2005-08-17 12:29:34 +00:00
iap10@freefall.cl.cam.ac.uk 8b799c9ee6 Yet another work-around in the network-bridge script
From: Zhai, Edwin [edwin.zhai@intel.com]
Signed-off-by: ian@xensource.com
2005-08-16 20:00:53 +00:00
iap10@firebug.cl.cam.ac.uk 1aa3b010b9 Tweaks to network-bridge script.
Signed-off-by: ian@xensource.com
2005-08-15 21:47:44 +00:00
iap10@freefall.cl.cam.ac.uk 141ec0c639 New 'network-bridge' script that uses ifdown/ifup to configure the interface rather than trying to transfer addresses and routes. (Suggested by Gerd Knorr)
Although Li Ge has had problems with this script he had trouble with the previous too. I think this new one should work for more people, particularly those using DHCP on their primary dom0 interface.

Debugging is currently enabled ("sh -x") so a log of the script's execution is output to /var/log/xend.log

Signed-off-by: ian@xensource.com



--HG--
rename : tools/examples/network => tools/examples/network-bridge
2005-08-13 22:02:54 +00:00