diff options
author | 2016-05-23 16:43:57 +0000 | |
---|---|---|
committer | 2016-05-23 16:43:57 +0000 | |
commit | 34f55a3f042881abdff2e7bac3622ce3b7ada7e8 (patch) | |
tree | 42842a35a0fe090aae5d7f1b73a2470db0a6c2fa /usr.sbin/ldpd/labelmapping.c | |
parent | Fix check of when a wildcard group PW-ID FEC is valid or not. (diff) | |
download | wireguard-openbsd-34f55a3f042881abdff2e7bac3622ce3b7ada7e8.tar.xz wireguard-openbsd-34f55a3f042881abdff2e7bac3622ce3b7ada7e8.zip |
Make send_labelmessage() more robust.
Immediately return from this function if the given list of mappings
is empty. This way we have more freedom when sending label messages,
not having to care with corner cases.
Diffstat (limited to 'usr.sbin/ldpd/labelmapping.c')
-rw-r--r-- | usr.sbin/ldpd/labelmapping.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/usr.sbin/ldpd/labelmapping.c b/usr.sbin/ldpd/labelmapping.c index 3f47ccd35f7..3f7684363fe 100644 --- a/usr.sbin/ldpd/labelmapping.c +++ b/usr.sbin/ldpd/labelmapping.c @@ -1,4 +1,4 @@ -/* $OpenBSD: labelmapping.c,v 1.39 2016/05/23 16:41:52 renato Exp $ */ +/* $OpenBSD: labelmapping.c,v 1.40 2016/05/23 16:43:57 renato Exp $ */ /* * Copyright (c) 2009 Michele Marchetto <michele@openbsd.org> @@ -63,6 +63,10 @@ send_labelmessage(struct nbr *nbr, u_int16_t type, struct mapping_head *mh) u_int16_t tlv_size, size = 0; int first = 1; + /* nothing to send */ + if (TAILQ_EMPTY(mh)) + return; + while ((me = TAILQ_FIRST(mh)) != NULL) { /* generate pdu */ if (first) { |