* [PATCH 2.6] ipconfig accepts any DHCPACK
@ 2004-09-07 21:46 Peter Buckingham
2004-09-07 22:02 ` David S. Miller
0 siblings, 1 reply; 6+ messages in thread
From: Peter Buckingham @ 2004-09-07 21:46 UTC (permalink / raw)
To: davem; +Cc: netdev
Hi David,
I was playing around with using ipconfig to initialise a bunch of
systems and it turns out that the ipconfig code doesn't check to see
whether the ACK is for it or another system. I've just added a simple
check to compare the hardware address of the device to the one in the
packet.
peter
Signed-off-by: Peter Buckingham <peter@pantasys.com>
--- linus-2.6/net/ipv4/ipconfig.c 2004-09-02 14:53:54.000000000 -0700
+++ local_linux/net/ipv4/ipconfig.c 2004-09-02 14:57:49.000000000 -0700
@@ -966,6 +966,12 @@ static int __init ic_bootp_recv(struct s
break;
case DHCPACK:
+ for (i = 0; (dev->dev_addr[i] == b->hw_addr[i])
+ && (i < 16); i++);
+ if (i < 16)
+ goto drop_unlock;
+
/* Yeah! */
break;
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2.6] ipconfig accepts any DHCPACK
2004-09-07 21:46 [PATCH 2.6] ipconfig accepts any DHCPACK Peter Buckingham
@ 2004-09-07 22:02 ` David S. Miller
2004-09-07 22:45 ` Peter Buckingham
0 siblings, 1 reply; 6+ messages in thread
From: David S. Miller @ 2004-09-07 22:02 UTC (permalink / raw)
To: Peter Buckingham; +Cc: netdev
On Tue, 07 Sep 2004 14:46:14 -0700
Peter Buckingham <peter@pantasys.com> wrote:
> I was playing around with using ipconfig to initialise a bunch of
> systems and it turns out that the ipconfig code doesn't check to see
> whether the ACK is for it or another system. I've just added a simple
> check to compare the hardware address of the device to the one in the
> packet.
Just because there are 16 bytes of hw address in the bootp packet
layout doesn't mean the device actually has that many. Please fix
it to use dev->addr_len.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2.6] ipconfig accepts any DHCPACK
2004-09-07 22:45 ` Peter Buckingham
@ 2004-09-07 22:43 ` David S. Miller
2004-09-08 0:12 ` Joe Perches
1 sibling, 0 replies; 6+ messages in thread
From: David S. Miller @ 2004-09-07 22:43 UTC (permalink / raw)
To: Peter Buckingham; +Cc: netdev
On Tue, 07 Sep 2004 15:45:06 -0700
Peter Buckingham <peter@pantasys.com> wrote:
> David S. Miller wrote:
> > Just because there are 16 bytes of hw address in the bootp packet
> > layout doesn't mean the device actually has that many. Please fix
> > it to use dev->addr_len.
> >
>
> is this okay?
yep, looks great, I'll apply it
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2.6] ipconfig accepts any DHCPACK
2004-09-07 22:02 ` David S. Miller
@ 2004-09-07 22:45 ` Peter Buckingham
2004-09-07 22:43 ` David S. Miller
2004-09-08 0:12 ` Joe Perches
0 siblings, 2 replies; 6+ messages in thread
From: Peter Buckingham @ 2004-09-07 22:45 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev
David S. Miller wrote:
> Just because there are 16 bytes of hw address in the bootp packet
> layout doesn't mean the device actually has that many. Please fix
> it to use dev->addr_len.
>
is this okay?
peter
Signed-off-by: Peter Buckingham <peter@pantasys.com>
--- linus-2.6/net/ipv4/ipconfig.c 2004-09-02 14:53:54.000000000 -0700
+++ local_linux/net/ipv4/ipconfig.c 2004-09-07 15:43:39.000000000 -0700
@@ -966,6 +966,11 @@ static int __init ic_bootp_recv(struct s
break;
case DHCPACK:
+ for (i = 0; (dev->dev_addr[i] == b->hw_addr[i])
+ && (i < dev->addr_len); i++);
+ if (i < dev->addr_len)
+ goto drop_unlock;
+
/* Yeah! */
break;
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2.6] ipconfig accepts any DHCPACK
2004-09-07 22:45 ` Peter Buckingham
2004-09-07 22:43 ` David S. Miller
@ 2004-09-08 0:12 ` Joe Perches
2004-09-08 0:18 ` Peter Buckingham
1 sibling, 1 reply; 6+ messages in thread
From: Joe Perches @ 2004-09-08 0:12 UTC (permalink / raw)
To: Peter Buckingham; +Cc: David S Miller, netdev
On Tue, 2004-09-07 at 15:45, Peter Buckingham wrote:
> is this okay?
> + for (i = 0; (dev->dev_addr[i] == b->hw_addr[i])
> + && (i < dev->addr_len); i++);
> + if (i < dev->addr_len)
> + goto drop_unlock;
> +
I had to read that twice.
How about something like:
for (i=0;i<dev->addr_len;i++)
if (dev->dev_addr[i] != b->hw_addr[i])
goto drop_unlock;
or
if (memcmp(dev->dev_addr, b->hw_addr, dev->addr_len)!=0)
goto drop_unlock;
instead?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2.6] ipconfig accepts any DHCPACK
2004-09-08 0:12 ` Joe Perches
@ 2004-09-08 0:18 ` Peter Buckingham
0 siblings, 0 replies; 6+ messages in thread
From: Peter Buckingham @ 2004-09-08 0:18 UTC (permalink / raw)
To: Joe Perches; +Cc: David S Miller, netdev
Joe Perches wrote:
> if (memcmp(dev->dev_addr, b->hw_addr, dev->addr_len)!=0)
> goto drop_unlock;
>
I prefer this one.
Signed-off-by: Peter Buckingham <peter@pantasys.com>
--- linus-2.6/net/ipv4/ipconfig.c 2004-09-02 14:53:54.000000000 -0700
+++ local_linux/net/ipv4/ipconfig.c 2004-09-07 17:16:55.000000000 -0700
@@ -966,6 +966,9 @@ static int __init ic_bootp_recv(struct s
break;
case DHCPACK:
+ if (memcmp(dev->dev_addr, b->hw_addr, dev->addr_len) != 0)
+ goto drop_unlock;
+
/* Yeah! */
break;
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2004-09-08 0:18 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-07 21:46 [PATCH 2.6] ipconfig accepts any DHCPACK Peter Buckingham
2004-09-07 22:02 ` David S. Miller
2004-09-07 22:45 ` Peter Buckingham
2004-09-07 22:43 ` David S. Miller
2004-09-08 0:12 ` Joe Perches
2004-09-08 0:18 ` Peter Buckingham
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).