Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F176948211
D49212.1793641830.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None
D49212.1793641830.diff
View Options
diff --git a/sys/net/route.h b/sys/net/route.h
--- a/sys/net/route.h
+++ b/sys/net/route.h
@@ -375,9 +375,6 @@
#ifdef _KERNEL
-#define RT_LINK_IS_UP(ifp) (!((ifp)->if_capabilities & IFCAP_LINKSTATE) \
- || (ifp)->if_link_state == LINK_STATE_UP)
-
#define RO_NHFREE(_ro) do { \
if ((_ro)->ro_nh) { \
NH_FREE((_ro)->ro_nh); \
diff --git a/sys/net/route/nhop.h b/sys/net/route/nhop.h
--- a/sys/net/route/nhop.h
+++ b/sys/net/route/nhop.h
@@ -152,7 +152,10 @@
* with NHF_INVALID flag.
*/
-#define NH_IS_VALID(_nh) RT_LINK_IS_UP((_nh)->nh_ifp)
+#define NH_IS_VALID(_nh) ((!((_nh)->nh_ifp->if_capabilities & IFCAP_LINKSTATE) \
+ || (_nh)->nh_ifp->if_link_state == LINK_STATE_UP) \
+ && (_nh)->nh_ifp->if_afdata_initialized != 0)
+
#define NH_IS_NHGRP(_nh) ((_nh)->nh_flags & NHF_MULTIPATH)
#define NH_FREE(_nh) do { \
diff --git a/sys/netinet/in_fib.c b/sys/netinet/in_fib.c
--- a/sys/netinet/in_fib.c
+++ b/sys/netinet/in_fib.c
@@ -120,7 +120,7 @@
if (nh != NULL) {
nh = nhop_select(nh, flowid);
/* Ensure route & ifp is UP */
- if (RT_LINK_IS_UP(nh->nh_ifp)) {
+ if (NH_IS_VALID(nh)) {
if (flags & NHR_REF)
nhop_ref_object(nh);
return (nh);
@@ -157,7 +157,7 @@
if (rn != NULL && ((rn->rn_flags & RNF_ROOT) == 0)) {
nh = nhop_select((RNTORT(rn))->rt_nhop, flowid);
/* Ensure route & ifp is UP */
- if (RT_LINK_IS_UP(nh->nh_ifp)) {
+ if (NH_IS_VALID(nh)) {
if (flags & NHR_REF)
nhop_ref_object(nh);
RIB_RUNLOCK(rh);
@@ -323,7 +323,7 @@
if (rt != NULL) {
struct nhop_object *nh = nhop_select(rnd.rnd_nhop, 0);
/* Ensure route & ifp is UP */
- if (RT_LINK_IS_UP(nh->nh_ifp))
+ if (NH_IS_VALID(nh))
return (nh);
}
diff --git a/sys/netinet6/in6_fib.c b/sys/netinet6/in6_fib.c
--- a/sys/netinet6/in6_fib.c
+++ b/sys/netinet6/in6_fib.c
@@ -128,7 +128,7 @@
if (nh != NULL) {
nh = nhop_select(nh, flowid);
/* Ensure route & ifp is UP */
- if (RT_LINK_IS_UP(nh->nh_ifp)) {
+ if (NH_IS_VALID(nh)) {
if (flags & NHR_REF)
nhop_ref_object(nh);
return (nh);
@@ -166,7 +166,7 @@
if (rn != NULL && ((rn->rn_flags & RNF_ROOT) == 0)) {
nh = nhop_select((RNTORT(rn))->rt_nhop, flowid);
/* Ensure route & ifp is UP */
- if (RT_LINK_IS_UP(nh->nh_ifp)) {
+ if (NH_IS_VALID(nh)) {
if (flags & NHR_REF)
nhop_ref_object(nh);
RIB_RUNLOCK(rh);
@@ -338,7 +338,7 @@
if (rt != NULL) {
struct nhop_object *nh = nhop_select(rnd.rnd_nhop, 0);
/* Ensure route & ifp is UP */
- if (RT_LINK_IS_UP(nh->nh_ifp))
+ if (NH_IS_VALID(nh))
return (nh);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Nov 2, 5:50 PM (14 h, 1 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41317613
Default Alt Text
D49212.1793641830.diff (2 KB)
Attached To
Mode
D49212: route: protect against unattached if_afdata
Attached
Detach File
Event Timeline