From owner-freebsd-net@FreeBSD.ORG Mon Dec 1 05:54:48 2003 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A7AD816A4CE for ; Mon, 1 Dec 2003 05:54:48 -0800 (PST) Received: from xorpc.icir.org (xorpc.icir.org [192.150.187.68]) by mx1.FreeBSD.org (Postfix) with ESMTP id C807944011 for ; Mon, 1 Dec 2003 05:54:47 -0800 (PST) (envelope-from rizzo@xorpc.icir.org) Received: from xorpc.icir.org (localhost [127.0.0.1]) by xorpc.icir.org (8.12.9p1/8.12.3) with ESMTP id hB1Dsl2e087869; Mon, 1 Dec 2003 05:54:47 -0800 (PST) (envelope-from rizzo@xorpc.icir.org) Received: (from rizzo@localhost) by xorpc.icir.org (8.12.9p1/8.12.3/Submit) id hB1Dsljg087868; Mon, 1 Dec 2003 05:54:47 -0800 (PST) (envelope-from rizzo) Date: Mon, 1 Dec 2003 05:54:47 -0800 From: Luigi Rizzo To: net@freebsd.org Message-ID: <20031201055447.A87811@xorpc.icir.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i Subject: proposed bootpd change X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Dec 2003 13:54:48 -0000 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,