summaryrefslogtreecommitdiff
path: root/sysdep/bsd/krt-sock.Y
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2023-01-13 13:17:46 +0100
committerOndrej Zajicek <santiago@crfreenet.org>2023-01-13 13:17:46 +0100
commit7fb23041a52d01754c53ba963e2282e524813364 (patch)
tree30325f71d00074c9322443c21ff4144d8f85785d /sysdep/bsd/krt-sock.Y
parent64a2b7aaa303be0b407508747bfc96c1c656f1e2 (diff)
BSD: Add support for kernel route metric
Add support for kernel route metric/priority, exported as krt_metric attribute, like in Linux. This should also fix issues with overwriting or removing system routes.
Diffstat (limited to 'sysdep/bsd/krt-sock.Y')
-rw-r--r--sysdep/bsd/krt-sock.Y10
1 files changed, 9 insertions, 1 deletions
diff --git a/sysdep/bsd/krt-sock.Y b/sysdep/bsd/krt-sock.Y
index 8581bd43..a03d6df5 100644
--- a/sysdep/bsd/krt-sock.Y
+++ b/sysdep/bsd/krt-sock.Y
@@ -10,7 +10,7 @@ CF_HDR
CF_DECLS
-CF_KEYWORDS(KERNEL, TABLE)
+CF_KEYWORDS(KERNEL, TABLE, METRIC)
CF_GRAMMAR
@@ -25,6 +25,14 @@ kern_sys_item:
THIS_KRT->sys.table_id = $3;
}
+ | METRIC expr {
+ if ($2 && !krt_max_metric)
+ cf_error("Kernel route metric not supported");
+ if ($2 > krt_max_metric)
+ cf_error("Kernel table id must be in range 0-%u", krt_max_metric);
+
+ THIS_KRT->sys.metric = $2;
+ }
;
CF_CODE