summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorclaudio <claudio@openbsd.org>2020-04-07 07:11:22 +0000
committerclaudio <claudio@openbsd.org>2020-04-07 07:11:22 +0000
commit972a3eac904477a18a4dc854655416b8fb0b522c (patch)
tree34f9fce88a1241c0012857598e59a7e6a519a13b
parentRemove superfluous NULL check from allocation with PR_WAITOK. (diff)
downloadwireguard-openbsd-972a3eac904477a18a4dc854655416b8fb0b522c.tar.xz
wireguard-openbsd-972a3eac904477a18a4dc854655416b8fb0b522c.zip
Deny to create a pipex session if the session id already exists.
From Vitaliy Makkoveev OK yasuoka@
-rw-r--r--sys/net/if_pppx.c7
-rw-r--r--sys/net/pipex.c7
2 files changed, 12 insertions, 2 deletions
diff --git a/sys/net/if_pppx.c b/sys/net/if_pppx.c
index 4834b45164a..85dcbd7d11b 100644
--- a/sys/net/if_pppx.c
+++ b/sys/net/if_pppx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_pppx.c,v 1.80 2020/04/07 07:09:47 mpi Exp $ */
+/* $OpenBSD: if_pppx.c,v 1.81 2020/04/07 07:11:22 claudio Exp $ */
/*
* Copyright (c) 2010 Claudio Jeker <claudio@openbsd.org>
@@ -719,6 +719,11 @@ pppx_add_session(struct pppx_dev *pxd, struct pipex_session_req *req)
return (EPROTONOSUPPORT);
}
+ session = pipex_lookup_by_session_id(req->pr_protocol,
+ req->pr_session_id);
+ if (session)
+ return (EEXIST);
+
pxi = pool_get(pppx_if_pl, PR_WAITOK | PR_ZERO);
session = &pxi->pxi_session;
diff --git a/sys/net/pipex.c b/sys/net/pipex.c
index 281b4a73be9..c433e4beaa6 100644
--- a/sys/net/pipex.c
+++ b/sys/net/pipex.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pipex.c,v 1.112 2020/04/06 13:14:04 claudio Exp $ */
+/* $OpenBSD: pipex.c,v 1.113 2020/04/07 07:11:22 claudio Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
@@ -312,6 +312,11 @@ pipex_add_session(struct pipex_session_req *req,
return (EPROTONOSUPPORT);
}
+ session = pipex_lookup_by_session_id(req->pr_protocol,
+ req->pr_session_id);
+ if (session)
+ return (EEXIST);
+
/* prepare a new session */
session = pool_get(&pipex_session_pool, PR_WAITOK | PR_ZERO);
session->state = PIPEX_STATE_OPENED;