summaryrefslogtreecommitdiff
path: root/sbin/route/show.c
diff options
context:
space:
mode:
authorHans-Joerg Hoexer <hshoexer@cvs.openbsd.org>2006-03-31 15:56:26 +0000
committerHans-Joerg Hoexer <hshoexer@cvs.openbsd.org>2006-03-31 15:56:26 +0000
commit497bf73fb242be923d2701d0352543d737ae597b (patch)
treea122717e23b7924bb1ea7156155930132fe64fd3 /sbin/route/show.c
parent3d3b14c5a3cde313e9486a05f81900988e248577 (diff)
Be careful when accessing the external destination address, as it is not set
for bypass and deny flows. Also display acquire/dontacquire flows. ok henning@
Diffstat (limited to 'sbin/route/show.c')
-rw-r--r--sbin/route/show.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/sbin/route/show.c b/sbin/route/show.c
index 594ef768d64..a79650d4850 100644
--- a/sbin/route/show.c
+++ b/sbin/route/show.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: show.c,v 1.49 2006/03/30 13:58:30 hshoexer Exp $ */
+/* $OpenBSD: show.c,v 1.50 2006/03/31 15:56:25 hshoexer Exp $ */
/* $NetBSD: show.c,v 1.1 1996/11/15 18:01:41 gwr Exp $ */
/*
@@ -293,22 +293,28 @@ p_pfkentry(struct sadb_msg *msg)
bzero(headers, sizeof(headers));
index_pfk(msg, headers);
+ /* These are always set */
saddr = headers[SADB_X_EXT_SRC_FLOW];
sa = (struct sockaddr *)(saddr + 1);
saddr = headers[SADB_X_EXT_SRC_MASK];
mask = (struct sockaddr *)(saddr + 1);
p_encap(sa, mask, WID_DST(sa->sa_family));
+ /* These are always set, too. */
saddr = headers[SADB_X_EXT_DST_FLOW];
sa = (struct sockaddr *)(saddr + 1);
saddr = headers[SADB_X_EXT_DST_MASK];
mask = (struct sockaddr *)(saddr + 1);
p_encap(sa, mask, WID_DST(sa->sa_family));
+ /* Bypass and deny flows do not set SADB_EXT_ADDRESS_DST! */
sap = headers[SADB_X_EXT_PROTOCOL];
saft = headers[SADB_X_EXT_FLOW_TYPE];
saddr = headers[SADB_EXT_ADDRESS_DST];
- sa = (struct sockaddr *)(saddr + 1);
+ if (saddr)
+ sa = (struct sockaddr *)(saddr + 1);
+ else
+ sa = NULL;
p_protocol(sap, sa, saft, msg->sadb_msg_satype);
printf("\n");
@@ -381,7 +387,10 @@ p_protocol(struct sadb_protocol *sap, struct sockaddr *sa, struct sadb_protocol
*saft, int proto)
{
printf("%-6u", sap->sadb_protocol_proto);
- p_sockaddr(sa, NULL, 0, -1);
+ if (sa)
+ p_sockaddr(sa, NULL, 0, -1);
+ else
+ printf("none");
switch (proto) {
case SADB_SATYPE_ESP:
@@ -407,12 +416,18 @@ p_protocol(struct sadb_protocol *sap, struct sockaddr *sa, struct sadb_protocol
case SADB_X_FLOW_TYPE_REQUIRE:
printf("/require");
break;
+ case SADB_X_FLOW_TYPE_ACQUIRE:
+ printf("/acquire");
+ break;
case SADB_X_FLOW_TYPE_DENY:
printf("/deny");
break;
case SADB_X_FLOW_TYPE_BYPASS:
printf("/bypass");
break;
+ case SADB_X_FLOW_TYPE_DONTACQ:
+ printf("/dontacq");
+ break;
default:
printf("/<unknown type>");
}