From owner-svn-src-all@freebsd.org Tue May 21 22:55:02 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 4ED631592C0E; Tue, 21 May 2019 22:55:02 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8BA41858FF; Tue, 21 May 2019 22:55:01 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id x4LMswuP081367; Tue, 21 May 2019 15:54:58 -0700 (PDT) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id x4LMswao081366; Tue, 21 May 2019 15:54:58 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201905212254.x4LMswao081366@gndrsh.dnsmgr.net> Subject: Re: svn commit: r348066 - in head/libexec/bootpd: . bootpgw In-Reply-To: <201905212122.x4LLMhup041717@repo.freebsd.org> To: Mark Johnston Date: Tue, 21 May 2019 15:54:58 -0700 (PDT) CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 8BA41858FF X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.98 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.98)[-0.984,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] 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, 21 May 2019 22:55:02 -0000 > Author: markj > Date: Tue May 21 21:22:43 2019 > New Revision: 348066 > URL: https://svnweb.freebsd.org/changeset/base/348066 > > Log: > bootpd: Add an option to skip modifications to the ARP table. > > PR: 30854 > Submitted by: Dan Lukes > Reviewed by: imp (previous version) > MFC after: 1 week > Event: Waterloo Hackathon 2019 > Differential Revision: https://reviews.freebsd.org/D2581 > > Modified: > head/libexec/bootpd/bootpd.8 > head/libexec/bootpd/bootpd.c > head/libexec/bootpd/bootpgw/bootpgw.c > > Modified: head/libexec/bootpd/bootpd.8 > ============================================================================== > --- head/libexec/bootpd/bootpd.8 Tue May 21 21:14:22 2019 (r348065) > +++ head/libexec/bootpd/bootpd.8 Tue May 21 21:22:43 2019 (r348066) > @@ -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: head/libexec/bootpd/bootpd.c > ============================================================================== > --- head/libexec/bootpd/bootpd.c Tue May 21 21:14:22 2019 (r348065) > +++ head/libexec/bootpd/bootpd.c Tue May 21 21:22:43 2019 (r348066) > @@ -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"); > + "usage: bootpd [-a] [-i | -s] [-c chdir-path] [-d level] [-h hostname] [-t timeout]\n"); > fprintf(stderr, " [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: head/libexec/bootpd/bootpgw/bootpgw.c > ============================================================================== > --- head/libexec/bootpd/bootpgw/bootpgw.c Tue May 21 21:14:22 2019 (r348065) > +++ head/libexec/bootpd/bootpgw/bootpgw.c Tue May 21 21:22:43 2019 (r348066) > @@ -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,8 @@ static void > usage() > { > fprintf(stderr, > - "usage: bootpgw [-d level] [-i] [-s] [-t timeout] server\n"); > + "usage: \nbootpgw [-a] [-d level] [-h count] [-i] [-s] [-t timeout] [-w time] server\n"); ^^^^ this looks very odd and is a very long line. Output would be: usage:bb bootpgw [-a] [-d level] [-h count] [-i] [-s] [-t timeout] [-w time] server I believe what you want here is: /*234567890123456789012345678901234567890123456789012345678901234567890123456789*/ /*234567890123456789012345678901234567890123456789012345678901234567890123456789*/ "usage:\t bootpgw [-a] [-d level] [-h count] [-i] [-s]" "[-t timeout] [-w time]\n" "\t server\n"); (Ignore my /*234 comments, that is just how I figure out how to fit these types of things.) > + 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"); The whole usage thing uses a space after tab, which also seems odd to me. I am use to using usage done using pure spaces, no tabs anyplace, usage: followed by 1 space. > @@ -641,19 +646,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, > > -- Rod Grimes rgrimes@freebsd.org