From: Antoine Martin <antoine@nagafix.co.uk>
To: Antoine Martin <antoine@nagafix.co.uk>
Cc: Jeff Dike <jdike@addtoit.com>,
Blaisorblade <blaisorblade@yahoo.it>,
user-mode-linux-devel@lists.sourceforge.net
Subject: Re: [uml-devel] regression: pcap broken in 2.6.20.x
Date: Fri, 27 Apr 2007 17:46:29 +0100 [thread overview]
Message-ID: <463228E5.6080904@nagafix.co.uk> (raw)
In-Reply-To: <463224F8.6080009@nagafix.co.uk>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
Antoine Martin wrote:
> Jeff Dike wrote:
>> On Fri, Apr 27, 2007 at 04:21:11PM +0100, Antoine Martin wrote:
>>> Question remains as to why the mac address was the same until 2.6.20 and
>>> is now different.
>> We started providing randomized MACs at bootup instead of deriving
>> them from the IP when the interface was brought up. The old behavior
>> broke when distros started bringing interfaces up without assigning
>> IPs to them.
>
>>> Except, pcap doesn't have the option.
>> Hmmm that would be a problem.
> :)
> I've got a patch - coming soon (tm)
Attached.
Not sure which approach is best:
1) this one requires a command line like:
"vmlinux eth0=pcap,eth0,,mac=00:01:02:03:04:05"
- --- a/arch/um/drivers/pcap_kern.c 2007-02-04 18:44:54.000000000 +0000
+++ b/arch/um/drivers/pcap_kern.c 2007-04-27 17:40:15.000000000 +0100
@@ -15,6 +15,7 @@
int promisc;
int optimize;
char *filter;
+ char *mac;
};
void pcap_init(struct net_device *dev, void *data)
@@ -56,17 +57,18 @@
int pcap_setup(char *str, char **mac_out, void *data)
{
struct pcap_init *init = data;
- - char *remain, *host_if = NULL, *options[2] = { NULL, NULL };
+ char *remain, *host_if = NULL, *options[3] = { NULL, NULL, NULL };
int i;
*init = ((struct pcap_init)
{ .host_if = "eth0",
.promisc = 1,
.optimize = 0,
- - .filter = NULL });
+ .filter = NULL,
+ .mac = "00:00:00:00:00:00" });
remain = split_if_spec(str, &host_if, &init->filter,
- - &options[0], &options[1], NULL);
+ &options[0], &options[1], &options[2], NULL);
if(remain != NULL){
printk(KERN_ERR "pcap_setup - Extra garbage on "
"specification : '%s'\n", remain);
@@ -87,6 +89,10 @@
init->optimize = 1;
else if(!strcmp(options[i], "nooptimize"))
init->optimize = 0;
+ else if(!strncmp(options[i], "mac=", 4) &&
strlen(options[i])==21) {
+ strncpy(init->mac, options[i]+4, 17);
+ *mac_out = init->mac;
+ }
else printk("pcap_setup : bad option - '%s'\n", options[i]);
}
2) or this one: which just assumes that the mac address is any option
that isn't [no]promisc or [no]optimize and is 17 characters long (I
don't see much point in doing extra checks since this is check in
setup_ether_xx later on)
- --- /uml/kernels/src/linux-2.6.20.9-amd64/arch/um/drivers/pcap_kern.c
2007-02-04 18:44:54.000000000 +0000
+++ pcap_kern.c 2007-04-27 17:45:31.000000000 +0100
@@ -15,6 +15,7 @@
int promisc;
int optimize;
char *filter;
+ char *mac;
};
void pcap_init(struct net_device *dev, void *data)
@@ -56,17 +57,18 @@
int pcap_setup(char *str, char **mac_out, void *data)
{
struct pcap_init *init = data;
- - char *remain, *host_if = NULL, *options[2] = { NULL, NULL };
+ char *remain, *host_if = NULL, *options[3] = { NULL, NULL, NULL };
int i;
*init = ((struct pcap_init)
{ .host_if = "eth0",
.promisc = 1,
.optimize = 0,
- - .filter = NULL });
+ .filter = NULL,
+ .mac = "00:00:00:00:00:00" });
remain = split_if_spec(str, &host_if, &init->filter,
- - &options[0], &options[1], NULL);
+ &options[0], &options[1], &options[2], NULL);
if(remain != NULL){
printk(KERN_ERR "pcap_setup - Extra garbage on "
"specification : '%s'\n", remain);
@@ -87,6 +89,11 @@
init->optimize = 1;
else if(!strcmp(options[i], "nooptimize"))
init->optimize = 0;
+ else if(strlen(options[i])==17) {
+ //a mac address is always 17 characters long
+ strncpy(init->mac, options[i], 17);
+ *mac_out = init->mac;
+ }
else printk("pcap_setup : bad option - '%s'\n", options[i]);
}
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.3 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGMijlGK2zHPGK1rsRCp1LAJ4wKs6o+Wv8dd2VCUO1Zd9jKKhoywCdF9FK
P6meCx9gwAFlI2+JelLDB7U=
=Yzfw
-----END PGP SIGNATURE-----
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
next prev parent reply other threads:[~2007-04-27 16:46 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-22 18:43 [uml-devel] regression: pcap broken in 2.6.20.x Antoine Martin
2007-04-25 20:48 ` Jeff Dike
2007-04-25 20:59 ` Antoine Martin
2007-04-26 14:12 ` Blaisorblade
2007-04-27 15:10 ` Jeff Dike
2007-04-27 15:21 ` Antoine Martin
2007-04-27 15:28 ` Antoine Martin
2007-04-27 15:50 ` Jeff Dike
2007-04-27 16:29 ` Antoine Martin
2007-04-27 16:46 ` Antoine Martin [this message]
2007-04-27 16:55 ` Antoine Martin
2007-04-27 20:20 ` Jeff Dike
2007-04-30 17:18 ` Antoine Martin
2007-04-30 18:10 ` Jeff Dike
2007-04-30 19:30 ` Antoine Martin
2007-04-30 21:32 ` Jeff Dike
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=463228E5.6080904@nagafix.co.uk \
--to=antoine@nagafix.co.uk \
--cc=blaisorblade@yahoo.it \
--cc=jdike@addtoit.com \
--cc=user-mode-linux-devel@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox