Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F177429601
D57007.1794358160.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
D57007.1794358160.diff
View Options
diff --git a/sys/net/route/nhop.c b/sys/net/route/nhop.c
--- a/sys/net/route/nhop.c
+++ b/sys/net/route/nhop.c
@@ -375,7 +375,11 @@
struct nhop_priv *nh_priv_ret;
NHOPS_RLOCK(ctl);
- CHT_SLIST_FIND_BYOBJ(&ctl->nh_head, nhops, nh_priv, nh_priv_ret);
+ if (nh_priv->nh->nh_metric == RT_WILDCARD_METRIC) {
+ CHT_SLIST_FIND_BYOBJ(&ctl->nh_head, nhops, nh_priv, nh_priv_ret);
+ } else {
+ CHT_SLIST_FIND_BYATTR(&ctl->nh_head, nhops, nh_priv, nh_priv_ret, metric);
+ }
if (nh_priv_ret != NULL) {
if (refcount_acquire_if_not_zero(&nh_priv_ret->nh_refcnt) == 0){
/* refcount was 0 -> nhop is being deleted */
diff --git a/sys/net/route/nhop_ctl.c b/sys/net/route/nhop_ctl.c
--- a/sys/net/route/nhop_ctl.c
+++ b/sys/net/route/nhop_ctl.c
@@ -161,6 +161,19 @@
return (1);
}
+int
+cmp_priv_with_metric(const struct nhop_priv *_one, const struct nhop_priv *_two)
+{
+
+ if (cmp_priv(_one, _two) == 0)
+ return (0);
+
+ if (_one->nh->nh_metric != _two->nh->nh_metric)
+ return (0);
+
+ return (1);
+}
+
/*
* Conditionally sets @nh mtu data based on the @info data.
*/
diff --git a/sys/net/route/nhop_utils.h b/sys/net/route/nhop_utils.h
--- a/sys/net/route/nhop_utils.h
+++ b/sys/net/route/nhop_utils.h
@@ -106,6 +106,16 @@
} \
} while(0)
+/* hash_obj, nhop_metric_cmp */
+#define CHT_SLIST_FIND_BYATTR(_head, _PX, _obj, _ret, _ATTR) do { \
+ uint32_t _buck = CHT_GET_BUCK_OBJ(_head, _PX, _obj); \
+ _ret = CHT_FIRST(_head, _buck); \
+ for ( ; _ret != NULL; _ret = _PX##_next(_ret)) { \
+ if (_PX##_##_ATTR##_cmp(_obj, _ret)) \
+ break; \
+ } \
+} while(0)
+
#define CHT_SLIST_INSERT_HEAD(_head, _PX, _obj) do { \
uint32_t _buck = CHT_GET_BUCK_OBJ(_head, _PX, _obj); \
_PX##_next(_obj) = CHT_FIRST(_head, _buck); \
diff --git a/sys/net/route/nhop_var.h b/sys/net/route/nhop_var.h
--- a/sys/net/route/nhop_var.h
+++ b/sys/net/route/nhop_var.h
@@ -44,6 +44,7 @@
#define nhops_hash_obj(_obj) hash_priv(_obj)
/* compare two objects */
#define nhops_cmp(_one, _two) cmp_priv(_one, _two)
+#define nhops_metric_cmp(_one, _two) cmp_priv_with_metric(_one, _two)
/* next object accessor */
#define nhops_next(_obj) (_obj)->nh_next
@@ -107,5 +108,6 @@
/* nhop_ctl.c */
int cmp_priv(const struct nhop_priv *_one, const struct nhop_priv *_two);
+int cmp_priv_with_metric(const struct nhop_priv *_one, const struct nhop_priv *_two);
#endif
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 11, 12:49 AM (7 h, 47 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41651671
Default Alt Text
D57007.1794358160.diff (2 KB)
Attached To
Mode
D57007: routing: Allow nhop reuse in nhgrp with different metric
Attached
Detach File
Event Timeline