summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.sbin/bgpd/bgpd.c16
-rw-r--r--usr.sbin/bgpd/bgpd.h10
-rw-r--r--usr.sbin/bgpd/kroute.c15
-rw-r--r--usr.sbin/bgpd/rde_rib.c8
4 files changed, 27 insertions, 22 deletions
diff --git a/usr.sbin/bgpd/bgpd.c b/usr.sbin/bgpd/bgpd.c
index 3a2093db2c3..5961b9844cd 100644
--- a/usr.sbin/bgpd/bgpd.c
+++ b/usr.sbin/bgpd/bgpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bgpd.c,v 1.63 2004/01/11 02:35:13 henning Exp $ */
+/* $OpenBSD: bgpd.c,v 1.64 2004/01/11 19:14:43 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -456,18 +456,22 @@ dispatch_imsg(struct imsgbuf *ibuf, int idx, struct mrt_head *mrtc)
void
send_nexthop_update(struct kroute_nexthop *msg)
{
- char *gw = NULL;
+ char *gw = NULL, *nh = NULL;
- if (msg->gateway)
- if (asprintf(&gw, ": via %s", log_ntoa(msg->gateway)) == -1) {
+ if (msg->gateway.af == AF_INET)
+ if (asprintf(&gw, ": via %s",
+ log_ntoa(msg->gateway.v4.s_addr)) == -1) {
log_err("send_nexthop_update");
quit = 1;
}
- logit(LOG_INFO, "nexthop %s now %s%s%s", log_ntoa(msg->nexthop),
+ if (msg->nexthop.af == AF_INET)
+ nh = log_ntoa(msg->nexthop.v4.s_addr);
+
+ logit(LOG_INFO, "nexthop %s now %s%s%s", nh,
msg->valid ? "valid" : "invalid",
msg->connected ? ": directly connected" : "",
- msg->gateway ? gw : "");
+ msg->gateway.af ? gw : "");
free(gw);
diff --git a/usr.sbin/bgpd/bgpd.h b/usr.sbin/bgpd/bgpd.h
index 5e1ad970850..5a1fcc7db06 100644
--- a/usr.sbin/bgpd/bgpd.h
+++ b/usr.sbin/bgpd/bgpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: bgpd.h,v 1.62 2004/01/11 02:35:14 henning Exp $ */
+/* $OpenBSD: bgpd.h,v 1.63 2004/01/11 19:14:43 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -204,10 +204,10 @@ struct kroute {
};
struct kroute_nexthop {
- in_addr_t nexthop;
- u_int8_t valid;
- u_int8_t connected;
- in_addr_t gateway;
+ struct bgpd_addr nexthop;
+ u_int8_t valid;
+ u_int8_t connected;
+ struct bgpd_addr gateway;
};
struct ctl_show_nexthop {
diff --git a/usr.sbin/bgpd/kroute.c b/usr.sbin/bgpd/kroute.c
index 76f36f21495..ec99b8bc6dc 100644
--- a/usr.sbin/bgpd/kroute.c
+++ b/usr.sbin/bgpd/kroute.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kroute.c,v 1.62 2004/01/11 02:35:14 henning Exp $ */
+/* $OpenBSD: kroute.c,v 1.63 2004/01/11 19:14:43 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -265,11 +265,11 @@ kr_nexthop_add(in_addr_t key)
struct kroute_nexthop nh;
bzero(&nh, sizeof(nh));
- nh.nexthop = key;
+ nh.nexthop.v4.s_addr = key;
if (h->kroute != NULL) {
nh.valid = 1;
nh.connected = h->kroute->r.flags & F_CONNECTED;
- nh.gateway = h->kroute->r.nexthop;
+ nh.gateway.v4.s_addr = h->kroute->r.nexthop;
}
send_nexthop_update(&nh);
} else {
@@ -589,7 +589,7 @@ knexthop_validate(struct knexthop_node *kn)
was_valid = 1;
bzero(&n, sizeof(n));
- n.nexthop = kn->nexthop;
+ n.nexthop.v4.s_addr = kn->nexthop;
kroute_detach_nexthop(kn);
if ((kr = kroute_match(kn->nexthop)) == NULL) { /* no match */
@@ -603,7 +603,7 @@ knexthop_validate(struct knexthop_node *kn)
if (!was_valid) {
n.valid = 1;
n.connected = kr->r.flags & F_CONNECTED;
- n.gateway = kr->r.nexthop;
+ n.gateway.v4.s_addr = kr->r.nexthop;
send_nexthop_update(&n);
}
}
@@ -756,11 +756,12 @@ if_change(u_short ifindex, int flags)
RB_FOREACH(n, knexthop_tree, &knt)
if (n->kroute == kkr->kr) {
bzero(&nh, sizeof(nh));
- nh.nexthop = n->nexthop;
+ nh.nexthop.v4.s_addr = n->nexthop;
if (!(kkr->kr->r.flags & F_DOWN)) {
nh.valid = 1;
nh.connected = 1;
- nh.gateway = kkr->kr->r.nexthop;
+ nh.gateway.v4.s_addr =
+ kkr->kr->r.nexthop;
}
send_nexthop_update(&nh);
}
diff --git a/usr.sbin/bgpd/rde_rib.c b/usr.sbin/bgpd/rde_rib.c
index 97b61b480ee..4653bebb579 100644
--- a/usr.sbin/bgpd/rde_rib.c
+++ b/usr.sbin/bgpd/rde_rib.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde_rib.c,v 1.17 2004/01/11 02:39:05 henning Exp $ */
+/* $OpenBSD: rde_rib.c,v 1.18 2004/01/11 19:14:43 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Claudio Jeker <claudio@openbsd.org>
@@ -1087,12 +1087,12 @@ nexthop_update(struct kroute_nexthop *msg)
RIB_STAT(nexthop_update);
- nh = nexthop_get(msg->nexthop);
+ nh = nexthop_get(msg->nexthop.v4.s_addr);
if (nh == NULL) {
logit(LOG_INFO, "nexthop_update: non-existent nexthop");
return;
}
- ENSURE(nh->exit_nexthop.s_addr == msg->nexthop);
+ ENSURE(nh->exit_nexthop.s_addr == msg->nexthop.v4.s_addr);
if (msg->valid)
nh->state = NEXTHOP_REACH;
@@ -1102,7 +1102,7 @@ nexthop_update(struct kroute_nexthop *msg)
if (msg->connected)
nh->true_nexthop.s_addr = nh->exit_nexthop.s_addr;
else
- nh->true_nexthop.s_addr = msg->gateway;
+ nh->true_nexthop.s_addr = msg->gateway.v4.s_addr;
nh->connected = msg->connected;