* [PATCH] SIS900 show warning if bogus MAC address
@ 2009-01-11 8:45 Daniele Venzano
2009-01-11 12:04 ` David Miller
2009-01-12 16:23 ` Stephen Hemminger
0 siblings, 2 replies; 3+ messages in thread
From: Daniele Venzano @ 2009-01-11 8:45 UTC (permalink / raw)
To: netdev; +Cc: akpm, venza
[-- Attachment #1: Type: text/plain, Size: 377 bytes --]
The attached patch modifies the sis900 driver to show a warning at boot
or module load time to show a message when a null MAC address
(00:00:00:00:00:00) is read from the the hardware.
This seems to happen with newer usage of the sis900 chipset, since this
never came up before.
Signed-off-by: Daniele Venzano <venza@brownhat.org>
--
Daniele Venzano
http://www.brownhat.org
[-- Attachment #2: sis900_check_mac.diff --]
[-- Type: text/x-diff, Size: 1092 bytes --]
--- a/drivers/net/sis900.c 2008-12-31 09:15:17.000000000 +0100
+++ b/drivers/net/sis900.c 2008-12-31 09:24:47.000000000 +0100
@@ -382,6 +382,25 @@ static int __devinit sis96x_get_mac_addr
}
/**
+ * sis900_check_mac_addr - Check the MAc adress for validity
+ * @net_dev: the net device that has the address to check
+ *
+ * Return false (0) if the mac address read from the hardware is
+ * composed of all zeros.
+ */
+
+static int __devinit sis900_check_mac_addr(struct net_device *net_dev)
+{
+ int i;
+
+ for (i = 0; i < 6; i++)
+ if (net_dev->dev_addr[i] != 0)
+ return 1;
+
+ return 0;
+}
+
+/**
* sis900_probe - Probe for sis900 device
* @pci_dev: the sis900 pci device
* @pci_id: the pci device ID
@@ -504,6 +523,9 @@ static int __devinit sis900_probe(struct
else
ret = sis900_get_mac_addr(pci_dev, net_dev);
+ if (sis900_check_mac_addr(net_dev) == 0)
+ printk(KERN_WARNING "%s: Read an invalid MAC address, remember to set one manually\n", dev_name);
+
if (ret == 0) {
printk(KERN_WARNING "%s: Cannot read MAC address.\n", dev_name);
ret = -ENODEV;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] SIS900 show warning if bogus MAC address
2009-01-11 8:45 [PATCH] SIS900 show warning if bogus MAC address Daniele Venzano
@ 2009-01-11 12:04 ` David Miller
2009-01-12 16:23 ` Stephen Hemminger
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2009-01-11 12:04 UTC (permalink / raw)
To: venza; +Cc: netdev, akpm
From: Daniele Venzano <venza@brownhat.org>
Date: Sun, 11 Jan 2009 09:45:04 +0100
> The attached patch modifies the sis900 driver to show a warning at boot
> or module load time to show a message when a null MAC address
> (00:00:00:00:00:00) is read from the the hardware.
> This seems to happen with newer usage of the sis900 chipset, since this
> never came up before.
>
> Signed-off-by: Daniele Venzano <venza@brownhat.org>
Choose a random mac address, as other drivers do in this
situation, so that the user ends up with a usable interface.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] SIS900 show warning if bogus MAC address
2009-01-11 8:45 [PATCH] SIS900 show warning if bogus MAC address Daniele Venzano
2009-01-11 12:04 ` David Miller
@ 2009-01-12 16:23 ` Stephen Hemminger
1 sibling, 0 replies; 3+ messages in thread
From: Stephen Hemminger @ 2009-01-12 16:23 UTC (permalink / raw)
To: Daniele Venzano; +Cc: netdev, akpm, venza
On Sun, 11 Jan 2009 09:45:04 +0100
Daniele Venzano <venza@brownhat.org> wrote:
> The attached patch modifies the sis900 driver to show a warning at boot
> or module load time to show a message when a null MAC address
> (00:00:00:00:00:00) is read from the the hardware.
> This seems to happen with newer usage of the sis900 chipset, since this
> never came up before.
>
> Signed-off-by: Daniele Venzano <venza@brownhat.org>
>
> --
> Daniele Venzano
> http://www.brownhat.org
>
/**
+ * sis900_check_mac_addr - Check the MAc adress for validity
+ * @net_dev: the net device that has the address to check
+ *
+ * Return false (0) if the mac address read from the hardware is
+ * composed of all zeros.
+ */
+
+static int __devinit sis900_check_mac_addr(struct net_device *net_dev)
+{
+ int i;
+
+ for (i = 0; i < 6; i++)
+ if (net_dev->dev_addr[i] != 0)
+ return 1;
+
+ return 0;
+}
+
This is a reimplementation of:
return !is_zero_ether_addr(net_dev->dev_addr);
You probably want to use is_valid_ether_addr() instead.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-01-12 16:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-11 8:45 [PATCH] SIS900 show warning if bogus MAC address Daniele Venzano
2009-01-11 12:04 ` David Miller
2009-01-12 16:23 ` Stephen Hemminger
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.