]> xenbits.xensource.com Git - xenclient/kernel.git/commitdiff
netfront: arp code needs CONFIG_INET.
authorKeir Fraser <keir@xensource.com>
Wed, 31 Oct 2007 09:42:20 +0000 (09:42 +0000)
committerKeir Fraser <keir@xensource.com>
Wed, 31 Oct 2007 09:42:20 +0000 (09:42 +0000)
Signed-off-by: Simon Horman <horms@verge.net.au>
drivers/xen/netfront/netfront.c

index f702a42c898b12986b86ded6200e982bb6f3c1a1..6de06891c4a2792e56ca43b19fd8af81e2cb7dd7 100644 (file)
@@ -221,7 +221,7 @@ static void netif_disconnect_backend(struct netfront_info *);
 static int network_connect(struct net_device *);
 static void network_tx_buf_gc(struct net_device *);
 static void network_alloc_rx_buffers(struct net_device *);
-static int send_fake_arp(struct net_device *);
+static void send_fake_arp(struct net_device *);
 
 static irqreturn_t netif_int(int irq, void *dev_id, struct pt_regs *ptregs);
 
@@ -542,7 +542,7 @@ static void backend_changed(struct xenbus_device *dev,
                if (network_connect(netdev) != 0)
                        break;
                xenbus_switch_state(dev, XenbusStateConnected);
-               (void)send_fake_arp(netdev);
+               send_fake_arp(netdev);
                break;
 
        case XenbusStateClosing:
@@ -557,8 +557,9 @@ static void backend_changed(struct xenbus_device *dev,
  * @param dev device
  * @return 0 on success, error code otherwise
  */
-static int send_fake_arp(struct net_device *dev)
+static void send_fake_arp(struct net_device *dev)
 {
+#ifdef CONFIG_INET
        struct sk_buff *skb;
        u32             src_ip, dst_ip;
 
@@ -567,16 +568,17 @@ static int send_fake_arp(struct net_device *dev)
 
        /* No IP? Then nothing to do. */
        if (src_ip == 0)
-               return 0;
+               return;
 
        skb = arp_create(ARPOP_REPLY, ETH_P_ARP,
                         dst_ip, dev, src_ip,
                         /*dst_hw*/ NULL, /*src_hw*/ NULL,
                         /*target_hw*/ dev->dev_addr);
        if (skb == NULL)
-               return -ENOMEM;
+               return;
 
-       return dev_queue_xmit(skb);
+       dev_queue_xmit(skb);
+#endif
 }
 
 static inline int netfront_tx_slot_available(struct netfront_info *np)
@@ -2098,6 +2100,7 @@ static struct net_device * __devinit create_netdev(struct xenbus_device *dev)
        return ERR_PTR(err);
 }
 
+#ifdef CONFIG_INET
 /*
  * We use this notifier to send out a fake ARP reply to reset switches and
  * router ARP caches when an IP interface is brought up on a VIF.
@@ -2110,11 +2113,18 @@ inetdev_notify(struct notifier_block *this, unsigned long event, void *ptr)
 
        /* UP event and is it one of our devices? */
        if (event == NETDEV_UP && dev->open == network_open)
-               (void)send_fake_arp(dev);
+               send_fake_arp(dev);
 
        return NOTIFY_DONE;
 }
 
+static struct notifier_block notifier_inetdev = {
+       .notifier_call  = inetdev_notify,
+       .next           = NULL,
+       .priority       = 0
+};
+#endif
+
 
 static void netif_disconnect_backend(struct netfront_info *info)
 {
@@ -2168,12 +2178,6 @@ static struct xenbus_driver netfront = {
 };
 
 
-static struct notifier_block notifier_inetdev = {
-       .notifier_call  = inetdev_notify,
-       .next           = NULL,
-       .priority       = 0
-};
-
 static int __init netif_init(void)
 {
        if (!is_running_on_xen())
@@ -2196,7 +2200,9 @@ static int __init netif_init(void)
 
        IPRINTK("Initialising virtual ethernet driver.\n");
 
+#ifdef CONFIG_INET
        (void)register_inetaddr_notifier(&notifier_inetdev);
+#endif
 
        return xenbus_register_frontend(&netfront);
 }
@@ -2208,7 +2214,9 @@ static void __exit netif_exit(void)
        if (is_initial_xendomain())
                return;
 
+#ifdef CONFIG_INET
        unregister_inetaddr_notifier(&notifier_inetdev);
+#endif
 
        netif_exit_accel();