summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Tuexen <tuexen@fh-muenster.de>2016-03-28 21:38:43 +0200
committerMichael Tuexen <tuexen@fh-muenster.de>2016-03-28 21:38:43 +0200
commitd75dc0cb70b070024d04078ae59ab709c22fa1a0 (patch)
treed572fab2f4ac9572ea31da85c6ece363c718d83c
parenta18a569a57c76a7e91892fc25627d977a34e51a7 (diff)
Restrict addresses when adding them to the endpoint.
Don't allow setting the peer primary if the address is restricted and not pending. This is related to https://github.com/sctplab/usrsctp/issues/57
-rwxr-xr-xusrsctplib/netinet/sctp_pcb.c6
-rwxr-xr-xusrsctplib/netinet/sctp_usrreq.c6
2 files changed, 10 insertions, 2 deletions
diff --git a/usrsctplib/netinet/sctp_pcb.c b/usrsctplib/netinet/sctp_pcb.c
index c264db5..fdd1ddf 100755
--- a/usrsctplib/netinet/sctp_pcb.c
+++ b/usrsctplib/netinet/sctp_pcb.c
@@ -32,7 +32,7 @@
#ifdef __FreeBSD__
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/sys/netinet/sctp_pcb.c 295805 2016-02-19 11:25:18Z tuexen $");
+__FBSDID("$FreeBSD: head/sys/netinet/sctp_pcb.c 297361 2016-03-28 19:31:10Z tuexen $");
#endif
#include <netinet/sctp_os.h>
@@ -6173,6 +6173,7 @@ void
sctp_add_local_addr_ep(struct sctp_inpcb *inp, struct sctp_ifa *ifa, uint32_t action)
{
struct sctp_laddr *laddr;
+ struct sctp_tcb *stcb;
int fnd, error = 0;
fnd = 0;
@@ -6231,6 +6232,9 @@ sctp_add_local_addr_ep(struct sctp_inpcb *inp, struct sctp_ifa *ifa, uint32_t ac
default:
break;
}
+ LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
+ sctp_add_local_addr_restricted(stcb, ifa);
+ }
}
return;
}
diff --git a/usrsctplib/netinet/sctp_usrreq.c b/usrsctplib/netinet/sctp_usrreq.c
index d426761..33a7584 100755
--- a/usrsctplib/netinet/sctp_usrreq.c
+++ b/usrsctplib/netinet/sctp_usrreq.c
@@ -32,7 +32,7 @@
#ifdef __FreeBSD__
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/sys/netinet/sctp_usrreq.c 297312 2016-03-27 10:04:25Z tuexen $");
+__FBSDID("$FreeBSD: head/sys/netinet/sctp_usrreq.c 297362 2016-03-28 19:32:13Z tuexen $");
#endif
#include <netinet/sctp_os.h>
@@ -6624,6 +6624,10 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
__func__);
continue;
}
+ if ((sctp_is_addr_restricted(stcb, laddr->ifa)) &&
+ (!sctp_is_addr_pending(stcb, laddr->ifa))) {
+ continue;
+ }
if (laddr->ifa == ifa) {
found = 1;
break;