diff options
Diffstat (limited to 'lib/sockunion.c')
-rw-r--r-- | lib/sockunion.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/sockunion.c b/lib/sockunion.c index efd41362c..59c5ba5dd 100644 --- a/lib/sockunion.c +++ b/lib/sockunion.c @@ -496,6 +496,25 @@ sockopt_cork (int sock, int onoff) #endif } +int sockopt_mark_default(int sock, int mark, struct zebra_privs_t *cap) +{ +#ifdef SO_MARK + int ret; + + if ( cap->change (ZPRIVS_RAISE) ) + zlog_err ("routing_socket: Can't raise privileges"); + + ret = setsockopt(sock, SOL_SOCKET, SO_MARK, &mark, sizeof(mark)); + + if ( cap->change (ZPRIVS_LOWER) ) + zlog_err ("routing_socket: Can't lower privileges"); + + return ret; +#else + return 0; +#endif +} + int sockopt_minttl (int family, int sock, int minttl) { |