summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Benoit <benno@cvs.openbsd.org>2014-01-21 21:27:15 +0000
committerSebastian Benoit <benno@cvs.openbsd.org>2014-01-21 21:27:15 +0000
commitbbf957cc5adb91037b33e37b595a467847061996 (patch)
treec3a16f9011f8e55c8aca4f5215d354ea23b1c833
parent7f21a9bf7d9ba818a2d0d26b4379d9ea3651461e (diff)
allow pflow(4) to determine the src IP address based on the route
table if flowsrc is not set. Now works with new udp checksum code. From Nathanael Rensen (nathanael.openbsd AT list DOT polymorpheus DOT com), tweak and ok florian@
-rw-r--r--sbin/ifconfig/ifconfig.87
-rw-r--r--sbin/ifconfig/ifconfig.c7
-rw-r--r--share/man/man4/pflow.47
-rw-r--r--sys/net/if_pflow.c4
4 files changed, 10 insertions, 15 deletions
diff --git a/sbin/ifconfig/ifconfig.8 b/sbin/ifconfig/ifconfig.8
index 119f9e4d221..f0679eb3834 100644
--- a/sbin/ifconfig/ifconfig.8
+++ b/sbin/ifconfig/ifconfig.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: ifconfig.8,v 1.238 2014/01/19 08:39:20 schwarze Exp $
+.\" $OpenBSD: ifconfig.8,v 1.239 2014/01/21 21:27:14 benno Exp $
.\" $NetBSD: ifconfig.8,v 1.11 1996/01/04 21:27:29 pk Exp $
.\" $FreeBSD: ifconfig.8,v 1.16 1998/02/01 07:03:29 steve Exp $
.\"
@@ -31,7 +31,7 @@
.\"
.\" @(#)ifconfig.8 8.4 (Berkeley) 6/1/94
.\"
-.Dd $Mdocdate: January 19 2014 $
+.Dd $Mdocdate: January 21 2014 $
.Dt IFCONFIG 8
.Os
.Sh NAME
@@ -1224,12 +1224,11 @@ Pflow data will be sent to this address/port.
Unset the receiver address and stop sending pflow data.
.It Cm flowsrc Ar addr
Set the source IP address for pflow packets.
-Must be defined to export pflow data.
.Ar addr
is the IP address used as sender of the UDP packets and may be used to
identify the source of the data on the pflow collector.
.It Fl flowsrc
-Unset the source address and stop sending pflow data.
+Unset the source address.
.It Cm pflowproto Ar n
Set the protocol version.
The default is version 5.
diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c
index 06e02d82819..46684f6b606 100644
--- a/sbin/ifconfig/ifconfig.c
+++ b/sbin/ifconfig/ifconfig.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ifconfig.c,v 1.280 2013/12/01 10:05:29 stsp Exp $ */
+/* $OpenBSD: ifconfig.c,v 1.281 2014/01/21 21:27:14 benno Exp $ */
/* $NetBSD: ifconfig.c,v 1.40 1997/10/01 02:19:43 enami Exp $ */
/*
@@ -3879,8 +3879,9 @@ pflow_status(void)
if (ioctl(s, SIOCGETPFLOW, (caddr_t)&ifr) == -1)
return;
- printf("\tpflow: sender: %s ", preq.sender_ip.s_addr != INADDR_ANY ?
- inet_ntoa(preq.sender_ip) : "INVALID");
+ printf("\tpflow: ");
+ if (preq.sender_ip.s_addr != INADDR_ANY)
+ printf("sender: %s ", inet_ntoa(preq.sender_ip));
printf("receiver: %s:", preq.receiver_ip.s_addr != INADDR_ANY ?
inet_ntoa(preq.receiver_ip) : "INVALID");
if (preq.receiver_port == 0)
diff --git a/share/man/man4/pflow.4 b/share/man/man4/pflow.4
index e2c9116075b..59b4dd15aa5 100644
--- a/share/man/man4/pflow.4
+++ b/share/man/man4/pflow.4
@@ -1,4 +1,4 @@
-.\" $OpenBSD: pflow.4,v 1.17 2014/01/21 03:15:46 schwarze Exp $
+.\" $OpenBSD: pflow.4,v 1.18 2014/01/21 21:27:14 benno Exp $
.\"
.\" Copyright (c) 2008 Henning Brauer <henning@openbsd.org>
.\" Copyright (c) 2008 Joerg Goltermann <jg@osn.de>
@@ -42,8 +42,7 @@ Multiple
interfaces can be created at runtime using the
.Ic ifconfig pflow Ns Ar N Ic create
command.
-Each interface must be configured with a flow sender IP address,
-a flow receiver IP address,
+Each interface must be configured with a flow receiver IP address
and a flow receiver port number.
.Pp
Only states created by a rule marked with the
@@ -92,8 +91,6 @@ collector.
.Cm flowdst
defines the collector IP address and the port.
The
-.Cm flowsrc
-IP address and
.Cm flowdst
IP address and port must be defined to enable the export of flows.
.Pp
diff --git a/sys/net/if_pflow.c b/sys/net/if_pflow.c
index cabad1efbe6..af7453c5974 100644
--- a/sys/net/if_pflow.c
+++ b/sys/net/if_pflow.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_pflow.c,v 1.38 2013/11/01 14:34:27 florian Exp $ */
+/* $OpenBSD: if_pflow.c,v 1.39 2014/01/21 21:27:14 benno Exp $ */
/*
* Copyright (c) 2011 Florian Obser <florian@narrans.de>
@@ -426,7 +426,6 @@ pflowioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
if ((ifp->if_flags & IFF_UP) &&
sc->sc_receiver_ip.s_addr != INADDR_ANY &&
sc->sc_receiver_port != 0 &&
- sc->sc_sender_ip.s_addr != INADDR_ANY &&
sc->sc_sender_port != 0) {
ifp->if_flags |= IFF_RUNNING;
sc->sc_gcounter=pflowstats.pflow_flows;
@@ -506,7 +505,6 @@ pflowioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
if ((ifp->if_flags & IFF_UP) &&
sc->sc_receiver_ip.s_addr != INADDR_ANY &&
sc->sc_receiver_port != 0 &&
- sc->sc_sender_ip.s_addr != INADDR_ANY &&
sc->sc_sender_port != 0) {
ifp->if_flags |= IFF_RUNNING;
sc->sc_gcounter=pflowstats.pflow_flows;