mirror of
				https://gitlab.labs.nic.cz/labs/bird.git
				synced 2024-05-11 16:54:54 +00:00 
			
		
		
		
	Rename as_path_get_last/as_path_get_first to be consistent.
This commit is contained in:
		@@ -734,7 +734,7 @@ interpret(struct f_inst *what)
 | 
				
			|||||||
      runtime( "AS Path expected" );
 | 
					      runtime( "AS Path expected" );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    as = 0;
 | 
					    as = 0;
 | 
				
			||||||
    as_path_get_last(v1.val.ad, &as); /* really last */
 | 
					    as_path_get_first(v1.val.ad, &as);
 | 
				
			||||||
    res.type = T_INT;
 | 
					    res.type = T_INT;
 | 
				
			||||||
    res.val.i = as;
 | 
					    res.val.i = as;
 | 
				
			||||||
    break;
 | 
					    break;
 | 
				
			||||||
@@ -744,7 +744,7 @@ interpret(struct f_inst *what)
 | 
				
			|||||||
      runtime( "AS path expected" );
 | 
					      runtime( "AS path expected" );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    as = 0;
 | 
					    as = 0;
 | 
				
			||||||
    as_path_get_first(v1.val.ad, &as); /* really first */
 | 
					    as_path_get_last(v1.val.ad, &as);
 | 
				
			||||||
    res.type = T_INT;
 | 
					    res.type = T_INT;
 | 
				
			||||||
    res.val.i = as;
 | 
					    res.val.i = as;
 | 
				
			||||||
    break;
 | 
					    break;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -213,7 +213,7 @@ as_path_getlen_int(struct adata *path, int bs)
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int
 | 
					int
 | 
				
			||||||
as_path_get_first(struct adata *path, u32 *orig_as)
 | 
					as_path_get_last(struct adata *path, u32 *orig_as)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  int bs = bgp_as4_support ? 4 : 2;
 | 
					  int bs = bgp_as4_support ? 4 : 2;
 | 
				
			||||||
  int found = 0;
 | 
					  int found = 0;
 | 
				
			||||||
@@ -229,8 +229,7 @@ as_path_get_first(struct adata *path, u32 *orig_as)
 | 
				
			|||||||
	case AS_PATH_SET:
 | 
						case AS_PATH_SET:
 | 
				
			||||||
	  if (len = *p++)
 | 
						  if (len = *p++)
 | 
				
			||||||
	    {
 | 
						    {
 | 
				
			||||||
	      found = 1;
 | 
						      found = 0;
 | 
				
			||||||
	      res = get_as(p);
 | 
					 | 
				
			||||||
	      p += bs * len;
 | 
						      p += bs * len;
 | 
				
			||||||
	    }
 | 
						    }
 | 
				
			||||||
	  break;
 | 
						  break;
 | 
				
			||||||
@@ -246,12 +245,13 @@ as_path_get_first(struct adata *path, u32 *orig_as)
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  *orig_as = res;
 | 
					  if (found)
 | 
				
			||||||
 | 
					    *orig_as = res;
 | 
				
			||||||
  return found;
 | 
					  return found;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int
 | 
					int
 | 
				
			||||||
as_path_get_last(struct adata *path, u32 *last_as)
 | 
					as_path_get_first(struct adata *path, u32 *last_as)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  u8 *p = path->data;
 | 
					  u8 *p = path->data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -996,7 +996,7 @@ bgp_get_neighbor(rte *r)
 | 
				
			|||||||
  eattr *e = ea_find(r->attrs->eattrs, EA_CODE(EAP_BGP, BA_AS_PATH));
 | 
					  eattr *e = ea_find(r->attrs->eattrs, EA_CODE(EAP_BGP, BA_AS_PATH));
 | 
				
			||||||
  u32 as;
 | 
					  u32 as;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (e && as_path_get_last(e->u.ptr, &as))
 | 
					  if (e && as_path_get_first(e->u.ptr, &as))
 | 
				
			||||||
    return as;
 | 
					    return as;
 | 
				
			||||||
  else
 | 
					  else
 | 
				
			||||||
    return ((struct bgp_proto *) r->attrs->proto)->remote_as;
 | 
					    return ((struct bgp_proto *) r->attrs->proto)->remote_as;
 | 
				
			||||||
@@ -1470,7 +1470,7 @@ bgp_get_route_info(rte *e, byte *buf, ea_list *attrs)
 | 
				
			|||||||
  u32 origas;
 | 
					  u32 origas;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  buf += bsprintf(buf, " (%d) [", e->pref);
 | 
					  buf += bsprintf(buf, " (%d) [", e->pref);
 | 
				
			||||||
  if (p && as_path_get_first(p->u.ptr, &origas))
 | 
					  if (p && as_path_get_last(p->u.ptr, &origas))
 | 
				
			||||||
    buf += bsprintf(buf, "AS%u", origas);
 | 
					    buf += bsprintf(buf, "AS%u", origas);
 | 
				
			||||||
  if (o)
 | 
					  if (o)
 | 
				
			||||||
    buf += bsprintf(buf, "%c", "ie?"[o->u.data]);
 | 
					    buf += bsprintf(buf, "%c", "ie?"[o->u.data]);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user