summaryrefslogtreecommitdiff
path: root/sys/net/route.c
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2005-06-08 03:13:50 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2005-06-08 03:13:50 +0000
commit59a548f3383db52de88f7e3290c836dd19566df4 (patch)
treeac3b7dfc0f7151896c0d110ed5931f98afb0a26f /sys/net/route.c
parentd7ec77836ae8bb78c0c12297ce25e765edcbffe3 (diff)
in rtlabel_name2id, handle the case of an empty name: return 0
label id 0 means "no label". in pf_ioctl, where this is used to filter based on a label, this is an error condition. for the other 2 cases, messages on the routing socket, this allows for an sockaddr_rtlabel to be always present for messages on the routing socket, and when it is all zero it is exactly like if there was no sockaddr_rtlabel at all. ryan ok
Diffstat (limited to 'sys/net/route.c')
-rw-r--r--sys/net/route.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/net/route.c b/sys/net/route.c
index c5f8baa38a4..ccfe02994c0 100644
--- a/sys/net/route.c
+++ b/sys/net/route.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: route.c,v 1.52 2005/06/07 18:21:44 henning Exp $ */
+/* $OpenBSD: route.c,v 1.53 2005/06/08 03:13:49 henning Exp $ */
/* $NetBSD: route.c,v 1.14 1996/02/13 22:00:46 christos Exp $ */
/*
@@ -1161,6 +1161,9 @@ rtlabel_name2id(char *name)
struct rt_label *label, *p = NULL;
u_int16_t new_id = 1;
+ if (!name[0])
+ return (0);
+
TAILQ_FOREACH(label, &rt_labels, rtl_entry)
if (strcmp(name, label->rtl_name) == 0) {
label->rtl_ref++;