diff options
author | darrenr <darrenr@FreeBSD.org> | 2004-05-02 06:36:30 +0000 |
---|---|---|
committer | darrenr <darrenr@FreeBSD.org> | 2004-05-02 06:36:30 +0000 |
commit | 8f62dbebe1b55307f420e4b9164fb86ec654824f (patch) | |
tree | a0e03ab4812c05ff712bfcffaddb0fcd9e1622f8 /sys | |
parent | 4eddf7cee686c3991128069a01ffe77d4b9a21a6 (diff) | |
download | FreeBSD-src-8f62dbebe1b55307f420e4b9164fb86ec654824f.zip FreeBSD-src-8f62dbebe1b55307f420e4b9164fb86ec654824f.tar.gz |
Rename ip_claim_next_hop() to m_claim_next_hop(), give it an extra arg
(the type of tag to claim) and push it out of ip_var.h into mbuf.h alongside
all of the other macros that work ok mbuf's and tag's.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/netinet/ip_input.c | 2 | ||||
-rw-r--r-- | sys/netinet/ip_output.c | 2 | ||||
-rw-r--r-- | sys/netinet/ip_var.h | 16 | ||||
-rw-r--r-- | sys/sys/mbuf.h | 17 |
4 files changed, 19 insertions, 18 deletions
diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c index a4b5844..063bfa4 100644 --- a/sys/netinet/ip_input.c +++ b/sys/netinet/ip_input.c @@ -318,7 +318,7 @@ ip_input(struct mbuf *m) M_ASSERTPKTHDR(m); - args.next_hop = ip_claim_next_hop(m); + args.next_hop = m_claim_next_hop(m, PACKET_TAG_IPFORWARD); args.rule = ip_dn_claim_rule(m); if (m->m_flags & M_FASTFWD_OURS) { diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c index d57b749..12fb495 100644 --- a/sys/netinet/ip_output.c +++ b/sys/netinet/ip_output.c @@ -157,7 +157,7 @@ ip_output(struct mbuf *m, struct mbuf *opt, struct route *ro, M_ASSERTPKTHDR(m); - args.next_hop = ip_claim_next_hop(m); + args.next_hop = m_claim_next_hop(m, PACKET_TAG_IPFORWARD); dummytag = m_tag_find(m, PACKET_TAG_DUMMYNET, NULL); if (dummytag != NULL) { struct dn_pkt_tag *dt = (struct dn_pkt_tag *)(dummytag+1); diff --git a/sys/netinet/ip_var.h b/sys/netinet/ip_var.h index a73827f..be83cde 100644 --- a/sys/netinet/ip_var.h +++ b/sys/netinet/ip_var.h @@ -194,22 +194,6 @@ extern int (*ip_rsvp_vif)(struct socket *, struct sockopt *); extern void (*ip_rsvp_force_done)(struct socket *); extern void (*rsvp_input_p)(struct mbuf *m, int off); -/* - * Obtain next_hop information asociated with the mbuf; if any. - * If a tag is present devalidate it also. - */ -static __inline struct sockaddr_in * -ip_claim_next_hop(struct mbuf *m) -{ - struct m_tag *mtag = m_tag_find(m, PACKET_TAG_IPFORWARD, NULL); - if (mtag) { - struct sockaddr_in *sin = *(struct sockaddr_in **)(mtag+1); - mtag->m_tag_id = PACKET_TAG_NONE; - return sin; - } else - return NULL; -} - #ifdef PFIL_HOOKS extern struct pfil_head inet_pfil_hook; #endif diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h index e75727e..8668336 100644 --- a/sys/sys/mbuf.h +++ b/sys/sys/mbuf.h @@ -647,6 +647,23 @@ m_tag_find(struct mbuf *m, int type, struct m_tag *start) return SLIST_EMPTY(&m->m_pkthdr.tags) ? NULL : m_tag_locate(m, MTAG_ABI_COMPAT, type, start); } + +/* + * Obtain next_hop information asociated with the mbuf; if any. + * If a tag is present devalidate it also. + */ +static __inline struct sockaddr_in * +m_claim_next_hop(struct mbuf *m, int type) +{ + struct m_tag *mtag = m_tag_find(m, type, NULL); + if (mtag) { + struct sockaddr_in *sin = *(struct sockaddr_in **)(mtag+1); + mtag->m_tag_id = PACKET_TAG_NONE; + return sin; + } else + return NULL; +} + #endif /* _KERNEL */ #endif /* !_SYS_MBUF_H_ */ |