> From: [email protected] (=?utf-8?Q?J=C3=A9r=C3=A9mie_Courr=C3=A8ges-Anglas?=) > Date: Mon, 11 Nov 2013 16:31:08 +0100 > > Today I heard someone struggling while trying to understand the meaning > and possible uses of the -d ping(8) flag. Looking at the code it seems > that SO_DEBUG has no effect on a raw socket (right?), so I thought that > it would be better to document that. > > ok?
Makes no sense. The man page still says that SO_DEBUG gets set, but you remove the code that actually does this. You should either change the man page, and leave the code alone, or you should change the code and change the manual page to state that -d is accepted for backwards compatibility only or remove it from the documentation altogether. I'd leave the code alone. > Index: ping.8 > =================================================================== > RCS file: /cvs/src/sbin/ping/ping.8,v > retrieving revision 1.48 > diff -u -p -r1.48 ping.8 > --- ping.8 14 Aug 2013 08:39:30 -0000 1.48 > +++ ping.8 11 Nov 2013 15:14:08 -0000 > @@ -86,6 +86,8 @@ bit. > Set the > .Dv SO_DEBUG > option on the socket being used. > +This option has no effect on > +.Ox . > .It Fl E > Emit an audible beep (by sending an ASCII BEL character to the > standard error output) when no packet is received before the next > Index: ping.c > =================================================================== > RCS file: /cvs/src/sbin/ping/ping.c,v > retrieving revision 1.96 > diff -u -p -r1.96 ping.c > --- ping.c 28 Oct 2013 15:05:35 -0000 1.96 > +++ ping.c 11 Nov 2013 15:21:29 -0000 > @@ -99,14 +99,13 @@ int options; > #define F_PINGFILLED 0x0008 > #define F_QUIET 0x0010 > #define F_RROUTE 0x0020 > -#define F_SO_DEBUG 0x0040 > -#define F_SO_DONTROUTE 0x0080 > -#define F_VERBOSE 0x0100 > -#define F_SADDR 0x0200 > -#define F_HDRINCL 0x0400 > -#define F_TTL 0x0800 > -#define F_AUD_RECV 0x2000 > -#define F_AUD_MISS 0x4000 > +#define F_SO_DONTROUTE 0x0040 > +#define F_VERBOSE 0x0080 > +#define F_SADDR 0x0100 > +#define F_HDRINCL 0x0200 > +#define F_TTL 0x0400 > +#define F_AUD_RECV 0x0800 > +#define F_AUD_MISS 0x1000 > > /* multicast options */ > int moptions; > @@ -218,7 +217,7 @@ main(int argc, char *argv[]) > df = 1; > break; > case 'd': > - options |= F_SO_DEBUG; > + /* Option retained for compatibility. */ > break; > case 'E': > options |= F_AUD_MISS; > @@ -400,9 +399,6 @@ main(int argc, char *argv[]) > } > } > > - if (options & F_SO_DEBUG) > - (void)setsockopt(s, SOL_SOCKET, SO_DEBUG, &hold, > - sizeof(hold)); > if (options & F_SO_DONTROUTE) > (void)setsockopt(s, SOL_SOCKET, SO_DONTROUTE, &hold, > sizeof(hold)); > >
