Page MenuHomeFreeBSD

D33660.diff
No OneTemporary

D33660.diff

diff --git a/sys/net/if_llatbl.h b/sys/net/if_llatbl.h
--- a/sys/net/if_llatbl.h
+++ b/sys/net/if_llatbl.h
@@ -222,6 +222,10 @@
struct sockaddr *, u_int);
int lltable_sysctl_dumparp(int, struct sysctl_req *);
+struct lltable *in_lltable_get(struct ifnet *ifp);
+struct lltable *in6_lltable_get(struct ifnet *ifp);
+struct lltable *lltable_get(struct ifnet *ifp, int family);
+
size_t llentry_free(struct llentry *);
/* helper functions */
diff --git a/sys/net/if_llatbl.c b/sys/net/if_llatbl.c
--- a/sys/net/if_llatbl.c
+++ b/sys/net/if_llatbl.c
@@ -712,6 +712,22 @@
}
+/*
+ * Gets interface @ifp lltable for the specified @family
+ */
+struct lltable *
+lltable_get(struct ifnet *ifp, int family)
+{
+ switch (family) {
+ case AF_INET:
+ return (in_lltable_get(ifp));
+ case AF_INET6:
+ return (in6_lltable_get(ifp));
+ }
+
+ return (NULL);
+}
+
/*
* External methods used by lltable consumers
*/
@@ -823,14 +839,8 @@
return EINVAL;
}
- /* XXX linked list may be too expensive */
- LLTABLE_LIST_RLOCK();
- SLIST_FOREACH(llt, &V_lltables, llt_link) {
- if (llt->llt_af == dst->sa_family &&
- llt->llt_ifp == ifp)
- break;
- }
- LLTABLE_LIST_RUNLOCK();
+ llt = lltable_get(ifp, dst->sa_family);
+
if (llt == NULL)
return (ESRCH);
diff --git a/sys/netinet/in.c b/sys/netinet/in.c
--- a/sys/netinet/in.c
+++ b/sys/netinet/in.c
@@ -1704,6 +1704,17 @@
return (llt);
}
+struct lltable *
+in_lltable_get(struct ifnet *ifp)
+{
+ struct lltable *llt = NULL;
+
+ void *afdata_ptr = ifp->if_afdata[AF_INET];
+ if (afdata_ptr != NULL)
+ llt = ((struct in_ifinfo *)afdata_ptr)->ii_llt;
+ return (llt);
+}
+
void *
in_domifattach(struct ifnet *ifp)
{
diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c
--- a/sys/netinet6/in6.c
+++ b/sys/netinet6/in6.c
@@ -2483,6 +2483,17 @@
return (llt);
}
+struct lltable *
+in6_lltable_get(struct ifnet *ifp)
+{
+ struct lltable *llt = NULL;
+
+ void *afdata_ptr = ifp->if_afdata[AF_INET6];
+ if (afdata_ptr != NULL)
+ llt = ((struct in6_ifextra *)afdata_ptr)->lltable;
+ return (llt);
+}
+
void *
in6_domifattach(struct ifnet *ifp)
{

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 16, 2:53 AM (21 h, 6 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14652061
Default Alt Text
D33660.diff (2 KB)

Event Timeline