diff options
author | 2013-06-01 19:01:32 +0000 | |
---|---|---|
committer | 2013-06-01 19:01:32 +0000 | |
commit | 53e2494849a3f145f758594d90afb931d737a201 (patch) | |
tree | fc5b44858f6825a5a69dfa52efe6668256b3e8ad /usr.sbin/ldpd/labelmapping.c | |
parent | fiddle with the NO_CONV code to allow notrunc and noerror to still work. (diff) | |
download | wireguard-openbsd-53e2494849a3f145f758594d90afb931d737a201.tar.xz wireguard-openbsd-53e2494849a3f145f758594d90afb931d737a201.zip |
Improve error handling on session_read
* Don't try to send a Shutdown message if the connection is already
closed or a read error occured;
* As per RFC 5036, send a Shutdown message if an unexpected message is
received during the initialization process;
* Check if the whole LSR ID of received messages is correct;
* On ldpe_dispatch_main(), ignore the messages from the lde process
whose associated neighbor is not in the operational state.
Diff from Renato Westphal
Diffstat (limited to 'usr.sbin/ldpd/labelmapping.c')
-rw-r--r-- | usr.sbin/ldpd/labelmapping.c | 32 |
1 files changed, 1 insertions, 31 deletions
diff --git a/usr.sbin/ldpd/labelmapping.c b/usr.sbin/ldpd/labelmapping.c index b44d4f56b90..268e44b88da 100644 --- a/usr.sbin/ldpd/labelmapping.c +++ b/usr.sbin/ldpd/labelmapping.c @@ -1,4 +1,4 @@ -/* $OpenBSD: labelmapping.c,v 1.21 2013/06/01 18:47:07 claudio Exp $ */ +/* $OpenBSD: labelmapping.c,v 1.22 2013/06/01 19:01:32 claudio Exp $ */ /* * Copyright (c) 2009 Michele Marchetto <michele@openbsd.org> @@ -96,12 +96,6 @@ recv_labelmapping(struct nbr *nbr, char *buf, u_int16_t len) int feclen, lbllen, tlen; u_int8_t addr_type; - if (nbr->state != NBR_STA_OPER) { - log_debug("recv_labelmapping: neighbor ID %s not operational", - inet_ntoa(nbr->id)); - return (-1); - } - bcopy(buf, &lm, sizeof(lm)); buf += sizeof(struct ldp_msg); @@ -201,12 +195,6 @@ recv_labelrequest(struct nbr *nbr, char *buf, u_int16_t len) int feclen, tlen; u_int8_t addr_type; - if (nbr->state != NBR_STA_OPER) { - log_debug("recv_labelrequest: neighbor ID %s not operational", - inet_ntoa(nbr->id)); - return (-1); - } - bcopy(buf, &lr, sizeof(lr)); buf += sizeof(struct ldp_msg); @@ -304,12 +292,6 @@ recv_labelwithdraw(struct nbr *nbr, char *buf, u_int16_t len) int feclen, tlen, numfec = 0; u_int8_t addr_type; - if (nbr->state != NBR_STA_OPER) { - log_debug("recv_labelwithdraw: neighbor ID %s not operational", - inet_ntoa(nbr->id)); - return (-1); - } - bcopy(buf, &lw, sizeof(lw)); buf += sizeof(struct ldp_msg); @@ -442,12 +424,6 @@ recv_labelrelease(struct nbr *nbr, char *buf, u_int16_t len) int feclen, tlen, numfec = 0; u_int8_t addr_type; - if (nbr->state != NBR_STA_OPER) { - log_debug("recv_labelrelease: neighbor ID %s not operational", - inet_ntoa(nbr->id)); - return (-1); - } - bcopy(buf, &lr, sizeof(lr)); buf += sizeof(struct ldp_msg); @@ -557,12 +533,6 @@ recv_labelabortreq(struct nbr *nbr, char *buf, u_int16_t len) int feclen, tlen; u_int8_t addr_type; - if (nbr->state != NBR_STA_OPER) { - log_debug("recv_labelabortreq: neighbor ID %s not operational", - inet_ntoa(nbr->id)); - return (-1); - } - log_debug("recv_labelabortreq: neighbor ID %s", inet_ntoa(nbr->id)); bcopy(buf, &la, sizeof(la)); |