aboutsummaryrefslogtreecommitdiffstats
path: root/xenolinux-2.4.21-pre4-sparse
diff options
context:
space:
mode:
authorkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>2003-04-29 15:47:27 +0000
committerkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>2003-04-29 15:47:27 +0000
commit455321c2002fc070889c89f935ec851baa85c60a (patch)
tree66590ae4047cf11fa4f4d5922a21d8530d6ea9b7 /xenolinux-2.4.21-pre4-sparse
parent4e45e54f52b94877c954fa96c2e878398ac1118b (diff)
downloadxen-455321c2002fc070889c89f935ec851baa85c60a.tar.gz
xen-455321c2002fc070889c89f935ec851baa85c60a.tar.bz2
xen-455321c2002fc070889c89f935ec851baa85c60a.zip
bitkeeper revision 1.193 (3eae9e8fDbEyBEL7yKPAlkULZMIM4g)
network.c, dev.c, vif.h, hypervisor-if.h, kernel.c, domain.c: Allow DHCP from domain-0 Xenolinux. Link-local IP addresses are now allocated consecutively from 169.254.1.0.
Diffstat (limited to 'xenolinux-2.4.21-pre4-sparse')
-rw-r--r--xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/network/network.c40
1 files changed, 28 insertions, 12 deletions
diff --git a/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/network/network.c b/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/network/network.c
index 7cf0fecbec..a125695e54 100644
--- a/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/network/network.c
+++ b/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/network/network.c
@@ -470,9 +470,9 @@ static int inetdev_notify(struct notifier_block *this,
(void)HYPERVISOR_network_op(&op);
/*
- * Xen creates a pair of bootstrap rules which allows domain 0 to
- * send and receive any packet. These rules can be removed once we
- * have configured an IP address.
+ * When the first real interface is brought up we delete the start-of-day
+ * bootstrap rules -- they were only installed to allow an initial DHCP
+ * request and response.
*/
if ( (idx == 0) && (event == NETDEV_UP) && !removed_bootstrap_rules )
{
@@ -480,11 +480,9 @@ static int inetdev_notify(struct notifier_block *this,
op.cmd = NETWORK_OP_DELETERULE;
op.u.net_rule.proto = NETWORK_PROTO_ANY;
op.u.net_rule.action = NETWORK_ACTION_ACCEPT;
-
op.u.net_rule.src_vif = 0;
op.u.net_rule.dst_vif = VIF_PHYSICAL_INTERFACE;
(void)HYPERVISOR_network_op(&op);
-
op.u.net_rule.src_vif = VIF_ANY_INTERFACE;
op.u.net_rule.dst_vif = 0;
(void)HYPERVISOR_network_op(&op);
@@ -511,13 +509,32 @@ int __init init_module(void)
INIT_LIST_HEAD(&dev_list);
- /*
- * Domain 0 must poke its own network rules as it discovers its IP
- * addresses. All other domains have a privileged "parent" to do this
- * for them at start of day.
- */
if ( start_info.dom_id == 0 )
+ {
+ /*
+ * Domain 0 creates wildcard rules to allow DHCP to find its first IP
+ * address. These wildcard rules are deleted when the first inet
+ * interface is brought up.
+ */
+ network_op_t op;
+ memset(&op, 0, sizeof(op));
+ op.cmd = NETWORK_OP_ADDRULE;
+ op.u.net_rule.proto = NETWORK_PROTO_ANY;
+ op.u.net_rule.action = NETWORK_ACTION_ACCEPT;
+ op.u.net_rule.src_vif = 0;
+ op.u.net_rule.dst_vif = VIF_PHYSICAL_INTERFACE;
+ (void)HYPERVISOR_network_op(&op);
+ op.u.net_rule.src_vif = VIF_ANY_INTERFACE;
+ op.u.net_rule.dst_vif = 0;
+ (void)HYPERVISOR_network_op(&op);
+
+ /*
+ * Domain 0 must poke its own network rules as it discovers its IP
+ * addresses. All other domains have a privileged "parent" to do this
+ * for them at start of day.
+ */
(void)register_inetaddr_notifier(&notifier_inetdev);
+ }
for ( i = 0; i < MAX_DOMAIN_VIFS; i++ )
{
@@ -548,8 +565,7 @@ int __init init_module(void)
dev->stop = network_close;
dev->get_stats = network_get_stats;
- memset(dev->dev_addr, 0, ETH_ALEN);
- *(unsigned int *)(dev->dev_addr + 1) = i;
+ memcpy(dev->dev_addr, start_info.net_vmac[i], ETH_ALEN);
if ( (err = register_netdev(dev)) != 0 )
{