* Re: IPCONFIG fails for BOOTP
@ 2001-08-30 15:32 H . J . Lu
2001-09-25 23:24 ` David S. Miller
0 siblings, 1 reply; 3+ messages in thread
From: H . J . Lu @ 2001-08-30 15:32 UTC (permalink / raw)
To: Ian.Dall; +Cc: Torvalds; Linus, linux kernel, alan
This is the patch I have been using since May.
H.J.
----
--- linux-2.4.5-ac3-ext3/net/ipv4/ipconfig.c.dhcp Tue May 1 20:59:24 2001
+++ linux-2.4.5-ac3-ext3/net/ipv4/ipconfig.c Tue May 29 09:30:16 2001
@@ -816,61 +816,63 @@ static int __init ic_bootp_recv(struct s
u8 *ext;
#ifdef IPCONFIG_DHCP
+ if (ic_proto_enabled & IC_USE_DHCP) {
- u32 server_id = INADDR_NONE;
- int mt = 0;
+ u32 server_id = INADDR_NONE;
+ int mt = 0;
- ext = &b->exten[4];
- while (ext < end && *ext != 0xff) {
- u8 *opt = ext++;
- if (*opt == 0) /* Padding */
- continue;
- ext += *ext + 1;
- if (ext >= end)
- break;
- switch (*opt) {
- case 53: /* Message type */
- if (opt[1])
- mt = opt[2];
- break;
- case 54: /* Server ID (IP address) */
- if (opt[1] >= 4)
- memcpy(&server_id, opt + 2, 4);
- break;
+ ext = &b->exten[4];
+ while (ext < end && *ext != 0xff) {
+ u8 *opt = ext++;
+ if (*opt == 0) /* Padding */
+ continue;
+ ext += *ext + 1;
+ if (ext >= end)
+ break;
+ switch (*opt) {
+ case 53: /* Message type */
+ if (opt[1])
+ mt = opt[2];
+ break;
+ case 54: /* Server ID (IP address) */
+ if (opt[1] >= 4)
+ memcpy(&server_id, opt + 2, 4);
+ break;
+ }
}
- }
#ifdef IPCONFIG_DEBUG
- printk("DHCP: Got message type %d\n", mt);
+ printk("DHCP: Got message type %d\n", mt);
#endif
- switch (mt) {
- case DHCPOFFER:
- /* While in the process of accepting one offer,
- ignore all others. */
- if (ic_myaddr != INADDR_NONE)
- goto drop;
- /* Let's accept that offer. */
- ic_myaddr = b->your_ip;
- ic_servaddr = server_id;
+ switch (mt) {
+ case DHCPOFFER:
+ /* While in the process of accepting one offer,
+ ignore all others. */
+ if (ic_myaddr != INADDR_NONE)
+ goto drop;
+ /* Let's accept that offer. */
+ ic_myaddr = b->your_ip;
+ ic_servaddr = server_id;
#ifdef IPCONFIG_DEBUG
- printk("DHCP: Offered address %u.%u.%u.%u", NIPQUAD(ic_myaddr));
- printk(" by server %u.%u.%u.%u\n", NIPQUAD(ic_servaddr));
+ printk("DHCP: Offered address %u.%u.%u.%u", NIPQUAD(ic_myaddr));
+ printk(" by server %u.%u.%u.%u\n", NIPQUAD(ic_servaddr));
#endif
- break;
+ break;
- case DHCPACK:
- /* Yeah! */
- break;
-
- default:
- /* Urque. Forget it*/
- ic_myaddr = INADDR_NONE;
- ic_servaddr = INADDR_NONE;
- goto drop;
- }
+ case DHCPACK:
+ /* Yeah! */
+ break;
+
+ default:
+ /* Urque. Forget it*/
+ ic_myaddr = INADDR_NONE;
+ ic_servaddr = INADDR_NONE;
+ goto drop;
+ }
- ic_dhcp_msgtype = mt;
+ ic_dhcp_msgtype = mt;
+ }
#endif /* IPCONFIG_DHCP */
^ permalink raw reply [flat|nested] 3+ messages in thread* IPCONFIG fails for BOOTP
@ 2001-08-29 4:04 Ian Dall
0 siblings, 0 replies; 3+ messages in thread
From: Ian Dall @ 2001-08-29 4:04 UTC (permalink / raw)
To: linux-kernel
Kernel version 2.4.8-ac9
I am attempting to set up a linux based xterm. The kernel loads
but times out attempting to get ipaddresses etc in ipconfig.
The following are defined in "include/linux/autoconf.h":
#define CONFIG_IP_PNP 1
#define CONFIG_IP_PNP_DHCP 1
#define CONFIG_IP_PNP_BOOTP 1
#undef CONFIG_IP_PNP_RARP
A few printk's latter and it seems that the problem is in ic_bootp_recv()
around line 843:
#ifdef IPCONFIG_DEBUG
printk("DHCP: Got message type %d\n", mt);
#endif
switch (mt) {
case DHCPOFFER:
[.....]
default:
/* Urque. Forget it*/
ic_myaddr = INADDR_NONE;
ic_servaddr = INADDR_NONE;
goto drop;
}
At this point we could be receiving either DHCP *or* BOOTP extensions.
The code to handle the BOOTP extension follows, but is never executed
because of the "goto drop" in the default case for handling dhcp packets.
If the kernel were compiled without DHCP this problem would go away.
There are two possibilities to fix this. One is to fall through to the
bootp case instead of going to drop, or maybe fold the bootp code into
the default case of the switch statement. The only problem then seems to
be how to conditionalize the DHCP support.
Ian
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2001-09-25 23:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-08-30 15:32 IPCONFIG fails for BOOTP H . J . Lu
2001-09-25 23:24 ` David S. Miller
-- strict thread matches above, loose matches on Subject: below --
2001-08-29 4:04 Ian Dall
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox