History log of /netbsd-current/sys/nfs/nfs_bootdhcp.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.58 13-May-2024 msaitoh

s/contigous/contiguous/ in comment.


Revision tags: thorpej-ifq-base thorpej-altq-separation-base
# 1.57 24-Dec-2022 andvar

s/reqest/request/ in comment.


Revision tags: netbsd-8-3-RELEASE netbsd-9-4-RELEASE netbsd-10-0-RELEASE netbsd-10-0-RC6 netbsd-10-0-RC5 netbsd-10-0-RC4 netbsd-10-0-RC3 netbsd-10-0-RC2 netbsd-10-0-RC1 netbsd-10-base bouyer-sunxi-drm-base netbsd-9-3-RELEASE thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 netbsd-9-2-RELEASE cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base netbsd-9-1-RELEASE bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 netbsd-8-2-RELEASE ad-namecache-base3 netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base2 ad-namecache-base1 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 netbsd-8-1-RELEASE netbsd-8-1-RC1 isaki-audio2-base pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.56 10-Jun-2016 ozaki-r

Introduce m_set_rcvif and m_reset_rcvif

The API is used to set (or reset) a received interface of a mbuf.
They are counterpart of m_get_rcvif, which will come in another
commit, hide internal of rcvif operation, and reduce the diff of
the upcoming change.

No functional change.


Revision tags: nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 nick-nhusb-base-20150921 nick-nhusb-base-20150606
# 1.55 21-May-2015 rtr

change nfs_boot_sendrecv to take sockaddr_in * instead of mbuf *

fixes m_serv (single mbuf leak) leak in kern/subr_tftproot.c


# 1.54 09-May-2015 rtr

when calling nfs_boot_sendrecv pass NULL for pointers instead of 0


Revision tags: nick-nhusb-base-20150406
# 1.53 27-Mar-2015 hikaru

m_pullup() is called in rcvproc callback functions,
so nfs_boot_sendrecv() should keep track of the head of mbuf chain.
fixes kern/48746


Revision tags: nick-nhusb-base netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-7-base yamt-pagecache-base9 yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE rmind-smpnet-nbase netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 tls-maxphys-base matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 rmind-uvmplock-base
# 1.52 04-Oct-2010 cyber

branches: 1.52.14; 1.52.18; 1.52.34; 1.52.36;
Add support to honor MTU settings from DHCP during netboot.

Defines IP_MIN_MTU as 576.

Glanced over quickly by martin@ and joerg@.


Revision tags: uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 jym-xensuspend-nbase
# 1.51 10-Jul-2009 roy

branches: 1.51.2; 1.51.4;
Use a function to add extra data to the vendor area so that data added
remains constant for both DISCOVER and REQUEST messages.


# 1.50 10-Jul-2009 roy

Protect against short IP addresses in the DHCP message.


# 1.49 10-Jul-2009 roy

When using DHCP, request the parameters that we need. Fixes PR kern/38830.
Thanks to Tim McIntosh.


Revision tags: yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-base
# 1.48 06-May-2009 cegger

correct previous: use %zu for BOOTP_SIZE_(MIN,MAX).
Pointed out by David Holland


# 1.47 05-May-2009 cegger

buildfix: use %d for BOOTP_SIZE_(MIN,MAX).
Makes i386 ALL kernel build again.


Revision tags: yamt-nfs-mp-base3
# 1.46 02-May-2009 manu

- Silence warning when running with debug enabled
- Remind the administrator about the required DHCP option when some are
missing, instead of silently failing, you stupid computer!


Revision tags: nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 haad-dm-base2 haad-nbase2 ad-audiomp2-base nick-hppapmap-base haad-dm-base mjf-devfs2-base
# 1.45 19-Nov-2008 ad

branches: 1.45.4;
Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base
# 1.44 27-Oct-2008 cegger

change nfs boot behaviour to automatically try next boot method if boot information are incomplete to succeed.
That way, it is possible combine static and dhcp boot:
For example, to boot diskless you can specify the nfs-server and the rootpath statically. All other information will be taken via dhcp.

Patch has been presented on port-xen, tech-kern and tech-net:
http://mail-index.netbsd.org/port-xen/2008/10/24/msg004488.html
http://mail-index.netbsd.org/tech-kern/2008/10/24/msg003255.html
http://mail-index.netbsd.org/tech-net/2008/10/24/msg000864.html

No comments, no objections.


Revision tags: matt-mips64-base2
# 1.43 24-Oct-2008 cegger

branches: 1.43.2;
- ansify function definition
- de- __P
- u_int32_t -> uint32_t

No functional changes.


Revision tags: haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.42 06-Aug-2008 plunky

Convert socket options code to use a sockopt structure
instead of laying everything into an mbuf.

approved by core


Revision tags: simonb-wapbl-nbase simonb-wapbl-base
# 1.41 20-Jul-2008 uwe

When doing pointer arithmetic to compute limit cast bootp to pointer
type of correct signedness. Caught by lint.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 1.40 09-May-2008 rumble

branches: 1.40.2; 1.40.4;
Fix compilation with DEBUG_NFS_BOOT_DHCP and ssp.


