Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F102148665
D28648.id83832.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
6 KB
Referenced Files
None
Subscribers
None
D28648.id83832.diff
View Options
Index: sys/netinet/tcp_input.c
===================================================================
--- sys/netinet/tcp_input.c
+++ sys/netinet/tcp_input.c
@@ -592,16 +592,13 @@
* better place to put this in?
*/
ip6 = mtod(m, struct ip6_hdr *);
- ia6 = in6ifa_ifwithaddr(&ip6->ip6_dst, 0 /* XXX */);
+ ia6 = in6ifa_ifwithaddr(&ip6->ip6_dst, 0 /* XXX */, false);
if (ia6 && (ia6->ia6_flags & IN6_IFF_ANYCAST)) {
- ifa_free(&ia6->ia_ifa);
icmp6_error(m, ICMP6_DST_UNREACH, ICMP6_DST_UNREACH_ADDR,
(caddr_t)&ip6->ip6_dst - (caddr_t)ip6);
*mp = NULL;
return (IPPROTO_DONE);
}
- if (ia6)
- ifa_free(&ia6->ia_ifa);
*mp = m;
return (tcp_input(mp, offp, proto));
@@ -1249,10 +1246,9 @@
if (isipv6 && !V_ip6_use_deprecated) {
struct in6_ifaddr *ia6;
- ia6 = in6ifa_ifwithaddr(&ip6->ip6_dst, 0 /* XXX */);
+ ia6 = in6ifa_ifwithaddr(&ip6->ip6_dst, 0 /* XXX */, false);
if (ia6 != NULL &&
(ia6->ia6_flags & IN6_IFF_DEPRECATED)) {
- ifa_free(&ia6->ia_ifa);
if ((s = tcp_log_addrs(&inc, th, NULL, NULL)))
log(LOG_DEBUG, "%s; %s: Listen socket: "
"Connection attempt to deprecated "
@@ -1261,8 +1257,6 @@
rstreason = BANDLIM_RST_OPENPORT;
goto dropwithreset;
}
- if (ia6)
- ifa_free(&ia6->ia_ifa);
}
#endif /* INET6 */
/*
Index: sys/netinet6/frag6.c
===================================================================
--- sys/netinet6/frag6.c
+++ sys/netinet6/frag6.c
@@ -396,11 +396,9 @@
dstifp = NULL;
/* Find the destination interface of the packet. */
- ia6 = in6ifa_ifwithaddr(&ip6->ip6_dst, 0 /* XXX */);
- if (ia6 != NULL) {
+ ia6 = in6ifa_ifwithaddr(&ip6->ip6_dst, 0 /* XXX */, false);
+ if (ia6 != NULL)
dstifp = ia6->ia_ifp;
- ifa_free(&ia6->ia_ifa);
- }
/* Jumbo payload cannot contain a fragment header. */
if (ip6->ip6_plen == 0) {
Index: sys/netinet6/icmp6.c
===================================================================
--- sys/netinet6/icmp6.c
+++ sys/netinet6/icmp6.c
@@ -1221,19 +1221,17 @@
goto bad;
/* else it's a link-local multicast, fine */
} else { /* unicast or anycast */
- ia6 = in6ifa_ifwithaddr(&ip6->ip6_dst, 0 /* XXX */);
+ ia6 = in6ifa_ifwithaddr(&ip6->ip6_dst, 0 /* XXX */, false);
if (ia6 == NULL)
goto bad; /* XXX impossible */
if ((ia6->ia6_flags & IN6_IFF_TEMPORARY) &&
!(V_icmp6_nodeinfo & ICMP6_NODEINFO_TMPADDROK)) {
- ifa_free(&ia6->ia_ifa);
nd6log((LOG_DEBUG, "ni6_input: ignore node info to "
"a temporary address in %s:%d",
__FILE__, __LINE__));
goto bad;
}
- ifa_free(&ia6->ia_ifa);
}
/* validate query Subject field. */
@@ -2104,7 +2102,7 @@
* destined to a duplicated address of ours.
*/
if (!IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst)) {
- ia = in6ifa_ifwithaddr(&ip6->ip6_dst, 0 /* XXX */);
+ ia = in6ifa_ifwithaddr(&ip6->ip6_dst, 0 /* XXX */, false);
if (ia != NULL && !(ia->ia6_flags &
(IN6_IFF_ANYCAST|IN6_IFF_NOTREADY))) {
src6 = ia->ia_addr.sin6_addr;
@@ -2116,8 +2114,6 @@
} else
hlim = V_ip6_defhlim;
}
- if (ia != NULL)
- ifa_free(&ia->ia_ifa);
}
if (srcp == NULL) {
Index: sys/netinet6/in6.c
===================================================================
--- sys/netinet6/in6.c
+++ sys/netinet6/in6.c
@@ -1550,10 +1550,10 @@
/*
* find the interface address corresponding to a given IPv6 address.
- * ifaddr is returned referenced.
+ * ifaddr is returned referenced if @referenced flag is set.
*/
struct in6_ifaddr *
-in6ifa_ifwithaddr(const struct in6_addr *addr, uint32_t zoneid)
+in6ifa_ifwithaddr(const struct in6_addr *addr, uint32_t zoneid, bool referenced)
{
struct rm_priotracker in6_ifa_tracker;
struct in6_ifaddr *ia;
@@ -1564,7 +1564,8 @@
if (zoneid != 0 &&
zoneid != ia->ia_addr.sin6_scope_id)
continue;
- ifa_ref(&ia->ia_ifa);
+ if (referenced)
+ ifa_ref(&ia->ia_ifa);
break;
}
}
Index: sys/netinet6/in6_ifattach.c
===================================================================
--- sys/netinet6/in6_ifattach.c
+++ sys/netinet6/in6_ifattach.c
@@ -713,11 +713,9 @@
/*
* check that loopback address doesn't exist yet.
*/
- ia = in6ifa_ifwithaddr(&in6addr_loopback, 0);
+ ia = in6ifa_ifwithaddr(&in6addr_loopback, 0, false);
if (ia == NULL)
in6_ifattach_loopback(ifp);
- else
- ifa_free(&ia->ia_ifa);
}
/*
Index: sys/netinet6/in6_src.c
===================================================================
--- sys/netinet6/in6_src.c
+++ sys/netinet6/in6_src.c
@@ -252,15 +252,11 @@
* ancillary data.
*/
if ((inp->inp_flags & INP_BINDANY) == 0) {
- ia = in6ifa_ifwithaddr(&tmp, 0 /* XXX */);
+ ia = in6ifa_ifwithaddr(&tmp, 0 /* XXX */, false);
if (ia == NULL || (ia->ia6_flags & (IN6_IFF_ANYCAST |
- IN6_IFF_NOTREADY))) {
- if (ia != NULL)
- ifa_free(&ia->ia_ifa);
+ IN6_IFF_NOTREADY)))
return (EADDRNOTAVAIL);
- }
bcopy(&ia->ia_addr.sin6_addr, srcp, sizeof(*srcp));
- ifa_free(&ia->ia_ifa);
} else
bcopy(&tmp, srcp, sizeof(*srcp));
pi->ipi6_addr = tmp; /* XXX: this overrides pi */
Index: sys/netinet6/in6_var.h
===================================================================
--- sys/netinet6/in6_var.h
+++ sys/netinet6/in6_var.h
@@ -899,7 +899,7 @@
int in6_if2idlen(struct ifnet *);
struct in6_ifaddr *in6ifa_ifpforlinklocal(struct ifnet *, int);
struct in6_ifaddr *in6ifa_ifpwithaddr(struct ifnet *, const struct in6_addr *);
-struct in6_ifaddr *in6ifa_ifwithaddr(const struct in6_addr *, uint32_t);
+struct in6_ifaddr *in6ifa_ifwithaddr(const struct in6_addr *, uint32_t, bool);
struct in6_ifaddr *in6ifa_llaonifp(struct ifnet *);
int in6_addr2zoneid(struct ifnet *, struct in6_addr *, u_int32_t *);
int in6_matchlen(struct in6_addr *, struct in6_addr *);
Index: sys/netinet6/ip6_input.c
===================================================================
--- sys/netinet6/ip6_input.c
+++ sys/netinet6/ip6_input.c
@@ -803,7 +803,7 @@
* XXX: For now we keep link-local IPv6 addresses with embedded
* scope zone id, therefore we use zero zoneid here.
*/
- ia = in6ifa_ifwithaddr(&ip6->ip6_dst, 0 /* XXX */);
+ ia = in6ifa_ifwithaddr(&ip6->ip6_dst, 0 /* XXX */, false);
if (ia != NULL) {
if (ia->ia6_flags & IN6_IFF_NOTREADY) {
char ip6bufs[INET6_ADDRSTRLEN];
@@ -813,13 +813,11 @@
"ip6_input: packet to an unready address %s->%s\n",
ip6_sprintf(ip6bufs, &ip6->ip6_src),
ip6_sprintf(ip6bufd, &ip6->ip6_dst)));
- ifa_free(&ia->ia_ifa);
goto bad;
}
/* Count the packet in the ip address stats */
counter_u64_add(ia->ia_ifa.ifa_ipackets, 1);
counter_u64_add(ia->ia_ifa.ifa_ibytes, m->m_pkthdr.len);
- ifa_free(&ia->ia_ifa);
ours = 1;
goto hbhcheck;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 9, 5:37 AM (14 h, 53 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14551194
Default Alt Text
D28648.id83832.diff (6 KB)
Attached To
Mode
D28648: Remove per-packet ifa refcounting from IPv6 fast path.
Attached
Detach File
Event Timeline
Log In to Comment