\hypertarget{ng__checksum_8c_source}{}\doxysection{ng\+\_\+checksum.\+c}
\label{ng__checksum_8c_source}\index{netgraph/ng\_checksum.c@{netgraph/ng\_checksum.c}}
\mbox{\hyperlink{ng__checksum_8c}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00001}00001 \textcolor{comment}{/*-\/}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00002}00002 \textcolor{comment}{ * Copyright (c) 2015 Dmitry Vagin <daemon.hammer@ya.ru>}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00003}00003 \textcolor{comment}{ * All rights reserved.}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00004}00004 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00005}00005 \textcolor{comment}{ * Redistribution and use in source and binary forms, with or without}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00006}00006 \textcolor{comment}{ * modification, are permitted provided that the following conditions}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00007}00007 \textcolor{comment}{ * are met:}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00008}00008 \textcolor{comment}{ * 1. Redistributions of source code must retain the above copyright}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00009}00009 \textcolor{comment}{ *    notice, this list of conditions and the following disclaimer.}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00010}00010 \textcolor{comment}{ * 2. Redistributions in binary form must reproduce the above copyright}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00011}00011 \textcolor{comment}{ *    notice, this list of conditions and the following disclaimer in the}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00012}00012 \textcolor{comment}{ *    documentation and/or other materials provided with the distribution.}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00013}00013 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00014}00014 \textcolor{comment}{ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00015}00015 \textcolor{comment}{ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00016}00016 \textcolor{comment}{ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00017}00017 \textcolor{comment}{ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00018}00018 \textcolor{comment}{ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00019}00019 \textcolor{comment}{ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00020}00020 \textcolor{comment}{ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00021}00021 \textcolor{comment}{ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00022}00022 \textcolor{comment}{ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00023}00023 \textcolor{comment}{ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00024}00024 \textcolor{comment}{ * SUCH DAMAGE.}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00025}00025 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00026}00026 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00027}00027 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00028}00028 \textcolor{preprocessor}{\#include <sys/cdefs.h>}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00029}\mbox{\hyperlink{ng__checksum_8c_a8c3ef283470a68cd30afe9b8a72cb60f}{00029}} \mbox{\hyperlink{ng__checksum_8c_a8c3ef283470a68cd30afe9b8a72cb60f}{\_\_FBSDID}}(\textcolor{stringliteral}{"{}\$FreeBSD\$"{}});}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00030}00030 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00031}00031 \textcolor{preprocessor}{\#include "{}opt\_inet.h"{}}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00032}00032 \textcolor{preprocessor}{\#include "{}opt\_inet6.h"{}}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00033}00033 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00034}00034 \textcolor{preprocessor}{\#include <sys/param.h>}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00035}00035 \textcolor{preprocessor}{\#include <sys/systm.h>}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00036}00036 \textcolor{preprocessor}{\#include <sys/kernel.h>}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00037}00037 \textcolor{preprocessor}{\#include <sys/endian.h>}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00038}00038 \textcolor{preprocessor}{\#include <sys/malloc.h>}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00039}00039 \textcolor{preprocessor}{\#include <sys/mbuf.h>}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00040}00040 \textcolor{preprocessor}{\#include <sys/socket.h>}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00041}00041 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00042}00042 \textcolor{preprocessor}{\#include <net/bpf.h>}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00043}00043 \textcolor{preprocessor}{\#include <net/ethernet.h>}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00044}00044 \textcolor{preprocessor}{\#include <net/if.h>}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00045}00045 \textcolor{preprocessor}{\#include <net/if\_vlan\_var.h>}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00046}00046 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00047}00047 \textcolor{preprocessor}{\#include <netinet/in.h>}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00048}00048 \textcolor{preprocessor}{\#include <netinet/ip.h>}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00049}00049 \textcolor{preprocessor}{\#include <netinet/ip6.h>}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00050}00050 \textcolor{preprocessor}{\#include <netinet/tcp.h>}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00051}00051 \textcolor{preprocessor}{\#include <netinet/udp.h>}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00052}00052 \textcolor{preprocessor}{\#include <machine/in\_cksum.h>}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00053}00053 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00054}00054 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{ng__message_8h}{netgraph/ng\_message.h}}>}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00055}00055 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{ng__parse_8h}{netgraph/ng\_parse.h}}>}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00056}00056 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{netgraph_8h}{netgraph/netgraph.h}}>}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00057}00057 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00058}00058 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{ng__checksum_8h}{netgraph/ng\_checksum.h}}>}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00059}00059 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00060}00060 \textcolor{comment}{/* private data */}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00061}\mbox{\hyperlink{structng__checksum__priv}{00061}} \textcolor{keyword}{struct }\mbox{\hyperlink{structng__checksum__priv}{ng\_checksum\_priv}} \{}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00062}\mbox{\hyperlink{structng__checksum__priv_aaf085f12b024d066e558498029e3a150}{00062}}         \mbox{\hyperlink{structng__hook}{hook\_p}} \mbox{\hyperlink{structng__checksum__priv_aaf085f12b024d066e558498029e3a150}{in}};}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00063}\mbox{\hyperlink{structng__checksum__priv_ae91470f50d77634a14e7d1a3719d6dd3}{00063}}         \mbox{\hyperlink{structng__hook}{hook\_p}} \mbox{\hyperlink{structng__checksum__priv_ae91470f50d77634a14e7d1a3719d6dd3}{out}};}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00064}\mbox{\hyperlink{structng__checksum__priv_a2ea55b24d1f0623216ad7de789c3b487}{00064}}         uint8\_t \mbox{\hyperlink{structng__checksum__priv_a2ea55b24d1f0623216ad7de789c3b487}{dlt}}; \textcolor{comment}{/* DLT\_XXX from bpf.h */}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00065}\mbox{\hyperlink{structng__checksum__priv_ac593273905e420ced425088c99cf83f5}{00065}}         \textcolor{keyword}{struct }\mbox{\hyperlink{structng__checksum__config}{ng\_checksum\_config}} *\mbox{\hyperlink{structng__checksum__priv_ac593273905e420ced425088c99cf83f5}{conf}};}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00066}\mbox{\hyperlink{structng__checksum__priv_a3449989955196f4a0a56e879a166c9e6}{00066}}         \textcolor{keyword}{struct }\mbox{\hyperlink{structng__checksum__stats}{ng\_checksum\_stats}} \mbox{\hyperlink{structstats}{stats}};}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00067}00067 \};}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00068}00068 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00069}\mbox{\hyperlink{ng__checksum_8c_acfc78b64720cc26b548cd0b90c883983}{00069}} \textcolor{keyword}{typedef} \textcolor{keyword}{struct }\mbox{\hyperlink{structng__checksum__priv}{ng\_checksum\_priv}} *\mbox{\hyperlink{ng__checksum_8c_acfc78b64720cc26b548cd0b90c883983}{priv\_p}};}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00070}00070 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00071}00071 \textcolor{comment}{/* Netgraph methods */}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00072}\mbox{\hyperlink{ng__checksum_8c_abea8e6cdbee4ca12e6bd350cf71894b3}{00072}} \textcolor{keyword}{static} \mbox{\hyperlink{netgraph_8h_abb75b9ed2849e15851d6402d2ab5b899}{ng\_constructor\_t}} \mbox{\hyperlink{ng__checksum_8c_abea8e6cdbee4ca12e6bd350cf71894b3}{ng\_checksum\_constructor}};}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00073}\mbox{\hyperlink{ng__checksum_8c_aa760227c4569ea2220dd6a16e457fcaa}{00073}} \textcolor{keyword}{static} \mbox{\hyperlink{netgraph_8h_a47b860e2900386e775707cc1ae661162}{ng\_rcvmsg\_t}}   \mbox{\hyperlink{ng__checksum_8c_aa760227c4569ea2220dd6a16e457fcaa}{ng\_checksum\_rcvmsg}};}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00074}\mbox{\hyperlink{ng__checksum_8c_a2ef690dc8b68b996ede1c2793fbd4f99}{00074}} \textcolor{keyword}{static} \mbox{\hyperlink{netgraph_8h_aab0a679789a1af312a7f856b4668ad74}{ng\_shutdown\_t}}       \mbox{\hyperlink{ng__checksum_8c_a2ef690dc8b68b996ede1c2793fbd4f99}{ng\_checksum\_shutdown}};}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00075}\mbox{\hyperlink{ng__checksum_8c_a76c8e3ed2699b9747e38ac79a8ac8100}{00075}} \textcolor{keyword}{static} \mbox{\hyperlink{netgraph_8h_afa50639df4ed6eb400f8220a890d56e6}{ng\_newhook\_t}} \mbox{\hyperlink{ng__checksum_8c_a76c8e3ed2699b9747e38ac79a8ac8100}{ng\_checksum\_newhook}};}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00076}\mbox{\hyperlink{ng__checksum_8c_ac4761c8acab93f166e2def5681598581}{00076}} \textcolor{keyword}{static} \mbox{\hyperlink{netgraph_8h_aa87ef7415b345b801747ceaf99de6c43}{ng\_rcvdata\_t}} \mbox{\hyperlink{ng__checksum_8c_ac4761c8acab93f166e2def5681598581}{ng\_checksum\_rcvdata}};}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00077}\mbox{\hyperlink{ng__checksum_8c_a6659ecfb5af2697f7a69a30a20255a34}{00077}} \textcolor{keyword}{static} \mbox{\hyperlink{netgraph_8h_a669e1783335f933b4a4f90f17d22f381}{ng\_disconnect\_t}}   \mbox{\hyperlink{ng__checksum_8c_a6659ecfb5af2697f7a69a30a20255a34}{ng\_checksum\_disconnect}};}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00078}\mbox{\hyperlink{ng__checksum_8c_a661c316872e6e1e6a714d7fad67f366f}{00078}} \textcolor{preprocessor}{\#define ERROUT(x) \{ error = (x); goto done; \}}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00079}00079 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00080}\mbox{\hyperlink{ng__checksum_8c_a39620d05dc0a6caf7743a3a57ab48626}{00080}} \textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keyword}{struct }\mbox{\hyperlink{structng__parse__struct__field}{ng\_parse\_struct\_field}} \mbox{\hyperlink{ng__checksum_8c_a39620d05dc0a6caf7743a3a57ab48626}{ng\_checksum\_config\_type\_fields}}[]}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00081}00081         = \mbox{\hyperlink{ng__checksum_8h_adb3e655a68ac39ce26e48a74bf8d7026}{NG\_CHECKSUM\_CONFIG\_TYPE}};}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00082}\mbox{\hyperlink{ng__checksum_8c_ab4f6d8b104520fb2ec9ea8eaa4481106}{00082}} \textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keyword}{struct }\mbox{\hyperlink{structng__parse__type}{ng\_parse\_type}} \mbox{\hyperlink{ng__checksum_8c_ab4f6d8b104520fb2ec9ea8eaa4481106}{ng\_checksum\_config\_type}} = \{}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00083}00083         \&\mbox{\hyperlink{ng__parse_8c_aa8b7049fbd698972a3d2ce77dfd7d079}{ng\_parse\_struct\_type}},}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00084}00084         \&\mbox{\hyperlink{ng__checksum_8c_a39620d05dc0a6caf7743a3a57ab48626}{ng\_checksum\_config\_type\_fields}}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00085}00085 \};}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00086}00086 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00087}\mbox{\hyperlink{ng__checksum_8c_a20d3c64c6590d793c5b5487643fe476c}{00087}} \textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keyword}{struct }\mbox{\hyperlink{structng__parse__struct__field}{ng\_parse\_struct\_field}} \mbox{\hyperlink{ng__checksum_8c_a20d3c64c6590d793c5b5487643fe476c}{ng\_checksum\_stats\_fields}}[]}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00088}00088         = \mbox{\hyperlink{ng__checksum_8h_a50581e147675fc0254bcb380e02be461}{NG\_CHECKSUM\_STATS\_TYPE}};}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00089}\mbox{\hyperlink{ng__checksum_8c_a7103025545b0a52013501f31e2202376}{00089}} \textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keyword}{struct }\mbox{\hyperlink{structng__parse__type}{ng\_parse\_type}} \mbox{\hyperlink{ng__checksum_8c_a7103025545b0a52013501f31e2202376}{ng\_checksum\_stats\_type}} = \{}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00090}00090         \&\mbox{\hyperlink{ng__parse_8c_aa8b7049fbd698972a3d2ce77dfd7d079}{ng\_parse\_struct\_type}},}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00091}00091         \&\mbox{\hyperlink{ng__checksum_8c_a20d3c64c6590d793c5b5487643fe476c}{ng\_checksum\_stats\_fields}}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00092}00092 \};}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00093}00093 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00094}\mbox{\hyperlink{ng__checksum_8c_a3a5f79c7a533adb2f9513e97f9ad942a}{00094}} \textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keyword}{struct }\mbox{\hyperlink{structng__cmdlist}{ng\_cmdlist}} \mbox{\hyperlink{ng__checksum_8c_a3a5f79c7a533adb2f9513e97f9ad942a}{ng\_checksum\_cmdlist}}[] = \{}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00095}00095         \{}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00096}00096                 \mbox{\hyperlink{ng__checksum_8h_a65cfbb64c85e3e67fef908ff46979a66}{NGM\_CHECKSUM\_COOKIE}},}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00097}00097                 \mbox{\hyperlink{ng__checksum_8h_a4caf8d8f829279fba122163d961608a4a4f116b89c40df73d4fc25a153cedf2ec}{NGM\_CHECKSUM\_GETDLT}},}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00098}00098                 \textcolor{stringliteral}{"{}getdlt"{}},}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00099}00099                 NULL,}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00100}00100                 \&\mbox{\hyperlink{ng__parse_8c_ad9b579abf3953b9655aec194529ddc1d}{ng\_parse\_uint8\_type}}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00101}00101         \},}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00102}00102         \{}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00103}00103                 \mbox{\hyperlink{ng__checksum_8h_a65cfbb64c85e3e67fef908ff46979a66}{NGM\_CHECKSUM\_COOKIE}},}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00104}00104                 \mbox{\hyperlink{ng__checksum_8h_a4caf8d8f829279fba122163d961608a4a5ebbc81dee7930d593e7da9f2c9ef3be}{NGM\_CHECKSUM\_SETDLT}},}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00105}00105                 \textcolor{stringliteral}{"{}setdlt"{}},}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00106}00106                 \&\mbox{\hyperlink{ng__parse_8c_ad9b579abf3953b9655aec194529ddc1d}{ng\_parse\_uint8\_type}},}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00107}00107                 NULL}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00108}00108         \},}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00109}00109         \{}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00110}00110                 \mbox{\hyperlink{ng__checksum_8h_a65cfbb64c85e3e67fef908ff46979a66}{NGM\_CHECKSUM\_COOKIE}},}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00111}00111                 \mbox{\hyperlink{ng__checksum_8h_a4caf8d8f829279fba122163d961608a4a0dd427f948be46f16b39e53802de3e5c}{NGM\_CHECKSUM\_GETCONFIG}},}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00112}00112                 \textcolor{stringliteral}{"{}getconfig"{}},}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00113}00113                 NULL,}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00114}00114                 \&\mbox{\hyperlink{ng__checksum_8c_ab4f6d8b104520fb2ec9ea8eaa4481106}{ng\_checksum\_config\_type}}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00115}00115         \},}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00116}00116         \{}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00117}00117                 \mbox{\hyperlink{ng__checksum_8h_a65cfbb64c85e3e67fef908ff46979a66}{NGM\_CHECKSUM\_COOKIE}},}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00118}00118                 \mbox{\hyperlink{ng__checksum_8h_a4caf8d8f829279fba122163d961608a4a1ea70e101aded5e4eaf21431431c2b1f}{NGM\_CHECKSUM\_SETCONFIG}},}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00119}00119                 \textcolor{stringliteral}{"{}setconfig"{}},}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00120}00120                 \&\mbox{\hyperlink{ng__checksum_8c_ab4f6d8b104520fb2ec9ea8eaa4481106}{ng\_checksum\_config\_type}},}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00121}00121                 NULL}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00122}00122         \},}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00123}00123         \{}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00124}00124                 \mbox{\hyperlink{ng__checksum_8h_a65cfbb64c85e3e67fef908ff46979a66}{NGM\_CHECKSUM\_COOKIE}},}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00125}00125                 \mbox{\hyperlink{ng__checksum_8h_a4caf8d8f829279fba122163d961608a4a42a65beb08f1ef38d87e2aa02e79609d}{NGM\_CHECKSUM\_GET\_STATS}},}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00126}00126                 \textcolor{stringliteral}{"{}getstats"{}},}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00127}00127                 NULL,}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00128}00128                 \&\mbox{\hyperlink{ng__checksum_8c_a7103025545b0a52013501f31e2202376}{ng\_checksum\_stats\_type}}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00129}00129         \},}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00130}00130         \{}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00131}00131                 \mbox{\hyperlink{ng__checksum_8h_a65cfbb64c85e3e67fef908ff46979a66}{NGM\_CHECKSUM\_COOKIE}},}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00132}00132                 \mbox{\hyperlink{ng__checksum_8h_a4caf8d8f829279fba122163d961608a4a784dd5684456265688e17fba63009c07}{NGM\_CHECKSUM\_CLR\_STATS}},}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00133}00133                 \textcolor{stringliteral}{"{}clrstats"{}},}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00134}00134                 NULL,}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00135}00135                 NULL}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00136}00136         \},}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00137}00137         \{}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00138}00138                 \mbox{\hyperlink{ng__checksum_8h_a65cfbb64c85e3e67fef908ff46979a66}{NGM\_CHECKSUM\_COOKIE}},}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00139}00139                 \mbox{\hyperlink{ng__checksum_8h_a4caf8d8f829279fba122163d961608a4a77d9b2241852e1a02af8f712bcd01510}{NGM\_CHECKSUM\_GETCLR\_STATS}},}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00140}00140                 \textcolor{stringliteral}{"{}getclrstats"{}},}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00141}00141                 NULL,}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00142}00142                 \&\mbox{\hyperlink{ng__checksum_8c_a7103025545b0a52013501f31e2202376}{ng\_checksum\_stats\_type}}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00143}00143         \},}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00144}00144         \{ 0 \}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00145}00145 \};}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00146}00146 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00147}\mbox{\hyperlink{ng__checksum_8c_a80a131770518c7fa3758d85054006e7a}{00147}} \textcolor{keyword}{static} \textcolor{keyword}{struct }\mbox{\hyperlink{structng__type}{ng\_type}} \mbox{\hyperlink{ng__checksum_8c_a80a131770518c7fa3758d85054006e7a}{typestruct}} = \{}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00148}00148         .\mbox{\hyperlink{structng__type_adbc1c8884ff0e625c19c4b513262fd0e}{version}} =       \mbox{\hyperlink{netgraph_8h_acc6b5f853e8058f4d5a8ca825ee60c97}{NG\_ABI\_VERSION}},}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00149}00149         .name =         \mbox{\hyperlink{ng__checksum_8h_a077aa83dfbe073b054398e1c5f41eebb}{NG\_CHECKSUM\_NODE\_TYPE}},}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00150}00150         .constructor =  \mbox{\hyperlink{ng__checksum_8c_abea8e6cdbee4ca12e6bd350cf71894b3}{ng\_checksum\_constructor}},}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00151}00151         .rcvmsg =       \mbox{\hyperlink{ng__checksum_8c_aa760227c4569ea2220dd6a16e457fcaa}{ng\_checksum\_rcvmsg}},}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00152}00152         .shutdown =     \mbox{\hyperlink{ng__checksum_8c_a2ef690dc8b68b996ede1c2793fbd4f99}{ng\_checksum\_shutdown}},}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00153}00153         .newhook =      \mbox{\hyperlink{ng__checksum_8c_a76c8e3ed2699b9747e38ac79a8ac8100}{ng\_checksum\_newhook}},}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00154}00154         .rcvdata =      \mbox{\hyperlink{ng__checksum_8c_ac4761c8acab93f166e2def5681598581}{ng\_checksum\_rcvdata}},}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00155}00155         .disconnect =   \mbox{\hyperlink{ng__checksum_8c_a6659ecfb5af2697f7a69a30a20255a34}{ng\_checksum\_disconnect}},}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00156}00156         .cmdlist =      \mbox{\hyperlink{ng__checksum_8c_a3a5f79c7a533adb2f9513e97f9ad942a}{ng\_checksum\_cmdlist}},}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00157}00157 \};}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00158}00158 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00159}\mbox{\hyperlink{ng__checksum_8c_ab6e69e4a112e95bcd329e664aa1ceed4}{00159}} \mbox{\hyperlink{ng__checksum_8c_ab6e69e4a112e95bcd329e664aa1ceed4}{NETGRAPH\_INIT}}(checksum, \&\mbox{\hyperlink{ng__checksum_8c_a80a131770518c7fa3758d85054006e7a}{typestruct}});}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00160}00160 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00161}00161 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00162}\mbox{\hyperlink{ng__checksum_8c_a2b60e8526607b4801a1934a6627f9954}{00162}} \mbox{\hyperlink{ng__checksum_8c_abea8e6cdbee4ca12e6bd350cf71894b3}{ng\_checksum\_constructor}}(\mbox{\hyperlink{structng__node}{node\_p}} node)}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00163}00163 \{}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00164}00164         \mbox{\hyperlink{structnetflow}{priv\_p}} \mbox{\hyperlink{structpriv}{priv}};}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00165}00165 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00166}00166         \mbox{\hyperlink{structpriv}{priv}} = malloc(\textcolor{keyword}{sizeof}(*\mbox{\hyperlink{structpriv}{priv}}), M\_NETGRAPH, M\_WAITOK|M\_ZERO);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00167}00167         \mbox{\hyperlink{structpriv}{priv}}-\/>dlt = DLT\_RAW;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00168}00168 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00169}00169         \mbox{\hyperlink{netgraph_8h_a674a9dcfdef6a73d16cccde37234f470}{NG\_NODE\_SET\_PRIVATE}}(node, \mbox{\hyperlink{structpriv}{priv}});}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00170}00170 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00171}00171         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00172}00172 \}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00173}00173 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00174}00174 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00175}\mbox{\hyperlink{ng__checksum_8c_ad18e9d4b5b76d9b2fb769f8b97d96023}{00175}} \mbox{\hyperlink{ng__checksum_8c_a76c8e3ed2699b9747e38ac79a8ac8100}{ng\_checksum\_newhook}}(\mbox{\hyperlink{structng__node}{node\_p}} node, \mbox{\hyperlink{structng__hook}{hook\_p}} hook, \textcolor{keyword}{const} \textcolor{keywordtype}{char} *\mbox{\hyperlink{ng__ppp_8c_ab2adbf48c2df32ccf9cced3bc8c3dc26}{name}})}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00176}00176 \{}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00177}00177         \textcolor{keyword}{const} \mbox{\hyperlink{structnetflow}{priv\_p}} \mbox{\hyperlink{structpriv}{priv}} = \mbox{\hyperlink{netgraph_8h_ae76b377c72ed8b60e8cbe1a204f70598}{NG\_NODE\_PRIVATE}}(node);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00178}00178 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00179}00179         \textcolor{keywordflow}{if} (strncmp(\mbox{\hyperlink{ng__ppp_8c_ab2adbf48c2df32ccf9cced3bc8c3dc26}{name}}, \mbox{\hyperlink{ng__checksum_8h_a4c0fae970be0c575bfd2a66a7dd1e313}{NG\_CHECKSUM\_HOOK\_IN}}, strlen(\mbox{\hyperlink{ng__checksum_8h_a4c0fae970be0c575bfd2a66a7dd1e313}{NG\_CHECKSUM\_HOOK\_IN}})) == 0) \{}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00180}00180                 \mbox{\hyperlink{structpriv}{priv}}-\/>in = hook;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00181}00181         \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (strncmp(\mbox{\hyperlink{ng__ppp_8c_ab2adbf48c2df32ccf9cced3bc8c3dc26}{name}}, \mbox{\hyperlink{ng__checksum_8h_a3349e755bacdd7f89d04799eecdeb255}{NG\_CHECKSUM\_HOOK\_OUT}}, strlen(\mbox{\hyperlink{ng__checksum_8h_a3349e755bacdd7f89d04799eecdeb255}{NG\_CHECKSUM\_HOOK\_OUT}})) == 0) \{}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00182}00182                 \mbox{\hyperlink{structpriv}{priv}}-\/>out = hook;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00183}00183         \} \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00184}00184                 \textcolor{keywordflow}{return} (EINVAL);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00185}00185 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00186}00186         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00187}00187 \}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00188}00188 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00189}00189 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00190}\mbox{\hyperlink{ng__checksum_8c_aa4550772771508bd32f611659a36aeeb}{00190}} \mbox{\hyperlink{ng__checksum_8c_aa760227c4569ea2220dd6a16e457fcaa}{ng\_checksum\_rcvmsg}}(\mbox{\hyperlink{structng__node}{node\_p}} node, \mbox{\hyperlink{structng__item}{item\_p}} item, \mbox{\hyperlink{structng__hook}{hook\_p}} lasthook)}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00191}00191 \{}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00192}00192         \textcolor{keyword}{const} \mbox{\hyperlink{structnetflow}{priv\_p}} \mbox{\hyperlink{structpriv}{priv}} = \mbox{\hyperlink{netgraph_8h_ae76b377c72ed8b60e8cbe1a204f70598}{NG\_NODE\_PRIVATE}}(node);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00193}00193         \textcolor{keyword}{struct }\mbox{\hyperlink{structng__checksum__config}{ng\_checksum\_config}} *conf, *newconf;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00194}00194         \textcolor{keyword}{struct }\mbox{\hyperlink{structng__mesg}{ng\_mesg}} *msg;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00195}00195         \textcolor{keyword}{struct }\mbox{\hyperlink{structng__mesg}{ng\_mesg}} *resp = NULL;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00196}00196         \textcolor{keywordtype}{int} error = 0;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00197}00197 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00198}00198         \mbox{\hyperlink{netgraph_8h_adc9a04fd174ef3c29ecae94016b84839}{NGI\_GET\_MSG}}(item, msg);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00199}00199 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00200}00200         \textcolor{keywordflow}{if}  (msg-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_ab59e14593b69a406ed5ca4209d489a10}{typecookie}} != \mbox{\hyperlink{ng__checksum_8h_a65cfbb64c85e3e67fef908ff46979a66}{NGM\_CHECKSUM\_COOKIE}})}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00201}00201                 \mbox{\hyperlink{ng__checksum_8c_a661c316872e6e1e6a714d7fad67f366f}{ERROUT}}(EINVAL);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00202}00202 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00203}00203         \textcolor{keywordflow}{switch} (msg-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_a8e76e57bf8666004146ceb1ba38ad3a5}{cmd}})}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00204}00204         \{}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00205}00205                 \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__checksum_8h_a4caf8d8f829279fba122163d961608a4a4f116b89c40df73d4fc25a153cedf2ec}{NGM\_CHECKSUM\_GETDLT}}:}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00206}00206                         \mbox{\hyperlink{ng__message_8h_a216c0b1bcd68ffab4668cdab2e4e0981}{NG\_MKRESPONSE}}(resp, msg, \textcolor{keyword}{sizeof}(uint8\_t), M\_WAITOK);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00207}00207 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00208}00208                         \textcolor{keywordflow}{if} (resp == NULL)}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00209}00209                                 \mbox{\hyperlink{ng__checksum_8c_a661c316872e6e1e6a714d7fad67f366f}{ERROUT}}(ENOMEM);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00210}00210 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00211}00211                         *((uint8\_t *) resp-\/>\mbox{\hyperlink{structng__mesg_afe7d2a81b120e0f3d15facd293174c6d}{data}}) = \mbox{\hyperlink{structpriv}{priv}}-\/>dlt;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00212}00212 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00213}00213                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00214}00214 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00215}00215                 \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__checksum_8h_a4caf8d8f829279fba122163d961608a4a5ebbc81dee7930d593e7da9f2c9ef3be}{NGM\_CHECKSUM\_SETDLT}}:}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00216}00216                         \textcolor{keywordflow}{if} (msg-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_a8f8d7499b617aa48f128bd10e40b5a13}{arglen}} != \textcolor{keyword}{sizeof}(uint8\_t))}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00217}00217                                 \mbox{\hyperlink{ng__checksum_8c_a661c316872e6e1e6a714d7fad67f366f}{ERROUT}}(EINVAL);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00218}00218 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00219}00219                         \textcolor{keywordflow}{switch} (*(uint8\_t *) msg-\/>\mbox{\hyperlink{structng__mesg_afe7d2a81b120e0f3d15facd293174c6d}{data}})}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00220}00220                         \{}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00221}00221                                 \textcolor{keywordflow}{case} DLT\_EN10MB:}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00222}00222                                 \textcolor{keywordflow}{case} DLT\_RAW:}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00223}00223                                         \mbox{\hyperlink{structpriv}{priv}}-\/>dlt = *(uint8\_t *) msg-\/>\mbox{\hyperlink{structng__mesg_afe7d2a81b120e0f3d15facd293174c6d}{data}};}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00224}00224                                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00225}00225 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00226}00226                                 \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00227}00227                                         \mbox{\hyperlink{ng__checksum_8c_a661c316872e6e1e6a714d7fad67f366f}{ERROUT}}(EINVAL);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00228}00228                         \}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00229}00229 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00230}00230                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00231}00231 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00232}00232                 \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__checksum_8h_a4caf8d8f829279fba122163d961608a4a0dd427f948be46f16b39e53802de3e5c}{NGM\_CHECKSUM\_GETCONFIG}}:}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00233}00233                         \textcolor{keywordflow}{if} (\mbox{\hyperlink{structpriv}{priv}}-\/>conf == NULL)}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00234}00234                                 \mbox{\hyperlink{ng__checksum_8c_a661c316872e6e1e6a714d7fad67f366f}{ERROUT}}(0);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00235}00235 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00236}00236                         \mbox{\hyperlink{ng__message_8h_a216c0b1bcd68ffab4668cdab2e4e0981}{NG\_MKRESPONSE}}(resp, msg, \textcolor{keyword}{sizeof}(\textcolor{keyword}{struct} \mbox{\hyperlink{structng__checksum__config}{ng\_checksum\_config}}), M\_WAITOK);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00237}00237 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00238}00238                         \textcolor{keywordflow}{if} (resp == NULL)}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00239}00239                                 \mbox{\hyperlink{ng__checksum_8c_a661c316872e6e1e6a714d7fad67f366f}{ERROUT}}(ENOMEM);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00240}00240 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00241}00241                         bcopy(\mbox{\hyperlink{structpriv}{priv}}-\/>conf, resp-\/>\mbox{\hyperlink{structng__mesg_afe7d2a81b120e0f3d15facd293174c6d}{data}}, \textcolor{keyword}{sizeof}(\textcolor{keyword}{struct} \mbox{\hyperlink{structng__checksum__config}{ng\_checksum\_config}}));}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00242}00242 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00243}00243                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00244}00244 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00245}00245                 \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__checksum_8h_a4caf8d8f829279fba122163d961608a4a1ea70e101aded5e4eaf21431431c2b1f}{NGM\_CHECKSUM\_SETCONFIG}}:}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00246}00246                         conf = (\textcolor{keyword}{struct }\mbox{\hyperlink{structng__checksum__config}{ng\_checksum\_config}} *) msg-\/>\mbox{\hyperlink{structng__mesg_afe7d2a81b120e0f3d15facd293174c6d}{data}};}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00247}00247 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00248}00248                         if (msg-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_a8f8d7499b617aa48f128bd10e40b5a13}{arglen}} != \textcolor{keyword}{sizeof}(\textcolor{keyword}{struct} \mbox{\hyperlink{structng__checksum__config}{ng\_checksum\_config}}))}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00249}00249                                 \mbox{\hyperlink{ng__checksum_8c_a661c316872e6e1e6a714d7fad67f366f}{ERROUT}}(EINVAL);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00250}00250 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00251}00251                         conf-\/>\mbox{\hyperlink{structng__checksum__config_a4032737b76749f7a39e96182c03355af}{csum\_flags}} \&= \mbox{\hyperlink{ng__checksum_8h_a5e1d02664bdf26d22ad9b462de0e9567}{NG\_CHECKSUM\_CSUM\_IPV4}}|\mbox{\hyperlink{ng__checksum_8h_a3cc1ed7691fcb587bbb29d26c6cf5a78}{NG\_CHECKSUM\_CSUM\_IPV6}};}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00252}00252                         conf-\/>\mbox{\hyperlink{structng__checksum__config_a1e381b3d6908d4acd2375306e298f84e}{csum\_offload}} \&= \mbox{\hyperlink{ng__checksum_8h_a5e1d02664bdf26d22ad9b462de0e9567}{NG\_CHECKSUM\_CSUM\_IPV4}}|\mbox{\hyperlink{ng__checksum_8h_a3cc1ed7691fcb587bbb29d26c6cf5a78}{NG\_CHECKSUM\_CSUM\_IPV6}};}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00253}00253 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00254}00254                         newconf = malloc(\textcolor{keyword}{sizeof}(\textcolor{keyword}{struct} \mbox{\hyperlink{structng__checksum__config}{ng\_checksum\_config}}), M\_NETGRAPH, M\_WAITOK|M\_ZERO);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00255}00255 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00256}00256                         bcopy(conf, newconf, \textcolor{keyword}{sizeof}(\textcolor{keyword}{struct} \mbox{\hyperlink{structng__checksum__config}{ng\_checksum\_config}}));}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00257}00257 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00258}00258                         \textcolor{keywordflow}{if} (\mbox{\hyperlink{structpriv}{priv}}-\/>conf)}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00259}00259                                 free(\mbox{\hyperlink{structpriv}{priv}}-\/>conf, M\_NETGRAPH);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00260}00260 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00261}00261                         \mbox{\hyperlink{structpriv}{priv}}-\/>conf = newconf;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00262}00262 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00263}00263                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00264}00264 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00265}00265                 \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__checksum_8h_a4caf8d8f829279fba122163d961608a4a42a65beb08f1ef38d87e2aa02e79609d}{NGM\_CHECKSUM\_GET\_STATS}}:}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00266}00266                 \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__checksum_8h_a4caf8d8f829279fba122163d961608a4a784dd5684456265688e17fba63009c07}{NGM\_CHECKSUM\_CLR\_STATS}}:}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00267}00267                 \textcolor{keywordflow}{case} \mbox{\hyperlink{ng__checksum_8h_a4caf8d8f829279fba122163d961608a4a77d9b2241852e1a02af8f712bcd01510}{NGM\_CHECKSUM\_GETCLR\_STATS}}:}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00268}00268                         \textcolor{keywordflow}{if} (msg-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_a8e76e57bf8666004146ceb1ba38ad3a5}{cmd}} != \mbox{\hyperlink{ng__checksum_8h_a4caf8d8f829279fba122163d961608a4a784dd5684456265688e17fba63009c07}{NGM\_CHECKSUM\_CLR\_STATS}}) \{}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00269}00269                                 \mbox{\hyperlink{ng__message_8h_a216c0b1bcd68ffab4668cdab2e4e0981}{NG\_MKRESPONSE}}(resp, msg, \textcolor{keyword}{sizeof}(\textcolor{keyword}{struct} \mbox{\hyperlink{structng__checksum__stats}{ng\_checksum\_stats}}), M\_WAITOK);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00270}00270 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00271}00271                                 \textcolor{keywordflow}{if} (resp == NULL)}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00272}00272                                         \mbox{\hyperlink{ng__checksum_8c_a661c316872e6e1e6a714d7fad67f366f}{ERROUT}}(ENOMEM);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00273}00273 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00274}00274                                 bcopy(\&(\mbox{\hyperlink{structpriv}{priv}}-\/>\mbox{\hyperlink{structpriv_a0e6807613dbfcab337d6220a3cbb5c3f}{stats}}), resp-\/>\mbox{\hyperlink{structng__mesg_afe7d2a81b120e0f3d15facd293174c6d}{data}}, \textcolor{keyword}{sizeof}(\textcolor{keyword}{struct} \mbox{\hyperlink{structng__checksum__stats}{ng\_checksum\_stats}}));}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00275}00275                         \}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00276}00276 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00277}00277                         \textcolor{keywordflow}{if} (msg-\/>\mbox{\hyperlink{structng__mesg_a16ea313a1e38531a10a14902b7579210}{header}}.\mbox{\hyperlink{structng__mesg_1_1ng__msghdr_a8e76e57bf8666004146ceb1ba38ad3a5}{cmd}} != \mbox{\hyperlink{ng__checksum_8h_a4caf8d8f829279fba122163d961608a4a42a65beb08f1ef38d87e2aa02e79609d}{NGM\_CHECKSUM\_GET\_STATS}})}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00278}00278                                 bzero(\&(\mbox{\hyperlink{structpriv}{priv}}-\/>\mbox{\hyperlink{structpriv_a0e6807613dbfcab337d6220a3cbb5c3f}{stats}}), \textcolor{keyword}{sizeof}(\textcolor{keyword}{struct} \mbox{\hyperlink{structng__checksum__stats}{ng\_checksum\_stats}}));}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00279}00279 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00280}00280                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00281}00281 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00282}00282                 \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00283}00283                         \mbox{\hyperlink{ng__checksum_8c_a661c316872e6e1e6a714d7fad67f366f}{ERROUT}}(EINVAL);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00284}00284         \}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00285}00285 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00286}00286 done:}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00287}00287         \mbox{\hyperlink{netgraph_8h_a69db50ed7f968e936580df029ab5c5dc}{NG\_RESPOND\_MSG}}(error, node, item, resp);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00288}00288         \mbox{\hyperlink{netgraph_8h_abd7a8c5f70b0f15aa17bfda43a9cf6b2}{NG\_FREE\_MSG}}(msg);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00289}00289 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00290}00290         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00291}00291 \}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00292}00292 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00293}\mbox{\hyperlink{ng__checksum_8c_a8b5f2474c5f0a6ca1328ed92c68d693e}{00293}} \textcolor{preprocessor}{\#define PULLUP\_CHECK(mbuf, length) do \{                                 \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00294}00294 \textcolor{preprocessor}{        pullup\_len += length;                                           \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00295}00295 \textcolor{preprocessor}{        if (((mbuf)-\/>m\_pkthdr.len < pullup\_len) ||                      \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00296}00296 \textcolor{preprocessor}{            (pullup\_len > MHLEN)) \{                                     \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00297}00297 \textcolor{preprocessor}{                return (EINVAL);                                        \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00298}00298 \textcolor{preprocessor}{        \}                                                               \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00299}00299 \textcolor{preprocessor}{        if ((mbuf)-\/>m\_len < pullup\_len \&\&                               \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00300}00300 \textcolor{preprocessor}{            (((mbuf) = m\_pullup((mbuf), pullup\_len)) == NULL)) \{        \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00301}00301 \textcolor{preprocessor}{                return (ENOBUFS);                                       \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00302}00302 \textcolor{preprocessor}{        \}                                                               \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00303}00303 \textcolor{preprocessor}{\} while (0)}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00304}00304 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00305}00305 \textcolor{preprocessor}{\#ifdef INET}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00306}00306 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00307}00307 checksum\_ipv4(\mbox{\hyperlink{structnetflow}{priv\_p}} \mbox{\hyperlink{structpriv}{priv}}, \textcolor{keyword}{struct} mbuf *m, \textcolor{keywordtype}{int} l3\_offset)}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00308}00308 \{}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00309}00309         \textcolor{keyword}{struct }ip *ip4;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00310}00310         \textcolor{keywordtype}{int} pullup\_len;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00311}00311         \textcolor{keywordtype}{int} hlen, plen;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00312}00312         \textcolor{keywordtype}{int} processed = 0;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00313}00313 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00314}00314         pullup\_len = l3\_offset;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00315}00315 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00316}00316         \mbox{\hyperlink{ng__checksum_8c_a8b5f2474c5f0a6ca1328ed92c68d693e}{PULLUP\_CHECK}}(m, \textcolor{keyword}{sizeof}(\textcolor{keyword}{struct} ip));}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00317}00317         ip4 = (\textcolor{keyword}{struct }ip *) mtodo(m, l3\_offset);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00318}00318 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00319}00319         \textcolor{keywordflow}{if} (ip4-\/>ip\_v != IPVERSION)}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00320}00320                 \textcolor{keywordflow}{return} (EOPNOTSUPP);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00321}00321 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00322}00322         hlen = ip4-\/>ip\_hl << 2;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00323}00323         plen = ntohs(ip4-\/>ip\_len);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00324}00324 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00325}00325         \textcolor{keywordflow}{if} (hlen < \textcolor{keyword}{sizeof}(\textcolor{keyword}{struct} ip) || m-\/>m\_pkthdr.len < l3\_offset + plen)}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00326}00326                 \textcolor{keywordflow}{return} (EINVAL);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00327}00327 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00328}00328         \textcolor{keywordflow}{if} (m-\/>m\_pkthdr.csum\_flags \& CSUM\_IP) \{}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00329}00329                 ip4-\/>ip\_sum = 0;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00330}00330 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00331}00331                 \textcolor{keywordflow}{if} ((\mbox{\hyperlink{structpriv}{priv}}-\/>conf-\/>csum\_offload \& CSUM\_IP) == 0) \{}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00332}00332                         \textcolor{keywordflow}{if} (hlen == \textcolor{keyword}{sizeof}(\textcolor{keyword}{struct} ip))}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00333}00333                                 ip4-\/>ip\_sum = in\_cksum\_hdr(ip4);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00334}00334                         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00335}00335                                 ip4-\/>ip\_sum = in\_cksum\_skip(m, l3\_offset + hlen, l3\_offset);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00336}00336 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00337}00337                         m-\/>m\_pkthdr.csum\_flags \&= \string~CSUM\_IP;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00338}00338                 \}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00339}00339 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00340}00340                 processed = 1;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00341}00341         \}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00342}00342 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00343}00343         pullup\_len = l3\_offset + hlen;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00344}00344 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00345}00345         \textcolor{comment}{/* We can not calculate a checksum fragmented packets */}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00346}00346         \textcolor{keywordflow}{if} (ip4-\/>ip\_off \& htons(IP\_MF|IP\_OFFMASK)) \{}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00347}00347                 m-\/>m\_pkthdr.csum\_flags \&= \string~(CSUM\_TCP|CSUM\_UDP);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00348}00348                 \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00349}00349         \}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00350}00350 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00351}00351         \textcolor{keywordflow}{switch} (ip4-\/>ip\_p)}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00352}00352         \{}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00353}00353                 \textcolor{keywordflow}{case} IPPROTO\_TCP:}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00354}00354                         \textcolor{keywordflow}{if} (m-\/>m\_pkthdr.csum\_flags \& CSUM\_TCP) \{}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00355}00355                                 \textcolor{keyword}{struct }tcphdr *th;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00356}00356 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00357}00357                                 \mbox{\hyperlink{ng__checksum_8c_a8b5f2474c5f0a6ca1328ed92c68d693e}{PULLUP\_CHECK}}(m, \textcolor{keyword}{sizeof}(\textcolor{keyword}{struct} tcphdr));}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00358}00358                                 th = (\textcolor{keyword}{struct }tcphdr *) mtodo(m, l3\_offset + hlen);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00359}00359 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00360}00360                                 th-\/>th\_sum = in\_pseudo(ip4-\/>ip\_src.s\_addr,}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00361}00361                                     ip4-\/>ip\_dst.s\_addr, htons(ip4-\/>ip\_p + plen -\/ hlen));}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00362}00362 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00363}00363                                 \textcolor{keywordflow}{if} ((\mbox{\hyperlink{structpriv}{priv}}-\/>conf-\/>csum\_offload \& CSUM\_TCP) == 0) \{}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00364}00364                                         th-\/>th\_sum = in\_cksum\_skip(m, l3\_offset + plen, l3\_offset + hlen);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00365}00365                                         m-\/>m\_pkthdr.csum\_flags \&= \string~CSUM\_TCP;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00366}00366                                 \}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00367}00367 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00368}00368                                 processed = 1;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00369}00369                         \}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00370}00370 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00371}00371                         m-\/>m\_pkthdr.csum\_flags \&= \string~CSUM\_UDP;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00372}00372                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00373}00373 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00374}00374                 \textcolor{keywordflow}{case} IPPROTO\_UDP:}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00375}00375                         \textcolor{keywordflow}{if} (m-\/>m\_pkthdr.csum\_flags \& CSUM\_UDP) \{}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00376}00376                                 \textcolor{keyword}{struct }udphdr *uh;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00377}00377 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00378}00378                                 \mbox{\hyperlink{ng__checksum_8c_a8b5f2474c5f0a6ca1328ed92c68d693e}{PULLUP\_CHECK}}(m, \textcolor{keyword}{sizeof}(\textcolor{keyword}{struct} udphdr));}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00379}00379                                 uh = (\textcolor{keyword}{struct }udphdr *) mtodo(m, l3\_offset + hlen);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00380}00380 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00381}00381                                 uh-\/>uh\_sum = in\_pseudo(ip4-\/>ip\_src.s\_addr,}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00382}00382                                     ip4-\/>ip\_dst.s\_addr, htons(ip4-\/>ip\_p + plen -\/ hlen));}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00383}00383 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00384}00384                                 \textcolor{keywordflow}{if} ((\mbox{\hyperlink{structpriv}{priv}}-\/>conf-\/>csum\_offload \& CSUM\_UDP) == 0) \{}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00385}00385                                         uh-\/>uh\_sum = in\_cksum\_skip(m,}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00386}00386                                             l3\_offset + plen, l3\_offset + hlen);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00387}00387 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00388}00388                                         \textcolor{keywordflow}{if} (uh-\/>uh\_sum == 0)}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00389}00389                                                 uh-\/>uh\_sum = 0xffff;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00390}00390 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00391}00391                                         m-\/>m\_pkthdr.csum\_flags \&= \string~CSUM\_UDP;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00392}00392                                 \}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00393}00393 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00394}00394                                 processed = 1;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00395}00395                         \}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00396}00396 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00397}00397                         m-\/>m\_pkthdr.csum\_flags \&= \string~CSUM\_TCP;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00398}00398                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00399}00399 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00400}00400                 \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00401}00401                         m-\/>m\_pkthdr.csum\_flags \&= \string~(CSUM\_TCP|CSUM\_UDP);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00402}00402                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00403}00403         \}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00404}00404 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00405}00405         m-\/>m\_pkthdr.csum\_flags \&= \string~NG\_CHECKSUM\_CSUM\_IPV6;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00406}00406 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00407}00407         \textcolor{keywordflow}{if} (processed)}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00408}00408                 \mbox{\hyperlink{structpriv}{priv}}-\/>\mbox{\hyperlink{structpriv_a0e6807613dbfcab337d6220a3cbb5c3f}{stats}}.processed++;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00409}00409 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00410}00410         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00411}00411 \}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00412}00412 \textcolor{preprocessor}{\#endif }\textcolor{comment}{/* INET */}\textcolor{preprocessor}{}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00413}00413 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00414}00414 \textcolor{preprocessor}{\#ifdef INET6}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00415}00415 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00416}00416 checksum\_ipv6(\mbox{\hyperlink{structnetflow}{priv\_p}} \mbox{\hyperlink{structpriv}{priv}}, \textcolor{keyword}{struct} mbuf *m, \textcolor{keywordtype}{int} l3\_offset)}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00417}00417 \{}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00418}00418         \textcolor{keyword}{struct }ip6\_hdr *ip6;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00419}00419         \textcolor{keyword}{struct }ip6\_ext *ip6e = NULL;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00420}00420         \textcolor{keywordtype}{int} pullup\_len;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00421}00421         \textcolor{keywordtype}{int} hlen, plen;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00422}00422         \textcolor{keywordtype}{int} nxt;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00423}00423         \textcolor{keywordtype}{int} processed = 0;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00424}00424 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00425}00425         pullup\_len = l3\_offset;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00426}00426 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00427}00427         \mbox{\hyperlink{ng__checksum_8c_a8b5f2474c5f0a6ca1328ed92c68d693e}{PULLUP\_CHECK}}(m, \textcolor{keyword}{sizeof}(\textcolor{keyword}{struct} ip6\_hdr));}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00428}00428         ip6 = (\textcolor{keyword}{struct }ip6\_hdr *) mtodo(m, l3\_offset);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00429}00429 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00430}00430         \textcolor{keywordflow}{if} ((ip6-\/>ip6\_vfc \& IPV6\_VERSION\_MASK) != IPV6\_VERSION)}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00431}00431                 \textcolor{keywordflow}{return} (EOPNOTSUPP);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00432}00432 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00433}00433         hlen = \textcolor{keyword}{sizeof}(\textcolor{keyword}{struct }ip6\_hdr);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00434}00434         plen = ntohs(ip6-\/>ip6\_plen) + hlen;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00435}00435 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00436}00436         \textcolor{keywordflow}{if} (m-\/>m\_pkthdr.len < l3\_offset + plen)}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00437}00437                 \textcolor{keywordflow}{return} (EINVAL);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00438}00438 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00439}00439         nxt = ip6-\/>ip6\_nxt;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00440}00440 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00441}00441         \textcolor{keywordflow}{for} (;;) \{}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00442}00442                 \textcolor{keywordflow}{switch} (nxt)}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00443}00443                 \{}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00444}00444                         \textcolor{keywordflow}{case} IPPROTO\_DSTOPTS:}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00445}00445                         \textcolor{keywordflow}{case} IPPROTO\_HOPOPTS:}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00446}00446                         \textcolor{keywordflow}{case} IPPROTO\_ROUTING:}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00447}00447                                 \mbox{\hyperlink{ng__checksum_8c_a8b5f2474c5f0a6ca1328ed92c68d693e}{PULLUP\_CHECK}}(m, \textcolor{keyword}{sizeof}(\textcolor{keyword}{struct} ip6\_ext));}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00448}00448                                 ip6e = (\textcolor{keyword}{struct }ip6\_ext *) mtodo(m, l3\_offset + hlen);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00449}00449                                 nxt = ip6e-\/>ip6e\_nxt;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00450}00450                                 hlen += (ip6e-\/>ip6e\_len + 1) << 3;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00451}00451                                 pullup\_len = l3\_offset + hlen;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00452}00452                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00453}00453 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00454}00454                         \textcolor{keywordflow}{case} IPPROTO\_AH:}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00455}00455                                 \mbox{\hyperlink{ng__checksum_8c_a8b5f2474c5f0a6ca1328ed92c68d693e}{PULLUP\_CHECK}}(m, \textcolor{keyword}{sizeof}(\textcolor{keyword}{struct} ip6\_ext));}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00456}00456                                 ip6e = (\textcolor{keyword}{struct }ip6\_ext *) mtodo(m, l3\_offset + hlen);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00457}00457                                 nxt = ip6e-\/>ip6e\_nxt;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00458}00458                                 hlen += (ip6e-\/>ip6e\_len + 2) << 2;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00459}00459                                 pullup\_len = l3\_offset + hlen;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00460}00460                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00461}00461 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00462}00462                         \textcolor{keywordflow}{case} IPPROTO\_FRAGMENT:}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00463}00463                                 \textcolor{comment}{/* We can not calculate a checksum fragmented packets */}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00464}00464                                 m-\/>m\_pkthdr.csum\_flags \&= \string~(CSUM\_TCP\_IPV6|CSUM\_UDP\_IPV6);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00465}00465                                 \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00466}00466 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00467}00467                         \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00468}00468                                 \textcolor{keywordflow}{goto} loopend;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00469}00469                 \}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00470}00470 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00471}00471                 \textcolor{keywordflow}{if} (nxt == 0)}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00472}00472                         \textcolor{keywordflow}{return} (EINVAL);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00473}00473         \}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00474}00474 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00475}00475 loopend:}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00476}00476 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00477}00477         \textcolor{keywordflow}{switch} (nxt)}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00478}00478         \{}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00479}00479                 \textcolor{keywordflow}{case} IPPROTO\_TCP:}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00480}00480                         \textcolor{keywordflow}{if} (m-\/>m\_pkthdr.csum\_flags \& CSUM\_TCP\_IPV6) \{}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00481}00481                                 \textcolor{keyword}{struct }tcphdr *th;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00482}00482 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00483}00483                                 \mbox{\hyperlink{ng__checksum_8c_a8b5f2474c5f0a6ca1328ed92c68d693e}{PULLUP\_CHECK}}(m, \textcolor{keyword}{sizeof}(\textcolor{keyword}{struct} tcphdr));}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00484}00484                                 th = (\textcolor{keyword}{struct }tcphdr *) mtodo(m, l3\_offset + hlen);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00485}00485 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00486}00486                                 th-\/>th\_sum = in6\_cksum\_pseudo(ip6, plen -\/ hlen, nxt, 0);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00487}00487 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00488}00488                                 \textcolor{keywordflow}{if} ((\mbox{\hyperlink{structpriv}{priv}}-\/>conf-\/>csum\_offload \& CSUM\_TCP\_IPV6) == 0) \{}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00489}00489                                         th-\/>th\_sum = in\_cksum\_skip(m, l3\_offset + plen, l3\_offset + hlen);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00490}00490                                         m-\/>m\_pkthdr.csum\_flags \&= \string~CSUM\_TCP\_IPV6;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00491}00491                                 \}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00492}00492 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00493}00493                                 processed = 1;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00494}00494                         \}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00495}00495 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00496}00496                         m-\/>m\_pkthdr.csum\_flags \&= \string~CSUM\_UDP\_IPV6;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00497}00497                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00498}00498 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00499}00499                 \textcolor{keywordflow}{case} IPPROTO\_UDP:}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00500}00500                         \textcolor{keywordflow}{if} (m-\/>m\_pkthdr.csum\_flags \& CSUM\_UDP\_IPV6) \{}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00501}00501                                 \textcolor{keyword}{struct }udphdr *uh;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00502}00502 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00503}00503                                 \mbox{\hyperlink{ng__checksum_8c_a8b5f2474c5f0a6ca1328ed92c68d693e}{PULLUP\_CHECK}}(m, \textcolor{keyword}{sizeof}(\textcolor{keyword}{struct} udphdr));}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00504}00504                                 uh = (\textcolor{keyword}{struct }udphdr *) mtodo(m, l3\_offset + hlen);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00505}00505 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00506}00506                                 uh-\/>uh\_sum = in6\_cksum\_pseudo(ip6, plen -\/ hlen, nxt, 0);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00507}00507 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00508}00508                                 \textcolor{keywordflow}{if} ((\mbox{\hyperlink{structpriv}{priv}}-\/>conf-\/>csum\_offload \& CSUM\_UDP\_IPV6) == 0) \{}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00509}00509                                         uh-\/>uh\_sum = in\_cksum\_skip(m,}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00510}00510                                             l3\_offset + plen, l3\_offset + hlen);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00511}00511 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00512}00512                                         \textcolor{keywordflow}{if} (uh-\/>uh\_sum == 0)}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00513}00513                                                 uh-\/>uh\_sum = 0xffff;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00514}00514 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00515}00515                                         m-\/>m\_pkthdr.csum\_flags \&= \string~CSUM\_UDP\_IPV6;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00516}00516                                 \}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00517}00517 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00518}00518                                 processed = 1;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00519}00519                         \}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00520}00520 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00521}00521                         m-\/>m\_pkthdr.csum\_flags \&= \string~CSUM\_TCP\_IPV6;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00522}00522                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00523}00523 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00524}00524                 \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00525}00525                         m-\/>m\_pkthdr.csum\_flags \&= \string~(CSUM\_TCP\_IPV6|CSUM\_UDP\_IPV6);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00526}00526                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00527}00527         \}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00528}00528 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00529}00529         m-\/>m\_pkthdr.csum\_flags \&= \string~NG\_CHECKSUM\_CSUM\_IPV4;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00530}00530 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00531}00531         \textcolor{keywordflow}{if} (processed)}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00532}00532                 \mbox{\hyperlink{structpriv}{priv}}-\/>\mbox{\hyperlink{structpriv_a0e6807613dbfcab337d6220a3cbb5c3f}{stats}}.processed++;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00533}00533 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00534}00534         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00535}00535 \}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00536}00536 \textcolor{preprocessor}{\#endif }\textcolor{comment}{/* INET6 */}\textcolor{preprocessor}{}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00537}00537 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00538}00538 \textcolor{preprocessor}{\#undef  PULLUP\_CHECK}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00539}00539 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00540}00540 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00541}\mbox{\hyperlink{ng__checksum_8c_a0e263ec7fe2cc4b238dbb664d7b5eae6}{00541}} \mbox{\hyperlink{ng__checksum_8c_ac4761c8acab93f166e2def5681598581}{ng\_checksum\_rcvdata}}(\mbox{\hyperlink{structng__hook}{hook\_p}} hook, \mbox{\hyperlink{structng__item}{item\_p}} item)}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00542}00542 \{}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00543}00543         \textcolor{keyword}{const} \mbox{\hyperlink{structnetflow}{priv\_p}} \mbox{\hyperlink{structpriv}{priv}} = \mbox{\hyperlink{netgraph_8h_ae76b377c72ed8b60e8cbe1a204f70598}{NG\_NODE\_PRIVATE}}(\mbox{\hyperlink{netgraph_8h_a1d027698ed92e240870e67cd8362f1d4}{NG\_HOOK\_NODE}}(hook));}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00544}00544         \textcolor{keyword}{struct }mbuf *m;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00545}00545         \mbox{\hyperlink{structng__hook}{hook\_p}} out;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00546}00546         \textcolor{keywordtype}{int} error = 0;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00547}00547 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00548}00548         \mbox{\hyperlink{structpriv}{priv}}-\/>\mbox{\hyperlink{structpriv_a0e6807613dbfcab337d6220a3cbb5c3f}{stats}}.received++;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00549}00549 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00550}00550         \mbox{\hyperlink{netgraph_8h_abbb0acb5f480576cff9901caddeef57f}{NGI\_GET\_M}}(item, m);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00551}00551 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00552}00552 \textcolor{preprocessor}{\#define PULLUP\_CHECK(mbuf, length) do \{                                 \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00553}00553 \textcolor{preprocessor}{        pullup\_len += length;                                           \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00554}00554 \textcolor{preprocessor}{        if (((mbuf)-\/>m\_pkthdr.len < pullup\_len) ||                      \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00555}00555 \textcolor{preprocessor}{            (pullup\_len > MHLEN)) \{                                     \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00556}00556 \textcolor{preprocessor}{                error = EINVAL;                                         \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00557}00557 \textcolor{preprocessor}{                goto bypass;                                            \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00558}00558 \textcolor{preprocessor}{        \}                                                               \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00559}00559 \textcolor{preprocessor}{        if ((mbuf)-\/>m\_len < pullup\_len \&\&                               \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00560}00560 \textcolor{preprocessor}{            (((mbuf) = m\_pullup((mbuf), pullup\_len)) == NULL)) \{        \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00561}00561 \textcolor{preprocessor}{                error = ENOBUFS;                                        \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00562}00562 \textcolor{preprocessor}{                goto drop;                                              \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00563}00563 \textcolor{preprocessor}{        \}                                                               \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00564}00564 \textcolor{preprocessor}{\} while (0)}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00565}00565 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00566}00566         \textcolor{keywordflow}{if} (!(\mbox{\hyperlink{structpriv}{priv}}-\/>conf \&\& hook == \mbox{\hyperlink{structpriv}{priv}}-\/>in \&\& m \&\& (m-\/>m\_flags \& M\_PKTHDR)))}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00567}00567                 \textcolor{keywordflow}{goto} bypass;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00568}00568 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00569}00569         m-\/>m\_pkthdr.csum\_flags |= \mbox{\hyperlink{structpriv}{priv}}-\/>conf-\/>csum\_flags;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00570}00570 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00571}00571         \textcolor{keywordflow}{if} (m-\/>m\_pkthdr.csum\_flags \& (\mbox{\hyperlink{ng__checksum_8h_a5e1d02664bdf26d22ad9b462de0e9567}{NG\_CHECKSUM\_CSUM\_IPV4}}|\mbox{\hyperlink{ng__checksum_8h_a3cc1ed7691fcb587bbb29d26c6cf5a78}{NG\_CHECKSUM\_CSUM\_IPV6}}))}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00572}00572         \{}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00573}00573                 \textcolor{keyword}{struct }ether\_header *eh;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00574}00574                 \textcolor{keyword}{struct }\mbox{\hyperlink{structng__checksum__vlan__header}{ng\_checksum\_vlan\_header}} *vh;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00575}00575                 \textcolor{keywordtype}{int} pullup\_len = 0;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00576}00576                 uint16\_t \mbox{\hyperlink{structng__checksum__vlan__header_ac408818506a4b6cddcddf5a239bc6cb8}{etype}};}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00577}00577 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00578}00578                 m = m\_unshare(m, M\_NOWAIT);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00579}00579 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00580}00580                 \textcolor{keywordflow}{if} (m == NULL)}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00581}00581                         \mbox{\hyperlink{ng__checksum_8c_a661c316872e6e1e6a714d7fad67f366f}{ERROUT}}(ENOMEM);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00582}00582 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00583}00583                 \textcolor{keywordflow}{switch} (\mbox{\hyperlink{structpriv}{priv}}-\/>dlt)}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00584}00584                 \{}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00585}00585                         \textcolor{keywordflow}{case} DLT\_EN10MB:}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00586}00586                                 \mbox{\hyperlink{ng__checksum_8c_a8b5f2474c5f0a6ca1328ed92c68d693e}{PULLUP\_CHECK}}(m, \textcolor{keyword}{sizeof}(\textcolor{keyword}{struct} ether\_header));}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00587}00587                                 eh = mtod(m, \textcolor{keyword}{struct} ether\_header *);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00588}00588                                 \mbox{\hyperlink{structng__checksum__vlan__header_ac408818506a4b6cddcddf5a239bc6cb8}{etype}} = ntohs(eh-\/>ether\_type);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00589}00589 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00590}00590                                 \textcolor{keywordflow}{for} (;;) \{      \textcolor{comment}{/* QinQ support */}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00591}00591                                         \textcolor{keywordflow}{switch} (\mbox{\hyperlink{structng__checksum__vlan__header_ac408818506a4b6cddcddf5a239bc6cb8}{etype}})}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00592}00592                                         \{}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00593}00593                                                 \textcolor{keywordflow}{case} 0x8100:}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00594}00594                                                 \textcolor{keywordflow}{case} 0x88A8:}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00595}00595                                                 \textcolor{keywordflow}{case} 0x9100:}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00596}00596                                                         \mbox{\hyperlink{ng__checksum_8c_a8b5f2474c5f0a6ca1328ed92c68d693e}{PULLUP\_CHECK}}(m, \textcolor{keyword}{sizeof}(\textcolor{keyword}{struct} \mbox{\hyperlink{structng__checksum__vlan__header}{ng\_checksum\_vlan\_header}}));}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00597}00597                                                         vh = (\textcolor{keyword}{struct }\mbox{\hyperlink{structng__checksum__vlan__header}{ng\_checksum\_vlan\_header}} *) mtodo(m,}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00598}00598                                                             pullup\_len -\/ \textcolor{keyword}{sizeof}(\textcolor{keyword}{struct} \mbox{\hyperlink{structng__checksum__vlan__header}{ng\_checksum\_vlan\_header}}));}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00599}00599                                                         \mbox{\hyperlink{structng__checksum__vlan__header_ac408818506a4b6cddcddf5a239bc6cb8}{etype}} = ntohs(vh-\/>\mbox{\hyperlink{structng__checksum__vlan__header_ac408818506a4b6cddcddf5a239bc6cb8}{etype}});}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00600}00600                                                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00601}00601 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00602}00602                                                 \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00603}00603                                                         \textcolor{keywordflow}{goto} loopend;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00604}00604                                         \}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00605}00605                                 \}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00606}00606 loopend:}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00607}00607 \textcolor{preprocessor}{\#ifdef INET}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00608}00608                                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{structng__checksum__vlan__header_ac408818506a4b6cddcddf5a239bc6cb8}{etype}} == ETHERTYPE\_IP \&\&}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00609}00609                                     (m-\/>m\_pkthdr.csum\_flags \& \mbox{\hyperlink{ng__checksum_8h_a5e1d02664bdf26d22ad9b462de0e9567}{NG\_CHECKSUM\_CSUM\_IPV4}})) \{}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00610}00610                                         error = checksum\_ipv4(\mbox{\hyperlink{structpriv}{priv}}, m, pullup\_len);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00611}00611                                         \textcolor{keywordflow}{if} (error == ENOBUFS)}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00612}00612                                                 \textcolor{keywordflow}{goto} drop;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00613}00613                                 \} \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00614}00614 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00615}00615 \textcolor{preprocessor}{\#ifdef INET6}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00616}00616                                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{structng__checksum__vlan__header_ac408818506a4b6cddcddf5a239bc6cb8}{etype}} == ETHERTYPE\_IPV6 \&\&}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00617}00617                                     (m-\/>m\_pkthdr.csum\_flags \& \mbox{\hyperlink{ng__checksum_8h_a3cc1ed7691fcb587bbb29d26c6cf5a78}{NG\_CHECKSUM\_CSUM\_IPV6}})) \{}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00618}00618                                         error = checksum\_ipv6(\mbox{\hyperlink{structpriv}{priv}}, m, pullup\_len);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00619}00619                                         \textcolor{keywordflow}{if} (error == ENOBUFS)}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00620}00620                                                 \textcolor{keywordflow}{goto} drop;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00621}00621                                 \} \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00622}00622 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00623}00623                                 \{}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00624}00624                                         m-\/>m\_pkthdr.csum\_flags \&=}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00625}00625                                             \string~(\mbox{\hyperlink{ng__checksum_8h_a5e1d02664bdf26d22ad9b462de0e9567}{NG\_CHECKSUM\_CSUM\_IPV4}}|\mbox{\hyperlink{ng__checksum_8h_a3cc1ed7691fcb587bbb29d26c6cf5a78}{NG\_CHECKSUM\_CSUM\_IPV6}});}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00626}00626                                 \}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00627}00627 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00628}00628                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00629}00629 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00630}00630                         \textcolor{keywordflow}{case} DLT\_RAW:}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00631}00631 \textcolor{preprocessor}{\#ifdef INET}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00632}00632                                 \textcolor{keywordflow}{if} (m-\/>m\_pkthdr.csum\_flags \& \mbox{\hyperlink{ng__checksum_8h_a5e1d02664bdf26d22ad9b462de0e9567}{NG\_CHECKSUM\_CSUM\_IPV4}})}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00633}00633                                 \{}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00634}00634                                         error = checksum\_ipv4(\mbox{\hyperlink{structpriv}{priv}}, m, pullup\_len);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00635}00635 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00636}00636                                         \textcolor{keywordflow}{if} (error == 0)}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00637}00637                                                 \textcolor{keywordflow}{goto} bypass;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00638}00638                                         \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (error == ENOBUFS)}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00639}00639                                                 \textcolor{keywordflow}{goto} drop;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00640}00640                                 \}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00641}00641 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00642}00642 \textcolor{preprocessor}{\#ifdef INET6}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00643}00643                                 \textcolor{keywordflow}{if} (m-\/>m\_pkthdr.csum\_flags \& \mbox{\hyperlink{ng__checksum_8h_a3cc1ed7691fcb587bbb29d26c6cf5a78}{NG\_CHECKSUM\_CSUM\_IPV6}})}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00644}00644                                 \{}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00645}00645                                         error = checksum\_ipv6(\mbox{\hyperlink{structpriv}{priv}}, m, pullup\_len);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00646}00646 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00647}00647                                         \textcolor{keywordflow}{if} (error == 0)}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00648}00648                                                 \textcolor{keywordflow}{goto} bypass;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00649}00649                                         \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (error == ENOBUFS)}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00650}00650                                                 \textcolor{keywordflow}{goto} drop;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00651}00651                                 \}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00652}00652 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00653}00653                                 \textcolor{keywordflow}{if} (error)}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00654}00654                                         m-\/>m\_pkthdr.csum\_flags \&=}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00655}00655                                             \string~(\mbox{\hyperlink{ng__checksum_8h_a5e1d02664bdf26d22ad9b462de0e9567}{NG\_CHECKSUM\_CSUM\_IPV4}}|\mbox{\hyperlink{ng__checksum_8h_a3cc1ed7691fcb587bbb29d26c6cf5a78}{NG\_CHECKSUM\_CSUM\_IPV6}});}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00656}00656 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00657}00657                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00658}00658 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00659}00659                         \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00660}00660                                 \mbox{\hyperlink{ng__checksum_8c_a661c316872e6e1e6a714d7fad67f366f}{ERROUT}}(EINVAL);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00661}00661                 \}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00662}00662         \}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00663}00663 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00664}00664 \textcolor{preprocessor}{\#undef  PULLUP\_CHECK}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00665}00665 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00666}00666 bypass:}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00667}00667         out = NULL;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00668}00668 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00669}00669         \textcolor{keywordflow}{if} (hook == \mbox{\hyperlink{structpriv}{priv}}-\/>in) \{}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00670}00670                 \textcolor{comment}{/* return frames on 'in' hook if 'out' not connected */}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00671}00671                 out = \mbox{\hyperlink{structpriv}{priv}}-\/>out ? \mbox{\hyperlink{structpriv}{priv}}-\/>out : \mbox{\hyperlink{structpriv}{priv}}-\/>in;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00672}00672         \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (hook == \mbox{\hyperlink{structpriv}{priv}}-\/>out \&\& \mbox{\hyperlink{structpriv}{priv}}-\/>in) \{}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00673}00673                 \textcolor{comment}{/* pass frames on 'out' hook if 'in' connected */}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00674}00674                 out = \mbox{\hyperlink{structpriv}{priv}}-\/>in;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00675}00675         \}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00676}00676 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00677}00677         \textcolor{keywordflow}{if} (out == NULL)}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00678}00678                 \mbox{\hyperlink{ng__checksum_8c_a661c316872e6e1e6a714d7fad67f366f}{ERROUT}}(0);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00679}00679 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00680}00680         \mbox{\hyperlink{netgraph_8h_a8c4d1be1c10df792d8e15b4458c9b400}{NG\_FWD\_NEW\_DATA}}(error, item, out, m);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00681}00681 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00682}00682         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00683}00683 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00684}00684 done:}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00685}00685         \mbox{\hyperlink{netgraph_8h_a2461bfcdc9e024484ed8037d386620e3}{NG\_FREE\_M}}(m);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00686}00686 drop:}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00687}00687         \mbox{\hyperlink{netgraph_8h_ab1451f92a5ed6715897d40bf802b06d5}{NG\_FREE\_ITEM}}(item);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00688}00688 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00689}00689         \mbox{\hyperlink{structpriv}{priv}}-\/>\mbox{\hyperlink{structpriv_a0e6807613dbfcab337d6220a3cbb5c3f}{stats}}.dropped++;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00690}00690 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00691}00691         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00692}00692 \}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00693}00693 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00694}00694 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00695}\mbox{\hyperlink{ng__checksum_8c_a46bff6b03d57cebbe0b44f3cd25dc555}{00695}} \mbox{\hyperlink{ng__checksum_8c_a2ef690dc8b68b996ede1c2793fbd4f99}{ng\_checksum\_shutdown}}(\mbox{\hyperlink{structng__node}{node\_p}} node)}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00696}00696 \{}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00697}00697         \textcolor{keyword}{const} \mbox{\hyperlink{structnetflow}{priv\_p}} \mbox{\hyperlink{structpriv}{priv}} = \mbox{\hyperlink{netgraph_8h_ae76b377c72ed8b60e8cbe1a204f70598}{NG\_NODE\_PRIVATE}}(node);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00698}00698 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00699}00699         \mbox{\hyperlink{netgraph_8h_a674a9dcfdef6a73d16cccde37234f470}{NG\_NODE\_SET\_PRIVATE}}(node, NULL);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00700}00700         \mbox{\hyperlink{netgraph_8h_a7e3862fa34646a9c66c9b02ac5383d1a}{NG\_NODE\_UNREF}}(node);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00701}00701 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00702}00702         \textcolor{keywordflow}{if} (\mbox{\hyperlink{structpriv}{priv}}-\/>conf)}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00703}00703                 free(\mbox{\hyperlink{structpriv}{priv}}-\/>conf, M\_NETGRAPH);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00704}00704 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00705}00705         free(\mbox{\hyperlink{structpriv}{priv}}, M\_NETGRAPH);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00706}00706 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00707}00707         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00708}00708 \}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00709}00709 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00710}00710 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00711}\mbox{\hyperlink{ng__checksum_8c_a2268eaeaff0faf398c0ccfc0f6f12d0b}{00711}} \mbox{\hyperlink{ng__checksum_8c_a6659ecfb5af2697f7a69a30a20255a34}{ng\_checksum\_disconnect}}(\mbox{\hyperlink{structng__hook}{hook\_p}} hook)}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00712}00712 \{}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00713}00713         \mbox{\hyperlink{structnetflow}{priv\_p}} \mbox{\hyperlink{structpriv}{priv}};}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00714}00714 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00715}00715         \mbox{\hyperlink{structpriv}{priv}} = \mbox{\hyperlink{netgraph_8h_ae76b377c72ed8b60e8cbe1a204f70598}{NG\_NODE\_PRIVATE}}(\mbox{\hyperlink{netgraph_8h_a1d027698ed92e240870e67cd8362f1d4}{NG\_HOOK\_NODE}}(hook));}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00716}00716 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00717}00717         \textcolor{keywordflow}{if} (hook == \mbox{\hyperlink{structpriv}{priv}}-\/>in)}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00718}00718                 \mbox{\hyperlink{structpriv}{priv}}-\/>in = NULL;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00719}00719 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00720}00720         \textcolor{keywordflow}{if} (hook == \mbox{\hyperlink{structpriv}{priv}}-\/>out)}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00721}00721                 \mbox{\hyperlink{structpriv}{priv}}-\/>out = NULL;}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00722}00722 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00723}00723         \textcolor{keywordflow}{if} (\mbox{\hyperlink{netgraph_8h_ad47e204c5b3adaddfa4bf0c380234f48}{NG\_NODE\_NUMHOOKS}}(\mbox{\hyperlink{netgraph_8h_a1d027698ed92e240870e67cd8362f1d4}{NG\_HOOK\_NODE}}(hook)) == 0 \&\&}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00724}00724             \mbox{\hyperlink{netgraph_8h_a6bdd56e0f33084eeaadbe696febcbbd8}{NG\_NODE\_IS\_VALID}}(\mbox{\hyperlink{netgraph_8h_a1d027698ed92e240870e67cd8362f1d4}{NG\_HOOK\_NODE}}(hook))) \textcolor{comment}{/* already shutting down? */}}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00725}00725                 \mbox{\hyperlink{netgraph_8h_a85914ce0da2b314478aaf7efcdcd3ff0}{ng\_rmnode\_self}}(\mbox{\hyperlink{netgraph_8h_a1d027698ed92e240870e67cd8362f1d4}{NG\_HOOK\_NODE}}(hook));}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00726}00726 }
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00727}00727         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{ng__checksum_8c_source_l00728}00728 \}}

\end{DoxyCode}
