return (0);
break;
default:
- send_notification_nbr(nbr, S_UNSUP_ADDR, msg.id, msg.type);
+ send_notification(nbr->tcp, S_UNSUP_ADDR, msg.id, msg.type);
return (-1);
}
buf += sizeof(alt);
return (-1);
default:
if (!(ntohs(tlv.type) & UNKNOWN_FLAG))
- send_notification_nbr(nbr, S_UNKNOWN_TLV,
+ send_notification(nbr->tcp, S_UNKNOWN_TLV,
msg.id, msg.type);
/* ignore unknown tlv */
break;
memcpy(&ft, buf, sizeof(ft));
if (ntohs(ft.type) != TLV_TYPE_FEC) {
- send_notification_nbr(nbr, S_MISS_MSG, msg.id, msg.type);
+ send_notification(nbr->tcp, S_MISS_MSG, msg.id, msg.type);
return (-1);
}
feclen = ntohs(ft.length);
!(map.flags & F_MAP_PW_ID) &&
type != MSG_TYPE_LABELWITHDRAW &&
type != MSG_TYPE_LABELRELEASE) {
- send_notification_nbr(nbr, S_MISS_MSG, msg.id,
+ send_notification(nbr->tcp, S_MISS_MSG, msg.id,
msg.type);
return (-1);
}
break;
default:
if (!(ntohs(tlv.type) & UNKNOWN_FLAG))
- send_notification_nbr(nbr, S_UNKNOWN_TLV,
+ send_notification(nbr->tcp, S_UNKNOWN_TLV,
msg.id, msg.type);
/* ignore unknown tlv */
break;
memcpy(<, buf, sizeof(lt));
if (!(ntohs(lt.type) & TLV_TYPE_GENERICLABEL)) {
- send_notification_nbr(nbr, S_MISS_MSG, msg->id, msg->type);
+ send_notification(nbr->tcp, S_MISS_MSG, msg->id, msg->type);
return (-1);
}
map->fec.prefix.af = AF_INET6;
break;
default:
- send_notification_nbr(nbr, S_UNSUP_ADDR, msg->id,
+ send_notification(nbr->tcp, S_UNSUP_ADDR, msg->id,
msg->type);
return (-1);
}
return (off);
default:
- send_notification_nbr(nbr, S_UNKNOWN_FEC, msg->id, msg->type);
+ send_notification(nbr->tcp, S_UNKNOWN_FEC, msg->id, msg->type);
break;
}
/* notification.c */
void send_notification_full(struct tcp_conn *, struct notify_msg *);
-void send_notification(uint32_t, struct tcp_conn *, uint32_t,
- uint16_t);
-void send_notification_nbr(struct nbr *, uint32_t, uint32_t, uint16_t);
+void send_notification(struct tcp_conn *, uint32_t, uint32_t, uint16_t);
int recv_notification(struct nbr *, char *, uint16_t);
int gen_status_tlv(struct ibuf *, uint32_t, uint32_t, uint16_t);
return;
}
- if (tcp->nbr)
+ if (tcp->nbr) {
debug_msg_send("notification: lsr-id %s status %s%s",
inet_ntoa(tcp->nbr->id), status_code_name(nm->status_code),
(nm->status_code & STATUS_FATAL) ? " (fatal)" : "");
+ nbr_fsm(tcp->nbr, NBR_EVT_PDU_SENT);
+ }
evbuf_enqueue(&tcp->wbuf, buf);
}
/* send a notification without optional tlvs */
void
-send_notification(uint32_t status_code, struct tcp_conn *tcp, uint32_t msg_id,
+send_notification(struct tcp_conn *tcp, uint32_t status_code, uint32_t msg_id,
uint16_t msg_type)
{
struct notify_msg nm;
send_notification_full(tcp, &nm);
}
-void
-send_notification_nbr(struct nbr *nbr, uint32_t status_code, uint32_t msg_id,
- uint16_t msg_type)
-{
- send_notification(status_code, nbr->tcp, msg_id, msg_type);
- nbr_fsm(nbr, NBR_EVT_PDU_SENT);
-}
-
int
recv_notification(struct nbr *nbr, char *buf, uint16_t len)
{
break;
default:
if (!(ntohs(tlv.type) & UNKNOWN_FLAG))
- send_notification_nbr(nbr, S_UNKNOWN_TLV,
+ send_notification(nbr->tcp, S_UNKNOWN_TLV,
msg.id, msg.type);
/* ignore unknown tlv */
break;
if (nm.status_code == S_PW_STATUS) {
if (!(nm.flags & (F_NOTIF_PW_STATUS|F_NOTIF_FEC))) {
- send_notification_nbr(nbr, S_MISS_MSG,
+ send_notification(nbr->tcp, S_MISS_MSG,
msg.id, msg.type);
return (-1);
}
case MAP_TYPE_PWID:
break;
default:
- send_notification_nbr(nbr, S_BAD_TLV_VAL,
+ send_notification(nbr->tcp, S_BAD_TLV_VAL,
msg.id, msg.type);
return (-1);
}
log_debug("%s: unknown LDP message from nbr %s",
__func__, inet_ntoa(nbr->id));
if (!(ntohs(msg->type) & UNKNOWN_FLAG))
- send_notification_nbr(nbr,
+ send_notification(nbr->tcp,
S_UNKNOWN_MSG, msg->id, msg->type);
/* ignore the message */
ret = 0;
case NBR_STA_OPER:
log_debug("%s: lsr-id %s", __func__, inet_ntoa(nbr->id));
- send_notification_nbr(nbr, status, msg_id, msg_type);
+ send_notification(nbr->tcp, status, msg_id, msg_type);
nbr_fsm(nbr, NBR_EVT_CLOSE_SESSION);
break;
* notification message reliably.
*/
tcp = tcp_new(pconn->fd, NULL);
- send_notification(S_NO_HELLO, tcp, 0, 0);
+ send_notification(tcp, S_NO_HELLO, 0, 0);
msgbuf_write(&tcp->wbuf.wbuf);
pending_conn_del(pconn);