diff options
author | rrs <rrs@FreeBSD.org> | 2006-12-29 20:21:42 +0000 |
---|---|---|
committer | rrs <rrs@FreeBSD.org> | 2006-12-29 20:21:42 +0000 |
commit | d392a291a28a8cbedf2cc9398d4a03c8467d8c3d (patch) | |
tree | ca49939e7d34d46ab49b2ec2d88653e27f3e43a1 /sys/netinet/sctp_bsd_addr.c | |
parent | c2bdc9dc5c518c1a3f29bb61d0d469bb1b6b68a9 (diff) | |
download | FreeBSD-src-d392a291a28a8cbedf2cc9398d4a03c8467d8c3d.zip FreeBSD-src-d392a291a28a8cbedf2cc9398d4a03c8467d8c3d.tar.gz |
a) macro-ization of all mbuf and random number
access plus timers. This makes the code
more portable and able to change out the
mbuf or timer system used more easily ;-)
b) removal of all use of pkt-hdr's until only
the places we need them (before ip_output routines).
c) remove a bunch of code not needed due to <b> aka
worrying about pkthdr's :-)
d) There was one last reorder problem it looks where
if a restart occur's and we release and relock (at
the point where we setup our alias vtag) we would
end up possibly getting the wrong TSN in place. The
code that fixed the TSN's just needed to be shifted
around BEFORE the release of the lock.. also code that
set the state (since this also could contribute).
Approved by: gnn
Diffstat (limited to 'sys/netinet/sctp_bsd_addr.c')
-rw-r--r-- | sys/netinet/sctp_bsd_addr.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/sys/netinet/sctp_bsd_addr.c b/sys/netinet/sctp_bsd_addr.c index 7d1265c..6cdbc6c 100644 --- a/sys/netinet/sctp_bsd_addr.c +++ b/sys/netinet/sctp_bsd_addr.c @@ -1873,23 +1873,22 @@ sctp_add_addr_to_mbuf(struct mbuf *m, struct ifaddr *ifa) /* unknown type */ return (m); } - if (M_TRAILINGSPACE(m) >= len) { /* easy side we just drop it on the end */ - parmh = (struct sctp_paramhdr *)(m->m_data + m->m_len); + parmh = (struct sctp_paramhdr *)(SCTP_BUF_AT(m, SCTP_BUF_LEN(m))); mret = m; } else { /* Need more space */ mret = m; - while (mret->m_next != NULL) { - mret = mret->m_next; + while (SCTP_BUF_NEXT(mret) != NULL) { + mret = SCTP_BUF_NEXT(mret); } - mret->m_next = sctp_get_mbuf_for_msg(len, 0, M_DONTWAIT, 1, MT_DATA); - if (mret->m_next == NULL) { + SCTP_BUF_NEXT(mret) = sctp_get_mbuf_for_msg(len, 0, M_DONTWAIT, 1, MT_DATA); + if (SCTP_BUF_NEXT(mret) == NULL) { /* We are hosed, can't add more addresses */ return (m); } - mret = mret->m_next; + mret = SCTP_BUF_NEXT(mret); parmh = mtod(mret, struct sctp_paramhdr *); } /* now add the parameter */ @@ -1902,7 +1901,7 @@ sctp_add_addr_to_mbuf(struct mbuf *m, struct ifaddr *ifa) parmh->param_type = htons(SCTP_IPV4_ADDRESS); parmh->param_length = htons(len); ipv4p->addr = sin->sin_addr.s_addr; - mret->m_len += len; + SCTP_BUF_LEN(mret) += len; } else if (ifa->ifa_addr->sa_family == AF_INET6) { struct sctp_ipv6addr_param *ipv6p; struct sockaddr_in6 *sin6; @@ -1915,7 +1914,7 @@ sctp_add_addr_to_mbuf(struct mbuf *m, struct ifaddr *ifa) sizeof(ipv6p->addr)); /* clear embedded scope in the address */ in6_clearscope((struct in6_addr *)ipv6p->addr); - mret->m_len += len; + SCTP_BUF_LEN(mret) += len; } else { return (m); } |