diff options
author | Renato Westphal <renato@opensourcerouting.org> | 2017-03-03 21:50:22 +0100 |
---|---|---|
committer | Renato Westphal <renato@opensourcerouting.org> | 2017-03-03 21:50:22 +0100 |
commit | a33df200732c7d7470fa9060a70ab59e2076932e (patch) | |
tree | 93bbf6e8f14f2b3e8360331b8931451f7233da00 /ldpd/address.c | |
parent | ldpd: create helper functions to log sent/received messages (diff) | |
download | frr-a33df200732c7d7470fa9060a70ab59e2076932e.tar.xz frr-a33df200732c7d7470fa9060a70ab59e2076932e.zip |
ldpd: send correct status code on error condition
The Unknown TLV status code is reserved for cases where we don't know
how to process a given TLV and its Unknown TLV bit is not set.
In the case of Address Messages, the Address List TLV is mandatory and
should appear before any optional TLV in the message. If that doesn't
happen the correct status notification to send is "Missing Message
Parameters" (non-fatal error).
Also, add a missing htons when creating an Address List TLV. Since the
value of TLV_TYPE_ADDRLIST is 0x0101 this missing htons wasn't noticed
earlier.
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to '')
-rw-r--r-- | ldpd/address.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/ldpd/address.c b/ldpd/address.c index cb2f505f7..25c03b811 100644 --- a/ldpd/address.c +++ b/ldpd/address.c @@ -162,7 +162,7 @@ recv_address(struct nbr *nbr, char *buf, uint16_t len) return (-1); } if (ntohs(alt.type) != TLV_TYPE_ADDRLIST) { - session_shutdown(nbr, S_UNKNOWN_TLV, msg.id, msg.type); + send_notification(nbr->tcp, S_MISS_MSG, msg.id, msg.type); return (-1); } switch (ntohs(alt.family)) { @@ -242,7 +242,7 @@ gen_address_list_tlv(struct ibuf *buf, uint16_t size, int af, int err = 0; memset(&alt, 0, sizeof(alt)); - alt.type = TLV_TYPE_ADDRLIST; + alt.type = htons(TLV_TYPE_ADDRLIST); alt.length = htons(size - TLV_HDR_SIZE); switch (af) { |