diff options
Diffstat (limited to 'sys/net/if_pflow.h')
-rw-r--r-- | sys/net/if_pflow.h | 123 |
1 files changed, 99 insertions, 24 deletions
diff --git a/sys/net/if_pflow.h b/sys/net/if_pflow.h index 250ff7e47ef..1676ec8d016 100644 --- a/sys/net/if_pflow.h +++ b/sys/net/if_pflow.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_pflow.h,v 1.8 2013/05/03 15:33:47 florian Exp $ */ +/* $OpenBSD: if_pflow.h,v 1.9 2013/08/13 08:44:05 florian Exp $ */ /* * Copyright (c) 2008 Henning Brauer <henning@openbsd.org> @@ -30,7 +30,7 @@ #define PFLOW_TMPL_TIMEOUT 30 /* rfc 5101 10.3.6 (p.40) recommends 600 */ #define PFLOW_V9_TMPL_SET_ID 0 -#define PFLOW_V10_TMPL_SET_ID 2 +#define PFLOW_IPFIX_TMPL_SET_ID 2 /* RFC 5102 Information Element Identifiers */ @@ -48,8 +48,8 @@ #define PFIX_IE_flowStartSysUpTime 22 #define PFIX_IE_sourceIPv6Address 27 #define PFIX_IE_destinationIPv6Address 28 -#define PFIX_IE_flowStartSeconds 150 -#define PFIX_IE_flowEndSeconds 151 +#define PFIX_IE_flowStartMilliseconds 152 +#define PFIX_IE_flowEndMilliseconds 153 struct pflow_flow { u_int32_t src_ip; @@ -93,8 +93,8 @@ struct pflow_tmpl_fspec { u_int16_t len; } __packed; -/* update pflow_clone_create() when changing pflow_tmpl_ipv4 */ -struct pflow_tmpl_ipv4 { +/* update pflow_clone_create() when changing pflow_v9_tmpl_ipv4 */ +struct pflow_v9_tmpl_ipv4 { struct pflow_tmpl_hdr h; struct pflow_tmpl_fspec src_ip; struct pflow_tmpl_fspec dest_ip; @@ -108,12 +108,12 @@ struct pflow_tmpl_ipv4 { struct pflow_tmpl_fspec dest_port; struct pflow_tmpl_fspec tos; struct pflow_tmpl_fspec protocol; -#define PFLOW_TMPL_IPV4_FIELD_COUNT 12 -#define PFLOW_TMPL_IPV4_ID 256 +#define PFLOW_V9_TMPL_IPV4_FIELD_COUNT 12 +#define PFLOW_V9_TMPL_IPV4_ID 256 } __packed; -/* update pflow_clone_create() when changing pflow_tmpl_v6 */ -struct pflow_tmpl_ipv6 { +/* update pflow_clone_create() when changing pflow_v9_tmpl_v6 */ +struct pflow_v9_tmpl_ipv6 { struct pflow_tmpl_hdr h; struct pflow_tmpl_fspec src_ip; struct pflow_tmpl_fspec dest_ip; @@ -127,17 +127,62 @@ struct pflow_tmpl_ipv6 { struct pflow_tmpl_fspec dest_port; struct pflow_tmpl_fspec tos; struct pflow_tmpl_fspec protocol; -#define PFLOW_TMPL_IPV6_FIELD_COUNT 12 -#define PFLOW_TMPL_IPV6_ID 257 +#define PFLOW_V9_TMPL_IPV6_FIELD_COUNT 12 +#define PFLOW_V9_TMPL_IPV6_ID 257 } __packed; -struct pflow_tmpl { +struct pflow_v9_tmpl { struct pflow_set_header set_header; - struct pflow_tmpl_ipv4 ipv4_tmpl; - struct pflow_tmpl_ipv6 ipv6_tmpl; + struct pflow_v9_tmpl_ipv4 ipv4_tmpl; + struct pflow_v9_tmpl_ipv6 ipv6_tmpl; } __packed; -struct pflow_flow4 { + +/* update pflow_clone_create() when changing pflow_ipfix_tmpl_ipv4 */ +struct pflow_ipfix_tmpl_ipv4 { + struct pflow_tmpl_hdr h; + struct pflow_tmpl_fspec src_ip; + struct pflow_tmpl_fspec dest_ip; + struct pflow_tmpl_fspec if_index_in; + struct pflow_tmpl_fspec if_index_out; + struct pflow_tmpl_fspec packets; + struct pflow_tmpl_fspec octets; + struct pflow_tmpl_fspec start; + struct pflow_tmpl_fspec finish; + struct pflow_tmpl_fspec src_port; + struct pflow_tmpl_fspec dest_port; + struct pflow_tmpl_fspec tos; + struct pflow_tmpl_fspec protocol; +#define PFLOW_IPFIX_TMPL_IPV4_FIELD_COUNT 12 +#define PFLOW_IPFIX_TMPL_IPV4_ID 256 +} __packed; + +/* update pflow_clone_create() when changing pflow_ipfix_tmpl_v6 */ +struct pflow_ipfix_tmpl_ipv6 { + struct pflow_tmpl_hdr h; + struct pflow_tmpl_fspec src_ip; + struct pflow_tmpl_fspec dest_ip; + struct pflow_tmpl_fspec if_index_in; + struct pflow_tmpl_fspec if_index_out; + struct pflow_tmpl_fspec packets; + struct pflow_tmpl_fspec octets; + struct pflow_tmpl_fspec start; + struct pflow_tmpl_fspec finish; + struct pflow_tmpl_fspec src_port; + struct pflow_tmpl_fspec dest_port; + struct pflow_tmpl_fspec tos; + struct pflow_tmpl_fspec protocol; +#define PFLOW_IPFIX_TMPL_IPV6_FIELD_COUNT 12 +#define PFLOW_IPFIX_TMPL_IPV6_ID 257 +} __packed; + +struct pflow_ipfix_tmpl { + struct pflow_set_header set_header; + struct pflow_ipfix_tmpl_ipv4 ipv4_tmpl; + struct pflow_ipfix_tmpl_ipv6 ipv6_tmpl; +} __packed; + +struct pflow_v9_flow4 { u_int32_t src_ip; /* sourceIPv4Address*/ u_int32_t dest_ip; /* destinationIPv4Address */ u_int32_t if_index_in; /* ingressInterface */ @@ -153,18 +198,47 @@ struct pflow_flow4 { /* XXX padding needed? */ } __packed; -struct pflow_flow6 { +struct pflow_v9_flow6 { + struct in6_addr src_ip; /* sourceIPv6Address */ + struct in6_addr dest_ip; /* destinationIPv6Address */ + u_int32_t if_index_in; /* ingressInterface */ + u_int32_t if_index_out; /* egressInterface */ + u_int64_t flow_packets; /* packetDeltaCount */ + u_int64_t flow_octets; /* octetDeltaCount */ + u_int32_t flow_start; /* flowStartSysUpTime */ + u_int32_t flow_finish; /* flowEndSysUpTime */ + u_int16_t src_port; /* sourceTransportPort */ + u_int16_t dest_port; /* destinationTransportPort */ + u_int8_t tos; /* ipClassOfService */ + u_int8_t protocol; /* protocolIdentifier */ + /* XXX padding needed? */ +} __packed; + +struct pflow_ipfix_flow4 { + u_int32_t src_ip; /* sourceIPv4Address*/ + u_int32_t dest_ip; /* destinationIPv4Address */ + u_int32_t if_index_in; /* ingressInterface */ + u_int32_t if_index_out; /* egressInterface */ + u_int64_t flow_packets; /* packetDeltaCount */ + u_int64_t flow_octets; /* octetDeltaCount */ + int64_t flow_start; /* flowStartMilliseconds */ + int64_t flow_finish; /* flowEndMilliseconds */ + u_int16_t src_port; /* sourceTransportPort */ + u_int16_t dest_port; /* destinationTransportPort */ + u_int8_t tos; /* ipClassOfService */ + u_int8_t protocol; /* protocolIdentifier */ + /* XXX padding needed? */ +} __packed; + +struct pflow_ipfix_flow6 { struct in6_addr src_ip; /* sourceIPv6Address */ struct in6_addr dest_ip; /* destinationIPv6Address */ u_int32_t if_index_in; /* ingressInterface */ u_int32_t if_index_out; /* egressInterface */ u_int64_t flow_packets; /* packetDeltaCount */ u_int64_t flow_octets; /* octetDeltaCount */ - u_int32_t flow_start; /* - * flowStartSysUpTime / - * flowStartSeconds - */ - u_int32_t flow_finish; /* flowEndSysUpTime / flowEndSeconds */ + int64_t flow_start; /* flowStartMilliseconds */ + int64_t flow_finish; /* flowEndMilliseconds */ u_int16_t src_port; /* sourceTransportPort */ u_int16_t dest_port; /* destinationTransportPort */ u_int8_t tos; /* ipClassOfService */ @@ -196,7 +270,8 @@ struct pflow_softc { struct in_addr sc_receiver_ip; u_int16_t sc_receiver_port; u_char sc_send_templates; - struct pflow_tmpl sc_tmpl; + struct pflow_v9_tmpl sc_tmpl_v9; + struct pflow_ipfix_tmpl sc_tmpl_ipfix; u_int8_t sc_version; struct mbuf *sc_mbuf; /* current cumulative mbuf */ struct mbuf *sc_mbuf6; /* current cumulative mbuf */ @@ -230,7 +305,7 @@ struct pflow_v10_header { u_int32_t observation_dom; } __packed; -#define PFLOW_V10_HDRLEN sizeof(struct pflow_v10_header) +#define PFLOW_IPFIX_HDRLEN sizeof(struct pflow_v10_header) struct pflow_v9_header { u_int16_t version; |