summaryrefslogtreecommitdiff
path: root/proto/bgp
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2014-10-24 11:11:43 +0200
committerOndrej Zajicek <santiago@crfreenet.org>2014-10-24 11:11:43 +0200
commit88a183c6c9a2b86b52f67e87bbc8b7edd32670c6 (patch)
treeb1348b71e69f9ed0d919a4792549026c9e31b092 /proto/bgp
parentf8fefde318c6248ad94e7b6d60155deed9ab8eed (diff)
Integrated IP functions.
Diffstat (limited to 'proto/bgp')
-rw-r--r--proto/bgp/attrs.c2
-rw-r--r--proto/bgp/bgp.c12
-rw-r--r--proto/bgp/config.Y2
-rw-r--r--proto/bgp/packets.c8
4 files changed, 12 insertions, 12 deletions
diff --git a/proto/bgp/attrs.c b/proto/bgp/attrs.c
index 1d37bfd7..a091ed1e 100644
--- a/proto/bgp/attrs.c
+++ b/proto/bgp/attrs.c
@@ -991,7 +991,7 @@ bgp_create_attrs(struct bgp_proto *p, rte *e, ea_list **attrs, struct linpool *p
if (p->cf->next_hop_self ||
rta->dest != RTD_ROUTER ||
ipa_equal(rta->gw, IPA_NONE) ||
- ipa_has_link_scope(rta->gw) ||
+ ipa_is_link_local(rta->gw) ||
(!p->is_internal && !p->cf->next_hop_keep &&
(!p->neigh || (rta->iface != p->neigh->iface))))
set_next_hop(z, p->source_addr);
diff --git a/proto/bgp/bgp.c b/proto/bgp/bgp.c
index e2339112..27825d7f 100644
--- a/proto/bgp/bgp.c
+++ b/proto/bgp/bgp.c
@@ -689,7 +689,7 @@ bgp_connect(struct bgp_proto *p) /* Enter Connect state and start establishing c
s->password = p->cf->password;
s->tx_hook = bgp_connected;
BGP_TRACE(D_EVENTS, "Connecting to %I%J from local address %I%J", s->daddr, p->cf->iface,
- s->saddr, ipa_has_link_scope(s->saddr) ? s->iface : NULL);
+ s->saddr, ipa_is_link_local(s->saddr) ? s->iface : NULL);
bgp_setup_conn(p, conn);
bgp_setup_sk(conn, s);
bgp_conn_set_state(conn, BS_CONNECT);
@@ -735,7 +735,7 @@ bgp_incoming_connection(sock *sk, int dummy UNUSED)
{
struct bgp_proto *p = (struct bgp_proto *) pc->proto;
if (ipa_equal(p->cf->remote_ip, sk->daddr) &&
- (!ipa_has_link_scope(sk->daddr) || (p->cf->iface == sk->iface)))
+ (!ipa_is_link_local(sk->daddr) || (p->cf->iface == sk->iface)))
{
/* We are in proper state and there is no other incoming connection */
int acc = (p->p.proto_state == PS_START || p->p.proto_state == PS_UP) &&
@@ -750,7 +750,7 @@ bgp_incoming_connection(sock *sk, int dummy UNUSED)
}
BGP_TRACE(D_EVENTS, "Incoming connection from %I%J (port %d) %s",
- sk->daddr, ipa_has_link_scope(sk->daddr) ? sk->iface : NULL,
+ sk->daddr, ipa_is_link_local(sk->daddr) ? sk->iface : NULL,
sk->dport, acc ? "accepted" : "rejected");
if (!acc)
@@ -779,7 +779,7 @@ bgp_incoming_connection(sock *sk, int dummy UNUSED)
}
log(L_WARN "BGP: Unexpected connect from unknown address %I%J (port %d)",
- sk->daddr, ipa_has_link_scope(sk->daddr) ? sk->iface : NULL, sk->dport);
+ sk->daddr, ipa_is_link_local(sk->daddr) ? sk->iface : NULL, sk->dport);
reject:
rfree(sk);
return 0;
@@ -1169,8 +1169,8 @@ bgp_check_config(struct bgp_config *c)
if (c->multihop && (c->gw_mode == GW_DIRECT))
cf_error("Multihop BGP cannot use direct gateway mode");
- if (c->multihop && (ipa_has_link_scope(c->remote_ip) ||
- ipa_has_link_scope(c->source_addr)))
+ if (c->multihop && (ipa_is_link_local(c->remote_ip) ||
+ ipa_is_link_local(c->source_addr)))
cf_error("Multihop BGP cannot be used with link-local addresses");
if (c->multihop && c->bfd && ipa_zero(c->source_addr))
diff --git a/proto/bgp/config.Y b/proto/bgp/config.Y
index 8e0b2412..c8345530 100644
--- a/proto/bgp/config.Y
+++ b/proto/bgp/config.Y
@@ -63,7 +63,7 @@ bgp_proto:
| bgp_proto NEIGHBOR ipa ipa_scope ipa_port AS expr ';' {
if (ipa_nonzero(BGP_CFG->remote_ip))
cf_error("Only one neighbor per BGP instance is allowed");
- if (!ipa_has_link_scope($3) != !$4)
+ if (!ipa_is_link_local($3) != !$4)
cf_error("Link-local address and interface scope must be used together");
BGP_CFG->remote_ip = $3;
diff --git a/proto/bgp/packets.c b/proto/bgp/packets.c
index 0b9de8c1..69646c7d 100644
--- a/proto/bgp/packets.c
+++ b/proto/bgp/packets.c
@@ -69,8 +69,8 @@ mrt_put_bgp4_hdr(byte *buf, struct bgp_conn *conn, int as4)
put_u16(buf+0, (p->neigh && p->neigh->iface) ? p->neigh->iface->index : 0);
put_u16(buf+2, BGP_AF);
buf+=4;
- buf = ipa_put_addr(buf, conn->sk ? conn->sk->daddr : IPA_NONE);
- buf = ipa_put_addr(buf, conn->sk ? conn->sk->saddr : IPA_NONE);
+ buf = put_ipa(buf, conn->sk ? conn->sk->daddr : IPA_NONE);
+ buf = put_ipa(buf, conn->sk ? conn->sk->saddr : IPA_NONE);
return buf;
}
@@ -522,7 +522,7 @@ bgp_create_update(struct bgp_conn *conn, byte *buf)
*tmp++ = BGP_AF_IPV6;
*tmp++ = 1;
- if (ipa_has_link_scope(ip))
+ if (ipa_is_link_local(ip))
ip = IPA_NONE;
if (ipa_nonzero(ip_ll))
@@ -1034,7 +1034,7 @@ bgp_set_next_hop(struct bgp_proto *p, rta *a)
int second = (nh->u.ptr->length == NEXT_HOP_LENGTH) && ipa_nonzero(nexthop[1]);
/* First address should not be link-local, but may be zero in direct mode */
- if (ipa_has_link_scope(*nexthop))
+ if (ipa_is_link_local(*nexthop))
*nexthop = IPA_NONE;
#else
int second = 0;