m_align() and other cleanup in carp(4)

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

m_align() and other cleanup in carp(4)

Claudio Jeker
Use m_align() in carp(4) and while there reorder the code a bit.
There is no need to set pkthdr values to 0, that is done my MGETHDR().
Make the IPv4 and IPv6 code use the same order by which stuff gets set.

OK?
--
:wq Claudio

Index: sys/netinet/ip_carp.c
===================================================================
RCS file: /cvs/src/sys/netinet/ip_carp.c,v
retrieving revision 1.334
diff -u -p -r1.334 ip_carp.c
--- sys/netinet/ip_carp.c 24 Sep 2018 12:25:52 -0000 1.334
+++ sys/netinet/ip_carp.c 12 Nov 2018 09:13:46 -0000
@@ -1095,12 +1095,11 @@ carp_send_ad(struct carp_vhost_entry *vh
  goto retry_later;
  }
  len = sizeof(*ip) + sizeof(ch);
- m->m_pkthdr.len = len;
- m->m_pkthdr.ph_ifidx = 0;
- m->m_pkthdr.ph_rtableid = sc->sc_if.if_rdomain;
  m->m_pkthdr.pf.prio = CARP_IFQ_PRIO;
+ m->m_pkthdr.ph_rtableid = sc->sc_if.if_rdomain;
+ m->m_pkthdr.len = len;
  m->m_len = len;
- MH_ALIGN(m, m->m_len);
+ m_align(m, len);
  ip = mtod(m, struct ip *);
  ip->ip_v = IPVERSION;
  ip->ip_hl = sizeof(*ip) >> 2;
@@ -1184,12 +1183,11 @@ carp_send_ad(struct carp_vhost_entry *vh
  goto retry_later;
  }
  len = sizeof(*ip6) + sizeof(ch);
- m->m_pkthdr.len = len;
- m->m_pkthdr.ph_ifidx = 0;
  m->m_pkthdr.pf.prio = CARP_IFQ_PRIO;
  m->m_pkthdr.ph_rtableid = sc->sc_if.if_rdomain;
+ m->m_pkthdr.len = len;
  m->m_len = len;
- MH_ALIGN(m, m->m_len);
+ m_align(m, len);
  m->m_flags |= M_MCAST;
  ip6 = mtod(m, struct ip6_hdr *);
  memset(ip6, 0, sizeof(*ip6));