From 1ea2308e5d33676c2e629e16d2d82a22b5c20d61 Mon Sep 17 00:00:00 2001 From: Toomas Soome Date: Sun, 28 May 2017 09:51:41 +0300 Subject: [PATCH] 8801 loader: always issue our dhcp request --- usr/src/boot/lib/libstand/bootp.c | 11 ---------- usr/src/boot/lib/libstand/bootp.h | 2 -- usr/src/boot/sys/boot/common/dev_net.c | 39 +++------------------------------- 3 files changed, 3 insertions(+), 49 deletions(-) diff --git a/usr/src/boot/lib/libstand/bootp.c b/usr/src/boot/lib/libstand/bootp.c index 3e706da761..9afe9a301b 100644 --- a/usr/src/boot/lib/libstand/bootp.c +++ b/usr/src/boot/lib/libstand/bootp.c @@ -349,17 +349,6 @@ bad: return (-1); } -int -dhcp_try_rfc1048(uint8_t *cp, size_t len) -{ - - expected_dhcpmsgtype = DHCPACK; - if (bcmp(vm_rfc1048, cp, sizeof (vm_rfc1048)) == 0) { - return (vend_rfc1048(cp, len)); - } - return (-1); -} - static int vend_rfc1048(u_char *cp, u_int len) { diff --git a/usr/src/boot/lib/libstand/bootp.h b/usr/src/boot/lib/libstand/bootp.h index db68995fd1..3118c8c653 100644 --- a/usr/src/boot/lib/libstand/bootp.h +++ b/usr/src/boot/lib/libstand/bootp.h @@ -144,6 +144,4 @@ struct cmu_vend { extern struct bootp *bootp_response; extern size_t bootp_response_size; -int dhcp_try_rfc1048(uint8_t *cp, size_t len); - #endif /* _BOOTP_H_ */ diff --git a/usr/src/boot/sys/boot/common/dev_net.c b/usr/src/boot/sys/boot/common/dev_net.c index dfa7eb1f99..46b5481222 100644 --- a/usr/src/boot/sys/boot/common/dev_net.c +++ b/usr/src/boot/sys/boot/common/dev_net.c @@ -228,22 +228,12 @@ net_strategy(void *devdata, int rw, daddr_t blk, size_t size, char *buf, return (EIO); } -#define SUPPORT_BOOTP - /* * Get info for NFS boot: our IP address, our hostname, * server IP address, and our root path on the server. * There are two ways to do this: The old, Sun way, - * and the more modern, BOOTP way. (RFC951, RFC1048) - * - * The default is to use the Sun bootparams RPC - * (because that is what the kernel will do). - * MD code can make try_bootp initialied data, - * which will override this common definition. + * and the more modern, BOOTP/DHCP way. (RFC951, RFC1048) */ -#ifdef SUPPORT_BOOTP -int try_bootp = 1; -#endif extern n_long ip_convertaddr(char *p); @@ -252,43 +242,20 @@ net_getparams(int sock) { char buf[MAXHOSTNAMELEN]; n_long rootaddr, smask; - struct iodesc *d = socktodesc(sock); - extern struct in_addr servip; -#ifdef SUPPORT_BOOTP /* - * Try to get boot info using BOOTP. If we succeed, then + * Try to get boot info using BOOTP/DHCP. If we succeed, then * the server IP address, gateway, and root path will all * be initialized. If any remain uninitialized, we will * use RARP and RPC/bootparam (the Sun way) to get them. */ - if (try_bootp) { - int rc = -1; - if (bootp_response != NULL) { - rc = dhcp_try_rfc1048(bootp_response->bp_vend, - bootp_response_size - - offsetof(struct bootp, bp_vend)); - - if (servip.s_addr == 0) - servip = bootp_response->bp_siaddr; - if (rootip.s_addr == 0) - rootip = bootp_response->bp_siaddr; - if (gateip.s_addr == 0) - gateip = bootp_response->bp_giaddr; - if (myip.s_addr == 0) - myip = bootp_response->bp_yiaddr; - d->myip = myip; - } - if (rc < 0) - bootp(sock); - } + bootp(sock); if (myip.s_addr != 0) goto exit; #ifdef NETIF_DEBUG if (debug) printf("net_open: BOOTP failed, trying RARP/RPC...\n"); #endif -#endif /* * Use RARP to get our IP address. This also sets our -- 2.11.4.GIT