# 1.39 28-Apr-2008 martin

branches: 1.39.2;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-nfs-mp-base
# 1.38 24-Apr-2008 ad

branches: 1.38.2;
Merge the socket locking patch:

- Socket layer becomes MP safe.
- Unix protocols become MP safe.
- Allows protocol processing interrupts to safely block on locks.
- Fixes a number of race conditions.

With much feedback from matt@ and plunky@.


Revision tags: yamt-pf42-baseX yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base vmlocking2-base3 bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-nbase mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 1.37 20-Dec-2007 dyoung

branches: 1.37.6; 1.37.8;
Constify.


Revision tags: nick-csl-alignment-base5 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base jmcneill-pm-base reinoud-bufcleanup-base vmlocking-base
# 1.36 29-Aug-2007 dyoung

branches: 1.36.8; 1.36.12;
Constify: LLADDR() -> CLLADDR().


Revision tags: matt-mips64-base nick-csl-alignment-base yamt-idlelwp-base8 mjf-ufs-trans-base
# 1.35 08-May-2007 manu

branches: 1.35.2; 1.35.6; 1.35.8;
Fix buid (broken by a fix introduced in the wrong file...)


# 1.34 08-May-2007 manu

Add the TFTPROOT kernel option for TFTP'ing root RAMdisk at root mount time.
This allows working around situations where a kernel with embedded RAMdisk
cannot be booted by the bootloader because the RAMdisk is too big.


Revision tags: thorpej-atomic-base
# 1.33 04-Mar-2007 christos

branches: 1.33.2; 1.33.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.32 09-Nov-2006 yamt

branches: 1.32.2; 1.32.4;
remove some __unused in function parameters.


Revision tags: yamt-splraiseipl-base2
# 1.31 12-Oct-2006 christos

- sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base elad-kernelauth-base simonb-timecounters-base rpaulo-netinet-merge-pcb-base
# 1.30 16-Mar-2006 christos

branches: 1.30.10; 1.30.12;
Don't use DEBUG, add a new DEBUG_NFS_BOOT_DHCP variable to provide more
information. Print more information about what fails.


Revision tags: yamt-pdpolicy-base2 yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.29 11-Dec-2005 christos

branches: 1.29.4; 1.29.6; 1.29.8; 1.29.10;
merge ktrace-lwp.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 yamt-readahead-base3 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 yamt-readahead-base2 netbsd-3-0-RC2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base netbsd-3-0-RC1 yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base ktrace-lwp-base
# 1.28 26-Feb-2005 perry

branches: 1.28.4;
nuke trailing whitespace


Revision tags: yamt-km-base2 yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.27 22-May-2004 jonathan

branches: 1.27.4; 1.27.6;
Eliminate several uses of `curproc' from the socket-layer code and from NFS.

Add a new explicit `struct proc *p' argument to socreate(), sosend().
Use that argument instead of curproc. Follow-on changes to pass that
argument to socreate(), sosend(), and (*so->so_send)() calls.
These changes reviewed and independently recoded by Matt Thomas.

