If pledge "wroute" is missing for setsockopt SO_RTABLE, print failure
authorbluhm <bluhm@openbsd.org>
Wed, 20 Jan 2021 16:36:09 +0000 (16:36 +0000)
committerbluhm <bluhm@openbsd.org>
Wed, 20 Jan 2021 16:36:09 +0000 (16:36 +0000)
message "wroute" into dmesg.  Since revision 1.263 pledge "wroute"
allows to change the routing table of a socket.
OK florian@ semarie@

sys/kern/kern_pledge.c

index c969af7..9ffb7f2 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: kern_pledge.c,v 1.268 2021/01/19 17:41:51 deraadt Exp $       */
+/*     $OpenBSD: kern_pledge.c,v 1.269 2021/01/20 16:36:09 bluhm Exp $ */
 
 /*
  * Copyright (c) 2015 Nicholas Marriott <nicm@openbsd.org>
@@ -1401,7 +1401,7 @@ pledge_sockopt(struct proc *p, int set, int level, int optname)
        case SOL_SOCKET:
                switch (optname) {
                case SO_RTABLE:
-                       return pledge_fail(p, EINVAL, PLEDGE_INET);
+                       return pledge_fail(p, EINVAL, PLEDGE_WROUTE);
                }
                return (0);
        }