summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorHans-Joerg Hoexer <hshoexer@cvs.openbsd.org>2005-12-01 10:36:43 +0000
committerHans-Joerg Hoexer <hshoexer@cvs.openbsd.org>2005-12-01 10:36:43 +0000
commitb4f14ddc6d60fd7567d21e3d52a8748f50475764 (patch)
treefd385e5ff1ff143bc45e30870340c442e57c2a5b /sbin
parent82ecbc37064600f7fd9be5420d53de0f5d5e6d42 (diff)
do not choke and dump core when printing bypass flows. noticed by jacob
schlyter. Thanks!
Diffstat (limited to 'sbin')
-rw-r--r--sbin/ipsecctl/ipsecctl.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/sbin/ipsecctl/ipsecctl.c b/sbin/ipsecctl/ipsecctl.c
index 36a5193d87b..af4e2d8bd11 100644
--- a/sbin/ipsecctl/ipsecctl.c
+++ b/sbin/ipsecctl/ipsecctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ipsecctl.c,v 1.36 2005/11/30 12:42:05 hshoexer Exp $ */
+/* $OpenBSD: ipsecctl.c,v 1.37 2005/12/01 10:36:42 hshoexer Exp $ */
/*
* Copyright (c) 2004, 2005 Hans-Joerg Hoexer <hshoexer@openbsd.org>
*
@@ -240,8 +240,10 @@ ipsecctl_print_flow(struct ipsec_rule *r, int opts)
ipsecctl_print_addr(r->src);
printf(" to ");
ipsecctl_print_addr(r->dst);
- printf(" peer ");
- ipsecctl_print_addr(r->peer);
+ if (r->peer) {
+ printf(" peer ");
+ ipsecctl_print_addr(r->peer);
+ }
if (opts & IPSECCTL_OPT_VERBOSE) {
if (r->auth) {
@@ -410,8 +412,10 @@ ipsecctl_show_flows(int opts)
free(rp->src);
free(rp->dst->name);
free(rp->dst);
- free(rp->peer->name);
- free(rp->peer);
+ if (rp->peer) {
+ free(rp->peer->name);
+ free(rp->peer);
+ }
if (rp->auth) {
if (rp->auth->srcid)
free(rp->auth->srcid);