Changes to soreceive() and (*dom->dom_exernalize() from Matt Thomas:
pass soreceive()'s struct uio* uio->uio_procp to unp_externalize().
Eliminate curproc from unp_externalize. Also, now soreceive() uses
its uio->uio_procp value, pass that same value downward to
((pr->pru_usrreq)() calls for consistency, instead of (struct proc * )0.

Similar changes in sys/nfs to eliminate (most) uses of curproc,
either via the req-> r_procp field of a struct nfsreq *req argument,
or by passing down new explicit struct proc * arguments.

Reviewed by: Matt Thomas, posted to tech-kern.
NB: The (*pr->pru_usrreq)() change should be tested on more (all!) protocols.


# 1.26 06-May-2004 drochner

remove duplicated snprintf(vci, ...)


# 1.25 21-Apr-2004 itojun

kill sprintf, use snprintf


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.24 29-Jun-2003 fvdl

branches: 1.24.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.


# 1.23 28-Jun-2003 darrenr

Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V


# 1.22 26-Feb-2003 matt

Add MBUFTRACE kernel option.
Do a little mbuf rework while here. Change all uses of MGET*(*, M_WAIT, *)
to m_get*(M_WAIT, *). These are not performance critical and making them
call m_get saves considerable space. Add m_clget analogue of MCLGET and
make corresponding change for M_WAIT uses.
Modify netinet, gem, fxp, tulip, nfs to support MBUFTRACE.
Begin to change netstat to use sysctl.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base kqueue-aftermerge kqueue-beforemerge gehenna-devsw-base kqueue-base
# 1.21 10-Jun-2002 drochner

increase IP TTL for BOOTP/DHCP request packets to avoid dumb
routers dropping the packet
(seems to be a problem with Cisco and its "helper-address" feature;
a Cabletron SSR I tested with didn't have this problem)


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.20 12-May-2002 simonb

branches: 1.20.2;
In bootpcheck(), make sure we m_pullup() all the of bootp header that we
actually examine.
While here, toss out home-grown ofs() macro and use offsetof().


Revision tags: eeh-devprop-base
# 1.19 20-Mar-2002 thorpej

Add a NetBSD Vendor Class Identifier option as proposed on tech-net in
message <20020216172527.C23901@dr-evil.shagadelic.org>.


Revision tags: newlock-base ifpoll-base thorpej-mips-cache-base
# 1.18 10-Nov-2001 lukem

add RCSIDs


Revision tags: thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.17 02-Jun-2001 kim

branches: 1.17.2; 1.17.6;
It is misleading that the kernel outputs "DHCP server:" followed by
the value of "next-server" from the DHCP (or BOOTP) reply. This is
not the DHCP server's IP address (except by chance), so instead of
"server" make it print "next-server".


Revision tags: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 1.16 05-Dec-2000 drochner

branches: 1.16.2;
add a kernel configuration option to set the string passed in bp_file
in diskless BOOTP/DHCP configuration - good for booting different
userland versions depending on the kernel version


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base
# 1.15 28-May-2000 gmcgarry

Allow nfs root over token ring. Closes PR6629.


Revision tags: minoura-xpg4dl-base
# 1.14 29-Mar-2000 simonb

branches: 1.14.2;
Don't need to include <sys/conf.h> here.


Revision tags: chs-ubc2-newbase
# 1.13 20-Jan-2000 enami

If server name field is overloaded for other purpose, or it just contains
NULL string, don't use it as server name.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base fvdl-softdep-base chs-ubc2-base
# 1.12 07-May-1999 drochner

branches: 1.12.2;
print diskless boot related IP addresses in dot notation


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 netbsd-1-4-RELEASE netbsd-1-4-base
# 1.11 21-Feb-1999 drochner

branches: 1.11.4;
restructure the diskless NFS boot code to keep track of the used
interface and the address allocated, to roll everything back if the
mount fails:
-put an interface pointer into "struct nfs_diskless" to have it
available for cleanup, don't pass it around anymore where the
"struct nfs_diskless" is already passed
-add a "cleanup" function which shuts the interface down
-in the protocol-specific parts, either return with "everything
ready" or "completely shut down"
-use common functions for interface initialization and shutdown
-add a function to delete all routes associate to an interface
(why is this necessary and not done by ~IFF_UP?)
g/c diskless swap stuff
general cleanup


# 1.10 12-Feb-1999 thorpej

Fix printf format problems on Alpha.


Revision tags: kenh-if-detach-base chs-ubc-base
# 1.9 13-Sep-1998 christos

Fix copyright spacing.


# 1.8 09-Aug-1998 perry

bzero->memset, bcopy->memcpy, bcmp->memcmp


Revision tags: eeh-paddr_t-base
# 1.7 24-Apr-1998 drochner

-catch zero and broadcast IP addresses sent by a DHCP server
-warn about them (and other invalid replies)
-print address of BOOTP/DHCP server for better problem tracking
-KNF


# 1.6 01-Mar-1998 ross

Sweep up some miscellaneous leftover lite2 integration shrapnel.


# 1.5 12-Jan-1998 scottr

Consolidate NFS_BOOT_* options into opt_nfs_boot.h


# 1.4 11-Jan-1998 scottr

Make NFS_BOOT_DHCP work as expected.


# 1.3 09-Jan-1998 drochner

Use interface type to select "hardware type" in bootp header.


Revision tags: netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base marc-pcmcia-base
# 1.2 30-Sep-1997 drochner

branches: 1.2.2;
Make this file deserve its name: add DHCP support, conditionalized
with NFS_BOOT_DHCP.
Don't increment xid between retries anymore, it is not required and
it increases the response time in case of a slow server.
Use common code with bootparam boot.


Revision tags: thorpej-signal-base
# 1.1 29-Aug-1997 gwr

branches: 1.1.2;
Add support for nfs_mountroot using BOOTP based on the contributions
of Tor Egge (closes PR kern/2351).


# 1.57 24-Dec-2022 andvar

s/reqest/request/ in comment.


Revision tags: netbsd-10-base bouyer-sunxi-drm-base netbsd-9-3-RELEASE thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 netbsd-9-2-RELEASE cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base netbsd-9-1-RELEASE bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 netbsd-8-2-RELEASE ad-namecache-base3 netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base2 ad-namecache-base1 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 netbsd-8-1-RELEASE netbsd-8-1-RC1 isaki-audio2-base pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.56 10-Jun-2016 ozaki-r

Introduce m_set_rcvif and m_reset_rcvif

The API is used to set (or reset) a received interface of a mbuf.
They are counterpart of m_get_rcvif, which will come in another
commit, hide internal of rcvif operation, and reduce the diff of
the upcoming change.

No functional change.


Revision tags: nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 nick-nhusb-base-20150921 nick-nhusb-base-20150606
# 1.55 21-May-2015 rtr

change nfs_boot_sendrecv to take sockaddr_in * instead of mbuf *

fixes m_serv (single mbuf leak) leak in kern/subr_tftproot.c


# 1.54 09-May-2015 rtr

when calling nfs_boot_sendrecv pass NULL for pointers instead of 0


Revision tags: nick-nhusb-base-20150406
# 1.53 27-Mar-2015 hikaru

m_pullup() is called in rcvproc callback functions,
so nfs_boot_sendrecv() should keep track of the head of mbuf chain.
fixes kern/48746


Revision tags: nick-nhusb-base netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-7-base yamt-pagecache-base9 yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE rmind-smpnet-nbase netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 tls-maxphys-base matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 rmind-uvmplock-base
# 1.52 04-Oct-2010 cyber

branches: 1.52.14; 1.52.18; 1.52.34; 1.52.36;
Add support to honor MTU settings from DHCP during netboot.

Defines IP_MIN_MTU as 576.

Glanced over quickly by martin@ and joerg@.


Revision tags: uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 jym-xensuspend-nbase
# 1.51 10-Jul-2009 roy

branches: 1.51.2; 1.51.4;
Use a function to add extra data to the vendor area so that data added
remains constant for both DISCOVER and REQUEST messages.


# 1.50 10-Jul-2009 roy

Protect against short IP addresses in the DHCP message.


# 1.49 10-Jul-2009 roy

When using DHCP, request the parameters that we need. Fixes PR kern/38830.
Thanks to Tim McIntosh.


Revision tags: yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-base
# 1.48 06-May-2009 cegger

correct previous: use %zu for BOOTP_SIZE_(MIN,MAX).
Pointed out by David Holland


# 1.47 05-May-2009 cegger

buildfix: use %d for BOOTP_SIZE_(MIN,MAX).
Makes i386 ALL kernel build again.


Revision tags: yamt-nfs-mp-base3
# 1.46 02-May-2009 manu

- Silence warning when running with debug enabled
- Remind the administrator about the required DHCP option when some are
missing, instead of silently failing, you stupid computer!


Revision tags: nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 haad-dm-base2 haad-nbase2 ad-audiomp2-base nick-hppapmap-base haad-dm-base mjf-devfs2-base
# 1.45 19-Nov-2008 ad

branches: 1.45.4;
Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base
# 1.44 27-Oct-2008 cegger

change nfs boot behaviour to automatically try next boot method if boot information are incomplete to succeed.
That way, it is possible combine static and dhcp boot:
For example, to boot diskless you can specify the nfs-server and the rootpath statically. All other information will be taken via dhcp.

Patch has been presented on port-xen, tech-kern and tech-net:
http://mail-index.netbsd.org/port-xen/2008/10/24/msg004488.html
http://mail-index.netbsd.org/tech-kern/2008/10/24/msg003255.html
http://mail-index.netbsd.org/tech-net/2008/10/24/msg000864.html

No comments, no objections.


Revision tags: matt-mips64-base2
# 1.43 24-Oct-2008 cegger

branches: 1.43.2;
- ansify function definition
- de- __P
- u_int32_t -> uint32_t

No functional changes.


Revision tags: haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.42 06-Aug-2008 plunky

Convert socket options code to use a sockopt structure
instead of laying everything into an mbuf.

approved by core


Revision tags: simonb-wapbl-nbase simonb-wapbl-base
# 1.41 20-Jul-2008 uwe

When doing pointer arithmetic to compute limit cast bootp to pointer
type of correct signedness. Caught by lint.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 1.40 09-May-2008 rumble

branches: 1.40.2; 1.40.4;
Fix compilation with DEBUG_NFS_BOOT_DHCP and ssp.


# 1.39 28-Apr-2008 martin

branches: 1.39.2;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-nfs-mp-base
# 1.38 24-Apr-2008 ad

branches: 1.38.2;
Merge the socket locking patch:

- Socket layer becomes MP safe.
- Unix protocols become MP safe.
- Allows protocol processing interrupts to safely block on locks.
- Fixes a number of race conditions.

With much feedback from matt@ and plunky@.


Revision tags: yamt-pf42-baseX yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base vmlocking2-base3 bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-nbase mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 1.37 20-Dec-2007 dyoung

branches: 1.37.6; 1.37.8;
Constify.


Revision tags: nick-csl-alignment-base5 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base jmcneill-pm-base reinoud-bufcleanup-base vmlocking-base
# 1.36 29-Aug-2007 dyoung

branches: 1.36.8; 1.36.12;
Constify: LLADDR() -> CLLADDR().


Revision tags: matt-mips64-base nick-csl-alignment-base yamt-idlelwp-base8 mjf-ufs-trans-base
# 1.35 08-May-2007 manu

branches: 1.35.2; 1.35.6; 1.35.8;
Fix buid (broken by a fix introduced in the wrong file...)


# 1.34 08-May-2007 manu

Add the TFTPROOT kernel option for TFTP'ing root RAMdisk at root mount time.
This allows working around situations where a kernel with embedded RAMdisk
cannot be booted by the bootloader because the RAMdisk is too big.


Revision tags: thorpej-atomic-base
# 1.33 04-Mar-2007 christos

branches: 1.33.2; 1.33.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.32 09-Nov-2006 yamt

branches: 1.32.2; 1.32.4;
remove some __unused in function parameters.


Revision tags: yamt-splraiseipl-base2
# 1.31 12-Oct-2006 christos

- sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base elad-kernelauth-base simonb-timecounters-base rpaulo-netinet-merge-pcb-base
# 1.30 16-Mar-2006 christos

branches: 1.30.10; 1.30.12;
Don't use DEBUG, add a new DEBUG_NFS_BOOT_DHCP variable to provide more
information. Print more information about what fails.


Revision tags: yamt-pdpolicy-base2 yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.29 11-Dec-2005 christos

branches: 1.29.4; 1.29.6; 1.29.8; 1.29.10;
merge ktrace-lwp.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 yamt-readahead-base3 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 yamt-readahead-base2 netbsd-3-0-RC2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base netbsd-3-0-RC1 yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base ktrace-lwp-base
# 1.28 26-Feb-2005 perry

branches: 1.28.4;
nuke trailing whitespace


Revision tags: yamt-km-base2 yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.27 22-May-2004 jonathan

branches: 1.27.4; 1.27.6;
Eliminate several uses of `curproc' from the socket-layer code and from NFS.

Add a new explicit `struct proc *p' argument to socreate(), sosend().
Use that argument instead of curproc. Follow-on changes to pass that
argument to socreate(), sosend(), and (*so->so_send)() calls.
These changes reviewed and independently recoded by Matt Thomas.

Changes to soreceive() and (*dom->dom_exernalize() from Matt Thomas:
pass soreceive()'s struct uio* uio->uio_procp to unp_externalize().
Eliminate curproc from unp_externalize. Also, now soreceive() uses
its uio->uio_procp value, pass that same value downward to
((pr->pru_usrreq)() calls for consistency, instead of (struct proc * )0.

Similar changes in sys/nfs to eliminate (most) uses of curproc,
either via the req-> r_procp field of a struct nfsreq *req argument,
or by passing down new explicit struct proc * arguments.

Reviewed by: Matt Thomas, posted to tech-kern.
NB: The (*pr->pru_usrreq)() change should be tested on more (all!) protocols.


# 1.26 06-May-2004 drochner

remove duplicated snprintf(vci, ...)


# 1.25 21-Apr-2004 itojun

kill sprintf, use snprintf


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.24 29-Jun-2003 fvdl

branches: 1.24.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.


# 1.23 28-Jun-2003 darrenr

Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V


# 1.22 26-Feb-2003 matt

Add MBUFTRACE kernel option.
Do a little mbuf rework while here. Change all uses of MGET*(*, M_WAIT, *)
to m_get*(M_WAIT, *). These are not performance critical and making them
call m_get saves considerable space. Add m_clget analogue of MCLGET and
make corresponding change for M_WAIT uses.
Modify netinet, gem, fxp, tulip, nfs to support MBUFTRACE.
Begin to change netstat to use sysctl.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base kqueue-aftermerge kqueue-beforemerge gehenna-devsw-base kqueue-base
# 1.21 10-Jun-2002 drochner

increase IP TTL for BOOTP/DHCP request packets to avoid dumb
routers dropping the packet
(seems to be a problem with Cisco and its "helper-address" feature;
a Cabletron SSR I tested with didn't have this problem)


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.20 12-May-2002 simonb

branches: 1.20.2;
In bootpcheck(), make sure we m_pullup() all the of bootp header that we
actually examine.
While here, toss out home-grown ofs() macro and use offsetof().


Revision tags: eeh-devprop-base
# 1.19 20-Mar-2002 thorpej

Add a NetBSD Vendor Class Identifier option as proposed on tech-net in
message <20020216172527.C23901@dr-evil.shagadelic.org>.


Revision tags: newlock-base ifpoll-base thorpej-mips-cache-base
# 1.18 10-Nov-2001 lukem

add RCSIDs


Revision tags: thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.17 02-Jun-2001 kim

branches: 1.17.2; 1.17.6;
It is misleading that the kernel outputs "DHCP server:" followed by
the value of "next-server" from the DHCP (or BOOTP) reply. This is
not the DHCP server's IP address (except by chance), so instead of
"server" make it print "next-server".


Revision tags: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 1.16 05-Dec-2000 drochner

branches: 1.16.2;
add a kernel configuration option to set the string passed in bp_file
in diskless BOOTP/DHCP configuration - good for booting different
userland versions depending on the kernel version


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base
# 1.15 28-May-2000 gmcgarry

Allow nfs root over token ring. Closes PR6629.


Revision tags: minoura-xpg4dl-base
# 1.14 29-Mar-2000 simonb

branches: 1.14.2;
Don't need to include <sys/conf.h> here.


Revision tags: chs-ubc2-newbase
# 1.13 20-Jan-2000 enami

If server name field is overloaded for other purpose, or it just contains
NULL string, don't use it as server name.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base fvdl-softdep-base chs-ubc2-base
# 1.12 07-May-1999 drochner

branches: 1.12.2;
print diskless boot related IP addresses in dot notation


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 netbsd-1-4-RELEASE netbsd-1-4-base
# 1.11 21-Feb-1999 drochner

branches: 1.11.4;
restructure the diskless NFS boot code to keep track of the used
interface and the address allocated, to roll everything back if the
mount fails:
-put an interface pointer into "struct nfs_diskless" to have it
available for cleanup, don't pass it around anymore where the
"struct nfs_diskless" is already passed
-add a "cleanup" function which shuts the interface down
-in the protocol-specific parts, either return with "everything
ready" or "completely shut down"
-use common functions for interface initialization and shutdown
-add a function to delete all routes associate to an interface
(why is this necessary and not done by ~IFF_UP?)
g/c diskless swap stuff
general cleanup


# 1.10 12-Feb-1999 thorpej

Fix printf format problems on Alpha.


Revision tags: kenh-if-detach-base chs-ubc-base
# 1.9 13-Sep-1998 christos

Fix copyright spacing.


# 1.8 09-Aug-1998 perry

bzero->memset, bcopy->memcpy, bcmp->memcmp


Revision tags: eeh-paddr_t-base
# 1.7 24-Apr-1998 drochner

-catch zero and broadcast IP addresses sent by a DHCP server
-warn about them (and other invalid replies)
-print address of BOOTP/DHCP server for better problem tracking
-KNF


# 1.6 01-Mar-1998 ross

Sweep up some miscellaneous leftover lite2 integration shrapnel.


# 1.5 12-Jan-1998 scottr

Consolidate NFS_BOOT_* options into opt_nfs_boot.h


# 1.4 11-Jan-1998 scottr

Make NFS_BOOT_DHCP work as expected.


# 1.3 09-Jan-1998 drochner

Use interface type to select "hardware type" in bootp header.


Revision tags: netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base marc-pcmcia-base
# 1.2 30-Sep-1997 drochner

branches: 1.2.2;
Make this file deserve its name: add DHCP support, conditionalized
with NFS_BOOT_DHCP.
Don't increment xid between retries anymore, it is not required and
it increases the response time in case of a slow server.
Use common code with bootparam boot.


Revision tags: thorpej-signal-base
# 1.1 29-Aug-1997 gwr

branches: 1.1.2;
Add support for nfs_mountroot using BOOTP based on the contributions
of Tor Egge (closes PR kern/2351).


Revision tags: nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.56 10-Jun-2016 ozaki-r

Introduce m_set_rcvif and m_reset_rcvif

The API is used to set (or reset) a received interface of a mbuf.
They are counterpart of m_get_rcvif, which will come in another
commit, hide internal of rcvif operation, and reduce the diff of
the upcoming change.

No functional change.


Revision tags: nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 nick-nhusb-base-20150921 nick-nhusb-base-20150606
# 1.55 21-May-2015 rtr

change nfs_boot_sendrecv to take sockaddr_in * instead of mbuf *

fixes m_serv (single mbuf leak) leak in kern/subr_tftproot.c


# 1.54 09-May-2015 rtr

when calling nfs_boot_sendrecv pass NULL for pointers instead of 0


Revision tags: nick-nhusb-base-20150406
# 1.53 27-Mar-2015 hikaru

m_pullup() is called in rcvproc callback functions,
so nfs_boot_sendrecv() should keep track of the head of mbuf chain.
fixes kern/48746


Revision tags: nick-nhusb-base netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-7-base yamt-pagecache-base9 yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE rmind-smpnet-nbase netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 tls-maxphys-base matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 rmind-uvmplock-base
# 1.52 04-Oct-2010 cyber

branches: 1.52.14; 1.52.34; 1.52.36;
Add support to honor MTU settings from DHCP during netboot.

Defines IP_MIN_MTU as 576.

Glanced over quickly by martin@ and joerg@.


Revision tags: uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 jym-xensuspend-nbase
# 1.51 10-Jul-2009 roy

branches: 1.51.2; 1.51.4;
Use a function to add extra data to the vendor area so that data added
remains constant for both DISCOVER and REQUEST messages.


# 1.50 10-Jul-2009 roy

Protect against short IP addresses in the DHCP message.


# 1.49 10-Jul-2009 roy

When using DHCP, request the parameters that we need. Fixes PR kern/38830.
Thanks to Tim McIntosh.


Revision tags: yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-base
# 1.48 06-May-2009 cegger

correct previous: use %zu for BOOTP_SIZE_(MIN,MAX).
Pointed out by David Holland


# 1.47 05-May-2009 cegger

buildfix: use %d for BOOTP_SIZE_(MIN,MAX).
Makes i386 ALL kernel build again.


Revision tags: yamt-nfs-mp-base3
# 1.46 02-May-2009 manu

- Silence warning when running with debug enabled
- Remind the administrator about the required DHCP option when some are
missing, instead of silently failing, you stupid computer!


Revision tags: nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 haad-dm-base2 haad-nbase2 ad-audiomp2-base nick-hppapmap-base haad-dm-base mjf-devfs2-base
# 1.45 19-Nov-2008 ad

branches: 1.45.4;
Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base
# 1.44 27-Oct-2008 cegger

change nfs boot behaviour to automatically try next boot method if boot information are incomplete to succeed.
That way, it is possible combine static and dhcp boot:
For example, to boot diskless you can specify the nfs-server and the rootpath statically. All other information will be taken via dhcp.

Patch has been presented on port-xen, tech-kern and tech-net:
http://mail-index.netbsd.org/port-xen/2008/10/24/msg004488.html
http://mail-index.netbsd.org/tech-kern/2008/10/24/msg003255.html
http://mail-index.netbsd.org/tech-net/2008/10/24/msg000864.html

No comments, no objections.


Revision tags: matt-mips64-base2
# 1.43 24-Oct-2008 cegger

branches: 1.43.2;
- ansify function definition
- de- __P
- u_int32_t -> uint32_t

No functional changes.


Revision tags: haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.42 06-Aug-2008 plunky

Convert socket options code to use a sockopt structure
instead of laying everything into an mbuf.

approved by core


Revision tags: simonb-wapbl-nbase simonb-wapbl-base
# 1.41 20-Jul-2008 uwe

When doing pointer arithmetic to compute limit cast bootp to pointer
type of correct signedness. Caught by lint.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 1.40 09-May-2008 rumble

branches: 1.40.2; 1.40.4;
Fix compilation with DEBUG_NFS_BOOT_DHCP and ssp.


# 1.39 28-Apr-2008 martin

branches: 1.39.2;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-nfs-mp-base
# 1.38 24-Apr-2008 ad

branches: 1.38.2;
Merge the socket locking patch:

- Socket layer becomes MP safe.
- Unix protocols become MP safe.
- Allows protocol processing interrupts to safely block on locks.
- Fixes a number of race conditions.

With much feedback from matt@ and plunky@.


Revision tags: yamt-pf42-baseX yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base vmlocking2-base3 bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-nbase mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 1.37 20-Dec-2007 dyoung

branches: 1.37.6; 1.37.8;
Constify.


Revision tags: nick-csl-alignment-base5 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base jmcneill-pm-base reinoud-bufcleanup-base vmlocking-base
# 1.36 29-Aug-2007 dyoung

branches: 1.36.8; 1.36.12;
Constify: LLADDR() -> CLLADDR().


Revision tags: matt-mips64-base nick-csl-alignment-base yamt-idlelwp-base8 mjf-ufs-trans-base
# 1.35 08-May-2007 manu

branches: 1.35.2; 1.35.6; 1.35.8;
Fix buid (broken by a fix introduced in the wrong file...)


# 1.34 08-May-2007 manu

Add the TFTPROOT kernel option for TFTP'ing root RAMdisk at root mount time.
This allows working around situations where a kernel with embedded RAMdisk
cannot be booted by the bootloader because the RAMdisk is too big.


Revision tags: thorpej-atomic-base
# 1.33 04-Mar-2007 christos

branches: 1.33.2; 1.33.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.32 09-Nov-2006 yamt

branches: 1.32.2; 1.32.4;
remove some __unused in function parameters.


Revision tags: yamt-splraiseipl-base2
# 1.31 12-Oct-2006 christos

- sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base elad-kernelauth-base simonb-timecounters-base rpaulo-netinet-merge-pcb-base
# 1.30 16-Mar-2006 christos

branches: 1.30.10; 1.30.12;
Don't use DEBUG, add a new DEBUG_NFS_BOOT_DHCP variable to provide more
information. Print more information about what fails.


Revision tags: yamt-pdpolicy-base2 yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.29 11-Dec-2005 christos

branches: 1.29.4; 1.29.6; 1.29.8; 1.29.10;
merge ktrace-lwp.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 yamt-readahead-base3 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 yamt-readahead-base2 netbsd-3-0-RC2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base netbsd-3-0-RC1 yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base ktrace-lwp-base
# 1.28 26-Feb-2005 perry

branches: 1.28.4;
nuke trailing whitespace


Revision tags: yamt-km-base2 yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.27 22-May-2004 jonathan

branches: 1.27.4; 1.27.6;
Eliminate several uses of `curproc' from the socket-layer code and from NFS.

Add a new explicit `struct proc *p' argument to socreate(), sosend().
Use that argument instead of curproc. Follow-on changes to pass that
argument to socreate(), sosend(), and (*so->so_send)() calls.
These changes reviewed and independently recoded by Matt Thomas.

Changes to soreceive() and (*dom->dom_exernalize() from Matt Thomas:
pass soreceive()'s struct uio* uio->uio_procp to unp_externalize().
Eliminate curproc from unp_externalize. Also, now soreceive() uses
its uio->uio_procp value, pass that same value downward to
((pr->pru_usrreq)() calls for consistency, instead of (struct proc * )0.

Similar changes in sys/nfs to eliminate (most) uses of curproc,
either via the req-> r_procp field of a struct nfsreq *req argument,
or by passing down new explicit struct proc * arguments.

Reviewed by: Matt Thomas, posted to tech-kern.
NB: The (*pr->pru_usrreq)() change should be tested on more (all!) protocols.


# 1.26 06-May-2004 drochner

remove duplicated snprintf(vci, ...)


# 1.25 21-Apr-2004 itojun

kill sprintf, use snprintf


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.24 29-Jun-2003 fvdl

branches: 1.24.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.


# 1.23 28-Jun-2003 darrenr

Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V


# 1.22 26-Feb-2003 matt

Add MBUFTRACE kernel option.
Do a little mbuf rework while here. Change all uses of MGET*(*, M_WAIT, *)
to m_get*(M_WAIT, *). These are not performance critical and making them
call m_get saves considerable space. Add m_clget analogue of MCLGET and
make corresponding change for M_WAIT uses.
Modify netinet, gem, fxp, tulip, nfs to support MBUFTRACE.
Begin to change netstat to use sysctl.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base kqueue-aftermerge kqueue-beforemerge gehenna-devsw-base kqueue-base
# 1.21 10-Jun-2002 drochner

increase IP TTL for BOOTP/DHCP request packets to avoid dumb
routers dropping the packet
(seems to be a problem with Cisco and its "helper-address" feature;
a Cabletron SSR I tested with didn't have this problem)


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.20 12-May-2002 simonb

branches: 1.20.2;
In bootpcheck(), make sure we m_pullup() all the of bootp header that we
actually examine.
While here, toss out home-grown ofs() macro and use offsetof().


Revision tags: eeh-devprop-base
# 1.19 20-Mar-2002 thorpej

Add a NetBSD Vendor Class Identifier option as proposed on tech-net in
message <20020216172527.C23901@dr-evil.shagadelic.org>.


Revision tags: newlock-base ifpoll-base thorpej-mips-cache-base
# 1.18 10-Nov-2001 lukem

add RCSIDs


Revision tags: thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.17 02-Jun-2001 kim

branches: 1.17.2; 1.17.6;
It is misleading that the kernel outputs "DHCP server:" followed by
the value of "next-server" from the DHCP (or BOOTP) reply. This is
not the DHCP server's IP address (except by chance), so instead of
"server" make it print "next-server".


Revision tags: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 1.16 05-Dec-2000 drochner

branches: 1.16.2;
add a kernel configuration option to set the string passed in bp_file
in diskless BOOTP/DHCP configuration - good for booting different
userland versions depending on the kernel version


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base
# 1.15 28-May-2000 gmcgarry

Allow nfs root over token ring. Closes PR6629.


Revision tags: minoura-xpg4dl-base
# 1.14 29-Mar-2000 simonb

branches: 1.14.2;
Don't need to include <sys/conf.h> here.


Revision tags: chs-ubc2-newbase
# 1.13 20-Jan-2000 enami

If server name field is overloaded for other purpose, or it just contains
NULL string, don't use it as server name.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base fvdl-softdep-base chs-ubc2-base
# 1.12 07-May-1999 drochner

branches: 1.12.2;
print diskless boot related IP addresses in dot notation


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 netbsd-1-4-RELEASE netbsd-1-4-base
# 1.11 21-Feb-1999 drochner

branches: 1.11.4;
restructure the diskless NFS boot code to keep track of the used
interface and the address allocated, to roll everything back if the
mount fails:
-put an interface pointer into "struct nfs_diskless" to have it
available for cleanup, don't pass it around anymore where the
"struct nfs_diskless" is already passed
-add a "cleanup" function which shuts the interface down
-in the protocol-specific parts, either return with "everything
ready" or "completely shut down"
-use common functions for interface initialization and shutdown
-add a function to delete all routes associate to an interface
(why is this necessary and not done by ~IFF_UP?)
g/c diskless swap stuff
general cleanup


# 1.10 12-Feb-1999 thorpej

Fix printf format problems on Alpha.


Revision tags: kenh-if-detach-base chs-ubc-base
# 1.9 13-Sep-1998 christos

Fix copyright spacing.


# 1.8 09-Aug-1998 perry

bzero->memset, bcopy->memcpy, bcmp->memcmp


Revision tags: eeh-paddr_t-base
# 1.7 24-Apr-1998 drochner

-catch zero and broadcast IP addresses sent by a DHCP server
-warn about them (and other invalid replies)
-print address of BOOTP/DHCP server for better problem tracking
-KNF


# 1.6 01-Mar-1998 ross

Sweep up some miscellaneous leftover lite2 integration shrapnel.


# 1.5 12-Jan-1998 scottr

Consolidate NFS_BOOT_* options into opt_nfs_boot.h


# 1.4 11-Jan-1998 scottr

Make NFS_BOOT_DHCP work as expected.


# 1.3 09-Jan-1998 drochner

Use interface type to select "hardware type" in bootp header.


Revision tags: netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base marc-pcmcia-base
# 1.2 30-Sep-1997 drochner

branches: 1.2.2;
Make this file deserve its name: add DHCP support, conditionalized
with NFS_BOOT_DHCP.
Don't increment xid between retries anymore, it is not required and
it increases the response time in case of a slow server.
Use common code with bootparam boot.


Revision tags: thorpej-signal-base
# 1.1 29-Aug-1997 gwr

branches: 1.1.2;
Add support for nfs_mountroot using BOOTP based on the contributions
of Tor Egge (closes PR kern/2351).