-/* $OpenBSD: npppctl.c,v 1.4 2014/07/22 02:02:59 yasuoka Exp $ */
+/* $OpenBSD: npppctl.c,v 1.5 2015/01/19 01:48:57 deraadt Exp $ */
/*
* Copyright (c) 2012 Internet Initiative Japan Inc.
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
#include <sys/queue.h>
#include <sys/socket.h>
#include <sys/un.h>
#include "parser.h"
#include "npppd_ctl.h"
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
+
#ifndef nitems
#define nitems(_x) (sizeof(_x) / sizeof(_x[0]))
#endif
"but cannot disconnect only %d sessions because of "
"the implementation limit.",
ppp_id_idx, (int)nitems(ppp_id));
- clear_session(ppp_id, MIN(ppp_id_idx, nitems(ppp_id)),
+ clear_session(ppp_id, MINIMUM(ppp_id_idx, nitems(ppp_id)),
ppp_id_idx, out);
}
}
offsetof(struct npppd_disconnect_request, ppp_id[0])) /
sizeof(u_int);
for (i = 0; i < ppp_id_count; i += n) {
- n = MIN(nmax, ppp_id_count - i);
+ n = MINIMUM(nmax, ppp_id_count - i);
req.count = n;
iov[0].iov_base = &req;
iov[0].iov_len = offsetof(
-/* $OpenBSD: parser.c,v 1.2 2014/03/22 04:30:31 yasuoka Exp $ */
+/* $OpenBSD: parser.c,v 1.3 2015/01/19 01:48:57 deraadt Exp $ */
/* This file is derived from OpenBSD:src/usr.sbin/ikectl/parser.c 1.9 */
/*
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
-/* $OpenBSD: bytebuf.c,v 1.6 2014/05/30 05:06:00 yasuoka Exp $ */
+/* $OpenBSD: bytebuf.c,v 1.7 2015/01/19 01:48:59 deraadt Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
* All rights reserved.
* }</pre>
*
* @author Yasuoka Masahiko
- * $Id: bytebuf.c,v 1.6 2014/05/30 05:06:00 yasuoka Exp $
+ * $Id: bytebuf.c,v 1.7 2015/01/19 01:48:59 deraadt Exp $
*/
#include <stdlib.h>
#include <string.h>
void *data;
};
-#ifndef MIN
-#define MIN(m,n) ((m) < (n)? (m) : (n))
-#endif
-
/**
* Create a bytebuffer and allocate memory area.
*
* SUCH DAMAGE.
*/
#include <sys/types.h>
-#include <sys/param.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include "debugutil.h"
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
+#define MAXIMUM(a, b) (((a) > (b)) ? (a) : (b))
+
int debuglevel = 0;
FILE *debugfp = NULL;
static int prio_idx_inititialized = 0;
if (use_syslog && DL(prio) == 0) {
level = LOG_PRI(prio) + syslog_level_adjust;
if (!no_debuglog || level < LOG_DEBUG) {
- level = MIN(LOG_DEBUG, level);
- level = MAX(LOG_EMERG, level);
+ level = MINIMUM(LOG_DEBUG, level);
+ level = MAXIMUM(LOG_EMERG, level);
level |= (prio & LOG_FACMASK);
vsyslog(level, format, ap);
}
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-/* $Id: ipsec_util.c,v 1.6 2014/11/18 20:54:28 krw Exp $ */
+/* $Id: ipsec_util.c,v 1.7 2015/01/19 01:48:59 deraadt Exp $ */
/*@file IPsec related utility functions */
/*
* RFC 2367 PF_KEY Key Management API, Version 2
*/
-#include <sys/param.h>
#include <sys/socket.h>
#include <sys/errno.h>
#include <net/pfkeyv2.h>
args->dst.sadb_address_prefixlen = 0;
#define SADB2SA(_base) ((struct sockaddr *)((_base) + 1))
memcpy(&args->src_sa, SADB2SA(src),
- MIN(sizeof(args->src_sa), SADB2SA(src)->sa_len));
+ MINIMUM(sizeof(args->src_sa), SADB2SA(src)->sa_len));
memcpy(&args->dst_sa, SADB2SA(dst),
- MIN(sizeof(args->src_sa), SADB2SA(dst)->sa_len));
+ MINIMUM(sizeof(args->src_sa), SADB2SA(dst)->sa_len));
#undef SADB2SA
if (proto != 0) {
args->src.sadb_address_proto = proto;
-/* $OpenBSD: l2tp_call.c,v 1.15 2013/09/20 07:26:23 yasuoka Exp $ */
+/* $OpenBSD: l2tp_call.c,v 1.16 2015/01/19 01:48:59 deraadt Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-/* $Id: l2tp_call.c,v 1.15 2013/09/20 07:26:23 yasuoka Exp $ */
+/* $Id: l2tp_call.c,v 1.16 2015/01/19 01:48:59 deraadt Exp $ */
/**@file L2TP LNS call */
#include <sys/types.h>
-#include <sys/param.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <stdlib.h>
*/
break;
case L2TP_AVP_TYPE_CALLING_NUMBER:
- slen = MIN(sizeof(_this->calling_number) - 1,
+ slen = MINIMUM(sizeof(_this->calling_number) - 1,
avp_attr_length(avp));
memcpy(_this->calling_number, avp->attr_value, slen);
_this->calling_number[slen] = '\0';
avp->attr_value[3];
len = avp->length - 12;
if (len > 0) {
- len = MIN(len, sizeof(pmes) - 1);
+ len = MINIMUM(len, sizeof(pmes) - 1);
memcpy(pmes, &avp->attr_value[4], len);
pmes[len] = '\0';
}
#endif
if (errmes != NULL) {
- len = MIN(strlen(errmes), L2TP_AVP_MAXSIZ - 128);
+ len = MINIMUM(strlen(errmes), L2TP_AVP_MAXSIZ - 128);
memcpy(&avp->attr_value[avplen], errmes, len);
avplen += len;
}
sizeof(ppp->phy_label));
L2TP_CALL_ASSERT(sizeof(ppp->phy_info) >= _this->ctrl->peer.ss_len);
memcpy(&ppp->phy_info, &_this->ctrl->peer,
- MIN(sizeof(ppp->phy_info), _this->ctrl->peer.ss_len));
+ MINIMUM(sizeof(ppp->phy_info), _this->ctrl->peer.ss_len));
strlcpy(ppp->calling_number, _this->calling_number,
sizeof(ppp->calling_number));
if (ppp_init(npppd_get_npppd(), ppp) != 0) {
-/* $OpenBSD: l2tp_ctrl.c,v 1.18 2014/07/21 01:51:11 guenther Exp $ */
+/* $OpenBSD: l2tp_ctrl.c,v 1.19 2015/01/19 01:48:59 deraadt Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
* SUCH DAMAGE.
*/
/**@file Control connection processing functions for L2TP LNS */
-/* $Id: l2tp_ctrl.c,v 1.18 2014/07/21 01:51:11 guenther Exp $ */
+/* $Id: l2tp_ctrl.c,v 1.19 2015/01/19 01:48:59 deraadt Exp $ */
#include <sys/types.h>
-#include <sys/param.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <syslog.h>
#include <time.h>
#include <unistd.h>
+#include <limits.h>
#ifdef USE_LIBSOCKUTIL
#include <seil/sockfromto.h>
#include "version.h"
#include "recvfromto.h"
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
+
static int l2tp_ctrl_init (l2tp_ctrl *, l2tpd *, struct sockaddr *, struct sockaddr *, void *);
static void l2tp_ctrl_reload (l2tp_ctrl *);
static int l2tp_ctrl_send_disconnect_notify (l2tp_ctrl *);
continue;
case L2TP_AVP_TYPE_HOST_NAME:
AVP_SIZE_CHECK(avp, >, 4);
- len = MIN(sizeof(hostname) - 1, avp->length - 6);
+ len = MINIMUM(sizeof(hostname) - 1, avp->length - 6);
memcpy(hostname, avp->attr_value, len);
hostname[len] = '\0';
continue;
case L2TP_AVP_TYPE_VENDOR_NAME:
AVP_SIZE_CHECK(avp, >, 4);
- len = MIN(sizeof(vendorname) - 1, avp->length - 6);
+ len = MINIMUM(sizeof(vendorname) - 1, avp->length - 6);
memcpy(vendorname, avp->attr_value, len);
vendorname[len] = '\0';
continue;
avp->attr_value[3];
len = avp->length - 12;
if (len > 0) {
- len = MIN(len, sizeof(pmes) - 1);
+ len = MINIMUM(len, sizeof(pmes) - 1);
memcpy(pmes, &avp->attr_value[4], len);
pmes[len] = '\0';
}
{
int len;
struct l2tp_avp *avp;
- char buf[L2TP_AVP_MAXSIZ], hbuf[MAXHOSTNAMELEN];
+ char buf[L2TP_AVP_MAXSIZ], hbuf[HOST_NAME_MAX+1];
const char *val;
bytebuffer *bytebuf;
-/* $OpenBSD: chap.c,v 1.11 2014/05/28 16:14:19 yasuoka Exp $ */
+/* $OpenBSD: chap.c,v 1.12 2015/01/19 01:48:59 deraadt Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
* </ul></p>
*/
/* RFC 1994, 2433 */
-/* $Id: chap.c,v 1.11 2014/05/28 16:14:19 yasuoka Exp $ */
+/* $Id: chap.c,v 1.12 2015/01/19 01:48:59 deraadt Exp $ */
#include <sys/types.h>
-#include <sys/param.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <netinet/in.h>
-/* $OpenBSD: control.c,v 1.2 2014/07/22 02:03:00 yasuoka Exp $ */
+/* $OpenBSD: control.c,v 1.3 2015/01/19 01:48:59 deraadt Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
#include <sys/queue.h>
#include <sys/stat.h>
#include <sys/socket.h>
-/* $OpenBSD: lcp.c,v 1.9 2013/04/20 23:32:32 yasuoka Exp $ */
+/* $OpenBSD: lcp.c,v 1.10 2015/01/19 01:48:59 deraadt Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-/* $Id: lcp.c,v 1.9 2013/04/20 23:32:32 yasuoka Exp $ */
+/* $Id: lcp.c,v 1.10 2015/01/19 01:48:59 deraadt Exp $ */
/**@file
* This file provides LCP related functions.
*<pre>
*</pre>
*/
#include <sys/types.h>
-#include <sys/param.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <netinet/in.h>
inp0 = inp;
PUTLONG(_this->magic_number, inp)
- len = MIN(inlen, f->ppp->peer_mru - 8);
+ len = MINIMUM(inlen, f->ppp->peer_mru - 8);
fsm_sdata(f, ECHOREP, id, inp0, len);
return 1;
GETLONG(magic, inp);
inlen -= 4;
memset(buf, 0, sizeof(buf));
- len = MIN(inlen, sizeof(buf) - 1);
+ len = MINIMUM(inlen, sizeof(buf) - 1);
memcpy(buf, inp, len);
buf[len] = '\0';
for (i = 0; i < len; i++) {
-/* $OpenBSD: npppd.c,v 1.39 2015/01/08 07:34:05 yasuoka Exp $ */
+/* $OpenBSD: npppd.c,v 1.40 2015/01/19 01:48:59 deraadt Exp $ */
/*-
* Copyright (c) 2005-2008,2009 Internet Initiative Japan Inc.
* Next pppd(nppd). This file provides a npppd daemon process and operations
* for npppd instance.
* @author Yasuoka Masahiko
- * $Id: npppd.c,v 1.39 2015/01/08 07:34:05 yasuoka Exp $
+ * $Id: npppd.c,v 1.40 2015/01/19 01:48:59 deraadt Exp $
*/
#include "version.h"
+#include <sys/param.h> /* ALIGNED_POINTER */
#include <sys/types.h>
#include <sys/socket.h>
-#include <sys/param.h>
#include <sys/sysctl.h>
#include <sys/wait.h>
#include <netinet/in.h>
ppp_log(ppp, LOG_DEBUG, "Received IP packet is too small");
return;
}
- lbuf = MIN(lpktp, sizeof(buf));
+ lbuf = MINIMUM(lpktp, sizeof(buf));
if (!ALIGNED_POINTER(pktp, struct ip)) {
memcpy(buf, pktp, lbuf);
pip = (struct ip *)buf;
-/* $OpenBSD: npppd.h,v 1.15 2014/03/22 04:30:31 yasuoka Exp $ */
+/* $OpenBSD: npppd.h,v 1.16 2015/01/19 01:48:59 deraadt Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
#define NPPPD_H 1
-#include <sys/param.h>
#include <sys/queue.h>
#include <sys/socket.h>
#include <stdbool.h>
#include <net/if_dl.h>
#include <netinet/in.h>
#include <event.h>
+#include <limits.h>
#include "addr_range.h"
#include "pptp_conf.h"
#include "pppoe_conf.h"
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
+#define MAXIMUM(a, b) (((a) > (b)) ? (a) : (b))
+
#define NPPPD_USER "_ppp"
#define NPPPD_GENERIC_NAME_LEN 32
bool eap_capable;
bool strip_nt_domain;
bool strip_atmark_realm;
- char users_file_path[MAXPATHLEN];
+ char users_file_path[PATH_MAX];
union {
struct {
struct radconf auth;
-/* $OpenBSD: npppd_auth.c,v 1.15 2014/08/22 04:36:16 jsg Exp $ */
+/* $OpenBSD: npppd_auth.c,v 1.16 2015/01/19 01:48:59 deraadt Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
* SUCH DAMAGE.
*/
/**@file authentication realm */
-/* $Id: npppd_auth.c,v 1.15 2014/08/22 04:36:16 jsg Exp $ */
+/* $Id: npppd_auth.c,v 1.16 2015/01/19 01:48:59 deraadt Exp $ */
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/socket.h>
u0 = username;
u1 = username_buffer;
if (username_buffer != u0)
- memmove(username_buffer, u0, MIN(strlen(u0) + 1,
+ memmove(username_buffer, u0, MINIMUM(strlen(u0) + 1,
MAX_USERNAME_LENGTH));
if (base->strip_atmark_realm != 0) {
if ((atmark = strrchr(u1, '@')) != NULL)
-/* $OpenBSD: npppd_config.c,v 1.13 2014/10/25 03:23:49 lteo Exp $ */
+/* $OpenBSD: npppd_config.c,v 1.14 2015/01/19 01:48:59 deraadt Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-/* $Id: npppd_config.c,v 1.13 2014/10/25 03:23:49 lteo Exp $ */
+/* $Id: npppd_config.c,v 1.14 2015/01/19 01:48:59 deraadt Exp $ */
/*@file
* This file provides functions which operates configuration and so on.
*/
-#include <sys/param.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <net/if_dl.h>
-/* $OpenBSD: npppd_ctl.c,v 1.13 2014/10/18 04:12:57 deraadt Exp $ */
+/* $OpenBSD: npppd_ctl.c,v 1.14 2015/01/19 01:48:59 deraadt Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <net/if.h>
_this->tunnel_peer.peer_in4.sin_family = AF_UNSPEC;
if (((struct sockaddr *)&ppp->phy_info)->sa_len > 0) {
memcpy(&_this->tunnel_peer, &ppp->phy_info,
- MIN(sizeof(_this->tunnel_peer),
+ MINIMUM(sizeof(_this->tunnel_peer),
((struct sockaddr *)&ppp->phy_info)->sa_len));
}
-/* $OpenBSD: npppd_iface.c,v 1.9 2014/10/25 03:23:49 lteo Exp $ */
+/* $OpenBSD: npppd_iface.c,v 1.10 2015/01/19 01:48:59 deraadt Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-/* $Id: npppd_iface.c,v 1.9 2014/10/25 03:23:49 lteo Exp $ */
+/* $Id: npppd_iface.c,v 1.10 2015/01/19 01:48:59 deraadt Exp $ */
/**@file
* The interface of npppd and kernel.
* This is an implementation to use tun(4) or pppx(4).
*/
#include <sys/types.h>
-#include <sys/param.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <sys/uio.h>
npppd_iface_start(npppd_iface *_this)
{
int x;
- char buf[MAXPATHLEN];
+ char buf[PATH_MAX];
NPPPD_IFACE_ASSERT(_this != NULL);
-/* $OpenBSD: npppd_local.h,v 1.13 2014/03/22 04:30:31 yasuoka Exp $ */
+/* $OpenBSD: npppd_local.h,v 1.14 2015/01/19 01:48:59 deraadt Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
#define NPPPD_BUFSZ BUFSZ
#endif
-#include <sys/param.h>
#include <net/if.h>
#include "npppd_defs.h"
int auth_finalizer_itvl;
/** name of configuration file */
- char config_file[MAXPATHLEN];
+ char config_file[PATH_MAX];
/** name of pid file */
- char pidpath[MAXPATHLEN];
+ char pidpath[PATH_MAX];
/** process id */
pid_t pid;
-/* $OpenBSD: npppd_subr.c,v 1.15 2014/11/13 04:18:27 yasuoka Exp $ */
+/* $OpenBSD: npppd_subr.c,v 1.16 2015/01/19 01:48:59 deraadt Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
/**@file
* This file provides helper functions for npppd.
*/
-#include <sys/param.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include "npppd_subr.h"
#include "privsep.h"
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
+
static u_int16_t route_seq = 0;
static int in_route0(int, struct in_addr *, struct in_addr *, struct in_addr *, int, const char *, uint32_t);
#define ROUNDUP(a) \
if ((th->th_flags & TH_SYN) == 0)
return 0;
- lpktp = MIN(th->th_off << 4, lpktp);
+ lpktp = MINIMUM(th->th_off << 4, lpktp);
pktp += sizeof(struct tcphdr);
lpktp -= sizeof(struct tcphdr);
-/* $OpenBSD: npppd_tun.c,v 1.4 2012/05/08 13:15:12 yasuoka Exp $ */
+/* $OpenBSD: npppd_tun.c,v 1.5 2015/01/19 01:48:59 deraadt Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
*/
#include <sys/types.h>
#include <sys/time.h>
-#include <sys/param.h>
#include <sys/socket.h>
#include <sys/sockio.h>
#include <sys/ioctl.h>
npppd_tundev_start(npppd *_this)
{
int x, sock;
- char buf[MAXPATHLEN];
+ char buf[PATH_MAX];
struct ifaliasreq ifra;
struct sockaddr_in *sin0;
-/* $OpenBSD: pap.c,v 1.7 2012/09/18 13:14:08 yasuoka Exp $ */
+/* $OpenBSD: pap.c,v 1.8 2015/01/19 01:48:59 deraadt Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-/* $Id: pap.c,v 1.7 2012/09/18 13:14:08 yasuoka Exp $ */
+/* $Id: pap.c,v 1.8 2015/01/19 01:48:59 deraadt Exp $ */
/**@file
* This file provides Password Authentication Protocol (PAP) handlers.
* @author Yasuoka Masahiko
*/
#include <sys/types.h>
-#include <sys/param.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <net/if_dl.h>
lmes = 0;
else
lmes = strlen(mes);
- lmes = MIN(lmes, lpktp - 1);
+ lmes = MINIMUM(lmes, lpktp - 1);
PUTCHAR(lmes, pktp1);
if (lmes > 0)
s_len = strlen(s);
memset(pass, 0, sizeof(pass)); /* null padding */
- passlen = MIN(strlen(password), sizeof(pass));
+ passlen = MINIMUM(strlen(password), sizeof(pass));
memcpy(pass, password, passlen);
if ((passlen % 16) != 0)
passlen += 16 - (passlen % 16);
-/* $OpenBSD: ppp.c,v 1.23 2014/11/20 14:51:42 krw Exp $ */
+/* $OpenBSD: ppp.c,v 1.24 2015/01/19 01:48:59 deraadt Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-/* $Id: ppp.c,v 1.23 2014/11/20 14:51:42 krw Exp $ */
+/* $Id: ppp.c,v 1.24 2015/01/19 01:48:59 deraadt Exp $ */
/**@file
* This file provides PPP(Point-to-Point Protocol, RFC 1661) and
* {@link :: _npppd_ppp PPP instance} related functions.
*/
#include <sys/types.h>
#include <sys/socket.h>
-#include <sys/param.h>
#include <netinet/in.h>
#include <net/if_dl.h>
#include <arpa/inet.h>
* comply with the peer's established MRU.
*/
lcp_send_protrej(&_this->lcp, inp_proto,
- MIN(lpkt - (inp_proto - pkt), NPPPD_MIN_MRU - 32));
+ MINIMUM(lpkt - (inp_proto - pkt), NPPPD_MIN_MRU - 32));
}
return 1;
-/* $OpenBSD: privsep.c,v 1.15 2014/08/23 15:29:55 doug Exp $ */
+/* $OpenBSD: privsep.c,v 1.16 2015/01/19 01:48:59 deraadt Exp $ */
/*
* Copyright (c) 2010 Yasuoka Masahiko <yasuoka@openbsd.org>
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
#include <sys/queue.h>
#include <sys/uio.h>
#include <sys/socket.h>
-/* $OpenBSD: radius+.c,v 1.7 2013/08/26 14:15:08 naddy Exp $ */
+/* $OpenBSD: radius+.c,v 1.8 2015/01/19 01:48:59 deraadt Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
#include <mpatrol.h>
#endif
-#include <sys/param.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "radius+_local.h"
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
+
u_int8_t radius_id_counter = 0;
static int radius_check_packet_data(const RADIUS_PACKET_DATA* pdata,
off = 0;
while (off < length) {
- len0 = MIN(length - off, 255-2);
+ len0 = MINIMUM(length - off, 255-2);
if(radius_ensure_add_capacity(packet, len0+2) != 0)
return 1;
off = 0;
while (off < length) {
- len0 = MIN(length - off, 255-8);
+ len0 = MINIMUM(length - off, 255-8);
if(radius_ensure_add_capacity(packet, len0+8) != 0)
return 1;
-/* $OpenBSD: radius_req.c,v 1.8 2014/05/30 05:06:00 yasuoka Exp $ */
+/* $OpenBSD: radius_req.c,v 1.9 2015/01/19 01:48:59 deraadt Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
/**@file
* This file provides functions for RADIUS request using radius+.c and event(3).
* @author Yasuoka Masahiko
- * $Id: radius_req.c,v 1.8 2014/05/30 05:06:00 yasuoka Exp $
+ * $Id: radius_req.c,v 1.9 2015/01/19 01:48:59 deraadt Exp $
*/
#include <sys/types.h>
-#include <sys/param.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <netinet/in.h>
-/* $OpenBSD: pppoe_session.c,v 1.8 2014/11/18 20:54:28 krw Exp $ */
+/* $OpenBSD: pppoe_session.c,v 1.9 2015/01/19 01:48:59 deraadt Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
/**@file
* Session management of PPPoE protocol
- * $Id: pppoe_session.c,v 1.8 2014/11/18 20:54:28 krw Exp $
+ * $Id: pppoe_session.c,v 1.9 2015/01/19 01:48:59 deraadt Exp $
*/
#include <sys/types.h>
#include <sys/socket.h>
-#include <sys/param.h>
#include <sys/uio.h>
#include <netinet/in.h>
#include <net/if.h>
if (len > 0) {
bytebuffer_put(buf, service_name->value, len);
strlcpy(msgbuf, service_name->value,
- MIN(len + 1, sizeof(msgbuf)));
+ MINIMUM(len + 1, sizeof(msgbuf)));
}
}
-/* $OpenBSD: pppoed.c,v 1.16 2014/11/27 10:22:38 tobias Exp $ */
+/* $OpenBSD: pppoed.c,v 1.17 2015/01/19 01:48:59 deraadt Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
/**@file
* This file provides the PPPoE(RFC2516) server(access concentrator)
* implementaion.
- * $Id: pppoed.c,v 1.16 2014/11/27 10:22:38 tobias Exp $
+ * $Id: pppoed.c,v 1.17 2015/01/19 01:48:59 deraadt Exp $
*/
+#include <sys/param.h> /* ALIGN */
#include <sys/types.h>
-#include <sys/param.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <sys/uio.h>
#include "pppoe.h"
#include "pppoe_local.h"
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
+
static int pppoed_seqno = 0;
#ifdef PPPOED_DEBUG
-/* $OpenBSD: pptp_call.c,v 1.7 2012/09/18 13:14:08 yasuoka Exp $ */
+/* $OpenBSD: pptp_call.c,v 1.8 2015/01/19 01:48:59 deraadt Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-/* $Id: pptp_call.c,v 1.7 2012/09/18 13:14:08 yasuoka Exp $ */
+/* $Id: pptp_call.c,v 1.8 2015/01/19 01:48:59 deraadt Exp $ */
/**@file PPTP Call */
/* currently it supports PAC mode only */
#include <sys/types.h>
-#include <sys/param.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <netinet/in.h>
PPTP_CALL_ASSERT(sizeof(ppp->phy_info) >= _this->ctrl->peer.ss_len);
memcpy(&ppp->phy_info, &_this->ctrl->peer,
- MIN(sizeof(ppp->phy_info), _this->ctrl->peer.ss_len));
+ MINIMUM(sizeof(ppp->phy_info), _this->ctrl->peer.ss_len));
if (ppp_init(npppd_get_npppd(), ppp) != 0)
goto fail;
-/* $OpenBSD: pptp_ctrl.c,v 1.8 2013/04/20 23:32:32 yasuoka Exp $ */
+/* $OpenBSD: pptp_ctrl.c,v 1.9 2015/01/19 01:48:59 deraadt Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
* PPTP(RFC 2637) control connection implementation.
* currently it only support PAC part
*/
-/* $Id: pptp_ctrl.c,v 1.8 2013/04/20 23:32:32 yasuoka Exp $ */
+/* $Id: pptp_ctrl.c,v 1.9 2015/01/19 01:48:59 deraadt Exp $ */
#include <sys/types.h>
-#include <sys/param.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <stdio.h>
#include "pptp_local.h"
#include "pptp_subr.h"
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
+#define MAXIMUM(a, b) (((a) > (b)) ? (a) : (b))
+
/* periods of pptp_ctrl_timeout */
#define PPTP_CTRL_TIMEOUT_IVAL_SEC 2
}
break;
case PPTP_CTRL_STATE_ESTABLISHED:
- last = MAX(_this->last_rcv_ctrl, _this->last_snd_ctrl);
+ last = MAXIMUM(_this->last_rcv_ctrl, _this->last_snd_ctrl);
if (curr_time - _this->last_rcv_ctrl
>= _this->echo_interval + _this->echo_timeout) {
-/* $OpenBSD: pptpd.c,v 1.24 2014/10/25 03:23:49 lteo Exp $ */
+/* $OpenBSD: pptpd.c,v 1.25 2015/01/19 01:48:59 deraadt Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-/* $Id: pptpd.c,v 1.24 2014/10/25 03:23:49 lteo Exp $ */
+/* $Id: pptpd.c,v 1.25 2015/01/19 01:48:59 deraadt Exp $ */
/**@file
* This file provides a implementation of PPTP daemon. Currently it
* provides functions for PAC (PPTP Access Concentrator) only.
- * $Id: pptpd.c,v 1.24 2014/10/25 03:23:49 lteo Exp $
+ * $Id: pptpd.c,v 1.25 2015/01/19 01:48:59 deraadt Exp $
*/
#include <sys/types.h>
-#include <sys/param.h>
#include <sys/socket.h>
#include <sys/sysctl.h>
#include <net/if.h>
#include "privsep.h"
#include "accept.h"
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
+
static int pptpd_seqno = 0;
#ifdef PPTPD_DEBUG
call[i - 1] = call0;
}
- for (i = 0; i < MIN(PPTP_MAX_CALL, countof(call)); i++)
+ for (i = 0; i < MINIMUM(PPTP_MAX_CALL, countof(call)); i++)
slist_add(&_this->call_free_list, (void *)(uintptr_t)call[i]);
slist_add(&_this->call_free_list, (void *)PPTPD_SHUFFLE_MARK);