Download raw body.
sys/if: egress at non-zero rdomain
tech@,
I'd like to suggest a diff which brings support of egress group for
interfaces which is in non-zero rdomain.
Feedback? Ok?
Index: sys/net/if.c
===================================================================
RCS file: /home/cvs/src/sys/net/if.c,v
diff -u -p -r1.734 if.c
--- sys/net/if.c 9 May 2025 03:12:36 -0000 1.734
+++ sys/net/if.c 12 May 2025 19:18:39 -0000
@@ -3279,6 +3279,7 @@ if_group_routechange(const struct sockad
int
if_group_egress_build(void)
{
+ u_int tid;
struct ifnet *ifp;
struct ifg_group *ifg;
struct ifg_member *ifgm, *next;
@@ -3296,34 +3297,38 @@ if_group_egress_build(void)
TAILQ_FOREACH_SAFE(ifgm, &ifg->ifg_members, ifgm_next, next)
if_delgroup(ifgm->ifgm_ifp, IFG_EGRESS);
- bzero(&sa_in, sizeof(sa_in));
- sa_in.sin_len = sizeof(sa_in);
- sa_in.sin_family = AF_INET;
- rt = rtable_lookup(0, sintosa(&sa_in), sintosa(&sa_in), NULL, RTP_ANY);
- for (; rt != NULL; rt = rtable_iterate(rt)) {
- if (ISSET(rt->rt_flags, RTF_REJECT | RTF_BLACKHOLE))
- continue;
- ifp = if_get(rt->rt_ifidx);
- if (ifp != NULL) {
- if_addgroup(ifp, IFG_EGRESS);
- if_put(ifp);
+ for (tid = 0; tid <= RT_TABLEID_MAX; tid++) {
+ bzero(&sa_in, sizeof(sa_in));
+ sa_in.sin_len = sizeof(sa_in);
+ sa_in.sin_family = AF_INET;
+ rt = rtable_lookup(tid, sintosa(&sa_in),
+ sintosa(&sa_in), NULL, RTP_ANY);
+ for (; rt != NULL; rt = rtable_iterate(rt)) {
+ if (ISSET(rt->rt_flags, RTF_REJECT | RTF_BLACKHOLE))
+ continue;
+ ifp = if_get(rt->rt_ifidx);
+ if (ifp != NULL) {
+ if_addgroup(ifp, IFG_EGRESS);
+ if_put(ifp);
+ }
}
- }
#ifdef INET6
- bcopy(&sa6_any, &sa_in6, sizeof(sa_in6));
- rt = rtable_lookup(0, sin6tosa(&sa_in6), sin6tosa(&sa_in6), NULL,
- RTP_ANY);
- for (; rt != NULL; rt = rtable_iterate(rt)) {
- if (ISSET(rt->rt_flags, RTF_REJECT | RTF_BLACKHOLE))
- continue;
- ifp = if_get(rt->rt_ifidx);
- if (ifp != NULL) {
- if_addgroup(ifp, IFG_EGRESS);
- if_put(ifp);
+ bcopy(&sa6_any, &sa_in6, sizeof(sa_in6));
+ rt = rtable_lookup(tid, sin6tosa(&sa_in6),
+ sin6tosa(&sa_in6), NULL, RTP_ANY);
+ for (; rt != NULL; rt = rtable_iterate(rt)) {
+ if (ISSET(rt->rt_flags, RTF_REJECT | RTF_BLACKHOLE))
+ continue;
+ ifp = if_get(rt->rt_ifidx);
+ if (ifp != NULL) {
+ if_addgroup(ifp, IFG_EGRESS);
+ if_put(ifp);
+ }
}
- }
#endif /* INET6 */
+
+ }
return (0);
}
--
wbr, Kirill
sys/if: egress at non-zero rdomain