Take source and destination address into account when determining
the scope. This fixes a problem when a client with a global address connects to a server with a private address. Thanks to Irene Ruengeler in helping me to find the issue. MFC after: 3 days
This commit is contained in:
parent
d60568d78a
commit
0818979a3c
@ -5612,7 +5612,8 @@ sctp_send_initiate_ack(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
|
||||
stc.laddr_type = SCTP_IPV4_ADDRESS;
|
||||
/* scope_id is only for v6 */
|
||||
stc.scope_id = 0;
|
||||
if (IN4_ISPRIVATE_ADDRESS(&src4->sin_addr)) {
|
||||
if ((IN4_ISPRIVATE_ADDRESS(&src4->sin_addr)) ||
|
||||
(IN4_ISPRIVATE_ADDRESS(&dst4->sin_addr))) {
|
||||
stc.ipv4_scope = 1;
|
||||
}
|
||||
/* Must use the address in this case */
|
||||
@ -5636,16 +5637,18 @@ sctp_send_initiate_ack(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
|
||||
stc.local_scope = 0;
|
||||
stc.site_scope = 1;
|
||||
stc.ipv4_scope = 1;
|
||||
} else if (IN6_IS_ADDR_LINKLOCAL(&src6->sin6_addr)) {
|
||||
} else if (IN6_IS_ADDR_LINKLOCAL(&src6->sin6_addr) ||
|
||||
IN6_IS_ADDR_LINKLOCAL(&dst6->sin6_addr)) {
|
||||
/*
|
||||
* If the new destination is a
|
||||
* LINK_LOCAL we must have common
|
||||
* both site and local scope. Don't
|
||||
* set local scope though since we
|
||||
* must depend on the source to be
|
||||
* added implicitly. We cannot
|
||||
* assure just because we share one
|
||||
* link that all links are common.
|
||||
* If the new destination or source
|
||||
* is a LINK_LOCAL we must have
|
||||
* common both site and local scope.
|
||||
* Don't set local scope though
|
||||
* since we must depend on the
|
||||
* source to be added implicitly. We
|
||||
* cannot assure just because we
|
||||
* share one link that all links are
|
||||
* common.
|
||||
*/
|
||||
stc.local_scope = 0;
|
||||
stc.site_scope = 1;
|
||||
@ -5661,11 +5664,12 @@ sctp_send_initiate_ack(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
|
||||
* pull out the scope_id from
|
||||
* incoming pkt
|
||||
*/
|
||||
} else if (IN6_IS_ADDR_SITELOCAL(&src6->sin6_addr)) {
|
||||
} else if (IN6_IS_ADDR_SITELOCAL(&src6->sin6_addr) ||
|
||||
IN6_IS_ADDR_SITELOCAL(&dst6->sin6_addr)) {
|
||||
/*
|
||||
* If the new destination is
|
||||
* SITE_LOCAL then we must have site
|
||||
* scope in common.
|
||||
* If the new destination or source
|
||||
* is SITE_LOCAL then we must have
|
||||
* site scope in common.
|
||||
*/
|
||||
stc.site_scope = 1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user