git: 77001f9b6dac - main - lltable: introduce the llt_post_resolved callback
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 30 May 2022 10:54:03 UTC
The branch main has been updated by melifaro:
URL: https://cgit.FreeBSD.org/src/commit/?id=77001f9b6dac3b8f898941287726e5a668bb5897
commit 77001f9b6dac3b8f898941287726e5a668bb5897
Author: KUROSAWA Takahiro <takahiro.kurosawa@gmail.com>
AuthorDate: 2022-05-30 07:38:54 +0000
Commit: Alexander V. Chernikov <melifaro@FreeBSD.org>
CommitDate: 2022-05-30 10:53:33 +0000
lltable: introduce the llt_post_resolved callback
In order to decrease ifdef INET/INET6s in the lltable implementation,
introduce the llt_post_resolved callback and implement protocol-dependent
code in the protocol-dependent part.
Reviewed By: melifaro
Differential Revision: https://reviews.freebsd.org/D35322
MFC after: 2 weeks
---
sys/net/if_llatbl.c | 10 +---------
sys/net/if_llatbl.h | 2 ++
sys/netinet/in.c | 12 ++++++++++++
sys/netinet6/in6.c | 7 +++++++
4 files changed, 22 insertions(+), 9 deletions(-)
diff --git a/sys/net/if_llatbl.c b/sys/net/if_llatbl.c
index d2fb58974d3f..1e7229ba95ca 100644
--- a/sys/net/if_llatbl.c
+++ b/sys/net/if_llatbl.c
@@ -970,15 +970,7 @@ lla_rt_output(struct rt_msghdr *rtm, struct rt_addrinfo *info)
*/
EVENTHANDLER_INVOKE(lle_event, lle, LLENTRY_RESOLVED);
LLE_WUNLOCK(lle);
-#ifdef INET
- /* gratuitous ARP */
- if ((laflags & LLE_PUB) && dst->sa_family == AF_INET)
- arprequest(ifp,
- &((struct sockaddr_in *)dst)->sin_addr,
- &((struct sockaddr_in *)dst)->sin_addr,
- (u_char *)LLADDR(dl));
-#endif
-
+ llt->llt_post_resolved(llt, lle);
break;
case RTM_DELETE:
diff --git a/sys/net/if_llatbl.h b/sys/net/if_llatbl.h
index 059e918d4fea..a290fb2349aa 100644
--- a/sys/net/if_llatbl.h
+++ b/sys/net/if_llatbl.h
@@ -160,6 +160,7 @@ typedef void (llt_free_tbl_t)(struct lltable *);
typedef int (llt_link_entry_t)(struct lltable *, struct llentry *);
typedef int (llt_unlink_entry_t)(struct llentry *);
typedef void (llt_mark_used_t)(struct llentry *);
+typedef void (llt_post_resolved_t)(struct lltable *, struct llentry *);
typedef int (llt_foreach_cb_t)(struct lltable *, struct llentry *, void *);
typedef int (llt_foreach_entry_t)(struct lltable *, llt_foreach_cb_t *, void *);
@@ -188,6 +189,7 @@ struct lltable {
llt_fill_sa_entry_t *llt_fill_sa_entry;
llt_free_tbl_t *llt_free_tbl;
llt_mark_used_t *llt_mark_used;
+ llt_post_resolved_t *llt_post_resolved;
};
MALLOC_DECLARE(M_LLTABLE);
diff --git a/sys/netinet/in.c b/sys/netinet/in.c
index e427b9e92db3..9e4b677cf7e1 100644
--- a/sys/netinet/in.c
+++ b/sys/netinet/in.c
@@ -1681,6 +1681,17 @@ in_lltable_dump_entry(struct lltable *llt, struct llentry *lle,
return (error);
}
+static void
+in_lltable_post_resolved(struct lltable *llt, struct llentry *lle)
+{
+ struct ifnet *ifp = llt->llt_ifp;
+
+ /* gratuitous ARP */
+ if ((lle->la_flags & LLE_PUB) != 0)
+ arprequest(ifp, &lle->r_l3addr.addr4, &lle->r_l3addr.addr4,
+ lle->ll_addr);
+}
+
static struct lltable *
in_lltattach(struct ifnet *ifp)
{
@@ -1699,6 +1710,7 @@ in_lltattach(struct ifnet *ifp)
llt->llt_free_entry = in_lltable_free_entry;
llt->llt_match_prefix = in_lltable_match_prefix;
llt->llt_mark_used = llentry_mark_used;
+ llt->llt_post_resolved = in_lltable_post_resolved;
lltable_link(llt);
return (llt);
diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c
index ba22dbb65e31..a39f7734e0ba 100644
--- a/sys/netinet6/in6.c
+++ b/sys/netinet6/in6.c
@@ -2460,6 +2460,12 @@ in6_lltable_dump_entry(struct lltable *llt, struct llentry *lle,
return (error);
}
+static void
+in6_lltable_post_resolved(struct lltable *llt, struct llentry *lle)
+{
+ /* Handle proxy NDP entries (not yet). */
+}
+
static struct lltable *
in6_lltattach(struct ifnet *ifp)
{
@@ -2478,6 +2484,7 @@ in6_lltattach(struct ifnet *ifp)
llt->llt_free_entry = in6_lltable_free_entry;
llt->llt_match_prefix = in6_lltable_match_prefix;
llt->llt_mark_used = llentry_mark_used;
+ llt->llt_post_resolved = in6_lltable_post_resolved;
lltable_link(llt);
return (llt);