summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.org>2005-04-21 13:26:26 +0000
committerOlivier Blin <oblin@mandriva.org>2005-04-21 13:26:26 +0000
commitd91533a5895e0b57ec233637e0310020676fe38e (patch)
tree14cc6c99ea44fc2ec164f3f00ddde1a469e62331
parent21b8ed97407afa9b48a6c1aa7b8415491b7bfc6c (diff)
downloaddrakx-backup-do-not-use-d91533a5895e0b57ec233637e0310020676fe38e.tar
drakx-backup-do-not-use-d91533a5895e0b57ec233637e0310020676fe38e.tar.gz
drakx-backup-do-not-use-d91533a5895e0b57ec233637e0310020676fe38e.tar.bz2
drakx-backup-do-not-use-d91533a5895e0b57ec233637e0310020676fe38e.tar.xz
drakx-backup-do-not-use-d91533a5895e0b57ec233637e0310020676fe38e.zip
support DHCP over Wireless, Token Ring (great), Firewire, you name it
borrow some comments from pump
-rw-r--r--mdk-stage1/dhcp.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/mdk-stage1/dhcp.c b/mdk-stage1/dhcp.c
index 6b23c1be7..b0c913e41 100644
--- a/mdk-stage1/dhcp.c
+++ b/mdk-stage1/dhcp.c
@@ -290,7 +290,7 @@ static int prepare_request(struct bootp_request * breq, int sock, char * device)
return -1;
}
- breq->hw = 1; /* ethernet */
+ breq->hw = req.ifr_hwaddr.sa_family;
breq->hwlength = IFHWADDRLEN;
memcpy(breq->hwaddr, req.ifr_hwaddr.sa_data, IFHWADDRLEN);
memcpy(gen_hwaddr, req.ifr_hwaddr.sa_data, IFHWADDRLEN);
@@ -516,11 +516,6 @@ enum return_type perform_dhcp(struct interface_info * intf)
char requested_options[50];
char * client_id_str, * client_id_hwaddr;
- if (strncmp(intf->device, "eth", 3)) {
- stg1_error_message("DHCP available only for Ethernet networking.");
- return RETURN_ERROR;
- }
-
s = socket(AF_INET, SOCK_DGRAM, 0);
if (s < 0) {
log_perror("socket");
@@ -573,9 +568,14 @@ enum return_type perform_dhcp(struct interface_info * intf)
if (dhcp_hostname && *dhcp_hostname) { /* pick client id form based on absence or presence of domain name */
if (*dhcp_domain) /* alternate style <hostname>.<domainname> */
add_vendor_code(&breq, DHCP_OPTION_CLIENT_IDENTIFIER, strlen(client_id_str+1)+1, client_id_str);
- else { /* usual style (aka windows / dhcpcd) */
+ else { /* usual style (aka windows / dhcpcd) */
/* but put MAC in form required for client identifier first */
client_id_hwaddr = malloc(IFHWADDRLEN+2);
+ /* (from pump-0.8.22/dhcp.c)
+ * Microsoft uses a client identifier field of the 802.3 address with a
+ * pre-byte of a "1". In order to re-use the DHCP address that they set
+ * for this interface, we have to mimic their identifier.
+ */
client_id_hwaddr[0] = 1; /* set flag for ethernet */
memcpy(client_id_hwaddr+1, gen_hwaddr, IFHWADDRLEN);
add_vendor_code(&breq, DHCP_OPTION_CLIENT_IDENTIFIER, IFHWADDRLEN+1, client_id_hwaddr);