|
@@ -33,6 +33,14 @@ char *hostname = "";
|
33
|
33
|
int hostnamelen = 0;
|
34
|
34
|
static uint32_t xid;
|
35
|
35
|
unsigned char *end_of_rfc1533 = NULL;
|
|
36
|
+unsigned char *addparam;
|
|
37
|
+int addparamlen;
|
|
38
|
+
|
|
39
|
+#ifdef IMAGE_FREEBSD
|
|
40
|
+int freebsd_howto = 0;
|
|
41
|
+char freebsd_kernel_env[FREEBSD_KERNEL_ENV_SIZE];
|
|
42
|
+#endif /* IMAGE_FREEBSD */
|
|
43
|
+
|
36
|
44
|
static int vendorext_isvalid;
|
37
|
45
|
static const unsigned char vendorext_magic[] = {0xE4,0x45,0x74,0x68}; /* äEth */
|
38
|
46
|
static const unsigned char broadcast[] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
|
|
@@ -261,9 +269,8 @@ static int nic_configure ( struct type_dev *type_dev ) {
|
261
|
269
|
#endif /* PXE_EXPORT */
|
262
|
270
|
#endif /* ! NO_DHCP_SUPPORT */
|
263
|
271
|
printf(", TFTP: %@", arptable[ARP_SERVER].ipaddr.s_addr);
|
264
|
|
- if (BOOTP_DATA_ADDR->bootp_reply.bp_giaddr.s_addr)
|
265
|
|
- printf(", Relay: %@",
|
266
|
|
- BOOTP_DATA_ADDR->bootp_reply.bp_giaddr.s_addr);
|
|
272
|
+ if (bootp_data.bootp_reply.bp_giaddr.s_addr)
|
|
273
|
+ printf(", Relay: %@", bootp_data.bootp_reply.bp_giaddr.s_addr);
|
267
|
274
|
if (arptable[ARP_GATEWAY].ipaddr.s_addr)
|
268
|
275
|
printf(", Gateway %@", arptable[ARP_GATEWAY].ipaddr.s_addr);
|
269
|
276
|
if (arptable[ARP_NAMESERVER].ipaddr.s_addr)
|
|
@@ -316,6 +323,22 @@ static int nic_load ( struct type_dev *type_dev, struct buffer *buffer ) {
|
316
|
323
|
NULL
|
317
|
324
|
#endif
|
318
|
325
|
: KERNEL_BUF;
|
|
326
|
+#ifdef ZPXE_SUFFIX_STRIP
|
|
327
|
+ {
|
|
328
|
+ int i = 0;
|
|
329
|
+ while (kernel[i++]);
|
|
330
|
+ if(i > 5) {
|
|
331
|
+ if(kernel[i - 6] == '.' &&
|
|
332
|
+ kernel[i - 5] == 'z' &&
|
|
333
|
+ kernel[i - 4] == 'p' &&
|
|
334
|
+ kernel[i - 3] == 'x' &&
|
|
335
|
+ kernel[i - 2] == 'e') {
|
|
336
|
+ printf("Trimming .zpxe extension\n");
|
|
337
|
+ kernel[i - 6] = 0;
|
|
338
|
+ }
|
|
339
|
+ }
|
|
340
|
+ }
|
|
341
|
+#endif
|
319
|
342
|
if ( kernel ) {
|
320
|
343
|
return download_url ( kernel, buffer );
|
321
|
344
|
} else {
|
|
@@ -659,8 +682,8 @@ static int await_bootp(int ival __unused, void *ptr __unused,
|
659
|
682
|
#endif /* NO_DHCP_SUPPORT */
|
660
|
683
|
netmask = default_netmask();
|
661
|
684
|
/* bootpreply->bp_file will be copied to KERNEL_BUF in the memcpy */
|
662
|
|
- memcpy((char *)BOOTP_DATA_ADDR, (char *)bootpreply, sizeof(struct bootpd_t));
|
663
|
|
- decode_rfc1533(BOOTP_DATA_ADDR->bootp_reply.bp_vend, 0,
|
|
685
|
+ memcpy((char *)&bootp_data, (char *)bootpreply, sizeof(struct bootpd_t));
|
|
686
|
+ decode_rfc1533(bootp_data.bootp_reply.bp_vend, 0,
|
664
|
687
|
#ifdef NO_DHCP_SUPPORT
|
665
|
688
|
BOOTP_VENDOR_LEN + MAX_BOOTP_EXTLEN,
|
666
|
689
|
#else
|
|
@@ -740,6 +763,8 @@ static int bootp(void)
|
740
|
763
|
#else
|
741
|
764
|
while ( remaining_time > 0 ) {
|
742
|
765
|
if (await_reply(await_bootp, 0, NULL, remaining_time)){
|
|
766
|
+ if (arptable[ARP_CLIENT].ipaddr.s_addr)
|
|
767
|
+ break;
|
743
|
768
|
}
|
744
|
769
|
remaining_time = stop_time - currticks();
|
745
|
770
|
}
|
|
@@ -1029,6 +1054,8 @@ int decode_rfc1533(unsigned char *p, unsigned int block, unsigned int len, int e
|
1029
|
1054
|
#else
|
1030
|
1055
|
vendorext_isvalid = 0;
|
1031
|
1056
|
#endif
|
|
1057
|
+ addparam = NULL;
|
|
1058
|
+ addparamlen = 0;
|
1032
|
1059
|
if (memcmp(p, rfc1533_cookie, 4))
|
1033
|
1060
|
return(0); /* no RFC 1533 header found */
|
1034
|
1061
|
p += 4;
|
|
@@ -1039,7 +1066,7 @@ int decode_rfc1533(unsigned char *p, unsigned int block, unsigned int len, int e
|
1039
|
1066
|
return(0); /* no RFC 1533 header found */
|
1040
|
1067
|
p += 4;
|
1041
|
1068
|
len -= 4; }
|
1042
|
|
- if (extend + len <= (unsigned char *)&(BOOTP_DATA_ADDR->bootp_extension[MAX_BOOTP_EXTLEN])) {
|
|
1069
|
+ if (extend + len <= (unsigned char *)&(bootp_data.bootp_extension[MAX_BOOTP_EXTLEN])) {
|
1043
|
1070
|
memcpy(extend, p, len);
|
1044
|
1071
|
extend += len;
|
1045
|
1072
|
} else {
|
|
@@ -1096,6 +1123,17 @@ int decode_rfc1533(unsigned char *p, unsigned int block, unsigned int len, int e
|
1096
|
1123
|
p[6] == RFC1533_VENDOR_MAJOR
|
1097
|
1124
|
)
|
1098
|
1125
|
vendorext_isvalid++;
|
|
1126
|
+ else if (c == RFC1533_VENDOR_ADDPARM) {
|
|
1127
|
+ /* This tag intentionally works for BOTH the encapsulated and
|
|
1128
|
+ * non-encapsulated case, since the current menu code (in mknbi)
|
|
1129
|
+ * creates this tag without encapsulation. In the future both the
|
|
1130
|
+ * menu from mknbi and this code should learn about the proper
|
|
1131
|
+ * encapsulation (which will require substantial changes to various
|
|
1132
|
+ * stuff from mknbi, which will break compatibility with older
|
|
1133
|
+ * versions of Etherboot). */
|
|
1134
|
+ addparam = p + 2;
|
|
1135
|
+ addparamlen = *(p + 1);
|
|
1136
|
+ }
|
1099
|
1137
|
else if (NON_ENCAP_OPT c == RFC1533_VENDOR_ETHERBOOT_ENCAP) {
|
1100
|
1138
|
in_encapsulated_options = 1;
|
1101
|
1139
|
decode_rfc1533(p+2, 0, TAG_LEN(p), -1);
|