Author: dim
Date: Tue Sep 22 22:18:36 2015
New Revision: 288134
URL: https://svnweb.freebsd.org/changeset/base/288134

Log:
  MFC r286702:
  
  In ipfw2, avoid left-shifting negative integers, which is undefined.
  While here, make some other arguments to htonl(3) unsigned too.

Modified:
  stable/10/sbin/ipfw/ipfw2.c
Directory Properties:
  stable/10/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/9/sbin/ipfw/ipfw2.c
Directory Properties:
  stable/9/   (props changed)
  stable/9/sbin/   (props changed)
  stable/9/sbin/ipfw/   (props changed)

Modified: stable/10/sbin/ipfw/ipfw2.c
==============================================================================
--- stable/10/sbin/ipfw/ipfw2.c Tue Sep 22 22:07:42 2015        (r288133)
+++ stable/10/sbin/ipfw/ipfw2.c Tue Sep 22 22:18:36 2015        (r288134)
@@ -2268,14 +2268,14 @@ fill_ip(ipfw_insn_ip *cmd, char *av, int
        case '/':
                masklen = atoi(p);
                if (masklen == 0)
-                       d[1] = htonl(0);        /* mask */
+                       d[1] = htonl(0U);       /* mask */
                else if (masklen > 32)
                        errx(EX_DATAERR, "bad width ``%s''", p);
                else
-                       d[1] = htonl(~0 << (32 - masklen));
+                       d[1] = htonl(~0U << (32 - masklen));
                break;
        case '{':       /* no mask, assume /24 and put back the '{' */
-               d[1] = htonl(~0 << (32 - 24));
+               d[1] = htonl(~0U << (32 - 24));
                *(--p) = md;
                break;
 
@@ -2284,7 +2284,7 @@ fill_ip(ipfw_insn_ip *cmd, char *av, int
                /* FALLTHROUGH */
        case 0:         /* initialization value */
        default:
-               d[1] = htonl(~0);       /* force /32 */
+               d[1] = htonl(~0U);      /* force /32 */
                break;
        }
        d[0] &= d[1];           /* mask base address with mask */
_______________________________________________
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"

Reply via email to