distinguish NFS versus TFTP boot by rootpath
Don't use DHCP 150 option to decide which protocol use to netboot. When root-path includes ip address - go thru NFS, if ip address not exists in root-path - go thru TFTP from server which ip address is in next-server. But there is one limitation - only one tftp server in network to provide loader and everything else. Does enybody use more than only one? Submitted by: kczekirda Sponsored by: Oktawave MFC after: 3 weeks Relnote: Yes Differential Revision: https://reviews.freebsd.org/D8740
This commit is contained in:
parent
f831d9368a
commit
a872bf12f8
|
@ -148,16 +148,15 @@ bootp(sock, flag)
|
|||
bp->bp_vend[8] = 9;
|
||||
bcopy("PXEClient", &bp->bp_vend[9], 9);
|
||||
bp->bp_vend[18] = TAG_PARAM_REQ;
|
||||
bp->bp_vend[19] = 8;
|
||||
bp->bp_vend[19] = 7;
|
||||
bp->bp_vend[20] = TAG_ROOTPATH;
|
||||
bp->bp_vend[21] = TAG_TFTP_SERVER;
|
||||
bp->bp_vend[22] = TAG_HOSTNAME;
|
||||
bp->bp_vend[23] = TAG_SWAPSERVER;
|
||||
bp->bp_vend[24] = TAG_GATEWAY;
|
||||
bp->bp_vend[25] = TAG_SUBNET_MASK;
|
||||
bp->bp_vend[26] = TAG_INTF_MTU;
|
||||
bp->bp_vend[27] = TAG_SERVERID;
|
||||
bp->bp_vend[28] = TAG_END;
|
||||
bp->bp_vend[21] = TAG_HOSTNAME;
|
||||
bp->bp_vend[22] = TAG_SWAPSERVER;
|
||||
bp->bp_vend[23] = TAG_GATEWAY;
|
||||
bp->bp_vend[24] = TAG_SUBNET_MASK;
|
||||
bp->bp_vend[25] = TAG_INTF_MTU;
|
||||
bp->bp_vend[26] = TAG_SERVERID;
|
||||
bp->bp_vend[27] = TAG_END;
|
||||
} else
|
||||
bp->bp_vend[7] = TAG_END;
|
||||
#else
|
||||
|
@ -438,10 +437,6 @@ vend_rfc1048(cp, len)
|
|||
bcopy(cp, &dhcp_serverip.s_addr,
|
||||
sizeof(dhcp_serverip.s_addr));
|
||||
}
|
||||
if (tag == TAG_TFTP_SERVER) {
|
||||
bcopy(cp, &tftpip.s_addr,
|
||||
sizeof(tftpip.s_addr));
|
||||
}
|
||||
#endif
|
||||
cp += size;
|
||||
}
|
||||
|
|
|
@ -108,7 +108,6 @@ struct bootp {
|
|||
#define TAG_T2 ((unsigned char) 59)
|
||||
#define TAG_CLASSID ((unsigned char) 60)
|
||||
#define TAG_CLIENTID ((unsigned char) 61)
|
||||
#define TAG_TFTP_SERVER ((unsigned char) 150)
|
||||
#endif
|
||||
|
||||
#define TAG_END ((unsigned char) 255)
|
||||
|
|
|
@ -32,7 +32,6 @@ struct in_addr nameip; /* DNS server ip address */
|
|||
struct in_addr rootip; /* root ip address */
|
||||
struct in_addr swapip; /* swap ip address */
|
||||
struct in_addr gateip; /* gateway ip address */
|
||||
struct in_addr tftpip; /* TFTP ip address */
|
||||
n_long netmask = 0xffffff00; /* subnet or net mask */
|
||||
u_int intf_mtu; /* interface mtu from bootp/dhcp */
|
||||
int errno; /* our old friend */
|
||||
|
|
|
@ -91,7 +91,6 @@ extern struct in_addr rootip;
|
|||
extern struct in_addr swapip;
|
||||
extern struct in_addr gateip;
|
||||
extern struct in_addr nameip;
|
||||
extern struct in_addr tftpip;
|
||||
extern n_long netmask;
|
||||
extern u_int intf_mtu;
|
||||
|
||||
|
|
|
@ -312,8 +312,11 @@ net_getparams(int sock)
|
|||
return (EIO);
|
||||
}
|
||||
exit:
|
||||
if ((rootaddr = net_parse_rootpath()) != INADDR_NONE)
|
||||
netproto = NET_TFTP;
|
||||
if ((rootaddr = net_parse_rootpath()) != INADDR_NONE) {
|
||||
netproto = NET_NFS;
|
||||
rootip.s_addr = rootaddr;
|
||||
}
|
||||
|
||||
#ifdef NETIF_DEBUG
|
||||
if (debug) {
|
||||
|
@ -365,13 +368,6 @@ net_parse_rootpath()
|
|||
int i;
|
||||
n_long addr = INADDR_NONE;
|
||||
|
||||
netproto = NET_NFS;
|
||||
|
||||
if (tftpip.s_addr != 0) {
|
||||
netproto = NET_TFTP;
|
||||
addr = tftpip.s_addr;
|
||||
}
|
||||
|
||||
for (i = 0; rootpath[i] != '\0' && i < FNAME_SIZE; i++)
|
||||
if (rootpath[i] == ':')
|
||||
break;
|
||||
|
|
|
@ -309,13 +309,9 @@ pxe_open(struct open_file *f, ...)
|
|||
if (servip.s_addr == 0)
|
||||
servip = rootip;
|
||||
|
||||
netproto = NET_NFS;
|
||||
if (tftpip.s_addr != 0) {
|
||||
netproto = NET_TFTP;
|
||||
rootip.s_addr = tftpip.s_addr;
|
||||
}
|
||||
netproto = NET_TFTP;
|
||||
|
||||
if (netproto == NET_NFS && !rootpath[0])
|
||||
if (!rootpath[0])
|
||||
strcpy(rootpath, PXENFSROOTPATH);
|
||||
|
||||
for (i = 0; rootpath[i] != '\0' && i < FNAME_SIZE; i++)
|
||||
|
@ -323,8 +319,10 @@ pxe_open(struct open_file *f, ...)
|
|||
break;
|
||||
if (i && i != FNAME_SIZE && rootpath[i] == ':') {
|
||||
rootpath[i++] = '\0';
|
||||
if (inet_addr(&rootpath[0]) != INADDR_NONE)
|
||||
if (inet_addr(&rootpath[0]) != INADDR_NONE) {
|
||||
netproto = NET_NFS;
|
||||
rootip.s_addr = inet_addr(&rootpath[0]);
|
||||
}
|
||||
bcopy(&rootpath[i], &temp[0], strlen(&rootpath[i]) + 1);
|
||||
bcopy(&temp[0], &rootpath[0], strlen(&rootpath[i]) + 1);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue