diff options
author | Renato Westphal <renato@cvs.openbsd.org> | 2013-10-15 16:47:25 +0000 |
---|---|---|
committer | Renato Westphal <renato@cvs.openbsd.org> | 2013-10-15 16:47:25 +0000 |
commit | 3922871c3b52574cae7f0b6c89f09c32f4d127c3 (patch) | |
tree | 3422ae40db21f918159cfcb99401e4c84980b6c5 /usr.sbin | |
parent | 906ff34631f3ae3befd91fb7209904e2f8ccab77 (diff) |
Ignore messages that have Unknown flag set.
OK claudio@
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/ldpd/ldp.h | 3 | ||||
-rw-r--r-- | usr.sbin/ldpd/packet.c | 13 |
2 files changed, 11 insertions, 5 deletions
diff --git a/usr.sbin/ldpd/ldp.h b/usr.sbin/ldpd/ldp.h index 910b7be825c..25d426c3817 100644 --- a/usr.sbin/ldpd/ldp.h +++ b/usr.sbin/ldpd/ldp.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ldp.h,v 1.13 2013/06/04 02:25:28 claudio Exp $ */ +/* $OpenBSD: ldp.h,v 1.14 2013/10/15 16:47:24 renato Exp $ */ /* * Copyright (c) 2009 Michele Marchetto <michele@openbsd.org> @@ -110,7 +110,6 @@ struct ldp_msg { #define LDP_MSG_LEN 8 -#define UNKNOWN_FLAGS_MASK 0xc000 #define UNKNOWN_FLAG 0x8000 #define FORWARD_FLAG 0xc000 diff --git a/usr.sbin/ldpd/packet.c b/usr.sbin/ldpd/packet.c index 39480b8c8b3..237c510f917 100644 --- a/usr.sbin/ldpd/packet.c +++ b/usr.sbin/ldpd/packet.c @@ -1,4 +1,4 @@ -/* $OpenBSD: packet.c,v 1.28 2013/06/05 19:19:10 miod Exp $ */ +/* $OpenBSD: packet.c,v 1.29 2013/10/15 16:47:24 renato Exp $ */ /* * Copyright (c) 2009 Michele Marchetto <michele@openbsd.org> @@ -474,8 +474,15 @@ session_read(int fd, short event, void *arg) default: log_debug("session_read: unknown LDP packet " "from nbr %s", inet_ntoa(nbr->id)); - free(buf); - return; + 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 */ + msg_size = ntohs(ldp_msg->length); + break; } if (msg_size == -1) { |