* - for consistency in rx processing
*
* The following comment is to signal GCC this intention
- * and supress the warning
+ * and suppress the warning
*/
/* FALLTHRU */
case BGP_ATTR_NHLEN_IPV4:
stream_getl(s); /* RD low */
}
stream_get(&attr->mp_nexthop_global, s, IPV6_MAX_BYTELEN);
- if (IN6_IS_ADDR_LINKLOCAL(&attr->mp_nexthop_global))
+ if (IN6_IS_ADDR_LINKLOCAL(&attr->mp_nexthop_global)) {
+ if (!peer->nexthop.ifp) {
+ zlog_warn("%s: interface not set appropriately to handle some attributes",
+ peer->host);
+ return BGP_ATTR_PARSE_WITHDRAW;
+ }
attr->nh_ifindex = peer->nexthop.ifp->ifindex;
+ }
break;
case BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL:
case BGP_ATTR_NHLEN_VPNV6_GLOBAL_AND_LL:
stream_getl(s); /* RD low */
}
stream_get(&attr->mp_nexthop_global, s, IPV6_MAX_BYTELEN);
- if (IN6_IS_ADDR_LINKLOCAL(&attr->mp_nexthop_global))
+ if (IN6_IS_ADDR_LINKLOCAL(&attr->mp_nexthop_global)) {
+ if (!peer->nexthop.ifp) {
+ zlog_warn("%s: interface not set appropriately to handle some attributes",
+ peer->host);
+ return BGP_ATTR_PARSE_WITHDRAW;
+ }
attr->nh_ifindex = peer->nexthop.ifp->ifindex;
+ }
if (attr->mp_nexthop_len
== BGP_ATTR_NHLEN_VPNV6_GLOBAL_AND_LL) {
stream_getl(s); /* RD high */
attr->mp_nexthop_len = IPV6_MAX_BYTELEN;
}
+ if (!peer->nexthop.ifp) {
+ zlog_warn("%s: Interface not set appropriately to handle this some attributes",
+ peer->host);
+ return BGP_ATTR_PARSE_WITHDRAW;
+ }
attr->nh_lla_ifindex = peer->nexthop.ifp->ifindex;
break;
default:
return ret;
}
- /* If hard error occured immediately return to the caller. */
+ /* If hard error occurred immediately return to the caller. */
if (ret == BGP_ATTR_PARSE_ERROR) {
zlog_warn("%s: Attribute %s, parse error", peer->host,
lookup_msg(attr_str, type, NULL));