summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorYASUOKA Masahiko <yasuoka@cvs.openbsd.org>2012-05-08 13:18:38 +0000
committerYASUOKA Masahiko <yasuoka@cvs.openbsd.org>2012-05-08 13:18:38 +0000
commit873ad9ae691b0cb4252232642bf6d7c57c4a7318 (patch)
treecd6b6953d6c4c43f7afb2caf5c72ba647554d262 /usr.sbin
parent99013be6c7f3058d49532f6ddf47243060c0fbc7 (diff)
Trivial changes from the upstream(IIJ).
- fix styles, compile errors in some ifdef condition and compiler warnings. - delete rtev* that was to work around routing socket overflows. - delete is_ctrl argument from l2tp_ctrl_send_packet(). It's not used. - tweak returning the exit status. - use IPV6_IPSEC_POLICY for IPv6 socket. (though npppd cannot set up a ipsec policy to the socket yet.) ok mcbride henning
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/npppd/common/ipsec_util.c10
-rw-r--r--usr.sbin/npppd/common/net_utils.c10
-rw-r--r--usr.sbin/npppd/l2tp/l2tp.h6
-rw-r--r--usr.sbin/npppd/l2tp/l2tp_call.c10
-rw-r--r--usr.sbin/npppd/l2tp/l2tp_ctrl.c67
-rw-r--r--usr.sbin/npppd/l2tp/l2tpd.c74
-rw-r--r--usr.sbin/npppd/npppd/Makefile8
-rw-r--r--usr.sbin/npppd/npppd/chap.c10
-rw-r--r--usr.sbin/npppd/npppd/mppe.c6
-rw-r--r--usr.sbin/npppd/npppd/npppd.c56
-rw-r--r--usr.sbin/npppd/npppd/npppd_local.h7
-rw-r--r--usr.sbin/npppd/npppd/npppd_subr.c15
-rw-r--r--usr.sbin/npppd/npppd/ppp.c6
-rw-r--r--usr.sbin/npppd/npppd/psm-opt.h132
-rw-r--r--usr.sbin/npppd/pppoe/pppoed.c5
-rw-r--r--usr.sbin/npppd/pptp/pptp_ctrl.c6
16 files changed, 205 insertions, 223 deletions
diff --git a/usr.sbin/npppd/common/ipsec_util.c b/usr.sbin/npppd/common/ipsec_util.c
index 3b4780673df..943201dda56 100644
--- a/usr.sbin/npppd/common/ipsec_util.c
+++ b/usr.sbin/npppd/common/ipsec_util.c
@@ -23,13 +23,13 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-/* $Id: ipsec_util.c,v 1.4 2010/09/23 04:47:40 jsg Exp $ */
+/* $Id: ipsec_util.c,v 1.5 2012/05/08 13:18:37 yasuoka Exp $ */
/*@file IPsec related utility functions */
/*
* RFC 2367 PF_KEY Key Management API, Version 2
*/
-#include <sys/types.h>
+#include <sys/param.h>
#include <sys/socket.h>
#include <sys/socket.h>
#include <sys/errno.h>
@@ -353,8 +353,10 @@ sadb_del_args_init(struct sadb_del_args *args, uint32_t spi,
args->src.sadb_address_prefixlen =
args->dst.sadb_address_prefixlen = 0;
#define SADB2SA(_base) ((struct sockaddr *)((_base) + 1))
- memcpy(&args->src_sa, SADB2SA(src), SADB2SA(src)->sa_len);
- memcpy(&args->dst_sa, SADB2SA(dst), SADB2SA(dst)->sa_len);
+ memcpy(&args->src_sa, SADB2SA(src),
+ MIN(sizeof(args->src_sa), SADB2SA(src)->sa_len));
+ memcpy(&args->dst_sa, SADB2SA(dst),
+ MIN(sizeof(args->src_sa), SADB2SA(dst)->sa_len));
#undef SADB2SA
if (proto != 0) {
args->src.sadb_address_proto = proto;
diff --git a/usr.sbin/npppd/common/net_utils.c b/usr.sbin/npppd/common/net_utils.c
index 467328f9072..b98d81aa28f 100644
--- a/usr.sbin/npppd/common/net_utils.c
+++ b/usr.sbin/npppd/common/net_utils.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-/* $Id: net_utils.c,v 1.3 2012/05/08 13:15:11 yasuoka Exp $ */
+/* $Id: net_utils.c,v 1.4 2012/05/08 13:18:37 yasuoka Exp $ */
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
@@ -35,10 +35,6 @@
#include "net_utils.h"
-#ifdef NPPPD_USE_RTEV
-#include "rtev.h"
-#endif
-
/** Get an interface name from sockaddr */
const char *
get_ifname_by_sockaddr(struct sockaddr *sa, char *ifname)
@@ -46,9 +42,7 @@ get_ifname_by_sockaddr(struct sockaddr *sa, char *ifname)
struct ifaddrs *addr, *addr0;
struct in_addr *in4a, *in4b;
const char *ifname0 = NULL;
-#ifdef INET6
struct in6_addr *in6a, *in6b;
-#endif
ifname0 = NULL;
/* I want other way than linear search */
@@ -70,7 +64,6 @@ get_ifname_by_sockaddr(struct sockaddr *sa, char *ifname)
ifname0 = ifname;
}
break;
-#ifdef INET6
case AF_INET6:
in6a = &((struct sockaddr_in6 *)addr->ifa_addr)
->sin6_addr;
@@ -80,7 +73,6 @@ get_ifname_by_sockaddr(struct sockaddr *sa, char *ifname)
ifname0 = ifname;
}
break;
-#endif
}
}
freeifaddrs(addr0);
diff --git a/usr.sbin/npppd/l2tp/l2tp.h b/usr.sbin/npppd/l2tp/l2tp.h
index f055f8a8ce9..cc3c8b36a2f 100644
--- a/usr.sbin/npppd/l2tp/l2tp.h
+++ b/usr.sbin/npppd/l2tp/l2tp.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: l2tp.h,v 1.7 2012/05/08 13:15:11 yasuoka Exp $ */
+/* $OpenBSD: l2tp.h,v 1.8 2012/05/08 13:18:37 yasuoka Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
@@ -30,7 +30,7 @@
/*@file
* header file for the L2TP module
*/
-/* $Id: l2tp.h,v 1.7 2012/05/08 13:15:11 yasuoka Exp $ */
+/* $Id: l2tp.h,v 1.8 2012/05/08 13:18:37 yasuoka Exp $ */
/************************************************************************
* Protocol Constants
@@ -464,7 +464,7 @@ void l2tp_ctrl_destroy (l2tp_ctrl *);
l2tp_ctrl *l2tp_ctrl_create (void);
void l2tp_ctrl_input (l2tpd *, int, struct sockaddr *, struct sockaddr *, void *, u_char *, int);
int l2tp_ctrl_send(l2tp_ctrl *, const void *, int);
-int l2tp_ctrl_send_packet(l2tp_ctrl *, int, bytebuffer *, int);
+int l2tp_ctrl_send_packet(l2tp_ctrl *, int, bytebuffer *);
int l2tp_ctrl_stop (l2tp_ctrl *, int);
bytebuffer *l2tp_ctrl_prepare_snd_buffer (l2tp_ctrl *, int);
void l2tp_ctrl_log (l2tp_ctrl *, int, const char *, ...) __attribute__((__format__ (__printf__, 3, 4)));
diff --git a/usr.sbin/npppd/l2tp/l2tp_call.c b/usr.sbin/npppd/l2tp/l2tp_call.c
index c7896096959..28c973f8af5 100644
--- a/usr.sbin/npppd/l2tp/l2tp_call.c
+++ b/usr.sbin/npppd/l2tp/l2tp_call.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: l2tp_call.c,v 1.11 2012/05/08 13:15:11 yasuoka Exp $ */
+/* $OpenBSD: l2tp_call.c,v 1.12 2012/05/08 13:18:37 yasuoka Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
@@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-/* $Id: l2tp_call.c,v 1.11 2012/05/08 13:15:11 yasuoka Exp $ */
+/* $Id: l2tp_call.c,v 1.12 2012/05/08 13:18:37 yasuoka Exp $ */
/**@file L2TP LNS call */
#include <sys/types.h>
#include <sys/param.h>
@@ -412,7 +412,7 @@ l2tp_call_send_ICRP(l2tp_call *_this)
bytebuf_add_avp(bytebuf, avp, 2);
if ((rval = l2tp_ctrl_send_packet(_this->ctrl, _this->peer_session_id,
- bytebuf, 1)) != 0) {
+ bytebuf)) != 0) {
l2tp_call_log(_this, LOG_ERR, "failed to SendICRP: %m");
return 1;
}
@@ -792,7 +792,7 @@ l2tp_call_send_CDN(l2tp_call *_this, int result_code, int error_code, const
bytebuf_add_avp(bytebuf, addavp[i], addavp[i]->length - 6);
if (l2tp_ctrl_send_packet(_this->ctrl, _this->peer_session_id,
- bytebuf, 1) != 0) {
+ bytebuf) != 0) {
l2tp_call_log(_this, LOG_ERR, "Error sending CDN: %m");
return 1;
}
@@ -824,7 +824,7 @@ l2tp_call_send_ZLB(l2tp_call *_this)
return 1;
}
return l2tp_ctrl_send_packet(_this->ctrl, _this->peer_session_id,
- bytebuf, 1);
+ bytebuf);
}
/*
diff --git a/usr.sbin/npppd/l2tp/l2tp_ctrl.c b/usr.sbin/npppd/l2tp/l2tp_ctrl.c
index ce7042bdd3d..c8e96795e1f 100644
--- a/usr.sbin/npppd/l2tp/l2tp_ctrl.c
+++ b/usr.sbin/npppd/l2tp/l2tp_ctrl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: l2tp_ctrl.c,v 1.9 2012/05/08 13:15:11 yasuoka Exp $ */
+/* $OpenBSD: l2tp_ctrl.c,v 1.10 2012/05/08 13:18:37 yasuoka Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
@@ -26,7 +26,7 @@
* SUCH DAMAGE.
*/
/**@file Control connection processing functions for L2TP LNS */
-/* $Id: l2tp_ctrl.c,v 1.9 2012/05/08 13:15:11 yasuoka Exp $ */
+/* $Id: l2tp_ctrl.c,v 1.10 2012/05/08 13:18:37 yasuoka Exp $ */
#include <sys/types.h>
#include <sys/param.h>
#include <sys/time.h>
@@ -35,16 +35,17 @@
#include <netinet/in.h>
#include <net/if.h>
#include <arpa/inet.h>
-#include <stdlib.h>
-#include <syslog.h>
-#include <stdio.h>
+#include <errno.h>
+#include <event.h>
+#include <ifaddrs.h>
+#include <netdb.h>
#include <stdarg.h>
#include <stddef.h>
-#include <netdb.h>
-#include <time.h>
+#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
-#include <event.h>
-#include <ifaddrs.h>
+#include <syslog.h>
+#include <time.h>
#ifdef USE_LIBSOCKUTIL
#include <seil/sockfromto.h>
@@ -422,18 +423,17 @@ l2tp_ctrl_purge_ipsec_sa(l2tp_ctrl *_this)
return; /* don't purge the sa */
}
-#ifdef USE_LIBSOCKUTIL
+#if defined(USE_LIBSOCKUTIL) && defined(IP_IPSEC_SA_COOKIE)
is_natt = (_this->sa_cookie != NULL)? 1 : 0;
#else
is_natt = 0;
#endif
+ proto = 0;
memcpy(&peer, &_this->peer, _this->peer.ss_len);
memcpy(&sock, &_this->sock, _this->sock.ss_len);
- if (!is_natt) {
- proto = 0;
+ if (!is_natt)
SIN(&peer)->sin_port = SIN(&sock)->sin_port = 0;
- }
-#ifdef USE_LIBSOCKUTIL
+#if defined(USE_LIBSOCKUTIL) && defined(IP_IPSEC_SA_COOKIE)
else {
ipsec_sa_cookie = _this->sa_cookie;
SIN(&peer)->sin_port = ipsec_sa_cookie->remote_port;
@@ -824,9 +824,14 @@ l2tp_ctrl_input(l2tpd *_this, int listener_index, struct sockaddr *peer,
listener_index))->phy_label, sizeof(phy_label));
if (_this->phy_label_with_ifname != 0) {
if (get_ifname_by_sockaddr(sock, ifname) == NULL) {
- l2tpd_log_access_deny(_this,
- "could not get interface informations",
- peer);
+ if (errno != ENOENT)
+ l2tp_ctrl_log(ctrl, LOG_ERR,
+ "get_ifname_by_sockaddr() "
+ "failed: %m");
+ else
+ l2tpd_log_access_deny(_this,
+ "could not determine received "
+ "interface", peer);
goto fail;
}
if (l2tpd_config_str_equal(_this,
@@ -1167,21 +1172,14 @@ l2tp_ctrl_txwin_is_full(l2tp_ctrl *_this)
/* send control packet */
int
-l2tp_ctrl_send_packet(l2tp_ctrl *_this, int call_id, bytebuffer *bytebuf,
- int is_ctrl)
+l2tp_ctrl_send_packet(l2tp_ctrl *_this, int call_id, bytebuffer *bytebuf)
{
struct l2tp_header *hdr;
- int rval, use_seq;
+ int rval;
time_t curr_time;
curr_time = get_monosec();
-#ifdef L2TP_DATA_WITH_SEQUENCE
- use_seq = 1;
-#else
- use_seq = is_ctrl;
-#endif
-
bytebuffer_flip(bytebuf);
hdr = (struct l2tp_header *)bytebuffer_pointer(bytebuf);
memset(hdr, 0, sizeof(*hdr));
@@ -1197,14 +1195,13 @@ l2tp_ctrl_send_packet(l2tp_ctrl *_this, int call_id, bytebuffer *bytebuf,
hdr->ns = htons(_this->snd_nxt);
hdr->nr = htons(_this->rcv_nxt);
- if (is_ctrl &&
- bytebuffer_remaining(bytebuf) > sizeof(struct l2tp_header))
+ if (bytebuffer_remaining(bytebuf) > sizeof(struct l2tp_header))
/* Not ZLB */
_this->snd_nxt++;
L2TP_CTRL_DBG((_this, DEBUG_LEVEL_2,
- "SEND %s ns=%u nr=%u snd_nxt=%u snd_una=%u rcv_nxt=%u ",
- (is_ctrl)? "C" : " ", ntohs(hdr->ns), htons(hdr->nr),
+ "SEND C ns=%u nr=%u snd_nxt=%u snd_una=%u rcv_nxt=%u ",
+ ntohs(hdr->ns), htons(hdr->nr),
_this->snd_nxt, _this->snd_una, _this->rcv_nxt));
if (_this->l2tpd->ctrl_out_pktdump != 0) {
@@ -1389,8 +1386,8 @@ l2tp_ctrl_send_StopCCN(l2tp_ctrl *_this, int result)
avp_set_val16(avp, result);
bytebuf_add_avp(bytebuf, avp, 2);
- if (l2tp_ctrl_send_packet(_this, 0, bytebuf, 1) != 0) {
- l2tp_ctrl_log(_this, LOG_ERR, "sending CCN failed");
+ if (l2tp_ctrl_send_packet(_this, 0, bytebuf) != 0) {
+ l2tp_ctrl_log(_this, LOG_ERR, "sending StopCCN failed");
return - 1;
}
l2tp_ctrl_log(_this, LOG_INFO, "SendStopCCN result=%d", result);
@@ -1601,7 +1598,7 @@ l2tp_ctrl_send_SCCRP(l2tp_ctrl *_this)
avp_set_val16(avp, _this->winsz);
bytebuf_add_avp(bytebuf, avp, 2);
- if ((l2tp_ctrl_send_packet(_this, 0, bytebuf, 1)) != 0) {
+ if ((l2tp_ctrl_send_packet(_this, 0, bytebuf)) != 0) {
l2tp_ctrl_log(_this, LOG_ERR, "sending SCCRP failed");
l2tp_ctrl_stop(_this, L2TP_STOP_CCN_RCODE_GENERAL);
return;
@@ -1630,7 +1627,7 @@ l2tp_ctrl_send_HELLO(l2tp_ctrl *_this)
avp_set_val16(avp, L2TP_AVP_MESSAGE_TYPE_HELLO);
bytebuf_add_avp(bytebuf, avp, 2);
- if ((l2tp_ctrl_send_packet(_this, 0, bytebuf, 1)) != 0) {
+ if ((l2tp_ctrl_send_packet(_this, 0, bytebuf)) != 0) {
l2tp_ctrl_log(_this, LOG_ERR, "sending HELLO failed");
l2tp_ctrl_stop(_this, L2TP_STOP_CCN_RCODE_GENERAL);
return 1;
@@ -1653,7 +1650,7 @@ l2tp_ctrl_send_ZLB(l2tp_ctrl *_this)
bytebuffer_put(_this->zlb_buffer, BYTEBUFFER_PUT_DIRECT,
sizeof(struct l2tp_header));
- return l2tp_ctrl_send_packet(_this, 0, _this->zlb_buffer, 1);
+ return l2tp_ctrl_send_packet(_this, 0, _this->zlb_buffer);
}
/*
diff --git a/usr.sbin/npppd/l2tp/l2tpd.c b/usr.sbin/npppd/l2tp/l2tpd.c
index 8b857d84234..a35028e9813 100644
--- a/usr.sbin/npppd/l2tp/l2tpd.c
+++ b/usr.sbin/npppd/l2tp/l2tpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: l2tpd.c,v 1.8 2012/05/08 13:15:11 yasuoka Exp $ */
+/* $OpenBSD: l2tpd.c,v 1.9 2012/05/08 13:18:37 yasuoka Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
@@ -26,7 +26,7 @@
* SUCH DAMAGE.
*/
/**@file L2TP(Layer Two Tunneling Protocol "L2TP") / RFC2661 */
-/* $Id: l2tpd.c,v 1.8 2012/05/08 13:15:11 yasuoka Exp $ */
+/* $Id: l2tpd.c,v 1.9 2012/05/08 13:18:37 yasuoka Exp $ */
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/time.h>
@@ -367,39 +367,60 @@ l2tpd_listener_start(l2tpd_listener *_this, char *ipsec_policy_in,
}
}
#endif
-#ifdef IP_PIPEX
if (_this->bind.sin6.sin6_family == AF_INET) {
+#ifdef IP_PIPEX
ival = 1;
if (setsockopt(sock, IPPROTO_IP, IP_PIPEX, &ival,
sizeof(ival)) != 0)
l2tpd_log(_l2tpd, LOG_WARNING,
"%s(): setsockopt(IP_PIPEX) failed: %m", __func__);
+#endif
+#ifdef IP_IPSEC_POLICY
+ if (ipsec_policy_in != NULL &&
+ setsockopt(sock, IPPROTO_IP, IP_IPSEC_POLICY,
+ ipsec_policy_in, ipsec_get_policylen(ipsec_policy_in))
+ < 0) {
+ l2tpd_log(_l2tpd, LOG_WARNING,
+ "setsockopt(,,IP_IPSEC_POLICY(in)) failed "
+ "in %s(): %m", __func__);
+ }
+ if (ipsec_policy_out != NULL &&
+ setsockopt(sock, IPPROTO_IP, IP_IPSEC_POLICY,
+ ipsec_policy_out, ipsec_get_policylen(ipsec_policy_out))
+ < 0) {
+ l2tpd_log(_l2tpd, LOG_WARNING,
+ "setsockopt(,,IP_IPSEC_POLICY(out)) failed "
+ "in %s(): %m", __func__);
+ }
+#endif
} else {
+#ifdef IPV6_PIPEX
ival = 1;
if (setsockopt(sock, IPPROTO_IPV6, IPV6_PIPEX, &ival,
sizeof(ival)) != 0)
l2tpd_log(_l2tpd, LOG_WARNING,
"%s(): setsockopt(IPV6_PIPEX) failed: %m",
__func__);
- }
#endif
-#ifdef IP_IPSEC_POLICY
-/*XXX */
- if (ipsec_policy_in != NULL &&
- setsockopt(sock, IPPROTO_IP, IP_IPSEC_POLICY,
- ipsec_policy_in, ipsec_get_policylen(ipsec_policy_in)) < 0) {
- l2tpd_log(_l2tpd, LOG_WARNING,
- "setsockopt(,,IP_IPSEC_POLICY(in)) failed in %s(): %m",
- __func__);
- }
- if (ipsec_policy_out != NULL &&
- setsockopt(sock, IPPROTO_IP, IP_IPSEC_POLICY,
- ipsec_policy_out, ipsec_get_policylen(ipsec_policy_out)) < 0) {
- l2tpd_log(_l2tpd, LOG_WARNING,
- "setsockopt(,,IP_IPSEC_POLICY(out)) failed in %s(): %m",
- __func__);
- }
+#ifdef IPV6_IPSEC_POLICY
+ if (ipsec_policy_in != NULL &&
+ setsockopt(sock, IPPROTO_IPV6, IPV6_IPSEC_POLICY,
+ ipsec_policy_in, ipsec_get_policylen(ipsec_policy_in))
+ < 0) {
+ l2tpd_log(_l2tpd, LOG_WARNING,
+ "setsockopt(,,IPV6_IPSEC_POLICY(in)) failed "
+ "in %s(): %m", __func__);
+ }
+ if (ipsec_policy_out != NULL &&
+ setsockopt(sock, IPPROTO_IPV6, IPV6_IPSEC_POLICY,
+ ipsec_policy_out, ipsec_get_policylen(ipsec_policy_out))
+ < 0) {
+ l2tpd_log(_l2tpd, LOG_WARNING,
+ "setsockopt(,,IPV6_IPSEC_POLICY(out)) failed "
+ "in %s(): %m", __func__);
+ }
#endif
+ }
_this->sock = sock;
event_set(&_this->ev_sock, _this->sock, EV_READ | EV_PERSIST,
@@ -735,16 +756,11 @@ l2tpd_reload(l2tpd *_this, struct properties *config, const char *name,
void
l2tpd_log_access_deny(l2tpd *_this, const char *reason, struct sockaddr *peer)
{
- char hostbuf[NI_MAXHOST], servbuf[NI_MAXSERV];
+ char buf[BUFSIZ];
- if (getnameinfo(peer, peer->sa_len, hostbuf, sizeof(hostbuf),
- servbuf, sizeof(servbuf), NI_NUMERICHOST | NI_NUMERICSERV) != 0) {
- l2tpd_log(_this, LOG_ERR, "getnameinfo() failed at %s(): %m",
- __func__);
- return;
- }
- l2tpd_log(_this, LOG_ALERT, "Received packet from %s:%s/udp: "
- "%s", hostbuf, servbuf, reason);
+ l2tpd_log(_this, LOG_ALERT, "Received packet from %s/udp: "
+ "%s", addrport_tostring(peer, peer->sa_len, buf, sizeof(buf)),
+ reason);
}
/* I/O event handler */
diff --git a/usr.sbin/npppd/npppd/Makefile b/usr.sbin/npppd/npppd/Makefile
index 648e3d2a5ae..f1237db7c58 100644
--- a/usr.sbin/npppd/npppd/Makefile
+++ b/usr.sbin/npppd/npppd/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.9 2012/01/18 03:13:04 yasuoka Exp $
+# $OpenBSD: Makefile,v 1.10 2012/05/08 13:18:37 yasuoka Exp $
NPPPD_COMMON_DIR= ${.CURDIR}/../common
@@ -9,9 +9,9 @@ CPPFLAGS+= -I${NPPPD_COMMON_DIR} -I${.CURDIR}
SRCS= ccp.c chap.c chap_ms.c fsm.c ipcp.c lcp.c
SRCS+= mppe.c pap.c ppp.c
SRCS+= npppd.c npppd_config.c npppd_subr.c npppd_auth.c npppd_iface.c
-SRCS+= config_helper.c slist.c hash.c properties.c rtev_common.c
-SRCS+= rtev_libevent.c bytebuf.c debugutil.c csvreader.c net_utils.c
-SRCS+= radish.c time_utils.c npppd_pool.c addr_range.c
+SRCS+= config_helper.c slist.c hash.c properties.c bytebuf.c
+SRCS+= debugutil.c csvreader.c net_utils.c radish.c time_utils.c
+SRCS+= npppd_pool.c addr_range.c
SRCS+= radius+.c radius_req.c npppd_radius.c
SRCS+= recvfromto.c
SRCS+= privsep.c
diff --git a/usr.sbin/npppd/npppd/chap.c b/usr.sbin/npppd/npppd/chap.c
index 529007ab1b0..f17fa53e229 100644
--- a/usr.sbin/npppd/npppd/chap.c
+++ b/usr.sbin/npppd/npppd/chap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: chap.c,v 1.6 2012/05/08 13:15:11 yasuoka Exp $ */
+/* $OpenBSD: chap.c,v 1.7 2012/05/08 13:18:37 yasuoka Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
@@ -36,7 +36,7 @@
* </ul></p>
*/
/* RFC 1994, 2433 */
-/* $Id: chap.c,v 1.6 2012/05/08 13:15:11 yasuoka Exp $ */
+/* $Id: chap.c,v 1.7 2012/05/08 13:18:37 yasuoka Exp $ */
#include <sys/types.h>
#include <sys/param.h>
#include <sys/socket.h>
@@ -292,7 +292,7 @@ chap_input(chap *_this, u_char *pktp, int len)
if (id != _this->challid) {
chap_log(_this, LOG_ERR,
- "Received challege response has unknown id.");
+ "Received challenge response has unknown id.");
return;
}
if (_this->state == CHAP_STATE_AUTHENTICATING)
@@ -308,7 +308,7 @@ chap_input(chap *_this, u_char *pktp, int len)
if (lval > length) {
chap_log(_this, LOG_ERR,
- "Received challege response has invalid Value-Size "
+ "Received challenge response has invalid Value-Size "
"field. %d", lval);
return;
}
@@ -316,7 +316,7 @@ chap_input(chap *_this, u_char *pktp, int len)
lname = len - (pktp1 - pktp);
if (lname <= 0 || sizeof(namebuf) <= lname + 1) {
chap_log(_this, LOG_ERR,
- "Received challege response has invalid Name "
+ "Received challenge response has invalid Name "
"field.");
return;
}
diff --git a/usr.sbin/npppd/npppd/mppe.c b/usr.sbin/npppd/npppd/mppe.c
index 8f7deee6220..f02a6d26881 100644
--- a/usr.sbin/npppd/npppd/mppe.c
+++ b/usr.sbin/npppd/npppd/mppe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mppe.c,v 1.6 2012/05/08 13:15:11 yasuoka Exp $ */
+/* $OpenBSD: mppe.c,v 1.7 2012/05/08 13:18:37 yasuoka Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
@@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-/* $Id: mppe.c,v 1.6 2012/05/08 13:15:11 yasuoka Exp $ */
+/* $Id: mppe.c,v 1.7 2012/05/08 13:18:37 yasuoka Exp $ */
/**@file
*
* The implementation of MPPE(Microsoft Point-To-Point Encryption Protocol)
@@ -379,7 +379,7 @@ mppe_input(mppe *_this, u_char *pktp, int len)
if (encrypt == 0) {
mppe_log(_this, LOG_WARNING,
- "Received unexpected MPPE packet. (no ecrypt)");
+ "Received unexpected MPPE packet. (no encrypt)");
return;
}
diff --git a/usr.sbin/npppd/npppd/npppd.c b/usr.sbin/npppd/npppd/npppd.c
index a84899228d2..f6128441d77 100644
--- a/usr.sbin/npppd/npppd/npppd.c
+++ b/usr.sbin/npppd/npppd/npppd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: npppd.c,v 1.16 2012/05/08 13:15:11 yasuoka Exp $ */
+/* $OpenBSD: npppd.c,v 1.17 2012/05/08 13:18:37 yasuoka Exp $ */
/*-
* Copyright (c) 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.16 2012/05/08 13:15:11 yasuoka Exp $
+ * $Id: npppd.c,v 1.17 2012/05/08 13:18:37 yasuoka Exp $
*/
#include <sys/cdefs.h>
#include "version.h"
@@ -79,7 +79,6 @@ __COPYRIGHT(
#include "npppd_local.h"
#include "npppd_auth.h"
#include "radish.h"
-#include "rtev.h"
#include "net_utils.h"
#include "time_utils.h"
@@ -148,12 +147,11 @@ int main (int, char *[]);
int
main(int argc, char *argv[])
{
- int ch, retstatus, ll_adjust = 0, runasdaemon = 0;
+ int ch, stop_by_error, ll_adjust = 0, runasdaemon = 0;
extern char *optarg;
const char *npppd_conf0 = DEFAULT_NPPPD_CONF;
struct passwd *pw;
- retstatus = EXIT_SUCCESS;
while ((ch = getopt(argc, argv, "Dc:dhs")) != -1) {
switch (ch) {
case 's':
@@ -194,33 +192,28 @@ main(int argc, char *argv[])
if (privsep_init() != 0)
err(1, "cannot drop privileges");
- if (npppd_init(&s_npppd, npppd_conf0) != 0) {
- retstatus = EXIT_FAILURE;
- goto fail;
- }
+ if (npppd_init(&s_npppd, npppd_conf0) != 0)
+ exit(EXIT_FAILURE);
if ((pw = getpwnam(NPPPD_USER)) == NULL)
- err(1, "gwpwnam");
+ err(EXIT_FAILURE, "gwpwnam");
if (chroot(pw->pw_dir) == -1)
- err(1, "chroot");
+ err(EXIT_FAILURE, "chroot");
if (chdir("/") == -1)
- err(1, "chdir(\"/\")");
+ err(EXIT_FAILURE, "chdir(\"/\")");
if (setgroups(1, &pw->pw_gid) ||
setresgid(pw->pw_gid, pw->pw_gid, pw->pw_gid) ||
setresuid(pw->pw_uid, pw->pw_uid, pw->pw_uid))
- err(1, "cannot drop privileges");
+ err(EXIT_FAILURE, "cannot drop privileges");
/* privileges is dropped */
npppd_start(&s_npppd);
- if (s_npppd.stop_by_error != 0)
- retstatus = EXIT_FAILURE;
+ stop_by_error = s_npppd.stop_by_error;
npppd_fini(&s_npppd);
- /* FALLTHROUGH */
-fail:
privsep_fini();
log_printf(LOG_NOTICE, "Terminate npppd.");
- exit(retstatus);
+ exit((!stop_by_error)? EXIT_SUCCESS : EXIT_FAILURE);
}
static void
@@ -332,17 +325,6 @@ npppd_init(npppd *_this, const char *config_file)
/* initialize event(3) */
event_init();
- /* initialize rtev */
- rtev_libevent_init(
- npppd_config_int(_this, "rtsock.event_delay",
- DEFAULT_RTSOCK_EVENT_DELAY),
- npppd_config_int(_this, "rtsock.send_wait_millisec",
- DEFAULT_RTSOCK_SEND_WAIT_MILLISEC),
- npppd_config_int(_this, "rtsock.send_npkts",
- DEFAULT_RTSOCK_SEND_NPKTS), 0);
-
- _this->rtev_event_serial = -1;
-
/* ignore signals */
signal(SIGPIPE, SIG_IGN);
signal(SIGURG, SIG_IGN);
@@ -512,8 +494,6 @@ npppd_fini(npppd *_this)
if (_this->map_user_ppp != NULL)
hash_free(_this->map_user_ppp);
-
- rtev_fini();
}
/***********************************************************************
@@ -559,14 +539,10 @@ npppd_timer(int fd, short evtype, void *ctx)
npppd_auth_finalizer_periodic(_this);
}
- if (_this->rtev_event_serial != rtev_get_event_serial()) {
#ifdef USE_NPPPD_PPPOE
- if (pppoed_need_polling(&_this->pppoed))
- pppoed_reload_listeners(&_this->pppoed);
+ if (pppoed_need_polling(&_this->pppoed))
+ pppoed_reload_listeners(&_this->pppoed);
#endif
- }
- _this->rtev_event_serial = rtev_get_event_serial();
-
#ifdef USE_NPPPD_PIPEX
pipex_periodic(_this);
#endif
@@ -1072,8 +1048,6 @@ npppd_ppp_pipex_enable(npppd *_this, npppd_ppp *ppp)
req.pr_proto.l2tp.ns_nxt = l2tp->snd_nxt;
req.pr_proto.l2tp.nr_nxt = l2tp->rcv_nxt;
- NPPPD_ASSERT(l2tpctrl->peer.ss_family == AF_INET);
-
memcpy(&req.peer_address, &l2tpctrl->peer,
l2tpctrl->peer.ss_len);
memcpy(&req.local_address, &l2tpctrl->sock,
@@ -1948,11 +1922,11 @@ npppd_on_sigchld(int fd, short ev_type, void *ctx)
if (wait4(wpid, &status, WNOHANG, NULL) == wpid) {
if (WIFSIGNALED(status))
log_printf(LOG_WARNING,
- "priviledged process exits abnormaly. signal=%d",
+ "privileged process exits abnormaly. signal=%d",
WTERMSIG(status));
else
log_printf(LOG_WARNING,
- "priviledged process exits abnormaly. status=%d",
+ "privileged process exits abnormaly. status=%d",
WEXITSTATUS(status));
_this->stop_by_error = 1;
npppd_stop(_this);
diff --git a/usr.sbin/npppd/npppd/npppd_local.h b/usr.sbin/npppd/npppd/npppd_local.h
index 773c36971b8..5a224da7a7a 100644
--- a/usr.sbin/npppd/npppd/npppd_local.h
+++ b/usr.sbin/npppd/npppd/npppd_local.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: npppd_local.h,v 1.9 2012/05/08 13:15:12 yasuoka Exp $ */
+/* $OpenBSD: npppd_local.h,v 1.10 2012/05/08 13:18:37 yasuoka Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
@@ -41,6 +41,7 @@
#include "slist.h"
#include "hash.h"
#include "properties.h"
+#include "debugutil.h"
#ifdef USE_NPPPD_RADIUS
#include <radius+.h>
@@ -48,7 +49,6 @@
#endif
#ifdef USE_NPPPD_L2TP
-#include "debugutil.h"
#include "bytebuf.h"
#include "l2tp.h"
#endif
@@ -230,9 +230,6 @@ struct _npppd {
/** counter of reload configuration */
int16_t reloading_count;
- /** serial number of routing event which was completed */
- int rtev_event_serial;
-
/** maximum PPP sessions */
int max_session;
diff --git a/usr.sbin/npppd/npppd/npppd_subr.c b/usr.sbin/npppd/npppd/npppd_subr.c
index bd920cd2bbe..e7766179cbc 100644
--- a/usr.sbin/npppd/npppd/npppd_subr.c
+++ b/usr.sbin/npppd/npppd/npppd_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: npppd_subr.c,v 1.7 2012/05/08 13:15:12 yasuoka Exp $ */
+/* $OpenBSD: npppd_subr.c,v 1.8 2012/05/08 13:18:37 yasuoka Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
@@ -28,7 +28,7 @@
/**@file
* This file provides helper functions for npppd.
*/
-/* $Id: npppd_subr.c,v 1.7 2012/05/08 13:15:12 yasuoka Exp $ */
+/* $Id: npppd_subr.c,v 1.8 2012/05/08 13:18:37 yasuoka Exp $ */
#include <sys/cdefs.h>
#ifndef LINT
__COPYRIGHT(
@@ -64,7 +64,6 @@ __COPYRIGHT(
#include "npppd_defs.h"
#include "npppd_subr.h"
-#include "rtev.h"
#include "privsep.h"
static u_int16_t route_seq = 0;
@@ -147,11 +146,9 @@ in_route0(int type, struct in_addr *dest, struct in_addr *mask,
char *cp, buf[sizeof(*rtm) + sizeof(struct sockaddr_in) * 3 +
sizeof(dl_buf) + 128];
const char *strtype;
-#ifndef NPPPD_USE_RTEV_WRITE
int rval, dummy, flags, sock;
sock = -1;
-#endif
ASSERT(type == RTM_ADD || type == RTM_DELETE);
if(type == RTM_ADD)
@@ -237,11 +234,6 @@ in_route0(int type, struct in_addr *dest, struct in_addr *mask,
rtm->rtm_msglen = cp - buf;
-#ifdef NPPPD_USE_RTEV_WRITE
- if (rtev_write(rtm) < 0)
- log_printf(LOG_ERR, "rtev_write failed in %s: %m", __func__);
-#else
-
if ((sock = priv_socket(PF_ROUTE, SOCK_RAW, AF_UNSPEC)) < 0) {
log_printf(LOG_ERR, "socket() failed in %s() on %s : %m",
__func__, strtype);
@@ -276,15 +268,12 @@ in_route0(int type, struct in_addr *dest, struct in_addr *mask,
}
close(sock);
-#endif
return 0;
-#ifndef NPPPD_USE_RTEV_WRITE
fail:
if (sock >= 0)
close(sock);
-#endif
return 1;
}
diff --git a/usr.sbin/npppd/npppd/ppp.c b/usr.sbin/npppd/npppd/ppp.c
index aef1fb5b0bd..9e69383da75 100644
--- a/usr.sbin/npppd/npppd/ppp.c
+++ b/usr.sbin/npppd/npppd/ppp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ppp.c,v 1.13 2012/05/08 13:15:12 yasuoka Exp $ */
+/* $OpenBSD: ppp.c,v 1.14 2012/05/08 13:18:37 yasuoka Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
@@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-/* $Id: ppp.c,v 1.13 2012/05/08 13:15:12 yasuoka Exp $ */
+/* $Id: ppp.c,v 1.14 2012/05/08 13:18:37 yasuoka Exp $ */
/**@file
* This file provides PPP(Point-to-Point Protocol, RFC 1661) and
* {@link :: _npppd_ppp PPP instance} related functions.
@@ -261,7 +261,7 @@ ppp_dialin_proxy_prepare(npppd_ppp *_this, dialin_proxy_info *dpi)
if (lcp_dialin_proxy(&_this->lcp, dpi, renego, renego_force) != 0) {
ppp_log(_this, LOG_ERR,
- "Failed to proxy-dialin, proxied lcp is broken.");
+ "Failed to dialin-proxy, proxied lcp is broken.");
return 1;
}
diff --git a/usr.sbin/npppd/npppd/psm-opt.h b/usr.sbin/npppd/npppd/psm-opt.h
index 818d57858c8..291cab7f298 100644
--- a/usr.sbin/npppd/npppd/psm-opt.h
+++ b/usr.sbin/npppd/npppd/psm-opt.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: psm-opt.h,v 1.4 2012/05/08 13:15:12 yasuoka Exp $ */
+/* $OpenBSD: psm-opt.h,v 1.5 2012/05/08 13:18:37 yasuoka Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
@@ -43,7 +43,7 @@
* // Mark peer rejects "Address and Control Field Compression" option.
* psm_peer_opt_set_reject(lcp, acfc, true)
* </pre></p>
- * $Id: psm-opt.h,v 1.4 2012/05/08 13:15:12 yasuoka Exp $
+ * $Id: psm-opt.h,v 1.5 2012/05/08 13:18:37 yasuoka Exp $
*/
#define PSM_OPT_REQUEST_OURS 0x01
@@ -56,68 +56,84 @@
#define PSM_OPT_REJECT_PEERS 0x40
#define PSM_OPT_ENABLED_PEERS 0x80
-#define psm_peer_opt_is_requested(psm, confopt) \
+#define psm_peer_opt_is_requested(psm, confopt) \
(((psm)->opt.confopt & PSM_OPT_REQUEST_PEERS) != 0)
-#define psm_peer_opt_set_requested(psm, confopt, boolval) \
- if ((boolval)) { \
- (psm)->opt.confopt |= PSM_OPT_REQUEST_PEERS; \
- } else { \
- (psm)->opt.confopt &= ~PSM_OPT_REQUEST_PEERS; \
- }
-#define psm_opt_is_requested(psm, confopt) \
+#define psm_peer_opt_set_requested(psm, confopt, boolval) \
+ do { \
+ if ((boolval)) { \
+ (psm)->opt.confopt |= PSM_OPT_REQUEST_PEERS; \
+ } else { \
+ (psm)->opt.confopt &= ~PSM_OPT_REQUEST_PEERS; \
+ } \
+ } while (0)
+#define psm_opt_is_requested(psm, confopt) \
(((psm)->opt.confopt & PSM_OPT_REQUEST_OURS) != 0)
-#define psm_opt_set_requested(psm, confopt, boolval) \
- if ((boolval)) { \
- (psm)->opt.confopt |= PSM_OPT_REQUEST_OURS; \
- } else { \
- (psm)->opt.confopt &= ~PSM_OPT_REQUEST_OURS; \
- }
-#define psm_peer_opt_is_accepted(psm, confopt) \
+#define psm_opt_set_requested(psm, confopt, boolval) \
+ do { \
+ if ((boolval)) { \
+ (psm)->opt.confopt |= PSM_OPT_REQUEST_OURS; \
+ } else { \
+ (psm)->opt.confopt &= ~PSM_OPT_REQUEST_OURS; \
+ } \
+ } while (0)
+#define psm_peer_opt_is_accepted(psm, confopt) \
(((psm)->opt.confopt & PSM_OPT_ACCEPT_PEERS) != 0)
-#define psm_peer_opt_set_accepted(psm, confopt, boolval) \
- if ((boolval)) { \
- (psm)->opt.confopt |= PSM_OPT_ACCEPT_PEERS; \
- } else { \
- (psm)->opt.confopt &= ~PSM_OPT_ACCEPT_PEERS; \
- }
-#define psm_opt_is_accepted(psm, confopt) \
+#define psm_peer_opt_set_accepted(psm, confopt, boolval) \
+ do { \
+ if ((boolval)) { \
+ (psm)->opt.confopt |= PSM_OPT_ACCEPT_PEERS; \
+ } else { \
+ (psm)->opt.confopt &= ~PSM_OPT_ACCEPT_PEERS; \
+ } \
+ } while (0)
+#define psm_opt_is_accepted(psm, confopt) \
(((psm)->opt.confopt & PSM_OPT_ACCEPT_OURS) != 0)
-#define psm_opt_set_accepted(psm, confopt, boolval) \
- if ((boolval)) { \
- (psm)->opt.confopt |= PSM_OPT_ACCEPT_OURS; \
- } else { \
- (psm)->opt.confopt &= ~PSM_OPT_ACCEPT_OURS; \
- }
-#define psm_peer_opt_is_rejected(psm, confopt) \
+#define psm_opt_set_accepted(psm, confopt, boolval) \
+ do { \
+ if ((boolval)) { \
+ (psm)->opt.confopt |= PSM_OPT_ACCEPT_OURS; \
+ } else { \
+ (psm)->opt.confopt &= ~PSM_OPT_ACCEPT_OURS; \
+ } \
+ } while (0)
+#define psm_peer_opt_is_rejected(psm, confopt) \
(((psm)->opt.confopt & PSM_OPT_REJECT_PEERS) != 0)
-#define psm_peer_opt_set_rejected(psm, confopt, boolval) \
- if ((boolval)) { \
- (psm)->opt.confopt |= PSM_OPT_REJECT_PEERS; \
- } else { \
- (psm)->opt.confopt &= ~PSM_OPT_REJECT_PEERS; \
- }
-#define psm_opt_is_rejected(psm, confopt) \
+#define psm_peer_opt_set_rejected(psm, confopt, boolval) \
+ do { \
+ if ((boolval)) { \
+ (psm)->opt.confopt |= PSM_OPT_REJECT_PEERS; \
+ } else { \
+ (psm)->opt.confopt &= ~PSM_OPT_REJECT_PEERS; \
+ } \
+ } while (0)
+#define psm_opt_is_rejected(psm, confopt) \
(((psm)->opt.confopt & PSM_OPT_REJECT_OURS) != 0)
-#define psm_opt_set_rejected(psm, confopt, boolval) \
- if ((boolval)) { \
- (psm)->opt.confopt |= PSM_OPT_REJECT_OURS; \
- } else { \
- (psm)->opt.confopt &= ~PSM_OPT_REJECT_OURS; \
- }
-#define psm_peer_opt_is_enabled(psm, confopt) \
+#define psm_opt_set_rejected(psm, confopt, boolval) \
+ do { \
+ if ((boolval)) { \
+ (psm)->opt.confopt |= PSM_OPT_REJECT_OURS; \
+ } else { \
+ (psm)->opt.confopt &= ~PSM_OPT_REJECT_OURS; \
+ } \
+ } while (0)
+#define psm_peer_opt_is_enabled(psm, confopt) \
(((psm)->opt.confopt & PSM_OPT_ENABLED_PEERS) != 0)
-#define psm_peer_opt_set_enabled(psm, confopt, boolval) \
- if ((boolval)) { \
- (psm)->opt.confopt |= PSM_OPT_ENABLED_PEERS; \
- } else { \
- (psm)->opt.confopt &= ~PSM_OPT_ENABLED_PEERS; \
- }
-#define psm_opt_is_enabled(psm, confopt) \
+#define psm_peer_opt_set_enabled(psm, confopt, boolval) \
+ do { \
+ if ((boolval)) { \
+ (psm)->opt.confopt |= PSM_OPT_ENABLED_PEERS; \
+ } else { \
+ (psm)->opt.confopt &= ~PSM_OPT_ENABLED_PEERS; \
+ } \
+ } while (0)
+#define psm_opt_is_enabled(psm, confopt) \
(((psm)->opt.confopt & PSM_OPT_ENABLED_OURS) != 0)
-#define psm_opt_set_enabled(psm, confopt, boolval) \
- if ((boolval)) { \
- (psm)->opt.confopt |= PSM_OPT_ENABLED_OURS; \
- } else { \
- (psm)->opt.confopt &= ~PSM_OPT_ENABLED_OURS; \
- }
+#define psm_opt_set_enabled(psm, confopt, boolval) \
+ do { \
+ if ((boolval)) { \
+ (psm)->opt.confopt |= PSM_OPT_ENABLED_OURS; \
+ } else { \
+ (psm)->opt.confopt &= ~PSM_OPT_ENABLED_OURS; \
+ } \
+ } while (0)
#endif
diff --git a/usr.sbin/npppd/pppoe/pppoed.c b/usr.sbin/npppd/pppoe/pppoed.c
index f63ed7afa8c..acf60fa8b3d 100644
--- a/usr.sbin/npppd/pppoe/pppoed.c
+++ b/usr.sbin/npppd/pppoe/pppoed.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pppoed.c,v 1.9 2012/05/08 13:15:12 yasuoka Exp $ */
+/* $OpenBSD: pppoed.c,v 1.10 2012/05/08 13:18:37 yasuoka Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
@@ -28,7 +28,7 @@
/**@file
* This file provides the PPPoE(RFC2516) server(access concentrator)
* implementaion.
- * $Id: pppoed.c,v 1.9 2012/05/08 13:15:12 yasuoka Exp $
+ * $Id: pppoed.c,v 1.10 2012/05/08 13:18:37 yasuoka Exp $
*/
#include <sys/types.h>
#include <sys/param.h>
@@ -66,7 +66,6 @@
#include "hash.h"
#include "properties.h"
#include "config_helper.h"
-#include "rtev.h"
#include "privsep.h"
#include "pppoe.h"
diff --git a/usr.sbin/npppd/pptp/pptp_ctrl.c b/usr.sbin/npppd/pptp/pptp_ctrl.c
index 9d84bd85587..8c555faf96c 100644
--- a/usr.sbin/npppd/pptp/pptp_ctrl.c
+++ b/usr.sbin/npppd/pptp/pptp_ctrl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pptp_ctrl.c,v 1.5 2012/05/08 13:15:12 yasuoka Exp $ */
+/* $OpenBSD: pptp_ctrl.c,v 1.6 2012/05/08 13:18:37 yasuoka Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
@@ -29,7 +29,7 @@
* PPTP(RFC 2637) control connection implementation.
* currently it only support PAC part
*/
-/* $Id: pptp_ctrl.c,v 1.5 2012/05/08 13:15:12 yasuoka Exp $ */
+/* $Id: pptp_ctrl.c,v 1.6 2012/05/08 13:18:37 yasuoka Exp $ */
#include <sys/types.h>
#include <sys/param.h>
#include <sys/socket.h>
@@ -405,7 +405,7 @@ pptp_ctrl_io_event(int fd, short evmask, void *ctx)
sz = read(_this->sock, bytebuffer_pointer(_this->recv_buf),
bytebuffer_remaining(_this->recv_buf));
if (sz <= 0) {
- if (errno == ECONNRESET || sz == 0) {
+ if (sz == 0 || errno == ECONNRESET) {
pptp_ctrl_log(_this, LOG_INFO,
"Connection closed by foreign host");
pptp_ctrl_fini(_this);