proposed bootpd change

Luigi Rizzo rizzo at icir.org
Mon Dec 1 05:54:48 PST 2003


Hi,
i would like to suggest the following bootpd change (after 5.2) that
fixes the following problem with our bootpd.

There are cases where one wants to run bootp over a non standard
port, e.g. ton install new machines etc. Newer versions of etherboot
support that, and there is even a couple of port numbers reserved
to this purpose in /etc/services (1067 and 1068).
It is easy to reconfigure bootp (if launched from inetd) to
listen on port 1067 -- t just suffices to change one line
in inetd.conf; however, the client service name ("bootpc")
is hardwired in the bootpd code, and there is no way to
override it short of changing /etc/services, which is undesirable.

I can think of two ways to enable the user to configure the
client port, one is to add a command-line flag to bootpd, the
other one is to infer the client port number from the server
port number, which is what the attached patch does.

Would people be comfortable with modifying bootpd in one
of these two ways ?

	cheers
	luigi

Index: bootpd.c
===================================================================
RCS file: /home/ncvs/src/libexec/bootpd/bootpd.c,v
retrieving revision 1.13.2.3
diff -u -r1.13.2.3 bootpd.c
--- bootpd.c	15 Feb 2003 05:36:01 -0000	1.13.2.3
+++ bootpd.c	28 Nov 2003 20:00:58 -0000
@@ -245,6 +245,7 @@
 		if (bind_addr.sin_family == AF_INET) {
 			standalone = FALSE;
 			bootps_port = ntohs(bind_addr.sin_port);
+			bootpc_port = bootps_port + 1;
 		} else {
 			/* Some other type of socket? */
 			report(LOG_ERR, "getsockname: not an INET socket");
@@ -473,7 +474,9 @@
 	 * Get destination port number so we can reply to client
 	 */
 	servp = getservbyname("bootpc", "udp");
-	if (servp) {
+	if (bootpc_port != 0) {
+		/* nothing to do; already set */
+	} else if (servp) {
 		bootpc_port = ntohs(servp->s_port);
 	} else {
 		report(LOG_ERR,


More information about the freebsd-net mailing list