summaryrefslogtreecommitdiff
path: root/sys/net/if.c
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2008-12-12 22:07:34 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2008-12-12 22:07:34 +0000
commit31b949d922863f483ab80e2e880d8d6adee8014f (patch)
tree2483c70a1b2f9ac0bad21129b7058d2f665bbcf5 /sys/net/if.c
parent5b78a9b707a28bbac3b9990a915717f59df94926 (diff)
Introduce a if_priority that will be added to RTP_STATIC when routes are
added without an expilict priority. This allows to specify less prefered interfaces that will only take over if the primary interface loses link. OK deraadt@
Diffstat (limited to 'sys/net/if.c')
-rw-r--r--sys/net/if.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index ebe573a28fd..ddb4c5bb1ce 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if.c,v 1.184 2008/12/11 16:45:45 deraadt Exp $ */
+/* $OpenBSD: if.c,v 1.185 2008/12/12 22:07:33 claudio Exp $ */
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
/*
@@ -1381,6 +1381,18 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, struct proc *p)
}
break;
+ case SIOCGIFPRIORITY:
+ ifr->ifr_metric = ifp->if_priority;
+ break;
+
+ case SIOCSIFPRIORITY:
+ if ((error = suser(p, 0)) != 0)
+ return (error);
+ if (ifr->ifr_metric < 0 || ifr->ifr_metric > 15)
+ return (EINVAL);
+ ifp->if_priority = ifr->ifr_metric;
+ break;
+
case SIOCAIFGROUP:
if ((error = suser(p, 0)))
return (error);