From owner-svn-src-all@freebsd.org Tue May 28 14:17:04 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BAB7E1598F1D; Tue, 28 May 2019 14:17:04 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5E5B3830E6; Tue, 28 May 2019 14:17:04 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 39A881B777; Tue, 28 May 2019 14:17:04 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4SEH4cs072788; Tue, 28 May 2019 14:17:04 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4SEH3u4072786; Tue, 28 May 2019 14:17:03 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201905281417.x4SEH3u4072786@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 28 May 2019 14:17:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348326 - in stable/12/libexec/bootpd: . bootpgw X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in stable/12/libexec/bootpd: . bootpgw X-SVN-Commit-Revision: 348326 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 5E5B3830E6 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.93 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.93)[-0.926,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 May 2019 14:17:05 -0000 Author: markj Date: Tue May 28 14:17:03 2019 New Revision: 348326 URL: https://svnweb.freebsd.org/changeset/base/348326 Log: MFC r348066, r348090: bootpd: Add an option to skip modifications to the ARP table. PR: 30854 Modified: stable/12/libexec/bootpd/bootpd.8 stable/12/libexec/bootpd/bootpd.c stable/12/libexec/bootpd/bootpgw/bootpgw.c Directory Properties: stable/12/ (props changed) Modified: stable/12/libexec/bootpd/bootpd.8 ============================================================================== --- stable/12/libexec/bootpd/bootpd.8 Tue May 28 13:14:53 2019 (r348325) +++ stable/12/libexec/bootpd/bootpd.8 Tue May 28 14:17:03 2019 (r348326) @@ -2,7 +2,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 10, 2004 +.Dd May 21, 2019 .Dt BOOTPD 8 .Os .Sh NAME @@ -103,6 +103,8 @@ option may be used to force standalone or inetd mode r .Sh OPTIONS The following options are available: .Bl -tag -width indent +.It Fl a +Skip ARP table modifications. .It Fl t Ar timeout Specify the .Ar timeout Modified: stable/12/libexec/bootpd/bootpd.c ============================================================================== --- stable/12/libexec/bootpd/bootpd.c Tue May 28 13:14:53 2019 (r348325) +++ stable/12/libexec/bootpd/bootpd.c Tue May 28 14:17:03 2019 (r348326) @@ -143,6 +143,7 @@ struct timeval actualtimeout = 15 * 60L, /* tv_sec */ 0 /* tv_usec */ }; +int arpmod = TRUE; /* modify the ARP table */ /* * General @@ -266,6 +267,9 @@ main(argc, argv) break; switch (argv[0][1]) { + case 'a': /* don't modify the ARP table */ + arpmod = FALSE; + break; case 'c': /* chdir_path */ if (argv[0][2]) { stmp = &(argv[0][2]); @@ -583,8 +587,9 @@ PRIVATE void usage() { fprintf(stderr, - "usage: bootpd [-i | -s] [-c chdir-path] [-d level] [-h hostname] [-t timeout]\n"); - fprintf(stderr, " [bootptab [dumpfile]]\n"); + "usage: bootpd [-a] [-i | -s] [-c chdir-path] [-d level] [-h hostname]\n" + " [-t timeout] [bootptab [dumpfile]]\n"); + fprintf(stderr, "\t -a\tdon't modify ARP table\n"); fprintf(stderr, "\t -c n\tset current directory\n"); fprintf(stderr, "\t -d n\tset debug level\n"); fprintf(stderr, "\t -h n\tset the hostname to listen on\n"); @@ -1067,10 +1072,12 @@ sendreply(forward, dst_override) if (haf == 0) haf = HTYPE_ETHERNET; - if (debug > 1) - report(LOG_INFO, "setarp %s - %s", - inet_ntoa(dst), haddrtoa(ha, len)); - setarp(s, &dst, haf, ha, len); + if (arpmod) { + if (debug > 1) + report(LOG_INFO, "setarp %s - %s", + inet_ntoa(dst), haddrtoa(ha, len)); + setarp(s, &dst, haf, ha, len); + } } if ((forward == 0) && Modified: stable/12/libexec/bootpd/bootpgw/bootpgw.c ============================================================================== --- stable/12/libexec/bootpd/bootpgw/bootpgw.c Tue May 28 13:14:53 2019 (r348325) +++ stable/12/libexec/bootpd/bootpgw/bootpgw.c Tue May 28 14:17:03 2019 (r348326) @@ -124,6 +124,7 @@ struct timeval actualtimeout = u_char maxhops = 4; /* Number of hops allowed for requests. */ u_int minwait = 3; /* Number of seconds client must wait before its bootrequest packets are forwarded. */ +int arpmod = TRUE; /* modify the ARP table */ /* * General @@ -238,6 +239,9 @@ main(argc, argv) break; switch (argv[0][1]) { + case 'a': /* don't modify the ARP table */ + arpmod = FALSE; + break; case 'd': /* debug level */ if (argv[0][2]) { stmp = &(argv[0][2]); @@ -496,7 +500,9 @@ static void usage() { fprintf(stderr, - "usage: bootpgw [-d level] [-i] [-s] [-t timeout] server\n"); + "usage: bootpgw [-a] [-i | -s] [-d level] [-h count] [-t timeout]\n" + " [-w time] server\n"); + fprintf(stderr, "\t -a\tdon't modify ARP table\n"); fprintf(stderr, "\t -d n\tset debug level\n"); fprintf(stderr, "\t -h n\tset max hop count\n"); fprintf(stderr, "\t -i\tforce inetd mode (run as child of inetd)\n"); @@ -641,19 +647,23 @@ handle_reply() send_addr.sin_addr = bp->bp_yiaddr; send_addr.sin_port = htons(bootpc_port); - /* Create an ARP cache entry for the client. */ - ha = bp->bp_chaddr; - len = bp->bp_hlen; - if (len > MAXHADDRLEN) - len = MAXHADDRLEN; - haf = (int) bp->bp_htype; - if (haf == 0) - haf = HTYPE_ETHERNET; + if (arpmod) { + /* Create an ARP cache entry for the client. */ + ha = bp->bp_chaddr; + len = bp->bp_hlen; + struct in_addr dst; - if (debug > 1) - report(LOG_INFO, "setarp %s - %s", - inet_ntoa(bp->bp_yiaddr), haddrtoa(ha, len)); - setarp(s, &bp->bp_yiaddr, haf, ha, len); + if (len > MAXHADDRLEN) + len = MAXHADDRLEN; + haf = (int) bp->bp_htype; + if (haf == 0) + haf = HTYPE_ETHERNET; + + if (debug > 1) + report(LOG_INFO, "setarp %s - %s", + inet_ntoa(dst), haddrtoa(ha, len)); + setarp(s, &dst, haf, ha, len); + } /* Send reply with same size packet as request used. */ if (sendto(s, pktbuf, pktlen, 0,