Fix the prefix length of the IP address in the error message which shows
authoryasuoka <yasuoka@openbsd.org>
Wed, 25 Jul 2018 02:18:36 +0000 (02:18 +0000)
committeryasuoka <yasuoka@openbsd.org>
Wed, 25 Jul 2018 02:18:36 +0000 (02:18 +0000)
failure of assigning requested IP address on IPCP, it was mistakenly "-1"
on little endians.  Found by IIJ.

usr.sbin/npppd/npppd/npppd.c

index 7f47403..a60c3bc 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: npppd.c,v 1.47 2017/08/12 11:20:34 goda Exp $ */
+/*     $OpenBSD: npppd.c,v 1.48 2018/07/25 02:18:36 yasuoka Exp $ */
 
 /*-
  * Copyright (c) 2005-2008,2009 Internet Initiative Japan Inc.
@@ -29,7 +29,7 @@
  * Next pppd(nppd). This file provides a npppd daemon process and operations
  * for npppd instance.
  * @author     Yasuoka Masahiko
- * $Id: npppd.c,v 1.47 2017/08/12 11:20:34 goda Exp $
+ * $Id: npppd.c,v 1.48 2018/07/25 02:18:36 yasuoka Exp $
  */
 #include "version.h"
 #include <sys/param.h> /* ALIGNED_POINTER */
@@ -1661,7 +1661,7 @@ npppd_assign_ip_addr(npppd *_this, npppd_ppp *ppp, uint32_t req_ip4)
                        ppp_log(ppp, LOG_NOTICE,
                            "Requested IP address (%d.%d.%d.%d)/%d "
                            "is %s", IP_4OCT(req_ip4),
-                           netmask2prefixlen(htonl(ip4mask)), reason);
+                           netmask2prefixlen(ip4mask), reason);
                        if (fallback_dyna)
                                goto dyna_assign;
                        return 1;