diff options
author | tuexen <tuexen@FreeBSD.org> | 2011-04-30 11:18:16 +0000 |
---|---|---|
committer | tuexen <tuexen@FreeBSD.org> | 2011-04-30 11:18:16 +0000 |
commit | ad795d2c5d13224f9b5bfefa5f6896ff66db16a0 (patch) | |
tree | 019e1b80ac539c2f5a7eeb9a859cfe17f3d979f9 /sys/netinet/sctputil.c | |
parent | 734a66b389401392d78d4cb81b576bbbf9de9a29 (diff) | |
download | FreeBSD-src-ad795d2c5d13224f9b5bfefa5f6896ff66db16a0.zip FreeBSD-src-ad795d2c5d13224f9b5bfefa5f6896ff66db16a0.tar.gz |
Improve compilation of SCTP code without INET support.
Some bugs where fixed while doing this:
* ASCONF-ACK messages might use wrong port number when using
IPv6.
* Checking for additional addresses takes the correct address
into account and also does not do more comparisons than
necessary.
This patch is based on one received from bz@ who was
sponsored by The FreeBSD Foundation and iXsystems.
MFC after: 1 week
Diffstat (limited to 'sys/netinet/sctputil.c')
-rw-r--r-- | sys/netinet/sctputil.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/sys/netinet/sctputil.c b/sys/netinet/sctputil.c index ffd131f..22e5c5b 100644 --- a/sys/netinet/sctputil.c +++ b/sys/netinet/sctputil.c @@ -4826,6 +4826,7 @@ sctp_find_ifa_in_ep(struct sctp_inpcb *inp, struct sockaddr *addr, continue; if (addr->sa_family != laddr->ifa->address.sa.sa_family) continue; +#ifdef INET if (addr->sa_family == AF_INET) { if (((struct sockaddr_in *)addr)->sin_addr.s_addr == laddr->ifa->address.sin.sin_addr.s_addr) { @@ -4837,6 +4838,7 @@ sctp_find_ifa_in_ep(struct sctp_inpcb *inp, struct sockaddr *addr, break; } } +#endif #ifdef INET6 if (addr->sa_family == AF_INET6) { if (SCTP6_ARE_ADDR_EQUAL((struct sockaddr_in6 *)addr, @@ -4924,6 +4926,7 @@ stage_right: } if (addr->sa_family != sctp_ifap->address.sa.sa_family) continue; +#ifdef INET if (addr->sa_family == AF_INET) { if (((struct sockaddr_in *)addr)->sin_addr.s_addr == sctp_ifap->address.sin.sin_addr.s_addr) { @@ -4934,6 +4937,7 @@ stage_right: break; } } +#endif #ifdef INET6 if (addr->sa_family == AF_INET6) { if (SCTP6_ARE_ADDR_EQUAL((struct sockaddr_in6 *)addr, @@ -6729,7 +6733,7 @@ sctp_recv_udp_tunneled_packet(struct mbuf *m, int off, struct inpcb *ignored) struct ip *iph; struct mbuf *sp, *last; struct udphdr *uhdr; - uint16_t port = 0, len; + uint16_t port = 0; int header_size = sizeof(struct udphdr) + sizeof(struct sctphdr); /* @@ -6779,8 +6783,11 @@ sctp_recv_udp_tunneled_packet(struct mbuf *m, int off, struct inpcb *ignored) /* Now its ready for sctp_input or sctp6_input */ iph = mtod(m, struct ip *); switch (iph->ip_v) { +#ifdef INET case IPVERSION: { + uint16_t len; + /* its IPv4 */ len = SCTP_GET_IPV4_LENGTH(iph); len -= sizeof(struct udphdr); @@ -6788,6 +6795,7 @@ sctp_recv_udp_tunneled_packet(struct mbuf *m, int off, struct inpcb *ignored) sctp_input_with_port(m, off, port); break; } +#endif #ifdef INET6 case IPV6_VERSION >> 4: { |