sctp: minor changes due to upstreaming of Glebs recent changes

This commit is contained in:
Michael Tuexen 2022-11-06 23:06:40 +01:00
parent 37bf391d3c
commit f83db6441a
5 changed files with 32 additions and 29 deletions

View file

@ -6946,6 +6946,7 @@ static void
sctp_drain(void)
{
struct epoch_tracker et;
VNET_ITERATOR_DECL(vnet_iter);
NET_EPOCH_ENTER(et);
@ -6987,6 +6988,7 @@ sctp_drain(void)
VNET_LIST_RUNLOCK_NOSLEEP();
NET_EPOCH_EXIT(et);
}
EVENTHANDLER_DEFINE(vm_lowmem, sctp_drain, NULL, LOWMEM_PRI_DEFAULT);
EVENTHANDLER_DEFINE(mbuf_lowmem, sctp_drain, NULL, LOWMEM_PRI_DEFAULT);

View file

@ -287,9 +287,9 @@ sctp_ctlinput(struct icmp *icmp)
dst.sin_port = sh->dest_port;
dst.sin_addr = inner_ip->ip_dst;
/*
* '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.
* '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;
@ -303,10 +303,9 @@ sctp_ctlinput(struct icmp *icmp)
/* Check the verification tag */
if (ntohl(sh->v_tag) != 0) {
/*
* This must be the verification tag used
* for sending out packets. We don't
* consider packets reflecting the
* verification tag.
* This must be the verification tag used for
* sending out packets. We don't consider packets
* reflecting the verification tag.
*/
if (ntohl(sh->v_tag) != stcb->asoc.peer_vtag) {
SCTP_TCB_UNLOCK(stcb);
@ -317,9 +316,9 @@ sctp_ctlinput(struct icmp *icmp)
sizeof(struct ip) +
8 + (inner_ip->ip_hl << 2) + 20) {
/*
* In this case we can check if we
* got an INIT chunk and if the
* initiate tag matches.
* In this case we can check if we got an
* INIT chunk and if the initiate tag
* matches.
*/
ch = (struct sctp_init_chunk *)(sh + 1);
if ((ch->ch.chunk_type != SCTP_INITIATION) ||
@ -7536,14 +7535,14 @@ sctp_peeraddr(struct socket *so, struct sockaddr **addr)
.pr_soreceive = sctp_soreceive \
struct protosw sctp_seqpacket_protosw = {
.pr_type = SOCK_SEQPACKET,
.pr_flags = PR_WANTRCVD,
.pr_type = SOCK_SEQPACKET,
.pr_flags = PR_WANTRCVD,
SCTP_PROTOSW
};
struct protosw sctp_stream_protosw = {
.pr_type = SOCK_STREAM,
.pr_flags = PR_CONNREQUIRED | PR_WANTRCVD,
.pr_type = SOCK_STREAM,
.pr_flags = PR_CONNREQUIRED | PR_WANTRCVD,
SCTP_PROTOSW
};
#endif

View file

@ -324,8 +324,10 @@ void sctp_close(struct socket *so);
int sctp_disconnect(struct socket *so);
ipproto_ctlinput_t sctp_ctlinput;
int sctp_ctloutput(struct socket *, struct sockopt *);
#ifdef INET
void sctp_input_with_port(struct mbuf *, int, uint16_t);
int sctp_input(struct mbuf **, int *, int);
#endif
void sctp_pathmtu_adjustment(struct sctp_tcb *, uint32_t, bool);
void
sctp_notify(struct sctp_inpcb *, struct sctp_tcb *, struct sctp_nets *,

View file

@ -256,12 +256,13 @@ sctp6_ctlinput(struct ip6ctlparam *ip6cp)
struct sctphdr sh;
struct sockaddr_in6 src, dst;
if (icmp6_errmap(ip6cp->ip6c_icmp6) == 0)
if (icmp6_errmap(ip6cp->ip6c_icmp6) == 0) {
return;
}
/*
* Check if we can safely examine the ports and the
* verification tag of the SCTP common header.
* Check if we can safely examine the ports and the verification tag
* of the SCTP common header.
*/
if (ip6cp->ip6c_m->m_pkthdr.len <
(int32_t)(ip6cp->ip6c_off + offsetof(struct sctphdr, checksum))) {
@ -301,10 +302,9 @@ sctp6_ctlinput(struct ip6ctlparam *ip6cp)
/* Check the verification tag */
if (ntohl(sh.v_tag) != 0) {
/*
* This must be the verification tag used
* for sending out packets. We don't
* consider packets reflecting the
* verification tag.
* This must be the verification tag used for
* sending out packets. We don't consider packets
* reflecting the verification tag.
*/
if (ntohl(sh.v_tag) != stcb->asoc.peer_vtag) {
SCTP_TCB_UNLOCK(stcb);
@ -316,9 +316,9 @@ sctp6_ctlinput(struct ip6ctlparam *ip6cp)
sizeof(struct sctp_chunkhdr) +
offsetof(struct sctp_init, a_rwnd)) {
/*
* In this case we can check if we
* got an INIT chunk and if the
* initiate tag matches.
* In this case we can check if we got an
* INIT chunk and if the initiate tag
* matches.
*/
uint32_t initiate_tag;
uint8_t chunk_type;
@ -1194,14 +1194,14 @@ sctp6_getpeeraddr(struct socket *so, struct sockaddr **nam)
.pr_soreceive = sctp_soreceive
struct protosw sctp6_seqpacket_protosw = {
.pr_type = SOCK_SEQPACKET,
.pr_flags = PR_WANTRCVD,
.pr_type = SOCK_SEQPACKET,
.pr_flags = PR_WANTRCVD,
SCTP6_PROTOSW
};
struct protosw sctp6_stream_protosw = {
.pr_type = SOCK_STREAM,
.pr_flags = PR_CONNREQUIRED | PR_WANTRCVD,
.pr_type = SOCK_STREAM,
.pr_flags = PR_CONNREQUIRED | PR_WANTRCVD,
SCTP6_PROTOSW
};
#endif

View file

@ -48,7 +48,7 @@ int sctp6_input_with_port(struct mbuf **, int *, uint16_t);
int
sctp6_output(struct sctp_inpcb *, struct mbuf *, struct sockaddr *,
struct mbuf *, struct proc *);
ip6proto_ctlinput_t sctp6_ctlinput;
ip6proto_ctlinput_t sctp6_ctlinput;
void
sctp6_notify(struct sctp_inpcb *, struct sctp_tcb *, struct sctp_nets *,
uint8_t, uint8_t, uint32_t);