Lines Matching defs:bootp
33 * Support for NFS diskless booting with BOOTP (RFC951, RFC1048)
85 * This implementation uses BOOTP (RFC951, RFC1048), and
88 * This method gets everything it needs with one BOOTP
90 * the old BOOTP functionality subset of DHCP. It is not
91 * clear that DHCP provides any advantage over BOOTP for
98 * address for the client and support BOOTP.
105 /* Begin stuff from bootp.h */
111 struct bootp {
128 * Note that BOOTP packets are allowed to be longer
181 /* End of stuff from bootp.h */
211 #define BOOTP_SIZE_MAX (sizeof(struct bootp)+312-64)
219 #define BOOTP_SIZE_MAX (sizeof(struct bootp)+256-64)
221 #define BOOTP_SIZE_MIN (sizeof(struct bootp))
227 static void bootp_extract (struct bootp *, int, struct nfs_diskless *, int *);
237 * Get our boot parameters using BOOTP.
296 struct bootp *replybuf;
310 struct bootp *bootp;
313 bootp = mtod(m, struct bootp*);
315 bootp->bp_secs = htons(waited);
323 struct bootp *bootp;
346 if (m->m_len < offsetof(struct bootp, bp_sname)) {
347 m = *mp = m_pullup(m, offsetof(struct bootp, bp_sname));
353 bootp = mtod(m, struct bootp*);
355 if (bootp->bp_op != BOOTREPLY) {
356 DPRINTF(("bootpcheck: op %d is not reply\n", bootp->bp_op));
359 if (bootp->bp_hlen != bpc->halen) {
360 DPRINTF(("bootpcheck: hlen %d != %d\n", bootp->bp_hlen,
364 if (memcmp(bootp->bp_chaddr, bpc->haddr, bpc->halen)) {
373 bootp->bp_chaddr),
381 if (bootp->bp_xid != bpc->xid) {
382 DPRINTF(("bootpcheck: xid %d != %d\n", bootp->bp_xid,
395 bootp = bpc->replybuf;
402 if (bootp->bp_yiaddr.s_addr == INADDR_ANY ||
403 bootp->bp_yiaddr.s_addr == INADDR_BROADCAST) {
405 inet_ntoa(bootp->bp_yiaddr));
412 if (memcmp(bootp->bp_vend, vm_rfc1048, 4)) {
416 p = &bootp->bp_vend[4];
417 limit = ((u_char*)bootp) + bpc->replylen;
449 printf(" (bad reply from %s)\n", inet_ntoa(bootp->bp_siaddr));
488 struct bootp *bootp; /* request */
499 printf("bootp: socreate, error=%d\n", error);
521 printf("bootp: unsupported interface type %d\n",
555 * Real BOOTP forwarding agents don't need this; they obey "bp_hops"
578 * Bind the local endpoint to a bootp client port.
599 bootp = mtod(m, struct bootp*);
604 * Build the BOOTP request message.
607 memset((void *)bootp, 0, BOOTP_SIZE_MAX);
608 bootp->bp_op = BOOTREQUEST;
609 bootp->bp_htype = hafmt;
610 bootp->bp_hlen = halen; /* Hardware address length */
611 bootp->bp_xid = ++xid;
612 memcpy(bootp->bp_chaddr, haddr, halen);
614 strncpy(bootp->bp_file, NFS_BOOT_BOOTP_REQFILE, sizeof(bootp->bp_file));
617 memcpy(bootp->bp_vend, vm_rfc1048, 4);
620 bootp->bp_vend[index++] = TAG_DHCP_MSGTYPE;
621 bootp->bp_vend[index++] = 1;
622 bootp->bp_vend[index++] = DHCPDISCOVER;
624 bootp_addvend(&bootp->bp_vend[index]);
646 bootp->bp_vend[index++] = DHCPREQUEST;
647 bootp->bp_vend[index++] = TAG_REQ_ADDR;
648 bootp->bp_vend[index++] = 4;
649 memcpy(&bootp->bp_vend[index], &bpc.replybuf->bp_yiaddr, 4);
651 bootp->bp_vend[index++] = TAG_SERVERID;
652 bootp->bp_vend[index++] = 4;
653 memcpy(&bootp->bp_vend[index], &bpc.dhcp_serverip.s_addr, 4);
655 bootp->bp_vend[index++] = TAG_LEASETIME;
656 bootp->bp_vend[index++] = 4;
658 memcpy(&bootp->bp_vend[index], &leasetime, 4);
660 bootp_addvend(&bootp->bp_vend[index]);
677 (bpc.dhcp_ok ? "DHCP" : "BOOTP"),
679 printf("nfs_boot: BOOTP next-server: %s\n",
694 bootp_extract(struct bootp *bootp, int replylen,
718 /* default root server to bootp next-server */
719 rootserver = bootp->bp_siaddr;
725 p = &bootp->bp_vend[4];
726 limit = ((u_char*)bootp) + replylen;
834 nd->nd_myip = bootp->bp_yiaddr;
873 if (!overloaded && bootp->bp_sname[0] != 0 &&
874 !memcmp(&rootserver, &bootp->bp_siaddr,
878 strncpy(ndm->ndm_host, bootp->bp_sname,
909 strncpy(nd->nd_bootfile, bootp->bp_file, BOOTFILELEN);