* Get physical MAC address
@ 2007-12-31 5:39 Theewara Vorakosit
2008-01-01 23:07 ` Bernd Petrovitsch
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Theewara Vorakosit @ 2007-12-31 5:39 UTC (permalink / raw)
To: linux-kernel
Hello,
I get MAC address from ioctl. However, ifconfig can change this MAC
address. Can I get a real physical MAC address of the NIC?
Thanks,
Theewara
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Get physical MAC address
[not found] <9Gmk2-1M1-5@gated-at.bofh.it>
@ 2007-12-31 11:11 ` Bodo Eggert
0 siblings, 0 replies; 8+ messages in thread
From: Bodo Eggert @ 2007-12-31 11:11 UTC (permalink / raw)
To: Theewara Vorakosit, linux-kernel
Theewara Vorakosit <thvo@hpcnc.cpe.ku.ac.th> wrote:
> I get MAC address from ioctl. However, ifconfig can change this MAC
> address. Can I get a real physical MAC address of the NIC?
First, get a network card having a physical MAC. Most cards have only a
(currently configured) default MAC address, maybe you'll be lucky
with some old ISA cards ...
Then, don't worry about sb changing it, since these cards don't support that.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Get physical MAC address
2007-12-31 5:39 Get physical MAC address Theewara Vorakosit
@ 2008-01-01 23:07 ` Bernd Petrovitsch
2008-01-02 2:12 ` Stephen Hemminger
2008-01-02 2:42 ` Jon Masters
2008-01-02 4:58 ` Matt Domsch
2 siblings, 1 reply; 8+ messages in thread
From: Bernd Petrovitsch @ 2008-01-01 23:07 UTC (permalink / raw)
To: Theewara Vorakosit; +Cc: linux-kernel
On Mon, 2007-12-31 at 12:39 +0700, Theewara Vorakosit wrote:
[...]
> I get MAC address from ioctl. However, ifconfig can change this MAC
> address. Can I get a real physical MAC address of the NIC?
- You can get the initial MAC address right after bootup before anyone
changes it.
- Some (if not many if not all) of the drivers output it on
driver initialization time so you could read it from `dmesg` or
some /var/log/messages or .....
There is no "get initial MAC address" ioctl (but it's not that
complicated to implement it).
Bernd
--
Firmix Software GmbH http://www.firmix.at/
mobil: +43 664 4416156 fax: +43 1 7890849-55
Embedded Linux Development and Services
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Get physical MAC address
2008-01-01 23:07 ` Bernd Petrovitsch
@ 2008-01-02 2:12 ` Stephen Hemminger
0 siblings, 0 replies; 8+ messages in thread
From: Stephen Hemminger @ 2008-01-02 2:12 UTC (permalink / raw)
To: Bernd Petrovitsch; +Cc: linux-kernel
On Wed, 02 Jan 2008 00:07:28 +0100
Bernd Petrovitsch <bernd@firmix.at> wrote:
> On Mon, 2007-12-31 at 12:39 +0700, Theewara Vorakosit wrote:
> [...]
> > I get MAC address from ioctl. However, ifconfig can change this MAC
> > address. Can I get a real physical MAC address of the NIC?
>
> - You can get the initial MAC address right after bootup before anyone
> changes it.
> - Some (if not many if not all) of the drivers output it on
> driver initialization time so you could read it from `dmesg` or
> some /var/log/messages or .....
> There is no "get initial MAC address" ioctl (but it's not that
> complicated to implement it).
>
> Bernd
There is already ethtool interface to get what you want (ETHTOOL_GPERMADDR)
--
Stephen Hemminger <stephen.hemminger@vyatta.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Get physical MAC address
2007-12-31 5:39 Get physical MAC address Theewara Vorakosit
2008-01-01 23:07 ` Bernd Petrovitsch
@ 2008-01-02 2:42 ` Jon Masters
2008-01-02 3:12 ` Kyle Moffett
2008-01-02 4:58 ` Matt Domsch
2 siblings, 1 reply; 8+ messages in thread
From: Jon Masters @ 2008-01-02 2:42 UTC (permalink / raw)
To: Theewara Vorakosit; +Cc: linux-kernel
On Mon, 2007-12-31 at 12:39 +0700, Theewara Vorakosit wrote:
> I get MAC address from ioctl. However, ifconfig can change this MAC
> address. Can I get a real physical MAC address of the NIC?
Forgive me reading into your mail...this smells a bit like some kind of
licensing/compliance thing. Just bear in mind that using the MAC to
verify the identity of a machine is utterly useless and pointless -
anyone can trivially fool your software[0] to see what it "wants".
Jon.
[0] We used to have to do far worse kludgery in college, in order to
prevent the silly powers that be who "banned" network cards other than
those made by one manufacturer from being used on their little network.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Get physical MAC address
2008-01-02 2:42 ` Jon Masters
@ 2008-01-02 3:12 ` Kyle Moffett
0 siblings, 0 replies; 8+ messages in thread
From: Kyle Moffett @ 2008-01-02 3:12 UTC (permalink / raw)
To: Jon Masters; +Cc: Theewara Vorakosit, linux-kernel
On Jan 01, 2008, at 21:42:18, Jon Masters wrote:
> On Mon, 2007-12-31 at 12:39 +0700, Theewara Vorakosit wrote:
>> I get MAC address from ioctl. However, ifconfig can change this
>> MAC address. Can I get a real physical MAC address of the NIC?
>
> Forgive me reading into your mail...this smells a bit like some
> kind of licensing/compliance thing. Just bear in mind that using
> the MAC to verify the identity of a machine is utterly useless and
> pointless - anyone can trivially fool your software[0] to see what
> it "wants".
Not necessarily; I can easily see distros wanting to have a "Restore
defaults" button in their network config windows which also includes
restoring the default MAC address to the NIC. It should also be
pointed out that anybody with one of a selection of re-flashable NICS
(or NICS with removable EEPROMS) can easily change the MAC address on
their NIC. Other alternatives includes renaming eth0 to mynet0 and
creating a downed dummy interface called "eth0" with the desired MAC
addr.
> [0] We used to have to do far worse kludgery in college, in order
> to prevent the silly powers that be who "banned" network cards
> other than those made by one manufacturer from being used on their
> little network.
Well for basically any userspace-level check, all it takes is
somebody who knows ASM and has about 5 minutes to track down the
problematic branch instructions. Then they just have to write a 10-
line GDB script which starts the program, traps the appropriate
instructions, and then changes a "0" to a "1" (or vice versa) before
the conditional branch. On Windows it's vaguely practical (albeit
crash-prone) to load a kernel hack which prevents your program from
being debugged, but under Linux it's effectively impossible
Cheers,
Kyle Moffett
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Get physical MAC address
2007-12-31 5:39 Get physical MAC address Theewara Vorakosit
2008-01-01 23:07 ` Bernd Petrovitsch
2008-01-02 2:42 ` Jon Masters
@ 2008-01-02 4:58 ` Matt Domsch
2008-01-02 9:31 ` Bernd Petrovitsch
2 siblings, 1 reply; 8+ messages in thread
From: Matt Domsch @ 2008-01-02 4:58 UTC (permalink / raw)
To: Theewara Vorakosit; +Cc: linux-kernel
On Mon, Dec 31, 2007 at 12:39:11PM +0700, Theewara Vorakosit wrote:
> Hello,
>
> I get MAC address from ioctl. However, ifconfig can change this MAC
> address. Can I get a real physical MAC address of the NIC?
yes. It's ETHTOOL_GPERMADDR to the ethtool ioctl.
case ETHTOOL_GPERMADDR:
rc = ethtool_get_perm_addr(dev, useraddr);
break;
When the driver is first loaded, before ifconfig can change the MAC
address, the existing (permanent) MAC address is stored away, able to
be retrieved via this ioctl. Jon Wetzel, a Dell intern of a few
summers ago, wrote the code and was able to have it included.
Thanks,
Matt
--
Matt Domsch
Linux Technology Strategist, Dell Office of the CTO
linux.dell.com & www.dell.com/linux
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Get physical MAC address
2008-01-02 4:58 ` Matt Domsch
@ 2008-01-02 9:31 ` Bernd Petrovitsch
0 siblings, 0 replies; 8+ messages in thread
From: Bernd Petrovitsch @ 2008-01-02 9:31 UTC (permalink / raw)
To: Matt Domsch; +Cc: Theewara Vorakosit, linux-kernel, Stephen Hemminger
On Die, 2008-01-01 at 22:58 -0600, Matt Domsch wrote:
> On Mon, Dec 31, 2007 at 12:39:11PM +0700, Theewara Vorakosit wrote:
> > Hello,
> >
> > I get MAC address from ioctl. However, ifconfig can change this MAC
> > address. Can I get a real physical MAC address of the NIC?
>
> yes. It's ETHTOOL_GPERMADDR to the ethtool ioctl.
>
> case ETHTOOL_GPERMADDR:
> rc = ethtool_get_perm_addr(dev, useraddr);
> break;
>
> When the driver is first loaded, before ifconfig can change the MAC
> address, the existing (permanent) MAC address is stored away, able to
> be retrieved via this ioctl. Jon Wetzel, a Dell intern of a few
> summers ago, wrote the code and was able to have it included.
I stand corrected.
Last time I looked for such a thing it didn't exist.
Bernd
--
Firmix Software GmbH http://www.firmix.at/
mobil: +43 664 4416156 fax: +43 1 7890849-55
Embedded Linux Development and Services
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2008-01-02 9:31 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-31 5:39 Get physical MAC address Theewara Vorakosit
2008-01-01 23:07 ` Bernd Petrovitsch
2008-01-02 2:12 ` Stephen Hemminger
2008-01-02 2:42 ` Jon Masters
2008-01-02 3:12 ` Kyle Moffett
2008-01-02 4:58 ` Matt Domsch
2008-01-02 9:31 ` Bernd Petrovitsch
[not found] <9Gmk2-1M1-5@gated-at.bofh.it>
2007-12-31 11:11 ` Bodo Eggert
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox