Increase statistic counters for enc0 interface when enabled
and processing IPSec traffic. Approved by: gnn (mentor) MFC after: 1 week
This commit is contained in:
parent
30d1eefe39
commit
97c2a697df
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=181627
@ -76,7 +76,7 @@ struct enchdr {
|
||||
u_int32_t flags;
|
||||
};
|
||||
|
||||
static struct ifnet *encif;
|
||||
struct ifnet *encif;
|
||||
static struct mtx enc_mtx;
|
||||
|
||||
struct enc_softc {
|
||||
|
35
sys/net/if_enc.h
Normal file
35
sys/net/if_enc.h
Normal file
@ -0,0 +1,35 @@
|
||||
/*-
|
||||
* Copyright (c) 2008 The FreeBSD Project.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef _NET_IF_ENC_H
|
||||
#define _NET_IF_ENC_H
|
||||
|
||||
extern struct ifnet *encif;
|
||||
|
||||
#endif /* _NET_IF_ENC_H */
|
@ -93,6 +93,11 @@
|
||||
#include <machine/in_cksum.h>
|
||||
#include <machine/stdarg.h>
|
||||
|
||||
#ifdef DEV_ENC
|
||||
#include <net/if_enc.h>
|
||||
#endif
|
||||
|
||||
|
||||
#define IPSEC_ISTAT(p,x,y,z) ((p) == IPPROTO_ESP ? (x)++ : \
|
||||
(p) == IPPROTO_AH ? (y)++ : (z)++)
|
||||
|
||||
@ -455,6 +460,9 @@ ipsec4_common_input_cb(struct mbuf *m, struct secasvar *sav,
|
||||
key_sa_recordxfer(sav, m); /* record data transfer */
|
||||
|
||||
#ifdef DEV_ENC
|
||||
encif->if_ipackets++;
|
||||
encif->if_ibytes += m->m_pkthdr.len;
|
||||
|
||||
/*
|
||||
* Pass the mbuf to enc0 for bpf and pfil. We will filter the IPIP
|
||||
* packet later after it has been decapsulated.
|
||||
@ -718,6 +726,9 @@ ipsec6_common_input_cb(struct mbuf *m, struct secasvar *sav, int skip, int proto
|
||||
key_sa_recordxfer(sav, m);
|
||||
|
||||
#ifdef DEV_ENC
|
||||
encif->if_ipackets++;
|
||||
encif->if_ibytes += m->m_pkthdr.len;
|
||||
|
||||
/*
|
||||
* Pass the mbuf to enc0 for bpf and pfil. We will filter the IPIP
|
||||
* packet later after it has been decapsulated.
|
||||
|
@ -82,6 +82,11 @@
|
||||
|
||||
#include <machine/in_cksum.h>
|
||||
|
||||
#ifdef DEV_ENC
|
||||
#include <net/if_enc.h>
|
||||
#endif
|
||||
|
||||
|
||||
int
|
||||
ipsec_process_done(struct mbuf *m, struct ipsecrequest *isr)
|
||||
{
|
||||
@ -364,6 +369,9 @@ ipsec4_process_packet(
|
||||
sav = isr->sav;
|
||||
|
||||
#ifdef DEV_ENC
|
||||
encif->if_opackets++;
|
||||
encif->if_obytes += m->m_pkthdr.len;
|
||||
|
||||
/* pass the mbuf to enc0 for bpf processing */
|
||||
ipsec_bpf(m, sav, AF_INET, ENC_OUT|ENC_BEFORE);
|
||||
/* pass the mbuf to enc0 for packet filtering */
|
||||
@ -724,6 +732,9 @@ ipsec6_output_tunnel(struct ipsec_output_state *state, struct secpolicy *sp, int
|
||||
}
|
||||
|
||||
#ifdef DEV_ENC
|
||||
encif->if_opackets++;
|
||||
encif->if_obytes += m->m_pkthdr.len;
|
||||
|
||||
/* pass the mbuf to enc0 for bpf processing */
|
||||
ipsec_bpf(m, isr->sav, AF_INET6, ENC_OUT|ENC_BEFORE);
|
||||
/* pass the mbuf to enc0 for packet filtering */
|
||||
|
Loading…
Reference in New Issue
Block a user