diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2013-06-01 19:01:33 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2013-06-01 19:01:33 +0000 |
commit | 7ff204a6dbb909d664b8485ab32475f765380d96 (patch) | |
tree | 38078f4eb631d4359ffc1ab2a078eb4c85bf719f /usr.sbin/ldpd/labelmapping.c | |
parent | 87c2594815504220bd0898510b022c5693883e4b (diff) |
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)); |