diff options
| author | Randall Stewart <rrs@FreeBSD.org> | 2008-05-19 12:34:44 +0000 |
|---|---|---|
| committer | Randall Stewart <rrs@FreeBSD.org> | 2008-05-19 12:34:44 +0000 |
| commit | 39df61e5a94ad147b53b687c211de3b0b8c87a02 (patch) | |
| tree | b5bf6a1e3f089efc82da35906b7ebc0131f684cb /sys/netinet/sctp_sysctl.c | |
| parent | 1066c76bab10989e5343646004d197da193ea5d5 (diff) | |
Notes
Diffstat (limited to 'sys/netinet/sctp_sysctl.c')
| -rw-r--r-- | sys/netinet/sctp_sysctl.c | 59 |
1 files changed, 37 insertions, 22 deletions
diff --git a/sys/netinet/sctp_sysctl.c b/sys/netinet/sctp_sysctl.c index fd232d94c559..b42802938153 100644 --- a/sys/netinet/sctp_sysctl.c +++ b/sys/netinet/sctp_sysctl.c @@ -206,36 +206,51 @@ copy_out_local_addresses(struct sctp_inpcb *inp, struct sctp_tcb *stcb, struct s if (sctp_is_addr_restricted(stcb, sctp_ifa)) continue; } - if ((sctp_ifa->address.sa.sa_family == AF_INET) && (ipv4_addr_legal)) { - struct sockaddr_in *sin; + switch (sctp_ifa->address.sa.sa_family) { + case AF_INET: + if (ipv4_addr_legal) { + struct sockaddr_in *sin; - sin = (struct sockaddr_in *)&sctp_ifa->address.sa; - if (sin->sin_addr.s_addr == 0) - continue; - if ((ipv4_local_scope == 0) && (IN4_ISPRIVATE_ADDRESS(&sin->sin_addr))) + sin = (struct sockaddr_in *)&sctp_ifa->address.sa; + if (sin->sin_addr.s_addr == 0) + continue; + if ((ipv4_local_scope == 0) && (IN4_ISPRIVATE_ADDRESS(&sin->sin_addr))) + continue; + } else { continue; - } else if ((sctp_ifa->address.sa.sa_family == AF_INET6) && (ipv6_addr_legal)) { - struct sockaddr_in6 *sin6; + } + break; +#ifdef INET6 + case AF_INET6: + if (ipv6_addr_legal) { + struct sockaddr_in6 *sin6; - sin6 = (struct sockaddr_in6 *)&sctp_ifa->address.sa; - if (IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr)) - continue; - if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) { - if (local_scope == 0) + sin6 = (struct sockaddr_in6 *)&sctp_ifa->address.sa; + if (IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr)) continue; - if (sin6->sin6_scope_id == 0) { - /* - * bad link local - * address - */ - if (sa6_recoverscope(sin6) != 0) + if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) { + if (local_scope == 0) continue; + if (sin6->sin6_scope_id == 0) { + /* + * bad link + * local + * address + */ + if (sa6_recoverscope(sin6) != 0) + continue; + } } - } - if ((site_scope == 0) && (IN6_IS_ADDR_SITELOCAL(&sin6->sin6_addr))) + if ((site_scope == 0) && (IN6_IS_ADDR_SITELOCAL(&sin6->sin6_addr))) + continue; + } else { continue; - } else + } + break; +#endif + default: continue; + } memset((void *)&xladdr, 0, sizeof(struct xsctp_laddr)); memcpy((void *)&xladdr.address, (const void *)&sctp_ifa->address, sizeof(union sctp_sockstore)); SCTP_INP_RUNLOCK(inp); |
