I like most (all? of the correct ones), can you have another go
at trying to fix the pointed out changes in behaviour?
On Tue, Jun 13, 2017 at 08:02:13PM +0200, Klemens Nanni wrote:
> Unify option checking and simply logic.
>
> F_HDRINCL and F_ROUTE are mutually exclusive, thus check the latter only
> if the former one is not set.
>
> Index: ping.c
> ===================================================================
> RCS file: /cvs/src/sbin/ping/ping.c,v
> retrieving revision 1.218
> diff -u -p -r1.218 ping.c
> --- ping.c 22 Feb 2017 13:43:35 -0000 1.218
> +++ ping.c 13 Jun 2017 17:38:22 -0000
> @@ -562,17 +562,17 @@ main(int argc, char *argv[])
> (void)setsockopt(s, SOL_SOCKET, SO_DEBUG, &optval,
> sizeof(optval));
>
> - if ((options & F_FLOOD) && (options & F_INTERVAL))
> + if (options & (F_FLOOD | F_INTERVAL))
> errx(1, "-f and -i options are incompatible");
>
> - if ((options & F_FLOOD) && (options & (F_AUD_RECV | F_AUD_MISS)))
> + if (options & (F_FLOOD | F_AUD_RECV | F_AUD_MISS))
> warnx("No audible output for flood pings");
>
> if (datalen >= sizeof(struct payload)) /* can we time transfer */
> timing = 1;
>
> if (v6flag) {
> - /* in F_VERBOSE case, we may get non-echoreply packets*/
> + /* in F_VERBOSE case, we may get non-echoreply packets */
> if (options & F_VERBOSE && datalen < 2048) /* XXX 2048? */
> packlen = 2048 + IP6LEN + ECHOLEN + EXTRA;
> else
> @@ -621,7 +621,7 @@ main(int argc, char *argv[])
> * let the kernel pass extension headers of incoming packets,
> * for privileged socket options
> */
> - if ((options & F_VERBOSE) != 0) {
> + if (options & F_VERBOSE) {
> int opton = 1;
>
> if (setsockopt(s, IPPROTO_IPV6, IPV6_RECVHOPOPTS,
> @@ -696,7 +696,7 @@ main(int argc, char *argv[])
> options |= F_HDRINCL;
> }
>
> - if (options & F_RROUTE && options & F_HDRINCL)
> + if (options & (F_RROUTE | F_HDRINCL))
> errx(1, "-R option and -D or -T, or -t to unicast"
> " destinations are incompatible");
>
> @@ -717,10 +717,8 @@ main(int argc, char *argv[])
> else
> ip->ip_src.s_addr = INADDR_ANY;
> ip->ip_dst = dst4.sin_addr;
> - }
> -
> /* record route option */
> - if (options & F_RROUTE) {
> + } else if (options & F_RROUTE) {
> if (IN_MULTICAST(ntohl(dst4.sin_addr.s_addr)))
> errx(1, "record route not valid to multicast"
> " destinations");
> @@ -773,7 +771,7 @@ main(int argc, char *argv[])
> (void)signal(SIGINT, onsignal);
> (void)signal(SIGINFO, onsignal);
>
> - if ((options & F_FLOOD) == 0) {
> + if (!(options & F_FLOOD)) {
> (void)signal(SIGALRM, onsignal);
> itimer.it_interval = interval;
> itimer.it_value = interval;
> @@ -861,8 +859,8 @@ main(int argc, char *argv[])
> * a path MTU notification.)
> */
> if ((mtu = get_pathmtu(&m, &dst6)) > 0) {
> - if ((options & F_VERBOSE) != 0) {
> - printf("new path MTU (%d) is "
> + if (options & F_VERBOSE) {
> + (void)printf("new path MTU (%d) is "
> "notified\n", mtu);
> }
> }
> @@ -961,7 +959,7 @@ pr_addr(struct sockaddr *addr, socklen_t
> static char buf[NI_MAXHOST];
> int flag = 0;
>
> - if ((options & F_HOSTNAME) == 0)
> + if (!(options & F_HOSTNAME))
> flag |= NI_NUMERICHOST;
>
> if (getnameinfo(addr, addrlen, buf, sizeof(buf), NULL, 0, flag) == 0)
> @@ -1892,7 +1890,7 @@ get_pathmtu(struct msghdr *mhdr, struct
>
> dst->sin6_scope_id &&
> mtuctl->ip6m_addr.sin6_scope_id !=
> dst->sin6_scope_id)) {
> - if ((options & F_VERBOSE) != 0) {
> + if (options & F_VERBOSE) {
> printf("path MTU for %s is notified. "
> "(ignored)\n",
> pr_addr((struct sockaddr *)
>
--
I'm not entirely sure you are real.