On 2018/02/10 10:12, Sebastian Benoit wrote:
>
>
> - add ROUTE_PRIOFILTER
> - it has one argument that is interpreted as a route priority
> - all route updates with prio lower or equal will pass the filter,
> all with higher priority value will be filtered.
> - example use in ospfd
>
> comments/oks?
>
> (benno_ospfd_route_priofilter_1.diff)
>
> diff --git sys/net/route.h sys/net/route.h
> index 1ca0a22c45f..7a4008b7ac1 100644
> --- sys/net/route.h
> +++ sys/net/route.h
> @@ -298,6 +298,9 @@ struct rt_msghdr {
> #define ROUTE_TABLEFILTER 2 /* change routing table the socket is listening
> on, RTABLE_ANY listens on all tables. */
>
> +#define ROUTE_PRIOFILTER 3 /* change routing table the socket is listening
> + on, RTABLE_ANY listens on all tables. */
> +
This comment needs fixing or removing, otherwise ok.
Feel free to use this accompanying manpage diff.
Index: route.4
===================================================================
RCS file: /cvs/src/share/man/man4/route.4,v
retrieving revision 1.44
diff -u -p -r1.44 route.4
--- route.4 12 Jan 2018 04:36:44 -0000 1.44
+++ route.4 10 Feb 2018 10:39:08 -0000
@@ -210,6 +210,20 @@ if (setsockopt(routefd, PF_ROUTE, ROUTE_
err(1, "setsockopt(ROUTE_MSGFILTER)");
.Ed
.Pp
+Similarly, a process can specify that it is only interested in messages
+relating to routes where the priority is no more than a certain value
+by issuing a setsockopt call with the
+.Dv ROUTE_PRIOFILTER
+option.
+For example, to select only static, directly connected and local routes:
+.Bd -literal -offset indent
+u_char maxprio;
+
+if (setsockopt(routefd, PF_ROUTE, ROUTE_PRIOFILTER,
+ &maxprio, sizeof(maxprio)) == -1)
+ err(1, "setsockopt(ROUTE_PRIOFILTER)");
+.Ed
+.Pp
If a route is in use when it is deleted,
the routing entry will be marked down and removed from the routing table,
but the resources associated with it will not