udp: Use link up/down signals from the MIB for the link
The mib was patched to send link up/down in case of failures, only put a link service when the MIB tells us the link is up, the failure case should only happen for remote links failing. We will reset and go through link alignment.
This commit is contained in:
parent
122d604838
commit
86a2a53b90
|
@ -38,6 +38,9 @@
|
||||||
#define UDP_DATA_RETR_PRIO_3 19
|
#define UDP_DATA_RETR_PRIO_3 19
|
||||||
#define UDP_DATA_RETR_COMPL 32
|
#define UDP_DATA_RETR_COMPL 32
|
||||||
#define UDP_DATA_RETR_IMPOS 33
|
#define UDP_DATA_RETR_IMPOS 33
|
||||||
|
#define UDP_DATA_LINK_UP 34
|
||||||
|
#define UDP_DATA_LINK_DOWN 35
|
||||||
|
|
||||||
|
|
||||||
struct udp_data_hdr {
|
struct udp_data_hdr {
|
||||||
uint8_t format_type;
|
uint8_t format_type;
|
||||||
|
|
|
@ -113,23 +113,33 @@ static int udp_read_cb(struct bsc_fd *fd)
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* throw away data as the link is down */
|
|
||||||
if (link->set->available == 0) {
|
|
||||||
LOGP(DINP, LOGL_ERROR, "The link is down. Not forwarding.\n");
|
|
||||||
rc = 0;
|
|
||||||
goto exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hdr->data_type == UDP_DATA_RETR_COMPL || hdr->data_type == UDP_DATA_RETR_IMPOS) {
|
if (hdr->data_type == UDP_DATA_RETR_COMPL || hdr->data_type == UDP_DATA_RETR_IMPOS) {
|
||||||
LOGP(DINP, LOGL_ERROR, "Link retrieval done. Restarting the link.\n");
|
LOGP(DINP, LOGL_ERROR, "Link retrieval done. Restarting the link.\n");
|
||||||
mtp_link_failure(link);
|
mtp_link_failure(link);
|
||||||
goto exit;
|
goto exit;
|
||||||
|
} else if (hdr->data_type == UDP_DATA_LINK_UP) {
|
||||||
|
LOGP(DINP, LOGL_NOTICE, "Link of %s/%d is up.\n",
|
||||||
|
link->set->name, link->link_no);
|
||||||
|
mtp_link_up(link);
|
||||||
|
goto exit;
|
||||||
|
} else if (hdr->data_type == UDP_DATA_LINK_DOWN) {
|
||||||
|
LOGP(DINP, LOGL_NOTICE, "Link of %s/%d is down.\n",
|
||||||
|
link->set->name, link->link_no);
|
||||||
|
mtp_link_failure(link);
|
||||||
|
goto exit;
|
||||||
} else if (hdr->data_type > UDP_DATA_MSU_PRIO_3) {
|
} else if (hdr->data_type > UDP_DATA_MSU_PRIO_3) {
|
||||||
LOGP(DINP, LOGL_ERROR, "Link failure. retrieved message.\n");
|
LOGP(DINP, LOGL_ERROR, "Link failure. retrieved message.\n");
|
||||||
mtp_link_failure(link);
|
mtp_link_failure(link);
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* throw away data as the link is down */
|
||||||
|
if (link->set->available == 0) {
|
||||||
|
LOGP(DINP, LOGL_ERROR, "The link is down. Not forwarding.\n");
|
||||||
|
rc = 0;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
length = ntohl(hdr->data_length);
|
length = ntohl(hdr->data_length);
|
||||||
if (length + sizeof(*hdr) > (unsigned int) rc) {
|
if (length + sizeof(*hdr) > (unsigned int) rc) {
|
||||||
LOGP(DINP, LOGL_ERROR, "The MSU payload does not fit: %u + %u > %d \n",
|
LOGP(DINP, LOGL_ERROR, "The MSU payload does not fit: %u + %u > %d \n",
|
||||||
|
@ -312,7 +322,6 @@ void snmp_mtp_callback(struct snmp_mtp_session *session,
|
||||||
|
|
||||||
switch (area) {
|
switch (area) {
|
||||||
case SNMP_LINK_UP:
|
case SNMP_LINK_UP:
|
||||||
mtp_link_up(link);
|
|
||||||
break;
|
break;
|
||||||
case SNMP_LINK_DOWN:
|
case SNMP_LINK_DOWN:
|
||||||
mtp_link_down(link);
|
mtp_link_down(link);
|
||||||
|
|
Reference in New Issue