diff options
author | 2006-03-31 15:56:25 +0000 | |
---|---|---|
committer | 2006-03-31 15:56:25 +0000 | |
commit | 1611c4d0eacae8772e73679c2cb75d37201bdba7 (patch) | |
tree | d83799c79b68b794bdddbe9241ebb37a580e3f9c | |
parent | forgot those in previous commit... (diff) | |
download | wireguard-openbsd-1611c4d0eacae8772e73679c2cb75d37201bdba7.tar.xz wireguard-openbsd-1611c4d0eacae8772e73679c2cb75d37201bdba7.zip |
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@
-rw-r--r-- | sbin/route/show.c | 21 |
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>"); } |