diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2018-12-06 08:11:53 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2018-12-06 08:11:53 +0000 |
commit | 13d5494dbef4df45d21a1e9b768b6f755dfa9845 (patch) | |
tree | 89f855b503d11baf2a10030eae38b1a6e80a75f9 /sys | |
parent | 53b36131ecbbbc4266f1291f8d45f53486b13813 (diff) |
When building ND packets use m_align() to pack the mbuf as optimal as
possible. Because of an optional payload maxlen bytes are used on the
m_align so that there is always enough space.
OK florian@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/netinet6/nd6_nbr.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/sys/netinet6/nd6_nbr.c b/sys/netinet6/nd6_nbr.c index a90f852b25e..174f0759a81 100644 --- a/sys/netinet6/nd6_nbr.c +++ b/sys/netinet6/nd6_nbr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nd6_nbr.c,v 1.124 2018/07/12 16:07:35 florian Exp $ */ +/* $OpenBSD: nd6_nbr.c,v 1.125 2018/12/06 08:11:52 claudio Exp $ */ /* $KAME: nd6_nbr.c,v 1.61 2001/02/10 16:06:14 jinmei Exp $ */ /* @@ -406,7 +406,7 @@ nd6_ns_output(struct ifnet *ifp, struct in6_addr *daddr6, icmp6len = sizeof(*nd_ns); m->m_pkthdr.len = m->m_len = sizeof(*ip6) + icmp6len; - m->m_data += max_linkhdr; /* or MH_ALIGN() equivalent? */ + m_align(m, maxlen); /* fill neighbor solicitation packet */ ip6 = mtod(m, struct ip6_hdr *); @@ -913,7 +913,6 @@ nd6_na_output(struct ifnet *ifp, struct in6_addr *daddr6, } if (m == NULL) return; - m->m_pkthdr.ph_ifidx = 0; m->m_pkthdr.ph_rtableid = ifp->if_rdomain; if (IN6_IS_ADDR_MULTICAST(daddr6)) { @@ -925,7 +924,7 @@ nd6_na_output(struct ifnet *ifp, struct in6_addr *daddr6, icmp6len = sizeof(*nd_na); m->m_pkthdr.len = m->m_len = sizeof(struct ip6_hdr) + icmp6len; - m->m_data += max_linkhdr; /* or MH_ALIGN() equivalent? */ + m_align(m, maxlen); /* fill neighbor advertisement packet */ ip6 = mtod(m, struct ip6_hdr *); @@ -1022,7 +1021,7 @@ nd6_na_output(struct ifnet *ifp, struct in6_addr *daddr6, m->m_pkthdr.csum_flags |= M_ICMP_CSUM_OUT; ip6_output(m, NULL, NULL, 0, &im6o, NULL); - icmp6stat_inc(icp6s_outhist+ ND_NEIGHBOR_ADVERT); + icmp6stat_inc(icp6s_outhist + ND_NEIGHBOR_ADVERT); return; bad: |