summaryrefslogtreecommitdiff
path: root/usr.sbin/ldpd/packet.c
diff options
context:
space:
mode:
authorRenato Westphal <renato@cvs.openbsd.org>2016-06-09 17:41:53 +0000
committerRenato Westphal <renato@cvs.openbsd.org>2016-06-09 17:41:53 +0000
commitc823c7f961e88d6dab88248f39ebd9c565b61e0c (patch)
tree6f4bd050a2a1882bc46d4ecc2f385895fa4449e2 /usr.sbin/ldpd/packet.c
parentf429e0627900f54d72548e50b7af0b713296264f (diff)
Do not shut down the session upon receiving unknown messages.
RFC 5036 says the following about the receipt of unknown messages: "Unknown message bit. Upon receipt of an unknown message, if U is clear (=0), a notification is returned to the message originator; if U is set (=1), the unknown message is silently ignored". We were correctly ignoring unknown messages when the U-bit was set. But when this bit was not set, we were shutting down the session when the correct thing to do is to just send a non-fatal notification message. Fix IxANVL LDP test 22.13.
Diffstat (limited to 'usr.sbin/ldpd/packet.c')
-rw-r--r--usr.sbin/ldpd/packet.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/usr.sbin/ldpd/packet.c b/usr.sbin/ldpd/packet.c
index e4b672db8f2..040b3ef31e4 100644
--- a/usr.sbin/ldpd/packet.c
+++ b/usr.sbin/ldpd/packet.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: packet.c,v 1.59 2016/06/06 15:30:59 renato Exp $ */
+/* $OpenBSD: packet.c,v 1.60 2016/06/09 17:41:52 renato Exp $ */
/*
* Copyright (c) 2013, 2016 Renato Westphal <renato@openbsd.org>
@@ -559,15 +559,13 @@ session_read(int fd, short event, void *arg)
type);
break;
default:
- log_debug("%s: unknown LDP packet from nbr %s",
+ log_debug("%s: unknown LDP message from nbr %s",
__func__, inet_ntoa(nbr->id));
- if (!(ntohs(ldp_msg->type) & UNKNOWN_FLAG)) {
- session_shutdown(nbr, S_UNKNOWN_MSG,
- ldp_msg->msgid, ldp_msg->type);
- free(buf);
- return;
- }
- /* unknown flag is set, ignore the message */
+ if (!(ntohs(ldp_msg->type) & UNKNOWN_FLAG))
+ send_notification_nbr(nbr,
+ S_UNKNOWN_MSG, ldp_msg->msgid,
+ ldp_msg->type);
+ /* ignore the message */
ret = 0;
break;
}