diff options
author | 2001-07-01 06:10:34 +0000 | |
---|---|---|
committer | 2001-07-01 06:10:34 +0000 | |
commit | 30a571ead45ae4e6879ce48ed4876c837db3ef14 (patch) | |
tree | a74779f2a80db2021af244aea23452b2bf8a70fd | |
parent | Remove inaccurate "Assumes IPv4" comments. (diff) | |
download | wireguard-openbsd-30a571ead45ae4e6879ce48ed4876c837db3ef14.tar.xz wireguard-openbsd-30a571ead45ae4e6879ce48ed4876c837db3ef14.zip |
Eliminate IPv4 dependency.
-rw-r--r-- | sbin/isakmpd/message.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/sbin/isakmpd/message.c b/sbin/isakmpd/message.c index 43fcfa1bf15..a418ff54096 100644 --- a/sbin/isakmpd/message.c +++ b/sbin/isakmpd/message.c @@ -1,4 +1,4 @@ -/* $OpenBSD: message.c,v 1.43 2001/06/29 18:52:17 ho Exp $ */ +/* $OpenBSD: message.c,v 1.44 2001/07/01 06:10:34 angelos Exp $ */ /* $EOM: message.c,v 1.156 2000/10/10 12:36:39 provos Exp $ */ /* @@ -1449,13 +1449,30 @@ message_drop (struct message *msg, int notify, struct proto *proto, { struct transport *t = msg->transport; struct sockaddr *dst; + char *address; + short port = 0; t->vtbl->get_dst (t, &dst); + if (sockaddr2text (dst, &address, 0)) + { + log_error ("message_drop: sockaddr2text () failed"); + address = 0; + } + + switch (dst->sa_family) + { + case AF_INET: + port = ((struct sockaddr_in *)dst)->sin_port; + break; + case AF_INET6: + port = ((struct sockaddr_in6 *)dst)->sin6_port; + break; + default: + log_print ("message_drop: unknown protocol family %d", dst->sa_family); + } - /* XXX Assumes IPv4. */ log_print ("dropped message from %s port %d due to notification type %s", - inet_ntoa (((struct sockaddr_in *)dst)->sin_addr), - ntohs (((struct sockaddr_in *)dst)->sin_port), + address ? address : "<unknown>", htons(port), constant_name (isakmp_notify_cst, notify)); /* If specified, return a notification. */ |