diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -154,6 +154,10 @@ * notification to a socket bound to a particular FIB. */ #define RTS_FILTER_FIB M_PROTO8 +/* + * Used to store address family of the notification. + */ +#define m_rtsock_family m_pkthdr.PH_loc.eight[0] typedef struct { int ip_count; /* attached w/ AF_INET */ @@ -292,17 +296,9 @@ rts_input(struct mbuf *m) { struct sockproto route_proto; - unsigned short *family; - struct m_tag *tag; route_proto.sp_family = PF_ROUTE; - tag = m_tag_find(m, PACKET_TAG_RTSOCKFAM, NULL); - if (tag != NULL) { - family = (unsigned short *)(tag + 1); - route_proto.sp_protocol = *family; - m_tag_delete(m, tag); - } else - route_proto.sp_protocol = 0; + route_proto.sp_protocol = m->m_rtsock_family; raw_input_ext(m, &route_proto, &route_src, raw_input_rts_cb); } @@ -2183,23 +2179,10 @@ static void rt_dispatch(struct mbuf *m, sa_family_t saf) { - struct m_tag *tag; - /* - * Preserve the family from the sockaddr, if any, in an m_tag for - * use when injecting the mbuf into the routing socket buffer from - * the netisr. - */ - if (saf != AF_UNSPEC) { - tag = m_tag_get(PACKET_TAG_RTSOCKFAM, sizeof(unsigned short), - M_NOWAIT); - if (tag == NULL) { - m_freem(m); - return; - } - *(unsigned short *)(tag + 1) = saf; - m_tag_prepend(m, tag); - } + M_ASSERTPKTHDR(m); + + m->m_rtsock_family = saf; if (V_loif) m->m_pkthdr.rcvif = V_loif; else { diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h --- a/sys/sys/mbuf.h +++ b/sys/sys/mbuf.h @@ -1385,7 +1385,7 @@ #define PACKET_TAG_IPFORWARD 18 /* ipforward info */ #define PACKET_TAG_MACLABEL (19 | MTAG_PERSISTENT) /* MAC label */ #define PACKET_TAG_PF 21 /* PF/ALTQ information */ -#define PACKET_TAG_RTSOCKFAM 25 /* rtsock sa family */ +/* was PACKET_TAG_RTSOCKFAM 25 rtsock sa family */ #define PACKET_TAG_IPOPTIONS 27 /* Saved IP options */ #define PACKET_TAG_CARP 28 /* CARP info */ #define PACKET_TAG_IPSEC_NAT_T_PORTS 29 /* two uint16_t */