summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.sbin/bgpd/bgpd.h4
-rw-r--r--usr.sbin/bgpd/config.c10
-rw-r--r--usr.sbin/bgpd/pfkey.c34
3 files changed, 24 insertions, 24 deletions
diff --git a/usr.sbin/bgpd/bgpd.h b/usr.sbin/bgpd/bgpd.h
index 94363d837bd..51d264ad4d4 100644
--- a/usr.sbin/bgpd/bgpd.h
+++ b/usr.sbin/bgpd/bgpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: bgpd.h,v 1.85 2004/01/27 22:18:28 henning Exp $ */
+/* $OpenBSD: bgpd.h,v 1.86 2004/01/28 11:03:32 markus Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -324,6 +324,6 @@ void control_cleanup(void);
int control_imsg_relay(struct imsg *);
/* pfkey.c */
-int pfkey_setkey(struct sockaddr *, struct sockaddr *, char *);
+int pfkey_setkey(struct bgpd_addr *, struct bgpd_addr *, char *);
#endif /* __BGPD_H__ */
diff --git a/usr.sbin/bgpd/config.c b/usr.sbin/bgpd/config.c
index 8201b56b776..dd450679179 100644
--- a/usr.sbin/bgpd/config.c
+++ b/usr.sbin/bgpd/config.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: config.c,v 1.22 2004/01/27 16:49:53 henning Exp $ */
+/* $OpenBSD: config.c,v 1.23 2004/01/28 11:03:32 markus Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -56,10 +56,10 @@ merge_config(struct bgpd_config *xconf, struct bgpd_config *conf,
if (!p->conf.id)
p->conf.id = get_id(p);
if (p->conf.tcp_sign_key[0] &&
- pfkey_setkey((struct sockaddr *)&p->conf.local_addr,
- (struct sockaddr *)&p->conf.remote_addr,
- p->conf.tcp_sign_key) == -1)
- return (1);
+ pfkey_setkey(&p->conf.local_addr,
+ &p->conf.remote_addr,
+ p->conf.tcp_sign_key) == -1)
+ return (1);
}
memcpy(xconf, conf, sizeof(struct bgpd_config));
diff --git a/usr.sbin/bgpd/pfkey.c b/usr.sbin/bgpd/pfkey.c
index cf4e79992ff..6b3337e089b 100644
--- a/usr.sbin/bgpd/pfkey.c
+++ b/usr.sbin/bgpd/pfkey.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfkey.c,v 1.4 2004/01/27 14:12:28 henning Exp $ */
+/* $OpenBSD: pfkey.c,v 1.5 2004/01/28 11:03:32 markus Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -37,12 +37,12 @@
static u_int32_t sadb_msg_seq = 1;
int pfkey_reply(int, u_int32_t *);
-int pfkey_send(int, uint8_t, struct sockaddr *, struct sockaddr *,
+int pfkey_send(int, uint8_t, struct bgpd_addr *, struct bgpd_addr *,
u_int32_t, char *);
int
-pfkey_send(int sd, uint8_t mtype, struct sockaddr *src, struct sockaddr *dst,
- u_int32_t spi, char *key)
+pfkey_send(int sd, uint8_t mtype, struct bgpd_addr *src,
+ struct bgpd_addr *dst, u_int32_t spi, char *key)
{
struct sadb_msg smsg;
struct sadb_sa sa;
@@ -61,31 +61,31 @@ pfkey_send(int sd, uint8_t mtype, struct sockaddr *src, struct sockaddr *dst,
/* we need clean sockaddr... no ports set */
bzero(&ssrc, sizeof(ssrc));
- if (src->sa_family == AF_INET) {
- ((struct sockaddr_in *)&ssrc)->sin_addr.s_addr =
- ((struct sockaddr_in *)src)->sin_addr.s_addr;
+ if (src->af == AF_INET) {
+ ((struct sockaddr_in *)&ssrc)->sin_addr = src->v4;
ssrc.ss_len = sizeof(struct sockaddr_in);
ssrc.ss_family = AF_INET;
- } else if (src->sa_family == AF_INET6) {
+ } else if (src->af == AF_INET6) {
memcpy(&((struct sockaddr_in6 *)&ssrc)->sin6_addr,
- &((struct sockaddr_in6 *)src)->sin6_addr,
- sizeof(struct in6_addr));
+ &src->v6, sizeof(struct in6_addr));
ssrc.ss_len = sizeof(struct sockaddr_in6);
ssrc.ss_family = AF_INET6;
+ } else {
+ return (-1);
}
bzero(&sdst, sizeof(sdst));
- if (dst->sa_family == AF_INET) {
- ((struct sockaddr_in *)&sdst)->sin_addr.s_addr =
- ((struct sockaddr_in *)dst)->sin_addr.s_addr;
+ if (dst->af == AF_INET) {
+ ((struct sockaddr_in *)&sdst)->sin_addr = dst->v4;
sdst.ss_len = sizeof(struct sockaddr_in);
sdst.ss_family = AF_INET;
- } else if (dst->sa_family == AF_INET6) {
+ } else if (dst->af == AF_INET6) {
memcpy(&((struct sockaddr_in6 *)&sdst)->sin6_addr,
- &((struct sockaddr_in6 *)dst)->sin6_addr,
- sizeof(struct in6_addr));
+ &dst->v6, sizeof(struct in6_addr));
sdst.ss_len = sizeof(struct sockaddr_in6);
sdst.ss_family = AF_INET6;
+ } else {
+ return (-1);
}
bzero(&smsg, sizeof(smsg));
@@ -262,7 +262,7 @@ pfkey_reply(int sd, u_int32_t *spip)
}
int
-pfkey_setkey(struct sockaddr *src, struct sockaddr *dst, char *key)
+pfkey_setkey(struct bgpd_addr *src, struct bgpd_addr *dst, char *key)
{
u_int32_t spi = 0;
int sd;