188768458SSam Leffler /* $KAME: ipcomp.h,v 1.8 2000/09/26 07:55:14 itojun Exp $ */ 288768458SSam Leffler 3c398230bSWarner Losh /*- 451369649SPedro F. Giffuni * SPDX-License-Identifier: BSD-3-Clause 551369649SPedro F. Giffuni * 688768458SSam Leffler * Copyright (C) 1999 WIDE Project. 788768458SSam Leffler * All rights reserved. 888768458SSam Leffler * 988768458SSam Leffler * Redistribution and use in source and binary forms, with or without 1088768458SSam Leffler * modification, are permitted provided that the following conditions 1188768458SSam Leffler * are met: 1288768458SSam Leffler * 1. Redistributions of source code must retain the above copyright 1388768458SSam Leffler * notice, this list of conditions and the following disclaimer. 1488768458SSam Leffler * 2. Redistributions in binary form must reproduce the above copyright 1588768458SSam Leffler * notice, this list of conditions and the following disclaimer in the 1688768458SSam Leffler * documentation and/or other materials provided with the distribution. 1788768458SSam Leffler * 3. Neither the name of the project nor the names of its contributors 1888768458SSam Leffler * may be used to endorse or promote products derived from this software 1988768458SSam Leffler * without specific prior written permission. 2088768458SSam Leffler * 2188768458SSam Leffler * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND 2288768458SSam Leffler * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2388768458SSam Leffler * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2488768458SSam Leffler * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE 2588768458SSam Leffler * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2688768458SSam Leffler * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2788768458SSam Leffler * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2888768458SSam Leffler * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2988768458SSam Leffler * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3088768458SSam Leffler * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3188768458SSam Leffler * SUCH DAMAGE. 3288768458SSam Leffler */ 3388768458SSam Leffler 3488768458SSam Leffler #ifndef _NETIPSEC_IPCOMP_VAR_H_ 3588768458SSam Leffler #define _NETIPSEC_IPCOMP_VAR_H_ 3688768458SSam Leffler 3788768458SSam Leffler /* 3888768458SSam Leffler * These define the algorithm indices into the histogram. They're 3988768458SSam Leffler * presently based on the PF_KEY v2 protocol values which is bogus; 4088768458SSam Leffler * they should be decoupled from the protocol at which time we can 4188768458SSam Leffler * pack them and reduce the size of the array to a minimum. 4288768458SSam Leffler */ 4388768458SSam Leffler #define IPCOMP_ALG_MAX 8 4488768458SSam Leffler 45c80211e3SAndrey V. Elsukov #define IPCOMPSTAT_VERSION 2 4688768458SSam Leffler struct ipcompstat { 47c80211e3SAndrey V. Elsukov uint64_t ipcomps_hdrops; /* Packet shorter than header shows */ 48c80211e3SAndrey V. Elsukov uint64_t ipcomps_nopf; /* Protocol family not supported */ 49c80211e3SAndrey V. Elsukov uint64_t ipcomps_notdb; 50c80211e3SAndrey V. Elsukov uint64_t ipcomps_badkcr; 51c80211e3SAndrey V. Elsukov uint64_t ipcomps_qfull; 52c80211e3SAndrey V. Elsukov uint64_t ipcomps_noxform; 53c80211e3SAndrey V. Elsukov uint64_t ipcomps_wrap; 54c80211e3SAndrey V. Elsukov uint64_t ipcomps_input; /* Input IPcomp packets */ 55c80211e3SAndrey V. Elsukov uint64_t ipcomps_output; /* Output IPcomp packets */ 56c80211e3SAndrey V. Elsukov uint64_t ipcomps_invalid;/* Trying to use an invalid TDB */ 57c80211e3SAndrey V. Elsukov uint64_t ipcomps_ibytes; /* Input bytes */ 58c80211e3SAndrey V. Elsukov uint64_t ipcomps_obytes; /* Output bytes */ 59c80211e3SAndrey V. Elsukov uint64_t ipcomps_toobig; /* Packet got > IP_MAXPACKET */ 60c80211e3SAndrey V. Elsukov uint64_t ipcomps_pdrops; /* Packet blocked due to policy */ 61c80211e3SAndrey V. Elsukov uint64_t ipcomps_crypto; /* "Crypto" processing failure */ 62c80211e3SAndrey V. Elsukov uint64_t ipcomps_hist[IPCOMP_ALG_MAX];/* Per-algorithm op count */ 63c80211e3SAndrey V. Elsukov uint64_t ipcomps_threshold; /* Packet < comp. algo. threshold. */ 64c80211e3SAndrey V. Elsukov uint64_t ipcomps_uncompr; /* Compression was useles. */ 6588768458SSam Leffler }; 6688768458SSam Leffler 6788768458SSam Leffler #ifdef _KERNEL 68db8c0879SAndrey V. Elsukov #include <sys/counter.h> 69*b1c3a4d7SKristof Provost #include <netinet/in_kdtrace.h> 7082cea7e6SBjoern A. Zeeb 71db8c0879SAndrey V. Elsukov VNET_DECLARE(int, ipcomp_enable); 72db8c0879SAndrey V. Elsukov VNET_PCPUSTAT_DECLARE(struct ipcompstat, ipcompstat); 73db8c0879SAndrey V. Elsukov 74db8c0879SAndrey V. Elsukov #define IPCOMPSTAT_ADD(name, val) \ 75*b1c3a4d7SKristof Provost do { \ 76*b1c3a4d7SKristof Provost MIB_SDT_PROBE1(ipcomp, count, name, (val)); \ 77*b1c3a4d7SKristof Provost VNET_PCPUSTAT_ADD(struct ipcompstat, ipcompstat, name, (val)); \ 78*b1c3a4d7SKristof Provost } while (0) 79*b1c3a4d7SKristof Provost #define IPCOMPSTAT_INC2(name, type) \ 80*b1c3a4d7SKristof Provost do { \ 81*b1c3a4d7SKristof Provost MIB_SDT_PROBE2(ipcomp, count, name, 1, (type)); \ 82*b1c3a4d7SKristof Provost VNET_PCPUSTAT_ADD(struct ipcompstat, ipcompstat, name[type], \ 83*b1c3a4d7SKristof Provost 1); \ 84*b1c3a4d7SKristof Provost } while (0) 85a04d64d8SAndrey V. Elsukov #define IPCOMPSTAT_INC(name) IPCOMPSTAT_ADD(name, 1) 8682cea7e6SBjoern A. Zeeb #define V_ipcomp_enable VNET(ipcomp_enable) 8788768458SSam Leffler #endif /* _KERNEL */ 8888768458SSam Leffler #endif /*_NETIPSEC_IPCOMP_VAR_H_*/ 89