aboutsummaryrefslogtreecommitdiff
path: root/sys/netinet
diff options
context:
space:
mode:
authorMichael Tuexen <tuexen@FreeBSD.org>2016-04-16 21:34:49 +0000
committerMichael Tuexen <tuexen@FreeBSD.org>2016-04-16 21:34:49 +0000
commitb9dd6a90b68f6c0d79c0e9bf49c5c10b9a6393aa (patch)
treefe7a95b48435d5a052faeb1c2b35aebbf572c3b4 /sys/netinet
parenta13bfb0908931436cb5d9ffbd53134b8a0c146c1 (diff)
Notes
Diffstat (limited to 'sys/netinet')
-rw-r--r--sys/netinet/sctp_usrreq.c48
-rw-r--r--sys/netinet/sctp_var.h3
2 files changed, 22 insertions, 29 deletions
diff --git a/sys/netinet/sctp_usrreq.c b/sys/netinet/sctp_usrreq.c
index 81d2478294d4..65d3af375f24 100644
--- a/sys/netinet/sctp_usrreq.c
+++ b/sys/netinet/sctp_usrreq.c
@@ -143,7 +143,7 @@ sctp_pathmtu_adjustment(struct sctp_tcb *stcb, uint16_t nxtsz)
}
#ifdef INET
-static void
+void
sctp_notify(struct sctp_inpcb *inp,
struct sctp_tcb *stcb,
struct sctp_nets *net,
@@ -171,13 +171,7 @@ sctp_notify(struct sctp_inpcb *inp,
(icmp_code == ICMP_UNREACH_NET_PROHIB) ||
(icmp_code == ICMP_UNREACH_HOST_PROHIB) ||
(icmp_code == ICMP_UNREACH_FILTER_PROHIB)) {
-
- /*
- * Hmm reachablity problems we must examine closely. If its
- * not reachable, we may have lost a network. Or if there is
- * NO protocol at the other end named SCTP. well we consider
- * it a OOTB abort.
- */
+ /* Mark the net unreachable. */
if (net->dest_state & SCTP_ADDR_REACHABLE) {
/* OK, that destination is NOT reachable. */
net->dest_state &= ~SCTP_ADDR_REACHABLE;
@@ -189,13 +183,7 @@ sctp_notify(struct sctp_inpcb *inp,
SCTP_TCB_UNLOCK(stcb);
} else if ((icmp_code == ICMP_UNREACH_PROTOCOL) ||
(icmp_code == ICMP_UNREACH_PORT)) {
- /*
- * Here the peer is either playing tricks on us, including
- * an address that belongs to someone who does not support
- * SCTP OR was a userland implementation that shutdown and
- * now is dead. In either case treat it like a OOTB abort
- * with no TCB
- */
+ /* Treat it like an ABORT. */
sctp_abort_notification(stcb, 1, 0, NULL, SCTP_SO_NOT_LOCKED);
#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING)
so = SCTP_INP_SO(inp);
@@ -261,7 +249,7 @@ sctp_ctlinput(int cmd, struct sockaddr *sa, void *vip)
struct sctp_tcb *stcb;
struct sctp_nets *net;
struct sctp_init_chunk *ch;
- struct sockaddr_in to, from;
+ struct sockaddr_in src, dst;
if (sa->sa_family != AF_INET ||
((struct sockaddr_in *)sa)->sin_addr.s_addr == INADDR_ANY) {
@@ -278,23 +266,25 @@ sctp_ctlinput(int cmd, struct sockaddr *sa, void *vip)
(sizeof(struct icmp) - sizeof(struct ip)));
outer_ip = (struct ip *)((caddr_t)icmp - sizeof(struct ip));
sh = (struct sctphdr *)((caddr_t)inner_ip + (inner_ip->ip_hl << 2));
- bzero(&to, sizeof(to));
- bzero(&from, sizeof(from));
- from.sin_family = to.sin_family = AF_INET;
- from.sin_len = to.sin_len = sizeof(to);
- from.sin_port = sh->src_port;
- from.sin_addr = inner_ip->ip_src;
- to.sin_port = sh->dest_port;
- to.sin_addr = inner_ip->ip_dst;
+ memset(&src, 0, sizeof(struct sockaddr_in));
+ src.sin_family = AF_INET;
+ src.sin_len = sizeof(struct sockaddr_in);
+ src.sin_port = sh->src_port;
+ src.sin_addr = inner_ip->ip_src;
+ memset(&dst, 0, sizeof(struct sockaddr_in));
+ dst.sin_family = AF_INET;
+ dst.sin_len = sizeof(struct sockaddr_in);
+ dst.sin_port = sh->dest_port;
+ dst.sin_addr = inner_ip->ip_dst;
/*
- * 'to' holds the dest of the packet that failed to be sent.
- * 'from' holds our local endpoint address. Thus we reverse
- * the to and the from in the lookup.
+ * 'dst' holds the dest of the packet that failed to be
+ * sent. 'src' holds our local endpoint address. Thus we
+ * reverse the dst and the src in the lookup.
*/
inp = NULL;
net = NULL;
- stcb = sctp_findassociation_addr_sa((struct sockaddr *)&to,
- (struct sockaddr *)&from,
+ stcb = sctp_findassociation_addr_sa((struct sockaddr *)&dst,
+ (struct sockaddr *)&src,
&inp, &net, 1,
SCTP_DEFAULT_VRFID);
if ((stcb != NULL) &&
diff --git a/sys/netinet/sctp_var.h b/sys/netinet/sctp_var.h
index 77e5da2edf07..8b4f7db88ddc 100644
--- a/sys/netinet/sctp_var.h
+++ b/sys/netinet/sctp_var.h
@@ -341,6 +341,9 @@ int sctp_input(struct mbuf **, int *, int);
void sctp_pathmtu_adjustment(struct sctp_tcb *, uint16_t);
void sctp_drain(void);
void sctp_init(void);
+void
+sctp_notify(struct sctp_inpcb *, struct sctp_tcb *, struct sctp_nets *,
+ uint8_t, uint8_t, uint16_t, uint16_t);
void sctp_finish(void);
int sctp_flush(struct socket *, int);
int sctp_shutdown(struct socket *);