summaryrefslogtreecommitdiffstats
path: root/bgpd
diff options
context:
space:
mode:
authorDaniel Walton <dwalton@cumulusnetworks.com>2016-05-27 15:31:06 +0200
committerDaniel Walton <dwalton@cumulusnetworks.com>2016-05-27 15:31:06 +0200
commit52a51fd333258529aa98a0d35e7bf757cc645f2b (patch)
treea0804b7b7f3093d3b9c1b6682af6567c314a7431 /bgpd
parentvtysh: Fix compile failure from cherry-pick (diff)
downloadfrr-52a51fd333258529aa98a0d35e7bf757cc645f2b.tar.xz
frr-52a51fd333258529aa98a0d35e7bf757cc645f2b.zip
bgpd: resolve merge issues in bgp_attr_check()
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Diffstat (limited to 'bgpd')
-rw-r--r--bgpd/bgp_attr.c21
-rw-r--r--bgpd/bgp_attr.h2
-rw-r--r--bgpd/bgp_packet.c2
3 files changed, 12 insertions, 13 deletions
diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c
index a151ae3cf..844bc0fd9 100644
--- a/bgpd/bgp_attr.c
+++ b/bgpd/bgp_attr.c
@@ -1817,7 +1817,7 @@ bgp_attr_unknown (struct bgp_attr_parser_args *args)
/* Well-known attribute check. */
static int
-bgp_attr_check (struct peer *peer, struct attr *attr, bgp_size_t nlri_len)
+bgp_attr_check (struct peer *peer, struct attr *attr)
{
u_char type = 0;
@@ -1840,13 +1840,12 @@ bgp_attr_check (struct peer *peer, struct attr *attr, bgp_size_t nlri_len)
if (! CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_AS_PATH)))
type = BGP_ATTR_AS_PATH;
- /* As per RFC 2858, NEXT_HOP is needed only if the update contains NLRI
- * other than in MP_REACH. In fact, if only MP_REACH_NLRI is present, the
- * update should not contain NEXT_HOP but it should be ignored, if recvd.
+ /* RFC 2858 makes Next-Hop optional/ignored, if MP_REACH_NLRI is present and
+ * NLRI is empty. We can't easily check NLRI empty here though.
*/
- if (nlri_len)
- if (! CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_NEXT_HOP)))
- type = BGP_ATTR_NEXT_HOP;
+ if (!CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_NEXT_HOP))
+ && !CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_MP_REACH_NLRI)))
+ type = BGP_ATTR_NEXT_HOP;
if (peer->sort == BGP_PEER_IBGP
&& ! CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF)))
@@ -1854,7 +1853,8 @@ bgp_attr_check (struct peer *peer, struct attr *attr, bgp_size_t nlri_len)
if (type)
{
- zlog_warn ("%s Missing well-known attribute %d.", peer->host, type);
+ zlog_warn ("%s Missing well-known attribute %s.", peer->host,
+ LOOKUP (attr_str, type));
bgp_notify_send_with_data (peer,
BGP_NOTIFY_UPDATE_ERR,
BGP_NOTIFY_UPDATE_MISS_ATTR,
@@ -1868,8 +1868,7 @@ bgp_attr_check (struct peer *peer, struct attr *attr, bgp_size_t nlri_len)
bgp_update_receive() in bgp_packet.c. */
bgp_attr_parse_ret_t
bgp_attr_parse (struct peer *peer, struct attr *attr, bgp_size_t size,
- struct bgp_nlri *mp_update, struct bgp_nlri *mp_withdraw,
- bgp_size_t nlri_len)
+ struct bgp_nlri *mp_update, struct bgp_nlri *mp_withdraw)
{
int ret;
u_char flag = 0;
@@ -2108,7 +2107,7 @@ bgp_attr_parse (struct peer *peer, struct attr *attr, bgp_size_t size,
/* Check all mandatory well-known attributes are present */
{
bgp_attr_parse_ret_t ret;
- if ((ret = bgp_attr_check (peer, attr, nlri_len)) < 0)
+ if ((ret = bgp_attr_check (peer, attr)) < 0)
{
if (as4_path)
aspath_unintern (&as4_path);
diff --git a/bgpd/bgp_attr.h b/bgpd/bgp_attr.h
index a9e8b4f5d..d71cb6805 100644
--- a/bgpd/bgp_attr.h
+++ b/bgpd/bgp_attr.h
@@ -171,7 +171,7 @@ extern void bgp_attr_init (void);
extern void bgp_attr_finish (void);
extern bgp_attr_parse_ret_t bgp_attr_parse (struct peer *, struct attr *,
bgp_size_t, struct bgp_nlri *,
- struct bgp_nlri *, bgp_size_t);
+ struct bgp_nlri *);
extern struct attr_extra *bgp_attr_extra_get (struct attr *);
extern void bgp_attr_extra_free (struct attr *);
extern void bgp_attr_dup (struct attr *, struct attr *);
diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c
index e2b8a3346..6c1e9e2f9 100644
--- a/bgpd/bgp_packet.c
+++ b/bgpd/bgp_packet.c
@@ -1430,7 +1430,7 @@ bgp_update_receive (struct peer *peer, bgp_size_t size)
if (attribute_len)
{
attr_parse_ret = bgp_attr_parse (peer, &attr, attribute_len,
- &mp_update, &mp_withdraw, update.length);
+ &mp_update, &mp_withdraw);
if (attr_parse_ret == BGP_ATTR_PARSE_ERROR)
{
bgp_attr_unintern_sub (&attr);