<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="1.8.16">
  <compounddef id="ip6__frag_8c" kind="file" language="C++">
    <compoundname>ip6_frag.c</compoundname>
    <includes refid="opt_8h" local="yes">net/opt.h</includes>
    <includes refid="ip6__frag_8h" local="yes">net/ip6_frag.h</includes>
    <includes refid="ip6_8h" local="yes">net/ip6.h</includes>
    <includes refid="icmp6_8h" local="yes">net/icmp6.h</includes>
    <includes refid="nd6_8h" local="yes">net/nd6.h</includes>
    <includes refid="ip_8h" local="yes">net/ip.h</includes>
    <includes refid="pbuf_8h" local="yes">net/pbuf.h</includes>
    <includes refid="memp_8h" local="yes">net/memp.h</includes>
    <includes refid="stats_8h" local="yes">net/stats.h</includes>
    <includes refid="string_8h" local="no">string.h</includes>
    <incdepgraph>
      <node id="1">
        <label>C:/Dev/git/UbixOS/sys/net/core/ipv6/ip6_frag.c</label>
        <link refid="ip6__frag_8c"/>
        <childnode refid="2" relation="include">
        </childnode>
        <childnode refid="19" relation="include">
        </childnode>
        <childnode refid="24" relation="include">
        </childnode>
        <childnode refid="33" relation="include">
        </childnode>
        <childnode refid="35" relation="include">
        </childnode>
        <childnode refid="36" relation="include">
        </childnode>
        <childnode refid="20" relation="include">
        </childnode>
        <childnode refid="30" relation="include">
        </childnode>
        <childnode refid="28" relation="include">
        </childnode>
        <childnode refid="39" relation="include">
        </childnode>
      </node>
      <node id="17">
        <label>stdarg.h</label>
        <link refid="stdarg_8h"/>
      </node>
      <node id="18">
        <label>ubixos/kpanic.h</label>
        <link refid="kpanic_8h"/>
      </node>
      <node id="35">
        <label>net/nd6.h</label>
        <link refid="nd6_8h"/>
        <childnode refid="2" relation="include">
        </childnode>
      </node>
      <node id="15">
        <label>sys/io.h</label>
        <link refid="io_8h"/>
      </node>
      <node id="34">
        <label>net/prot/icmp6.h</label>
        <link refid="prot_2icmp6_8h"/>
        <childnode refid="5" relation="include">
        </childnode>
      </node>
      <node id="20">
        <label>net/pbuf.h</label>
        <link refid="pbuf_8h"/>
        <childnode refid="2" relation="include">
        </childnode>
        <childnode refid="21" relation="include">
        </childnode>
      </node>
      <node id="40">
        <label>strings.h</label>
        <link refid="strings_8h"/>
        <childnode refid="6" relation="include">
        </childnode>
      </node>
      <node id="37">
        <label>net/ip4.h</label>
        <link refid="ip4_8h"/>
        <childnode refid="2" relation="include">
        </childnode>
      </node>
      <node id="32">
        <label>net/priv/memp_priv.h</label>
        <link refid="memp__priv_8h"/>
        <childnode refid="2" relation="include">
        </childnode>
        <childnode refid="29" relation="include">
        </childnode>
      </node>
      <node id="8">
        <label>sys/select.h</label>
        <link refid="select_8h"/>
        <childnode refid="9" relation="include">
        </childnode>
        <childnode refid="7" relation="include">
        </childnode>
        <childnode refid="10" relation="include">
        </childnode>
        <childnode refid="11" relation="include">
        </childnode>
        <childnode refid="12" relation="include">
        </childnode>
      </node>
      <node id="33">
        <label>net/icmp6.h</label>
        <link refid="icmp6_8h"/>
        <childnode refid="2" relation="include">
        </childnode>
        <childnode refid="20" relation="include">
        </childnode>
        <childnode refid="22" relation="include">
        </childnode>
        <childnode refid="25" relation="include">
        </childnode>
        <childnode refid="34" relation="include">
        </childnode>
      </node>
      <node id="13">
        <label>net/arch/cc.h</label>
        <link refid="cc_8h"/>
        <childnode refid="14" relation="include">
        </childnode>
      </node>
      <node id="12">
        <label>sys/_sigset.h</label>
        <link refid="__sigset_8h"/>
        <childnode refid="7" relation="include">
        </childnode>
      </node>
      <node id="29">
        <label>net/mem.h</label>
        <link refid="mem_8h"/>
        <childnode refid="2" relation="include">
        </childnode>
      </node>
      <node id="28">
        <label>net/stats.h</label>
        <link refid="stats_8h"/>
        <childnode refid="2" relation="include">
        </childnode>
        <childnode refid="29" relation="include">
        </childnode>
        <childnode refid="30" relation="include">
        </childnode>
      </node>
      <node id="3">
        <label>net/lwipopts.h</label>
        <link refid="lwipopts_8h"/>
      </node>
      <node id="39">
        <label>string.h</label>
        <link refid="string_8h"/>
        <childnode refid="6" relation="include">
        </childnode>
        <childnode refid="40" relation="include">
        </childnode>
      </node>
      <node id="6">
        <label>sys/types.h</label>
        <link refid="include_2sys_2types_8h"/>
        <childnode refid="7" relation="include">
        </childnode>
        <childnode refid="8" relation="include">
        </childnode>
      </node>
      <node id="23">
        <label>net/def.h</label>
        <link refid="def_8h"/>
        <childnode refid="5" relation="include">
        </childnode>
        <childnode refid="2" relation="include">
        </childnode>
      </node>
      <node id="25">
        <label>net/netif.h</label>
        <link refid="netif_8h"/>
        <childnode refid="2" relation="include">
        </childnode>
        <childnode refid="21" relation="include">
        </childnode>
        <childnode refid="26" relation="include">
        </childnode>
        <childnode refid="23" relation="include">
        </childnode>
        <childnode refid="20" relation="include">
        </childnode>
        <childnode refid="28" relation="include">
        </childnode>
      </node>
      <node id="19">
        <label>net/ip6_frag.h</label>
        <link refid="ip6__frag_8h"/>
        <childnode refid="2" relation="include">
        </childnode>
        <childnode refid="20" relation="include">
        </childnode>
        <childnode refid="22" relation="include">
        </childnode>
        <childnode refid="24" relation="include">
        </childnode>
        <childnode refid="25" relation="include">
        </childnode>
      </node>
      <node id="5">
        <label>net/arch.h</label>
        <link refid="arch_8h"/>
        <childnode refid="6" relation="include">
        </childnode>
        <childnode refid="13" relation="include">
        </childnode>
        <childnode refid="16" relation="include">
        </childnode>
        <childnode refid="18" relation="include">
        </childnode>
      </node>
      <node id="24">
        <label>net/ip6.h</label>
        <link refid="ip6_8h"/>
        <childnode refid="2" relation="include">
        </childnode>
      </node>
      <node id="22">
        <label>net/ip6_addr.h</label>
        <link refid="ip6__addr_8h"/>
        <childnode refid="2" relation="include">
        </childnode>
        <childnode refid="23" relation="include">
        </childnode>
      </node>
      <node id="2">
        <label>net/opt.h</label>
        <link refid="opt_8h"/>
        <childnode refid="3" relation="include">
        </childnode>
        <childnode refid="4" relation="include">
        </childnode>
      </node>
      <node id="16">
        <label>lib/kprintf.h</label>
        <link refid="kprintf_8h"/>
        <childnode refid="6" relation="include">
        </childnode>
        <childnode refid="17" relation="include">
        </childnode>
      </node>
      <node id="36">
        <label>net/ip.h</label>
        <link refid="ip_8h"/>
        <childnode refid="2" relation="include">
        </childnode>
        <childnode refid="23" relation="include">
        </childnode>
        <childnode refid="20" relation="include">
        </childnode>
        <childnode refid="26" relation="include">
        </childnode>
        <childnode refid="21" relation="include">
        </childnode>
        <childnode refid="25" relation="include">
        </childnode>
        <childnode refid="37" relation="include">
        </childnode>
        <childnode refid="24" relation="include">
        </childnode>
        <childnode refid="38" relation="include">
        </childnode>
      </node>
      <node id="4">
        <label>net/debug.h</label>
        <link refid="debug_8h"/>
        <childnode refid="5" relation="include">
        </childnode>
        <childnode refid="2" relation="include">
        </childnode>
      </node>
      <node id="27">
        <label>net/ip4_addr.h</label>
        <link refid="ip4__addr_8h"/>
        <childnode refid="2" relation="include">
        </childnode>
        <childnode refid="23" relation="include">
        </childnode>
      </node>
      <node id="26">
        <label>net/ip_addr.h</label>
        <link refid="ip__addr_8h"/>
        <childnode refid="2" relation="include">
        </childnode>
        <childnode refid="23" relation="include">
        </childnode>
        <childnode refid="27" relation="include">
        </childnode>
        <childnode refid="22" relation="include">
        </childnode>
      </node>
      <node id="31">
        <label>net/priv/memp_std.h</label>
        <link refid="memp__std_8h"/>
      </node>
      <node id="9">
        <label>sys/cdefs.h</label>
        <link refid="cdefs_8h"/>
      </node>
      <node id="14">
        <label>ubixos/time.h</label>
        <link refid="time_8h"/>
        <childnode refid="6" relation="include">
        </childnode>
        <childnode refid="10" relation="include">
        </childnode>
        <childnode refid="15" relation="include">
        </childnode>
      </node>
      <node id="7">
        <label>sys/_types.h</label>
        <link refid="__types_8h"/>
      </node>
      <node id="38">
        <label>net/prot/ip.h</label>
        <link refid="prot_2ip_8h"/>
        <childnode refid="5" relation="include">
        </childnode>
      </node>
      <node id="21">
        <label>net/err.h</label>
        <link refid="err_8h"/>
        <childnode refid="2" relation="include">
        </childnode>
        <childnode refid="5" relation="include">
        </childnode>
      </node>
      <node id="10">
        <label>sys/_timespec.h</label>
        <link refid="__timespec_8h"/>
        <childnode refid="7" relation="include">
        </childnode>
      </node>
      <node id="11">
        <label>sys/_timeval.h</label>
        <link refid="__timeval_8h"/>
        <childnode refid="7" relation="include">
        </childnode>
      </node>
      <node id="30">
        <label>net/memp.h</label>
        <link refid="memp_8h"/>
        <childnode refid="2" relation="include">
        </childnode>
        <childnode refid="31" relation="include">
        </childnode>
        <childnode refid="32" relation="include">
        </childnode>
        <childnode refid="28" relation="include">
        </childnode>
      </node>
    </incdepgraph>
    <briefdescription>
    </briefdescription>
    <detaileddescription>
<para>IPv6 fragmentation and reassembly. </para>
    </detaileddescription>
    <programlisting>
<codeline lineno="1"></codeline>
<codeline lineno="7"><highlight class="comment">/*</highlight></codeline>
<codeline lineno="8"><highlight class="comment"><sp/>*<sp/>Copyright<sp/>(c)<sp/>2010<sp/>Inico<sp/>Technologies<sp/>Ltd.</highlight></codeline>
<codeline lineno="9"><highlight class="comment"><sp/>*<sp/>All<sp/>rights<sp/>reserved.</highlight></codeline>
<codeline lineno="10"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="11"><highlight class="comment"><sp/>*<sp/>Redistribution<sp/>and<sp/>use<sp/>in<sp/>source<sp/>and<sp/>binary<sp/>forms,<sp/>with<sp/>or<sp/>without<sp/>modification,</highlight></codeline>
<codeline lineno="12"><highlight class="comment"><sp/>*<sp/>are<sp/>permitted<sp/>provided<sp/>that<sp/>the<sp/>following<sp/>conditions<sp/>are<sp/>met:</highlight></codeline>
<codeline lineno="13"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="14"><highlight class="comment"><sp/>*<sp/>1.<sp/>Redistributions<sp/>of<sp/>source<sp/>code<sp/>must<sp/>retain<sp/>the<sp/>above<sp/>copyright<sp/>notice,</highlight></codeline>
<codeline lineno="15"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/>this<sp/>list<sp/>of<sp/>conditions<sp/>and<sp/>the<sp/>following<sp/>disclaimer.</highlight></codeline>
<codeline lineno="16"><highlight class="comment"><sp/>*<sp/>2.<sp/>Redistributions<sp/>in<sp/>binary<sp/>form<sp/>must<sp/>reproduce<sp/>the<sp/>above<sp/>copyright<sp/>notice,</highlight></codeline>
<codeline lineno="17"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/>this<sp/>list<sp/>of<sp/>conditions<sp/>and<sp/>the<sp/>following<sp/>disclaimer<sp/>in<sp/>the<sp/>documentation</highlight></codeline>
<codeline lineno="18"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/>and/or<sp/>other<sp/>materials<sp/>provided<sp/>with<sp/>the<sp/>distribution.</highlight></codeline>
<codeline lineno="19"><highlight class="comment"><sp/>*<sp/>3.<sp/>The<sp/>name<sp/>of<sp/>the<sp/>author<sp/>may<sp/>not<sp/>be<sp/>used<sp/>to<sp/>endorse<sp/>or<sp/>promote<sp/>products</highlight></codeline>
<codeline lineno="20"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/>derived<sp/>from<sp/>this<sp/>software<sp/>without<sp/>specific<sp/>prior<sp/>written<sp/>permission.</highlight></codeline>
<codeline lineno="21"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="22"><highlight class="comment"><sp/>*<sp/>THIS<sp/>SOFTWARE<sp/>IS<sp/>PROVIDED<sp/>BY<sp/>THE<sp/>AUTHOR<sp/>``AS<sp/>IS&apos;&apos;<sp/>AND<sp/>ANY<sp/>EXPRESS<sp/>OR<sp/>IMPLIED</highlight></codeline>
<codeline lineno="23"><highlight class="comment"><sp/>*<sp/>WARRANTIES,<sp/>INCLUDING,<sp/>BUT<sp/>NOT<sp/>LIMITED<sp/>TO,<sp/>THE<sp/>IMPLIED<sp/>WARRANTIES<sp/>OF</highlight></codeline>
<codeline lineno="24"><highlight class="comment"><sp/>*<sp/>MERCHANTABILITY<sp/>AND<sp/>FITNESS<sp/>FOR<sp/>A<sp/>PARTICULAR<sp/>PURPOSE<sp/>ARE<sp/>DISCLAIMED.<sp/>IN<sp/>NO<sp/>EVENT</highlight></codeline>
<codeline lineno="25"><highlight class="comment"><sp/>*<sp/>SHALL<sp/>THE<sp/>AUTHOR<sp/>BE<sp/>LIABLE<sp/>FOR<sp/>ANY<sp/>DIRECT,<sp/>INDIRECT,<sp/>INCIDENTAL,<sp/>SPECIAL,</highlight></codeline>
<codeline lineno="26"><highlight class="comment"><sp/>*<sp/>EXEMPLARY,<sp/>OR<sp/>CONSEQUENTIAL<sp/>DAMAGES<sp/>(INCLUDING,<sp/>BUT<sp/>NOT<sp/>LIMITED<sp/>TO,<sp/>PROCUREMENT</highlight></codeline>
<codeline lineno="27"><highlight class="comment"><sp/>*<sp/>OF<sp/>SUBSTITUTE<sp/>GOODS<sp/>OR<sp/>SERVICES;<sp/>LOSS<sp/>OF<sp/>USE,<sp/>DATA,<sp/>OR<sp/>PROFITS;<sp/>OR<sp/>BUSINESS</highlight></codeline>
<codeline lineno="28"><highlight class="comment"><sp/>*<sp/>INTERRUPTION)<sp/>HOWEVER<sp/>CAUSED<sp/>AND<sp/>ON<sp/>ANY<sp/>THEORY<sp/>OF<sp/>LIABILITY,<sp/>WHETHER<sp/>IN</highlight></codeline>
<codeline lineno="29"><highlight class="comment"><sp/>*<sp/>CONTRACT,<sp/>STRICT<sp/>LIABILITY,<sp/>OR<sp/>TORT<sp/>(INCLUDING<sp/>NEGLIGENCE<sp/>OR<sp/>OTHERWISE)<sp/>ARISING</highlight></codeline>
<codeline lineno="30"><highlight class="comment"><sp/>*<sp/>IN<sp/>ANY<sp/>WAY<sp/>OUT<sp/>OF<sp/>THE<sp/>USE<sp/>OF<sp/>THIS<sp/>SOFTWARE,<sp/>EVEN<sp/>IF<sp/>ADVISED<sp/>OF<sp/>THE<sp/>POSSIBILITY</highlight></codeline>
<codeline lineno="31"><highlight class="comment"><sp/>*<sp/>OF<sp/>SUCH<sp/>DAMAGE.</highlight></codeline>
<codeline lineno="32"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="33"><highlight class="comment"><sp/>*<sp/>This<sp/>file<sp/>is<sp/>part<sp/>of<sp/>the<sp/>lwIP<sp/>TCP/IP<sp/>stack.</highlight></codeline>
<codeline lineno="34"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="35"><highlight class="comment"><sp/>*<sp/>Author:<sp/>Ivan<sp/>Delamer<sp/>&lt;delamer@inicotech.com&gt;</highlight></codeline>
<codeline lineno="36"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="37"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="38"><highlight class="comment"><sp/>*<sp/>Please<sp/>coordinate<sp/>changes<sp/>and<sp/>requests<sp/>with<sp/>Ivan<sp/>Delamer</highlight></codeline>
<codeline lineno="39"><highlight class="comment"><sp/>*<sp/>&lt;delamer@inicotech.com&gt;</highlight></codeline>
<codeline lineno="40"><highlight class="comment"><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="41"><highlight class="normal"></highlight></codeline>
<codeline lineno="42"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="opt_8h" kindref="compound">net/opt.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="43"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="ip6__frag_8h" kindref="compound">net/ip6_frag.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="44"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="ip6_8h" kindref="compound">net/ip6.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="45"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="icmp6_8h" kindref="compound">net/icmp6.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="46"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="nd6_8h" kindref="compound">net/nd6.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="47"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="ip_8h" kindref="compound">net/ip.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="48"><highlight class="normal"></highlight></codeline>
<codeline lineno="49"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="pbuf_8h" kindref="compound">net/pbuf.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="50"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="memp_8h" kindref="compound">net/memp.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="51"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="stats_8h" kindref="compound">net/stats.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="52"><highlight class="normal"></highlight></codeline>
<codeline lineno="53"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;<ref refid="string_8h" kindref="compound">string.h</ref>&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="54"><highlight class="normal"></highlight></codeline>
<codeline lineno="55"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_IPV6<sp/>&amp;&amp;<sp/>LWIP_IPV6_REASS<sp/><sp/></highlight><highlight class="comment">/*<sp/>don&apos;t<sp/>build<sp/>if<sp/>not<sp/>configured<sp/>for<sp/>use<sp/>in<sp/>lwipopts.h<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="56"><highlight class="normal"></highlight></codeline>
<codeline lineno="57"><highlight class="normal"></highlight></codeline>
<codeline lineno="61"><highlight class="preprocessor">#ifndef<sp/>IP_REASS_CHECK_OVERLAP</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="62"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>IP_REASS_CHECK_OVERLAP<sp/>1</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="63"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>IP_REASS_CHECK_OVERLAP<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="64"><highlight class="normal"></highlight></codeline>
<codeline lineno="69"><highlight class="preprocessor">#ifndef<sp/>IP_REASS_FREE_OLDEST</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="70"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>IP_REASS_FREE_OLDEST<sp/>1</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="71"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>IP_REASS_FREE_OLDEST<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="72"><highlight class="normal"></highlight></codeline>
<codeline lineno="73"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>IPV6_FRAG_COPYHEADER</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="74"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>IPV6_FRAG_REQROOM<sp/>((s16_t)(sizeof(struct<sp/>ip6_reass_helper)<sp/>-<sp/>IP6_FRAG_HLEN))</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="75"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="76"><highlight class="normal"></highlight></codeline>
<codeline lineno="77"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>IP_REASS_FLAG_LASTFRAG<sp/>0x01</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="78"><highlight class="normal"></highlight></codeline>
<codeline lineno="86"><highlight class="preprocessor">#ifdef<sp/>PACK_STRUCT_USE_INCLUDES</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="87"><highlight class="normal"></highlight><highlight class="preprocessor">#<sp/><sp/>include<sp/>&quot;arch/bpstruct.h&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="88"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="89"><highlight class="normal"><ref refid="cc_8h_1a73199061891adf1b912d20835c7d5e96" kindref="member">PACK_STRUCT_BEGIN</ref></highlight></codeline>
<codeline lineno="90"><highlight class="normal"></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">ip6_reass_helper<sp/>{</highlight></codeline>
<codeline lineno="91"><highlight class="normal"><sp/><sp/><ref refid="cc_8h_1aab0b988124e37a978d9a88e7c1c778e0" kindref="member">PACK_STRUCT_FIELD</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*next_pbuf);</highlight></codeline>
<codeline lineno="92"><highlight class="normal"><sp/><sp/><ref refid="cc_8h_1aab0b988124e37a978d9a88e7c1c778e0" kindref="member">PACK_STRUCT_FIELD</ref>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>start);</highlight></codeline>
<codeline lineno="93"><highlight class="normal"><sp/><sp/><ref refid="cc_8h_1aab0b988124e37a978d9a88e7c1c778e0" kindref="member">PACK_STRUCT_FIELD</ref>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>end);</highlight></codeline>
<codeline lineno="94"><highlight class="normal">}<sp/><ref refid="cc_8h_1a9ebc500530d0d9e6cd0b81969f48bbc8" kindref="member">PACK_STRUCT_STRUCT</ref>;</highlight></codeline>
<codeline lineno="95"><highlight class="normal"><ref refid="cc_8h_1a465fef70f294e21cbf4ea51fc342f20e" kindref="member">PACK_STRUCT_END</ref></highlight></codeline>
<codeline lineno="96"><highlight class="normal"></highlight><highlight class="preprocessor">#ifdef<sp/>PACK_STRUCT_USE_INCLUDES</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="97"><highlight class="normal"></highlight><highlight class="preprocessor">#<sp/><sp/>include<sp/>&quot;arch/epstruct.h&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="98"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="99"><highlight class="normal"></highlight></codeline>
<codeline lineno="100"><highlight class="normal"></highlight><highlight class="comment">/*<sp/>static<sp/>variables<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="101"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">ip6_reassdata<sp/>*reassdatagrams;</highlight></codeline>
<codeline lineno="102"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>ip6_reass_pbufcount;</highlight></codeline>
<codeline lineno="103"><highlight class="normal"></highlight></codeline>
<codeline lineno="104"><highlight class="normal"></highlight><highlight class="comment">/*<sp/>Forward<sp/>declarations.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="105"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>ip6_reass_free_complete_datagram(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>ip6_reassdata<sp/>*ipr);</highlight></codeline>
<codeline lineno="106"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>IP_REASS_FREE_OLDEST</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="107"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>ip6_reass_remove_oldest_datagram(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>ip6_reassdata<sp/>*ipr,<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>pbufs_needed);</highlight></codeline>
<codeline lineno="108"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>IP_REASS_FREE_OLDEST<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="109"><highlight class="normal"></highlight></codeline>
<codeline lineno="110"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="111"><highlight class="normal">ip6_reass_tmr(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">)</highlight></codeline>
<codeline lineno="112"><highlight class="normal">{</highlight></codeline>
<codeline lineno="113"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">ip6_reassdata<sp/>*r,<sp/>*tmp;</highlight></codeline>
<codeline lineno="114"><highlight class="normal"></highlight></codeline>
<codeline lineno="115"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>!IPV6_FRAG_COPYHEADER</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="116"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;sizeof(struct<sp/>ip6_reass_helper)<sp/>&lt;=<sp/>IP6_FRAG_HLEN,<sp/>set<sp/>IPV6_FRAG_COPYHEADER<sp/>to<sp/>1&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="117"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>ip6_reass_helper)<sp/>&lt;=<sp/><ref refid="prot_2ip6_8h_1aacda00cc76d9e7f9f3197de3b27089ea" kindref="member">IP6_FRAG_HLEN</ref>);</highlight></codeline>
<codeline lineno="118"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>!IPV6_FRAG_COPYHEADER<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="119"><highlight class="normal"></highlight></codeline>
<codeline lineno="120"><highlight class="normal"><sp/><sp/>r<sp/>=<sp/>reassdatagrams;</highlight></codeline>
<codeline lineno="121"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(r<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="122"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Decrement<sp/>the<sp/>timer.<sp/>Once<sp/>it<sp/>reaches<sp/>0,</highlight></codeline>
<codeline lineno="123"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>*<sp/>clean<sp/>up<sp/>the<sp/>incomplete<sp/>fragment<sp/>assembly<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="124"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(r-&gt;timer<sp/>&gt;<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="125"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>r-&gt;timer--;</highlight></codeline>
<codeline lineno="126"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>r<sp/>=<sp/>r-&gt;next;</highlight></codeline>
<codeline lineno="127"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="128"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>reassembly<sp/>timed<sp/>out<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="129"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>tmp<sp/>=<sp/>r;</highlight></codeline>
<codeline lineno="130"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>get<sp/>the<sp/>next<sp/>pointer<sp/>before<sp/>freeing<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="131"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>r<sp/>=<sp/>r-&gt;next;</highlight></codeline>
<codeline lineno="132"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>free<sp/>the<sp/>helper<sp/>struct<sp/>and<sp/>all<sp/>enqueued<sp/>pbufs<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="133"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>ip6_reass_free_complete_datagram(tmp);</highlight></codeline>
<codeline lineno="134"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="135"><highlight class="normal"><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="136"><highlight class="normal">}</highlight></codeline>
<codeline lineno="137"><highlight class="normal"></highlight></codeline>
<codeline lineno="145"><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="146"><highlight class="normal">ip6_reass_free_complete_datagram(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>ip6_reassdata<sp/>*ipr)</highlight></codeline>
<codeline lineno="147"><highlight class="normal">{</highlight></codeline>
<codeline lineno="148"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">ip6_reassdata<sp/>*prev;</highlight></codeline>
<codeline lineno="149"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>pbufs_freed<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="150"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>clen;</highlight></codeline>
<codeline lineno="151"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*p;</highlight></codeline>
<codeline lineno="152"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">ip6_reass_helper<sp/>*iprh;</highlight></codeline>
<codeline lineno="153"><highlight class="normal"></highlight></codeline>
<codeline lineno="154"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_ICMP6</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="155"><highlight class="normal"><sp/><sp/>iprh<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">ip6_reass_helper<sp/>*)ipr-&gt;p-&gt;payload;</highlight></codeline>
<codeline lineno="156"><highlight class="normal"><sp/><sp/>if<sp/>(iprh-&gt;start<sp/>==<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="157"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>The<sp/>first<sp/>fragment<sp/>was<sp/>received,<sp/>send<sp/>ICMP<sp/>time<sp/>exceeded.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="158"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>First,<sp/>de-queue<sp/>the<sp/>first<sp/>pbuf<sp/>from<sp/>r-&gt;p.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="159"><highlight class="normal"><sp/><sp/><sp/><sp/>p<sp/>=<sp/>ipr-&gt;p;</highlight></codeline>
<codeline lineno="160"><highlight class="normal"><sp/><sp/><sp/><sp/>ipr-&gt;p<sp/>=<sp/>iprh-&gt;next_pbuf;</highlight></codeline>
<codeline lineno="161"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Then,<sp/>move<sp/>back<sp/>to<sp/>the<sp/>original<sp/>ipv6<sp/>header<sp/>(we<sp/>are<sp/>now<sp/>pointing<sp/>to<sp/>Fragment<sp/>header).</highlight></codeline>
<codeline lineno="162"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>This<sp/>cannot<sp/>fail<sp/>since<sp/>we<sp/>already<sp/>checked<sp/>when<sp/>receiving<sp/>this<sp/>fragment.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="163"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="pbuf_8h_1a27480c41c34021d4417691d327163626" kindref="member">pbuf_header_force</ref>(p,<sp/>(<ref refid="group__compiler__abstraction_1gacf46f4df0ebab84edebcb69967fdf86b" kindref="member">s16_t</ref>)((<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref>*)p-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref><sp/>-<sp/>(<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref>*)IPV6_FRAG_HDRREF(ipr-&gt;iphdr))))<sp/>{</highlight></codeline>
<codeline lineno="164"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;ip6_reass_free:<sp/>moving<sp/>p-&gt;payload<sp/>to<sp/>ip6<sp/>header<sp/>failed\n&quot;</highlight><highlight class="normal">,<sp/>0);</highlight></codeline>
<codeline lineno="165"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="166"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="167"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>icmp6_time_exceeded(p,<sp/><ref refid="prot_2icmp6_8h_1ad06bbf4ee72635ece968db41cbe6869eaec493420d61c80a21981b1aa32befe1f" kindref="member">ICMP6_TE_FRAG</ref>);</highlight></codeline>
<codeline lineno="168"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="169"><highlight class="normal"><sp/><sp/><sp/><sp/>clen<sp/>=<sp/><ref refid="pbuf_8h_1a5df7ac5ae59012fe9aeddba375a72190" kindref="member">pbuf_clen</ref>(p);</highlight></codeline>
<codeline lineno="170"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;pbufs_freed<sp/>+<sp/>clen<sp/>&lt;=<sp/>0xffff&quot;</highlight><highlight class="normal">,<sp/>pbufs_freed<sp/>+<sp/>clen<sp/>&lt;=<sp/>0xffff);</highlight></codeline>
<codeline lineno="171"><highlight class="normal"><sp/><sp/><sp/><sp/>pbufs_freed<sp/>+=<sp/>clen;</highlight></codeline>
<codeline lineno="172"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(p);</highlight></codeline>
<codeline lineno="173"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="174"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_ICMP6<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="175"><highlight class="normal"></highlight></codeline>
<codeline lineno="176"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>First,<sp/>free<sp/>all<sp/>received<sp/>pbufs.<sp/><sp/>The<sp/>individual<sp/>pbufs<sp/>need<sp/>to<sp/>be<sp/>released</highlight></codeline>
<codeline lineno="177"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>separately<sp/>as<sp/>they<sp/>have<sp/>not<sp/>yet<sp/>been<sp/>chained<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="178"><highlight class="normal"><sp/><sp/>p<sp/>=<sp/>ipr-&gt;p;</highlight></codeline>
<codeline lineno="179"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(p<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="180"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*pcur;</highlight></codeline>
<codeline lineno="181"><highlight class="normal"><sp/><sp/><sp/><sp/>iprh<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">ip6_reass_helper<sp/>*)p-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref>;</highlight></codeline>
<codeline lineno="182"><highlight class="normal"><sp/><sp/><sp/><sp/>pcur<sp/>=<sp/>p;</highlight></codeline>
<codeline lineno="183"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>get<sp/>the<sp/>next<sp/>pointer<sp/>before<sp/>freeing<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="184"><highlight class="normal"><sp/><sp/><sp/><sp/>p<sp/>=<sp/>iprh-&gt;next_pbuf;</highlight></codeline>
<codeline lineno="185"><highlight class="normal"><sp/><sp/><sp/><sp/>clen<sp/>=<sp/><ref refid="pbuf_8h_1a5df7ac5ae59012fe9aeddba375a72190" kindref="member">pbuf_clen</ref>(pcur);</highlight></codeline>
<codeline lineno="186"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;pbufs_freed<sp/>+<sp/>clen<sp/>&lt;=<sp/>0xffff&quot;</highlight><highlight class="normal">,<sp/>pbufs_freed<sp/>+<sp/>clen<sp/>&lt;=<sp/>0xffff);</highlight></codeline>
<codeline lineno="187"><highlight class="normal"><sp/><sp/><sp/><sp/>pbufs_freed<sp/>+=<sp/>clen;</highlight></codeline>
<codeline lineno="188"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(pcur);</highlight></codeline>
<codeline lineno="189"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="190"><highlight class="normal"></highlight></codeline>
<codeline lineno="191"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Then,<sp/>unchain<sp/>the<sp/>struct<sp/>ip6_reassdata<sp/>from<sp/>the<sp/>list<sp/>and<sp/>free<sp/>it.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="192"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ipr<sp/>==<sp/>reassdatagrams)<sp/>{</highlight></codeline>
<codeline lineno="193"><highlight class="normal"><sp/><sp/><sp/><sp/>reassdatagrams<sp/>=<sp/>ipr-&gt;next;</highlight></codeline>
<codeline lineno="194"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="195"><highlight class="normal"><sp/><sp/><sp/><sp/>prev<sp/>=<sp/>reassdatagrams;</highlight></codeline>
<codeline lineno="196"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(prev<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="197"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(prev-&gt;next<sp/>==<sp/>ipr)<sp/>{</highlight></codeline>
<codeline lineno="198"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="199"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="200"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>prev<sp/>=<sp/>prev-&gt;next;</highlight></codeline>
<codeline lineno="201"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="202"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(prev<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="203"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>prev-&gt;next<sp/>=<sp/>ipr-&gt;next;</highlight></codeline>
<codeline lineno="204"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="205"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="206"><highlight class="normal"><sp/><sp/><ref refid="memp_8h_1aecd94926b7c2a0e23ae195f4ae97581f" kindref="member">memp_free</ref>(MEMP_IP6_REASSDATA,<sp/>ipr);</highlight></codeline>
<codeline lineno="207"><highlight class="normal"></highlight></codeline>
<codeline lineno="208"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Finally,<sp/>update<sp/>number<sp/>of<sp/>pbufs<sp/>in<sp/>reassembly<sp/>queue<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="209"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;ip_reass_pbufcount<sp/>&gt;=<sp/>clen&quot;</highlight><highlight class="normal">,<sp/>ip6_reass_pbufcount<sp/>&gt;=<sp/>pbufs_freed);</highlight></codeline>
<codeline lineno="210"><highlight class="normal"><sp/><sp/>ip6_reass_pbufcount<sp/>-=<sp/>pbufs_freed;</highlight></codeline>
<codeline lineno="211"><highlight class="normal">}</highlight></codeline>
<codeline lineno="212"><highlight class="normal"></highlight></codeline>
<codeline lineno="213"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>IP_REASS_FREE_OLDEST</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="214"><highlight class="normal"></highlight></codeline>
<codeline lineno="222"><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="223"><highlight class="normal">ip6_reass_remove_oldest_datagram(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>ip6_reassdata<sp/>*ipr,<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>pbufs_needed)</highlight></codeline>
<codeline lineno="224"><highlight class="normal">{</highlight></codeline>
<codeline lineno="225"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">ip6_reassdata<sp/>*r,<sp/>*oldest;</highlight></codeline>
<codeline lineno="226"><highlight class="normal"></highlight></codeline>
<codeline lineno="227"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Free<sp/>datagrams<sp/>until<sp/>being<sp/>allowed<sp/>to<sp/>enqueue<sp/>&apos;pbufs_needed&apos;<sp/>pbufs,</highlight></codeline>
<codeline lineno="228"><highlight class="comment"><sp/><sp/><sp/>*<sp/>but<sp/>don&apos;t<sp/>free<sp/>the<sp/>current<sp/>datagram!<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="229"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">do</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="230"><highlight class="normal"><sp/><sp/><sp/><sp/>r<sp/>=<sp/>oldest<sp/>=<sp/>reassdatagrams;</highlight></codeline>
<codeline lineno="231"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(r<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="232"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(r<sp/>!=<sp/>ipr)<sp/>{</highlight></codeline>
<codeline lineno="233"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(r-&gt;timer<sp/>&lt;=<sp/>oldest-&gt;timer)<sp/>{</highlight></codeline>
<codeline lineno="234"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>older<sp/>than<sp/>the<sp/>previous<sp/>oldest<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="235"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>oldest<sp/>=<sp/>r;</highlight></codeline>
<codeline lineno="236"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="237"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="238"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>r<sp/>=<sp/>r-&gt;next;</highlight></codeline>
<codeline lineno="239"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="240"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(oldest<sp/>==<sp/>ipr)<sp/>{</highlight></codeline>
<codeline lineno="241"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>nothing<sp/>to<sp/>free,<sp/>ipr<sp/>is<sp/>the<sp/>only<sp/>element<sp/>on<sp/>the<sp/>list<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="242"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="243"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="244"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(oldest<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="245"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>ip6_reass_free_complete_datagram(oldest);</highlight></codeline>
<codeline lineno="246"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="247"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(((ip6_reass_pbufcount<sp/>+<sp/>pbufs_needed)<sp/>&gt;<sp/><ref refid="lwipopts_8h_1a29084a46d7d4be30e8029d356bca0394" kindref="member">IP_REASS_MAX_PBUFS</ref>)<sp/>&amp;&amp;<sp/>(reassdatagrams<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>));</highlight></codeline>
<codeline lineno="248"><highlight class="normal">}</highlight></codeline>
<codeline lineno="249"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>IP_REASS_FREE_OLDEST<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="250"><highlight class="normal"></highlight></codeline>
<codeline lineno="258"><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*</highlight></codeline>
<codeline lineno="259"><highlight class="normal">ip6_reass(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*p)</highlight></codeline>
<codeline lineno="260"><highlight class="normal">{</highlight></codeline>
<codeline lineno="261"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">ip6_reassdata<sp/>*ipr,<sp/>*ipr_prev;</highlight></codeline>
<codeline lineno="262"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">ip6_reass_helper<sp/>*iprh,<sp/>*iprh_tmp,<sp/>*iprh_prev=<ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="263"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structip6__frag__hdr" kindref="compound">ip6_frag_hdr</ref><sp/>*frag_hdr;</highlight></codeline>
<codeline lineno="264"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>offset,<sp/>len;</highlight></codeline>
<codeline lineno="265"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>clen;</highlight></codeline>
<codeline lineno="266"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>valid<sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="267"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*q;</highlight></codeline>
<codeline lineno="268"><highlight class="normal"></highlight></codeline>
<codeline lineno="269"><highlight class="normal"><sp/><sp/><ref refid="stats_8h_1ac74aa05083bf4034fe2cc1efd5fde36c" kindref="member">IP6_FRAG_STATS_INC</ref>(ip6_frag.recv);</highlight></codeline>
<codeline lineno="270"><highlight class="normal"></highlight></codeline>
<codeline lineno="271"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal">*)ip6_current_header()<sp/>!=<sp/>((<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref>*)p-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref>)<sp/>-<sp/><ref refid="prot_2ip6_8h_1afb4c1dc527be76d8f27591dfb726c023" kindref="member">IP6_HLEN</ref>)<sp/>{</highlight></codeline>
<codeline lineno="272"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>ip6_frag_hdr<sp/>must<sp/>be<sp/>in<sp/>the<sp/>first<sp/>pbuf,<sp/>not<sp/>chained<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="273"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="stats_8h_1ac74aa05083bf4034fe2cc1efd5fde36c" kindref="member">IP6_FRAG_STATS_INC</ref>(ip6_frag.proterr);</highlight></codeline>
<codeline lineno="274"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="stats_8h_1ac74aa05083bf4034fe2cc1efd5fde36c" kindref="member">IP6_FRAG_STATS_INC</ref>(ip6_frag.drop);</highlight></codeline>
<codeline lineno="275"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">goto</highlight><highlight class="normal"><sp/>nullreturn;</highlight></codeline>
<codeline lineno="276"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="277"><highlight class="normal"></highlight></codeline>
<codeline lineno="278"><highlight class="normal"><sp/><sp/>frag_hdr<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structip6__frag__hdr" kindref="compound">ip6_frag_hdr</ref><sp/>*)<sp/>p-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref>;</highlight></codeline>
<codeline lineno="279"><highlight class="normal"></highlight></codeline>
<codeline lineno="280"><highlight class="normal"><sp/><sp/>clen<sp/>=<sp/><ref refid="pbuf_8h_1a5df7ac5ae59012fe9aeddba375a72190" kindref="member">pbuf_clen</ref>(p);</highlight></codeline>
<codeline lineno="281"><highlight class="normal"></highlight></codeline>
<codeline lineno="282"><highlight class="normal"><sp/><sp/>offset<sp/>=<sp/><ref refid="def_8h_1ac642bf6057869696d7807564d8309ffc" kindref="member">lwip_ntohs</ref>(frag_hdr-&gt;_fragment_offset);</highlight></codeline>
<codeline lineno="283"><highlight class="normal"></highlight></codeline>
<codeline lineno="284"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Calculate<sp/>fragment<sp/>length<sp/>from<sp/>IPv6<sp/>payload<sp/>length.</highlight></codeline>
<codeline lineno="285"><highlight class="comment"><sp/><sp/><sp/>*<sp/>Adjust<sp/>for<sp/>headers<sp/>before<sp/>Fragment<sp/>Header.</highlight></codeline>
<codeline lineno="286"><highlight class="comment"><sp/><sp/><sp/>*<sp/>And<sp/>finally<sp/>adjust<sp/>by<sp/>Fragment<sp/>Header<sp/>length.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="287"><highlight class="normal"><sp/><sp/>len<sp/>=<sp/><ref refid="def_8h_1ac642bf6057869696d7807564d8309ffc" kindref="member">lwip_ntohs</ref>(ip6_current_header()-&gt;_plen);</highlight></codeline>
<codeline lineno="288"><highlight class="normal"><sp/><sp/>len<sp/>-=<sp/>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)(((<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref>*)p-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref><sp/>-<sp/>(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref>*)ip6_current_header())<sp/>-<sp/><ref refid="prot_2ip6_8h_1afb4c1dc527be76d8f27591dfb726c023" kindref="member">IP6_HLEN</ref>);</highlight></codeline>
<codeline lineno="289"><highlight class="normal"><sp/><sp/>len<sp/>-=<sp/><ref refid="prot_2ip6_8h_1aacda00cc76d9e7f9f3197de3b27089ea" kindref="member">IP6_FRAG_HLEN</ref>;</highlight></codeline>
<codeline lineno="290"><highlight class="normal"></highlight></codeline>
<codeline lineno="291"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Look<sp/>for<sp/>the<sp/>datagram<sp/>the<sp/>fragment<sp/>belongs<sp/>to<sp/>in<sp/>the<sp/>current<sp/>datagram<sp/>queue,</highlight></codeline>
<codeline lineno="292"><highlight class="comment"><sp/><sp/><sp/>*<sp/>remembering<sp/>the<sp/>previous<sp/>in<sp/>the<sp/>queue<sp/>for<sp/>later<sp/>dequeueing.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="293"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(ipr<sp/>=<sp/>reassdatagrams,<sp/>ipr_prev<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;<sp/>ipr<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;<sp/>ipr<sp/>=<sp/>ipr-&gt;next)<sp/>{</highlight></codeline>
<codeline lineno="294"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Check<sp/>if<sp/>the<sp/>incoming<sp/>fragment<sp/>matches<sp/>the<sp/>one<sp/>currently<sp/>present</highlight></codeline>
<codeline lineno="295"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>in<sp/>the<sp/>reassembly<sp/>buffer.<sp/>If<sp/>so,<sp/>we<sp/>proceed<sp/>with<sp/>copying<sp/>the</highlight></codeline>
<codeline lineno="296"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>fragment<sp/>into<sp/>the<sp/>buffer.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="297"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((frag_hdr-&gt;_identification<sp/>==<sp/>ipr-&gt;identification)<sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="298"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ip6_addr_cmp(ip6_current_src_addr(),<sp/>&amp;(IPV6_FRAG_HDRREF(ipr-&gt;iphdr)-&gt;src))<sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="299"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ip6_addr_cmp(ip6_current_dest_addr(),<sp/>&amp;(IPV6_FRAG_HDRREF(ipr-&gt;iphdr)-&gt;dest)))<sp/>{</highlight></codeline>
<codeline lineno="300"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1ac74aa05083bf4034fe2cc1efd5fde36c" kindref="member">IP6_FRAG_STATS_INC</ref>(ip6_frag.cachehit);</highlight></codeline>
<codeline lineno="301"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="302"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="303"><highlight class="normal"><sp/><sp/><sp/><sp/>ipr_prev<sp/>=<sp/>ipr;</highlight></codeline>
<codeline lineno="304"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="305"><highlight class="normal"></highlight></codeline>
<codeline lineno="306"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ipr<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="307"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Enqueue<sp/>a<sp/>new<sp/>datagram<sp/>into<sp/>the<sp/>datagram<sp/>queue<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="308"><highlight class="normal"><sp/><sp/><sp/><sp/>ipr<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">ip6_reassdata<sp/>*)<ref refid="memp_8h_1a2b00593d086313c267b54a976bf67aa5" kindref="member">memp_malloc</ref>(MEMP_IP6_REASSDATA);</highlight></codeline>
<codeline lineno="309"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ipr<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="310"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>IP_REASS_FREE_OLDEST</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="311"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Make<sp/>room<sp/>and<sp/>try<sp/>again.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="312"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>ip6_reass_remove_oldest_datagram(ipr,<sp/>clen);</highlight></codeline>
<codeline lineno="313"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>ipr<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">ip6_reassdata<sp/>*)<ref refid="memp_8h_1a2b00593d086313c267b54a976bf67aa5" kindref="member">memp_malloc</ref>(MEMP_IP6_REASSDATA);</highlight></codeline>
<codeline lineno="314"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ipr<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="315"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>re-search<sp/>ipr_prev<sp/>since<sp/>it<sp/>might<sp/>have<sp/>been<sp/>removed<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="316"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(ipr_prev<sp/>=<sp/>reassdatagrams;<sp/>ipr_prev<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;<sp/>ipr_prev<sp/>=<sp/>ipr_prev-&gt;next)<sp/>{</highlight></codeline>
<codeline lineno="317"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ipr_prev-&gt;next<sp/>==<sp/>ipr)<sp/>{</highlight></codeline>
<codeline lineno="318"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="319"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="320"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="321"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="322"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>IP_REASS_FREE_OLDEST<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="323"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="324"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1ac74aa05083bf4034fe2cc1efd5fde36c" kindref="member">IP6_FRAG_STATS_INC</ref>(ip6_frag.memerr);</highlight></codeline>
<codeline lineno="325"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1ac74aa05083bf4034fe2cc1efd5fde36c" kindref="member">IP6_FRAG_STATS_INC</ref>(ip6_frag.drop);</highlight></codeline>
<codeline lineno="326"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">goto</highlight><highlight class="normal"><sp/>nullreturn;</highlight></codeline>
<codeline lineno="327"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="328"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="329"><highlight class="normal"></highlight></codeline>
<codeline lineno="330"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="string_8h_1ace4b911463887af5e748326323e99a23" kindref="member">memset</ref>(ipr,<sp/>0,<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>ip6_reassdata));</highlight></codeline>
<codeline lineno="331"><highlight class="normal"><sp/><sp/><sp/><sp/>ipr-&gt;timer<sp/>=<sp/><ref refid="lwipopts_8h_1ad41122bd0b5485a18a4415c8f953727b" kindref="member">IP_REASS_MAXAGE</ref>;</highlight></codeline>
<codeline lineno="332"><highlight class="normal"></highlight></codeline>
<codeline lineno="333"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>enqueue<sp/>the<sp/>new<sp/>structure<sp/>to<sp/>the<sp/>front<sp/>of<sp/>the<sp/>list<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="334"><highlight class="normal"><sp/><sp/><sp/><sp/>ipr-&gt;next<sp/>=<sp/>reassdatagrams;</highlight></codeline>
<codeline lineno="335"><highlight class="normal"><sp/><sp/><sp/><sp/>reassdatagrams<sp/>=<sp/>ipr;</highlight></codeline>
<codeline lineno="336"><highlight class="normal"></highlight></codeline>
<codeline lineno="337"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Use<sp/>the<sp/>current<sp/>IPv6<sp/>header<sp/>for<sp/>src/dest<sp/>address<sp/>reference.</highlight></codeline>
<codeline lineno="338"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>*<sp/>Eventually,<sp/>we<sp/>will<sp/>replace<sp/>it<sp/>when<sp/>we<sp/>get<sp/>the<sp/>first<sp/>fragment</highlight></codeline>
<codeline lineno="339"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>*<sp/>(it<sp/>might<sp/>be<sp/>this<sp/>one,<sp/>in<sp/>any<sp/>case,<sp/>it<sp/>is<sp/>done<sp/>later).<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="340"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>IPV6_FRAG_COPYHEADER</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="341"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="lwipopts_8h_1aa1dd57a66b6de8c0593e9e3e8d1411f6" kindref="member">MEMCPY</ref>(&amp;ipr-&gt;iphdr,<sp/>ip6_current_header(),<sp/><ref refid="prot_2ip6_8h_1afb4c1dc527be76d8f27591dfb726c023" kindref="member">IP6_HLEN</ref>);</highlight></codeline>
<codeline lineno="342"><highlight class="normal"></highlight><highlight class="preprocessor">#else<sp/></highlight><highlight class="comment">/*<sp/>IPV6_FRAG_COPYHEADER<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="343"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>need<sp/>to<sp/>use<sp/>the<sp/>none-const<sp/>pointer<sp/>here:<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="344"><highlight class="normal"><sp/><sp/><sp/><sp/>ipr-&gt;iphdr<sp/>=<sp/><ref refid="ip_8h_1ac944fb6564f181bc90bc7c2b8b00d94c" kindref="member">ip_data</ref>.current_ip6_header;</highlight></codeline>
<codeline lineno="345"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>IPV6_FRAG_COPYHEADER<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="346"><highlight class="normal"></highlight></codeline>
<codeline lineno="347"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>copy<sp/>the<sp/>fragmented<sp/>packet<sp/>id.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="348"><highlight class="normal"><sp/><sp/><sp/><sp/>ipr-&gt;identification<sp/>=<sp/>frag_hdr-&gt;_identification;</highlight></codeline>
<codeline lineno="349"><highlight class="normal"></highlight></codeline>
<codeline lineno="350"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>copy<sp/>the<sp/>nexth<sp/>field<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="351"><highlight class="normal"><sp/><sp/><sp/><sp/>ipr-&gt;nexth<sp/>=<sp/>frag_hdr-&gt;_nexth;</highlight></codeline>
<codeline lineno="352"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="353"><highlight class="normal"></highlight></codeline>
<codeline lineno="354"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Check<sp/>if<sp/>we<sp/>are<sp/>allowed<sp/>to<sp/>enqueue<sp/>more<sp/>datagrams.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="355"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((ip6_reass_pbufcount<sp/>+<sp/>clen)<sp/>&gt;<sp/><ref refid="lwipopts_8h_1a29084a46d7d4be30e8029d356bca0394" kindref="member">IP_REASS_MAX_PBUFS</ref>)<sp/>{</highlight></codeline>
<codeline lineno="356"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>IP_REASS_FREE_OLDEST</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="357"><highlight class="normal"><sp/><sp/><sp/><sp/>ip6_reass_remove_oldest_datagram(ipr,<sp/>clen);</highlight></codeline>
<codeline lineno="358"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((ip6_reass_pbufcount<sp/>+<sp/>clen)<sp/>&lt;=<sp/><ref refid="lwipopts_8h_1a29084a46d7d4be30e8029d356bca0394" kindref="member">IP_REASS_MAX_PBUFS</ref>)<sp/>{</highlight></codeline>
<codeline lineno="359"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>re-search<sp/>ipr_prev<sp/>since<sp/>it<sp/>might<sp/>have<sp/>been<sp/>removed<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="360"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(ipr_prev<sp/>=<sp/>reassdatagrams;<sp/>ipr_prev<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;<sp/>ipr_prev<sp/>=<sp/>ipr_prev-&gt;next)<sp/>{</highlight></codeline>
<codeline lineno="361"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ipr_prev-&gt;next<sp/>==<sp/>ipr)<sp/>{</highlight></codeline>
<codeline lineno="362"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="363"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="364"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="365"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="366"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>IP_REASS_FREE_OLDEST<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="367"><highlight class="normal"><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="368"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>@todo:<sp/>send<sp/>ICMPv6<sp/>time<sp/>exceeded<sp/>here?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="369"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>drop<sp/>this<sp/>pbuf<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="370"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1ac74aa05083bf4034fe2cc1efd5fde36c" kindref="member">IP6_FRAG_STATS_INC</ref>(ip6_frag.memerr);</highlight></codeline>
<codeline lineno="371"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1ac74aa05083bf4034fe2cc1efd5fde36c" kindref="member">IP6_FRAG_STATS_INC</ref>(ip6_frag.drop);</highlight></codeline>
<codeline lineno="372"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">goto</highlight><highlight class="normal"><sp/>nullreturn;</highlight></codeline>
<codeline lineno="373"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="374"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="375"><highlight class="normal"></highlight></codeline>
<codeline lineno="376"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Overwrite<sp/>Fragment<sp/>Header<sp/>with<sp/>our<sp/>own<sp/>helper<sp/>struct.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="377"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>IPV6_FRAG_COPYHEADER</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="378"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(IPV6_FRAG_REQROOM<sp/>&gt;<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="379"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Make<sp/>room<sp/>for<sp/>struct<sp/>ip6_reass_helper<sp/>(only<sp/>required<sp/>if<sp/>sizeof(void*)<sp/>&gt;<sp/>4).</highlight></codeline>
<codeline lineno="380"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>This<sp/>cannot<sp/>fail<sp/>since<sp/>we<sp/>already<sp/>checked<sp/>when<sp/>receiving<sp/>this<sp/>fragment.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="381"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>hdrerr<sp/>=<sp/><ref refid="pbuf_8h_1a27480c41c34021d4417691d327163626" kindref="member">pbuf_header_force</ref>(p,<sp/>IPV6_FRAG_REQROOM);</highlight></codeline>
<codeline lineno="382"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__compiler__abstraction_1ga70624a5deb8b9199406372a7f3603ecf" kindref="member">LWIP_UNUSED_ARG</ref>(hdrerr);<sp/></highlight><highlight class="comment">/*<sp/>in<sp/>case<sp/>of<sp/>LWIP_NOASSERT<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="383"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;no<sp/>room<sp/>for<sp/>struct<sp/>ip6_reass_helper&quot;</highlight><highlight class="normal">,<sp/>hdrerr<sp/>==<sp/>0);</highlight></codeline>
<codeline lineno="384"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="385"><highlight class="normal"></highlight><highlight class="preprocessor">#else<sp/></highlight><highlight class="comment">/*<sp/>IPV6_FRAG_COPYHEADER<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="386"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;sizeof(struct<sp/>ip6_reass_helper)<sp/>&lt;=<sp/>IP6_FRAG_HLEN,<sp/>set<sp/>IPV6_FRAG_COPYHEADER<sp/>to<sp/>1&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="387"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>ip6_reass_helper)<sp/>&lt;=<sp/><ref refid="prot_2ip6_8h_1aacda00cc76d9e7f9f3197de3b27089ea" kindref="member">IP6_FRAG_HLEN</ref>);</highlight></codeline>
<codeline lineno="388"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>IPV6_FRAG_COPYHEADER<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="389"><highlight class="normal"><sp/><sp/>iprh<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">ip6_reass_helper<sp/>*)p-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref>;</highlight></codeline>
<codeline lineno="390"><highlight class="normal"><sp/><sp/>iprh-&gt;next_pbuf<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="391"><highlight class="normal"><sp/><sp/>iprh-&gt;start<sp/>=<sp/>(offset<sp/>&amp;<sp/><ref refid="prot_2ip6_8h_1a4ada75ee94d08af1a0d2656e6d14d7d9" kindref="member">IP6_FRAG_OFFSET_MASK</ref>);</highlight></codeline>
<codeline lineno="392"><highlight class="normal"><sp/><sp/>iprh-&gt;end<sp/>=<sp/>(offset<sp/>&amp;<sp/><ref refid="prot_2ip6_8h_1a4ada75ee94d08af1a0d2656e6d14d7d9" kindref="member">IP6_FRAG_OFFSET_MASK</ref>)<sp/>+<sp/>len;</highlight></codeline>
<codeline lineno="393"><highlight class="normal"></highlight></codeline>
<codeline lineno="394"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>find<sp/>the<sp/>right<sp/>place<sp/>to<sp/>insert<sp/>this<sp/>pbuf<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="395"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Iterate<sp/>through<sp/>until<sp/>we<sp/>either<sp/>get<sp/>to<sp/>the<sp/>end<sp/>of<sp/>the<sp/>list<sp/>(append),</highlight></codeline>
<codeline lineno="396"><highlight class="comment"><sp/><sp/><sp/>*<sp/>or<sp/>we<sp/>find<sp/>on<sp/>with<sp/>a<sp/>larger<sp/>offset<sp/>(insert).<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="397"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(q<sp/>=<sp/>ipr-&gt;p;<sp/>q<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;)<sp/>{</highlight></codeline>
<codeline lineno="398"><highlight class="normal"><sp/><sp/><sp/><sp/>iprh_tmp<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">ip6_reass_helper*)q-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref>;</highlight></codeline>
<codeline lineno="399"><highlight class="normal"><sp/><sp/><sp/><sp/>if<sp/>(iprh-&gt;start<sp/>&lt;<sp/>iprh_tmp-&gt;start)<sp/>{</highlight></codeline>
<codeline lineno="400"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>IP_REASS_CHECK_OVERLAP</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="401"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(iprh-&gt;end<sp/>&gt;<sp/>iprh_tmp-&gt;start)<sp/>{</highlight></codeline>
<codeline lineno="402"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>fragment<sp/>overlaps<sp/>with<sp/>following,<sp/>throw<sp/>away<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="403"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1ac74aa05083bf4034fe2cc1efd5fde36c" kindref="member">IP6_FRAG_STATS_INC</ref>(ip6_frag.proterr);</highlight></codeline>
<codeline lineno="404"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1ac74aa05083bf4034fe2cc1efd5fde36c" kindref="member">IP6_FRAG_STATS_INC</ref>(ip6_frag.drop);</highlight></codeline>
<codeline lineno="405"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">goto</highlight><highlight class="normal"><sp/>nullreturn;</highlight></codeline>
<codeline lineno="406"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="407"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(iprh_prev<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="408"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(iprh-&gt;start<sp/>&lt;<sp/>iprh_prev-&gt;end)<sp/>{</highlight></codeline>
<codeline lineno="409"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>fragment<sp/>overlaps<sp/>with<sp/>previous,<sp/>throw<sp/>away<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="410"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1ac74aa05083bf4034fe2cc1efd5fde36c" kindref="member">IP6_FRAG_STATS_INC</ref>(ip6_frag.proterr);</highlight></codeline>
<codeline lineno="411"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1ac74aa05083bf4034fe2cc1efd5fde36c" kindref="member">IP6_FRAG_STATS_INC</ref>(ip6_frag.drop);</highlight></codeline>
<codeline lineno="412"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">goto</highlight><highlight class="normal"><sp/>nullreturn;</highlight></codeline>
<codeline lineno="413"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="414"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="415"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>IP_REASS_CHECK_OVERLAP<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="416"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>the<sp/>new<sp/>pbuf<sp/>should<sp/>be<sp/>inserted<sp/>before<sp/>this<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="417"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>iprh-&gt;next_pbuf<sp/>=<sp/>q;</highlight></codeline>
<codeline lineno="418"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(iprh_prev<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="419"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>not<sp/>the<sp/>fragment<sp/>with<sp/>the<sp/>lowest<sp/>offset<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="420"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>iprh_prev-&gt;next_pbuf<sp/>=<sp/>p;</highlight></codeline>
<codeline lineno="421"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="422"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>fragment<sp/>with<sp/>the<sp/>lowest<sp/>offset<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="423"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ipr-&gt;p<sp/>=<sp/>p;</highlight></codeline>
<codeline lineno="424"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="425"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="426"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(iprh-&gt;start<sp/>==<sp/>iprh_tmp-&gt;start)<sp/>{</highlight></codeline>
<codeline lineno="427"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>received<sp/>the<sp/>same<sp/>datagram<sp/>twice:<sp/>no<sp/>need<sp/>to<sp/>keep<sp/>the<sp/>datagram<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="428"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1ac74aa05083bf4034fe2cc1efd5fde36c" kindref="member">IP6_FRAG_STATS_INC</ref>(ip6_frag.drop);</highlight></codeline>
<codeline lineno="429"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">goto</highlight><highlight class="normal"><sp/>nullreturn;</highlight></codeline>
<codeline lineno="430"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>IP_REASS_CHECK_OVERLAP</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="431"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(iprh-&gt;start<sp/>&lt;<sp/>iprh_tmp-&gt;end)<sp/>{</highlight></codeline>
<codeline lineno="432"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>overlap:<sp/>no<sp/>need<sp/>to<sp/>keep<sp/>the<sp/>new<sp/>datagram<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="433"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1ac74aa05083bf4034fe2cc1efd5fde36c" kindref="member">IP6_FRAG_STATS_INC</ref>(ip6_frag.proterr);</highlight></codeline>
<codeline lineno="434"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1ac74aa05083bf4034fe2cc1efd5fde36c" kindref="member">IP6_FRAG_STATS_INC</ref>(ip6_frag.drop);</highlight></codeline>
<codeline lineno="435"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">goto</highlight><highlight class="normal"><sp/>nullreturn;</highlight></codeline>
<codeline lineno="436"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>IP_REASS_CHECK_OVERLAP<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="437"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="438"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Check<sp/>if<sp/>the<sp/>fragments<sp/>received<sp/>so<sp/>far<sp/>have<sp/>no<sp/>gaps.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="439"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(iprh_prev<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="440"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(iprh_prev-&gt;end<sp/>!=<sp/>iprh_tmp-&gt;start)<sp/>{</highlight></codeline>
<codeline lineno="441"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>There<sp/>is<sp/>a<sp/>fragment<sp/>missing<sp/>between<sp/>the<sp/>current</highlight></codeline>
<codeline lineno="442"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*<sp/>and<sp/>the<sp/>previous<sp/>fragment<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="443"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>valid<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="444"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="445"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="446"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="447"><highlight class="normal"><sp/><sp/><sp/><sp/>q<sp/>=<sp/>iprh_tmp-&gt;next_pbuf;</highlight></codeline>
<codeline lineno="448"><highlight class="normal"><sp/><sp/><sp/><sp/>iprh_prev<sp/>=<sp/>iprh_tmp;</highlight></codeline>
<codeline lineno="449"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="450"><highlight class="normal"></highlight></codeline>
<codeline lineno="451"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>If<sp/>q<sp/>is<sp/>NULL,<sp/>then<sp/>we<sp/>made<sp/>it<sp/>to<sp/>the<sp/>end<sp/>of<sp/>the<sp/>list.<sp/>Determine<sp/>what<sp/>to<sp/>do<sp/>now<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="452"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(q<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="453"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(iprh_prev<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="454"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>this<sp/>is<sp/>(for<sp/>now),<sp/>the<sp/>fragment<sp/>with<sp/>the<sp/>highest<sp/>offset:</highlight></codeline>
<codeline lineno="455"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*<sp/>chain<sp/>it<sp/>to<sp/>the<sp/>last<sp/>fragment<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="456"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>IP_REASS_CHECK_OVERLAP</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="457"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;check<sp/>fragments<sp/>don&apos;t<sp/>overlap&quot;</highlight><highlight class="normal">,<sp/>iprh_prev-&gt;end<sp/>&lt;=<sp/>iprh-&gt;start);</highlight></codeline>
<codeline lineno="458"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>IP_REASS_CHECK_OVERLAP<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="459"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>iprh_prev-&gt;next_pbuf<sp/>=<sp/>p;</highlight></codeline>
<codeline lineno="460"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(iprh_prev-&gt;end<sp/>!=<sp/>iprh-&gt;start)<sp/>{</highlight></codeline>
<codeline lineno="461"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>valid<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="462"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="463"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="464"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>IP_REASS_CHECK_OVERLAP</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="465"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;no<sp/>previous<sp/>fragment,<sp/>this<sp/>must<sp/>be<sp/>the<sp/>first<sp/>fragment!&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="466"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ipr-&gt;p<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>);</highlight></codeline>
<codeline lineno="467"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>IP_REASS_CHECK_OVERLAP<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="468"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>this<sp/>is<sp/>the<sp/>first<sp/>fragment<sp/>we<sp/>ever<sp/>received<sp/>for<sp/>this<sp/>ip<sp/>datagram<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="469"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>ipr-&gt;p<sp/>=<sp/>p;</highlight></codeline>
<codeline lineno="470"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="471"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="472"><highlight class="normal"></highlight></codeline>
<codeline lineno="473"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Track<sp/>the<sp/>current<sp/>number<sp/>of<sp/>pbufs<sp/>current<sp/>&apos;in-flight&apos;,<sp/>in<sp/>order<sp/>to<sp/>limit</highlight></codeline>
<codeline lineno="474"><highlight class="comment"><sp/><sp/>the<sp/>number<sp/>of<sp/>fragments<sp/>that<sp/>may<sp/>be<sp/>enqueued<sp/>at<sp/>any<sp/>one<sp/>time<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="475"><highlight class="normal"><sp/><sp/>ip6_reass_pbufcount<sp/>+=<sp/>clen;</highlight></codeline>
<codeline lineno="476"><highlight class="normal"></highlight></codeline>
<codeline lineno="477"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Remember<sp/>IPv6<sp/>header<sp/>if<sp/>this<sp/>is<sp/>the<sp/>first<sp/>fragment.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="478"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(iprh-&gt;start<sp/>==<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="479"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>IPV6_FRAG_COPYHEADER</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="480"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(iprh-&gt;next_pbuf<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="481"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="lwipopts_8h_1aa1dd57a66b6de8c0593e9e3e8d1411f6" kindref="member">MEMCPY</ref>(&amp;ipr-&gt;iphdr,<sp/>ip6_current_header(),<sp/><ref refid="prot_2ip6_8h_1afb4c1dc527be76d8f27591dfb726c023" kindref="member">IP6_HLEN</ref>);</highlight></codeline>
<codeline lineno="482"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="483"><highlight class="normal"></highlight><highlight class="preprocessor">#else<sp/></highlight><highlight class="comment">/*<sp/>IPV6_FRAG_COPYHEADER<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="484"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>need<sp/>to<sp/>use<sp/>the<sp/>none-const<sp/>pointer<sp/>here:<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="485"><highlight class="normal"><sp/><sp/><sp/><sp/>ipr-&gt;iphdr<sp/>=<sp/><ref refid="ip_8h_1ac944fb6564f181bc90bc7c2b8b00d94c" kindref="member">ip_data</ref>.current_ip6_header;</highlight></codeline>
<codeline lineno="486"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>IPV6_FRAG_COPYHEADER<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="487"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="488"><highlight class="normal"></highlight></codeline>
<codeline lineno="489"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>If<sp/>this<sp/>is<sp/>the<sp/>last<sp/>fragment,<sp/>calculate<sp/>total<sp/>packet<sp/>length.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="490"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((offset<sp/>&amp;<sp/><ref refid="prot_2ip6_8h_1a4e60dc945c0061d3d4dc4a84132a506b" kindref="member">IP6_FRAG_MORE_FLAG</ref>)<sp/>==<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="491"><highlight class="normal"><sp/><sp/><sp/><sp/>ipr-&gt;datagram_len<sp/>=<sp/>iprh-&gt;end;</highlight></codeline>
<codeline lineno="492"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="493"><highlight class="normal"></highlight></codeline>
<codeline lineno="494"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Additional<sp/>validity<sp/>tests:<sp/>we<sp/>have<sp/>received<sp/>first<sp/>and<sp/>last<sp/>fragment.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="495"><highlight class="normal"><sp/><sp/>iprh_tmp<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">ip6_reass_helper*)ipr-&gt;p-&gt;payload;</highlight></codeline>
<codeline lineno="496"><highlight class="normal"><sp/><sp/>if<sp/>(iprh_tmp-&gt;start<sp/>!=<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="497"><highlight class="normal"><sp/><sp/><sp/><sp/>valid<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="498"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="499"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ipr-&gt;datagram_len<sp/>==<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="500"><highlight class="normal"><sp/><sp/><sp/><sp/>valid<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="501"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="502"><highlight class="normal"></highlight></codeline>
<codeline lineno="503"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Final<sp/>validity<sp/>test:<sp/>no<sp/>gaps<sp/>between<sp/>current<sp/>and<sp/>last<sp/>fragment.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="504"><highlight class="normal"><sp/><sp/>iprh_prev<sp/>=<sp/>iprh;</highlight></codeline>
<codeline lineno="505"><highlight class="normal"><sp/><sp/>q<sp/>=<sp/>iprh-&gt;next_pbuf;</highlight></codeline>
<codeline lineno="506"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>((q<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>&amp;&amp;<sp/>valid)<sp/>{</highlight></codeline>
<codeline lineno="507"><highlight class="normal"><sp/><sp/><sp/><sp/>iprh<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">ip6_reass_helper*)q-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref>;</highlight></codeline>
<codeline lineno="508"><highlight class="normal"><sp/><sp/><sp/><sp/>if<sp/>(iprh_prev-&gt;end<sp/>!=<sp/>iprh-&gt;start)<sp/>{</highlight></codeline>
<codeline lineno="509"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>valid<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="510"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="511"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="512"><highlight class="normal"><sp/><sp/><sp/><sp/>iprh_prev<sp/>=<sp/>iprh;</highlight></codeline>
<codeline lineno="513"><highlight class="normal"><sp/><sp/><sp/><sp/>q<sp/>=<sp/>iprh-&gt;next_pbuf;</highlight></codeline>
<codeline lineno="514"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="515"><highlight class="normal"></highlight></codeline>
<codeline lineno="516"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(valid)<sp/>{</highlight></codeline>
<codeline lineno="517"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>All<sp/>fragments<sp/>have<sp/>been<sp/>received<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="518"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structip6__hdr" kindref="compound">ip6_hdr</ref>*<sp/>iphdr_ptr;</highlight></codeline>
<codeline lineno="519"><highlight class="normal"></highlight></codeline>
<codeline lineno="520"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>chain<sp/>together<sp/>the<sp/>pbufs<sp/>contained<sp/>within<sp/>the<sp/>ip6_reassdata<sp/>list.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="521"><highlight class="normal"><sp/><sp/><sp/><sp/>iprh<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">ip6_reass_helper*)<sp/>ipr-&gt;p-&gt;payload;</highlight></codeline>
<codeline lineno="522"><highlight class="normal"><sp/><sp/><sp/><sp/>while<sp/>(iprh<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="523"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structpbuf" kindref="compound">pbuf</ref>*<sp/>next_pbuf<sp/>=<sp/>iprh-&gt;next_pbuf;</highlight></codeline>
<codeline lineno="524"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(next_pbuf<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="525"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Save<sp/>next<sp/>helper<sp/>struct<sp/>(will<sp/>be<sp/>hidden<sp/>in<sp/>next<sp/>step).<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="526"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>iprh_tmp<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">ip6_reass_helper*)next_pbuf-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref>;</highlight></codeline>
<codeline lineno="527"><highlight class="normal"></highlight></codeline>
<codeline lineno="528"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>hide<sp/>the<sp/>fragment<sp/>header<sp/>for<sp/>every<sp/>succeeding<sp/>fragment<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="529"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="pbuf_8h_1aaa17c1951cf2d207b6adfd3947d91f00" kindref="member">pbuf_header</ref>(next_pbuf,<sp/>-<ref refid="prot_2ip6_8h_1aacda00cc76d9e7f9f3197de3b27089ea" kindref="member">IP6_FRAG_HLEN</ref>);</highlight></codeline>
<codeline lineno="530"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>IPV6_FRAG_COPYHEADER</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="531"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(IPV6_FRAG_REQROOM<sp/>&gt;<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="532"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>hide<sp/>the<sp/>extra<sp/>bytes<sp/>borrowed<sp/>from<sp/>ip6_hdr<sp/>for<sp/>struct<sp/>ip6_reass_helper<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="533"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>hdrerr<sp/>=<sp/><ref refid="pbuf_8h_1aaa17c1951cf2d207b6adfd3947d91f00" kindref="member">pbuf_header</ref>(next_pbuf,<sp/>-(<ref refid="group__compiler__abstraction_1gacf46f4df0ebab84edebcb69967fdf86b" kindref="member">s16_t</ref>)(IPV6_FRAG_REQROOM));</highlight></codeline>
<codeline lineno="534"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__compiler__abstraction_1ga70624a5deb8b9199406372a7f3603ecf" kindref="member">LWIP_UNUSED_ARG</ref>(hdrerr);<sp/></highlight><highlight class="comment">/*<sp/>in<sp/>case<sp/>of<sp/>LWIP_NOASSERT<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="535"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;no<sp/>room<sp/>for<sp/>struct<sp/>ip6_reass_helper&quot;</highlight><highlight class="normal">,<sp/>hdrerr<sp/>==<sp/>0);</highlight></codeline>
<codeline lineno="536"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="537"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="538"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1ga82429084fe29015509c9b4a072707cd4" kindref="member">pbuf_cat</ref>(ipr-&gt;p,<sp/>next_pbuf);</highlight></codeline>
<codeline lineno="539"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="540"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="541"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>iprh_tmp<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="542"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="543"><highlight class="normal"></highlight></codeline>
<codeline lineno="544"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>iprh<sp/>=<sp/>iprh_tmp;</highlight></codeline>
<codeline lineno="545"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="546"><highlight class="normal"></highlight></codeline>
<codeline lineno="547"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>IPV6_FRAG_COPYHEADER</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="548"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(IPV6_FRAG_REQROOM<sp/>&gt;<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="549"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>get<sp/>back<sp/>room<sp/>for<sp/>struct<sp/>ip6_reass_helper<sp/>(only<sp/>required<sp/>if<sp/>sizeof(void*)<sp/>&gt;<sp/>4)<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="550"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>hdrerr<sp/>=<sp/><ref refid="pbuf_8h_1aaa17c1951cf2d207b6adfd3947d91f00" kindref="member">pbuf_header</ref>(ipr-&gt;p,<sp/>-(<ref refid="group__compiler__abstraction_1gacf46f4df0ebab84edebcb69967fdf86b" kindref="member">s16_t</ref>)(IPV6_FRAG_REQROOM));</highlight></codeline>
<codeline lineno="551"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__compiler__abstraction_1ga70624a5deb8b9199406372a7f3603ecf" kindref="member">LWIP_UNUSED_ARG</ref>(hdrerr);<sp/></highlight><highlight class="comment">/*<sp/>in<sp/>case<sp/>of<sp/>LWIP_NOASSERT<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="552"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;no<sp/>room<sp/>for<sp/>struct<sp/>ip6_reass_helper&quot;</highlight><highlight class="normal">,<sp/>hdrerr<sp/>==<sp/>0);</highlight></codeline>
<codeline lineno="553"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="554"><highlight class="normal"><sp/><sp/><sp/><sp/>iphdr_ptr<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structip6__hdr" kindref="compound">ip6_hdr</ref>*)((<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref>*)ipr-&gt;p-&gt;payload<sp/>-<sp/><ref refid="prot_2ip6_8h_1afb4c1dc527be76d8f27591dfb726c023" kindref="member">IP6_HLEN</ref>);</highlight></codeline>
<codeline lineno="555"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="lwipopts_8h_1aa1dd57a66b6de8c0593e9e3e8d1411f6" kindref="member">MEMCPY</ref>(iphdr_ptr,<sp/>&amp;ipr-&gt;iphdr,<sp/><ref refid="prot_2ip6_8h_1afb4c1dc527be76d8f27591dfb726c023" kindref="member">IP6_HLEN</ref>);</highlight></codeline>
<codeline lineno="556"><highlight class="normal"></highlight><highlight class="preprocessor">#else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="557"><highlight class="normal"><sp/><sp/><sp/><sp/>iphdr_ptr<sp/>=<sp/>ipr-&gt;iphdr;</highlight></codeline>
<codeline lineno="558"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="559"><highlight class="normal"></highlight></codeline>
<codeline lineno="560"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Adjust<sp/>datagram<sp/>length<sp/>by<sp/>adding<sp/>header<sp/>lengths.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="561"><highlight class="normal"><sp/><sp/><sp/><sp/>ipr-&gt;datagram_len<sp/>+=<sp/>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)(((<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref>*)ipr-&gt;p-&gt;payload<sp/>-<sp/>(<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref>*)iphdr_ptr)</highlight></codeline>
<codeline lineno="562"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>+<sp/><ref refid="prot_2ip6_8h_1aacda00cc76d9e7f9f3197de3b27089ea" kindref="member">IP6_FRAG_HLEN</ref></highlight></codeline>
<codeline lineno="563"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>-<sp/><ref refid="prot_2ip6_8h_1afb4c1dc527be76d8f27591dfb726c023" kindref="member">IP6_HLEN</ref>);</highlight></codeline>
<codeline lineno="564"><highlight class="normal"></highlight></codeline>
<codeline lineno="565"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Set<sp/>payload<sp/>length<sp/>in<sp/>ip<sp/>header.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="566"><highlight class="normal"><sp/><sp/><sp/><sp/>iphdr_ptr-&gt;_plen<sp/>=<sp/><ref refid="def_8c_1ad637280639de4066392e6b5614fa3e56" kindref="member">lwip_htons</ref>(ipr-&gt;datagram_len);</highlight></codeline>
<codeline lineno="567"><highlight class="normal"></highlight></codeline>
<codeline lineno="568"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Get<sp/>the<sp/>first<sp/>pbuf.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="569"><highlight class="normal"><sp/><sp/><sp/><sp/>p<sp/>=<sp/>ipr-&gt;p;</highlight></codeline>
<codeline lineno="570"><highlight class="normal"></highlight></codeline>
<codeline lineno="571"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Restore<sp/>Fragment<sp/>Header<sp/>in<sp/>first<sp/>pbuf.<sp/>Mark<sp/>as<sp/>&quot;single<sp/>fragment&quot;</highlight></codeline>
<codeline lineno="572"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>*<sp/>packet.<sp/>Restore<sp/>nexth.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="573"><highlight class="normal"><sp/><sp/><sp/><sp/>frag_hdr<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structip6__frag__hdr" kindref="compound">ip6_frag_hdr</ref><sp/>*)<sp/>p-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref>;</highlight></codeline>
<codeline lineno="574"><highlight class="normal"><sp/><sp/><sp/><sp/>frag_hdr-&gt;_nexth<sp/>=<sp/>ipr-&gt;nexth;</highlight></codeline>
<codeline lineno="575"><highlight class="normal"><sp/><sp/><sp/><sp/>frag_hdr-&gt;reserved<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="576"><highlight class="normal"><sp/><sp/><sp/><sp/>frag_hdr-&gt;_fragment_offset<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="577"><highlight class="normal"><sp/><sp/><sp/><sp/>frag_hdr-&gt;_identification<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="578"><highlight class="normal"></highlight></codeline>
<codeline lineno="579"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>release<sp/>the<sp/>sources<sp/>allocate<sp/>for<sp/>the<sp/>fragment<sp/>queue<sp/>entry<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="580"><highlight class="normal"><sp/><sp/><sp/><sp/>if<sp/>(reassdatagrams<sp/>==<sp/>ipr)<sp/>{</highlight></codeline>
<codeline lineno="581"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>it<sp/>was<sp/>the<sp/>first<sp/>in<sp/>the<sp/>list<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="582"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>reassdatagrams<sp/>=<sp/>ipr-&gt;next;</highlight></codeline>
<codeline lineno="583"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="584"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>it<sp/>wasn&apos;t<sp/>the<sp/>first,<sp/>so<sp/>it<sp/>must<sp/>have<sp/>a<sp/>valid<sp/>&apos;prev&apos;<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="585"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;sanity<sp/>check<sp/>linked<sp/>list&quot;</highlight><highlight class="normal">,<sp/>ipr_prev<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>);</highlight></codeline>
<codeline lineno="586"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>ipr_prev-&gt;next<sp/>=<sp/>ipr-&gt;next;</highlight></codeline>
<codeline lineno="587"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="588"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="memp_8h_1aecd94926b7c2a0e23ae195f4ae97581f" kindref="member">memp_free</ref>(MEMP_IP6_REASSDATA,<sp/>ipr);</highlight></codeline>
<codeline lineno="589"><highlight class="normal"></highlight></codeline>
<codeline lineno="590"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>adjust<sp/>the<sp/>number<sp/>of<sp/>pbufs<sp/>currently<sp/>queued<sp/>for<sp/>reassembly.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="591"><highlight class="normal"><sp/><sp/><sp/><sp/>ip6_reass_pbufcount<sp/>-=<sp/><ref refid="pbuf_8h_1a5df7ac5ae59012fe9aeddba375a72190" kindref="member">pbuf_clen</ref>(p);</highlight></codeline>
<codeline lineno="592"><highlight class="normal"></highlight></codeline>
<codeline lineno="593"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Move<sp/>pbuf<sp/>back<sp/>to<sp/>IPv6<sp/>header.</highlight></codeline>
<codeline lineno="594"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>This<sp/>cannot<sp/>fail<sp/>since<sp/>we<sp/>already<sp/>checked<sp/>when<sp/>receiving<sp/>this<sp/>fragment.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="595"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="pbuf_8h_1a27480c41c34021d4417691d327163626" kindref="member">pbuf_header_force</ref>(p,<sp/>(<ref refid="group__compiler__abstraction_1gacf46f4df0ebab84edebcb69967fdf86b" kindref="member">s16_t</ref>)((<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref>*)p-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref><sp/>-<sp/>(<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref>*)iphdr_ptr)))<sp/>{</highlight></codeline>
<codeline lineno="596"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;ip6_reass:<sp/>moving<sp/>p-&gt;payload<sp/>to<sp/>ip6<sp/>header<sp/>failed\n&quot;</highlight><highlight class="normal">,<sp/>0);</highlight></codeline>
<codeline lineno="597"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(p);</highlight></codeline>
<codeline lineno="598"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="599"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="600"><highlight class="normal"></highlight></codeline>
<codeline lineno="601"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Return<sp/>the<sp/>pbuf<sp/>chain<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="602"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>p;</highlight></codeline>
<codeline lineno="603"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="604"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>the<sp/>datagram<sp/>is<sp/>not<sp/>(yet?)<sp/>reassembled<sp/>completely<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="605"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="606"><highlight class="normal"></highlight></codeline>
<codeline lineno="607"><highlight class="normal">nullreturn:</highlight></codeline>
<codeline lineno="608"><highlight class="normal"><sp/><sp/><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(p);</highlight></codeline>
<codeline lineno="609"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="610"><highlight class="normal">}</highlight></codeline>
<codeline lineno="611"><highlight class="normal"></highlight></codeline>
<codeline lineno="612"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_IPV6<sp/>&amp;&amp;<sp/>LWIP_IPV6_REASS<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="613"><highlight class="normal"></highlight></codeline>
<codeline lineno="614"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_IPV6<sp/>&amp;&amp;<sp/>LWIP_IPV6_FRAG</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="615"><highlight class="normal"></highlight></codeline>
<codeline lineno="616"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>!LWIP_NETIF_TX_SINGLE_PBUF</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="617"><highlight class="normal"></highlight></codeline>
<codeline lineno="618"><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">pbuf_custom_ref*</highlight></codeline>
<codeline lineno="619"><highlight class="normal">ip6_frag_alloc_pbuf_custom_ref(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">)</highlight></codeline>
<codeline lineno="620"><highlight class="normal">{</highlight></codeline>
<codeline lineno="621"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>pbuf_custom_ref*)<ref refid="memp_8h_1a2b00593d086313c267b54a976bf67aa5" kindref="member">memp_malloc</ref>(MEMP_FRAG_PBUF);</highlight></codeline>
<codeline lineno="622"><highlight class="normal">}</highlight></codeline>
<codeline lineno="623"><highlight class="normal"></highlight></codeline>
<codeline lineno="625"><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="626"><highlight class="normal">ip6_frag_free_pbuf_custom_ref(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>pbuf_custom_ref*<sp/>p)</highlight></codeline>
<codeline lineno="627"><highlight class="normal">{</highlight></codeline>
<codeline lineno="628"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;p<sp/>!=<sp/>NULL&quot;</highlight><highlight class="normal">,<sp/>p<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>);</highlight></codeline>
<codeline lineno="629"><highlight class="normal"><sp/><sp/><ref refid="memp_8h_1aecd94926b7c2a0e23ae195f4ae97581f" kindref="member">memp_free</ref>(MEMP_FRAG_PBUF,<sp/>p);</highlight></codeline>
<codeline lineno="630"><highlight class="normal">}</highlight></codeline>
<codeline lineno="631"><highlight class="normal"></highlight></codeline>
<codeline lineno="634"><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="635"><highlight class="normal">ip6_frag_free_pbuf_custom(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*p)</highlight></codeline>
<codeline lineno="636"><highlight class="normal">{</highlight></codeline>
<codeline lineno="637"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">pbuf_custom_ref<sp/>*pcr<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">pbuf_custom_ref*)p;</highlight></codeline>
<codeline lineno="638"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;pcr<sp/>!=<sp/>NULL&quot;</highlight><highlight class="normal">,<sp/>pcr<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>);</highlight></codeline>
<codeline lineno="639"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;pcr<sp/>==<sp/>p&quot;</highlight><highlight class="normal">,<sp/>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">*)pcr<sp/>==<sp/>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">*)p);</highlight></codeline>
<codeline lineno="640"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcr-&gt;original<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="641"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(pcr-&gt;original);</highlight></codeline>
<codeline lineno="642"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="643"><highlight class="normal"><sp/><sp/>ip6_frag_free_pbuf_custom_ref(pcr);</highlight></codeline>
<codeline lineno="644"><highlight class="normal">}</highlight></codeline>
<codeline lineno="645"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>!LWIP_NETIF_TX_SINGLE_PBUF<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="646"><highlight class="normal"></highlight></codeline>
<codeline lineno="659"><highlight class="normal"><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="660"><highlight class="normal">ip6_frag(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*p,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>ip6_addr_t<sp/>*dest)</highlight></codeline>
<codeline lineno="661"><highlight class="normal">{</highlight></codeline>
<codeline lineno="662"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structip6__hdr" kindref="compound">ip6_hdr</ref><sp/>*original_ip6hdr;</highlight></codeline>
<codeline lineno="663"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structip6__hdr" kindref="compound">ip6_hdr</ref><sp/>*ip6hdr;</highlight></codeline>
<codeline lineno="664"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structip6__frag__hdr" kindref="compound">ip6_frag_hdr</ref><sp/>*frag_hdr;</highlight></codeline>
<codeline lineno="665"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*rambuf;</highlight></codeline>
<codeline lineno="666"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>!LWIP_NETIF_TX_SINGLE_PBUF</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="667"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*newpbuf;</highlight></codeline>
<codeline lineno="668"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>newpbuflen<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="669"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>left_to_copy;</highlight></codeline>
<codeline lineno="670"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="671"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__compiler__abstraction_1ga4c14294869aceba3ef9d4c0c302d0f33" kindref="member">u32_t</ref><sp/>identification;</highlight></codeline>
<codeline lineno="672"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>nfb;</highlight></codeline>
<codeline lineno="673"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>left,<sp/>cop;</highlight></codeline>
<codeline lineno="674"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>mtu;</highlight></codeline>
<codeline lineno="675"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>fragment_offset<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="676"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>last;</highlight></codeline>
<codeline lineno="677"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>poff<sp/>=<sp/><ref refid="prot_2ip6_8h_1afb4c1dc527be76d8f27591dfb726c023" kindref="member">IP6_HLEN</ref>;</highlight></codeline>
<codeline lineno="678"><highlight class="normal"></highlight></codeline>
<codeline lineno="679"><highlight class="normal"><sp/><sp/>identification++;</highlight></codeline>
<codeline lineno="680"><highlight class="normal"></highlight></codeline>
<codeline lineno="681"><highlight class="normal"><sp/><sp/>original_ip6hdr<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structip6__hdr" kindref="compound">ip6_hdr</ref><sp/>*)p-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref>;</highlight></codeline>
<codeline lineno="682"><highlight class="normal"></highlight></codeline>
<codeline lineno="683"><highlight class="normal"><sp/><sp/>mtu<sp/>=<sp/>nd6_get_destination_mtu(dest,<sp/><ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="684"><highlight class="normal"></highlight></codeline>
<codeline lineno="685"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>@todo<sp/>we<sp/>assume<sp/>there<sp/>are<sp/>no<sp/>options<sp/>in<sp/>the<sp/>unfragmentable<sp/>part<sp/>(IPv6<sp/>header).<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="686"><highlight class="normal"><sp/><sp/>left<sp/>=<sp/>p-&gt;<ref refid="structpbuf_1a5259e7ec29bab9c0999b64f2e86b411f" kindref="member">tot_len</ref><sp/>-<sp/><ref refid="prot_2ip6_8h_1afb4c1dc527be76d8f27591dfb726c023" kindref="member">IP6_HLEN</ref>;</highlight></codeline>
<codeline lineno="687"><highlight class="normal"></highlight></codeline>
<codeline lineno="688"><highlight class="normal"><sp/><sp/>nfb<sp/>=<sp/>(mtu<sp/>-<sp/>(<ref refid="prot_2ip6_8h_1afb4c1dc527be76d8f27591dfb726c023" kindref="member">IP6_HLEN</ref><sp/>+<sp/><ref refid="prot_2ip6_8h_1aacda00cc76d9e7f9f3197de3b27089ea" kindref="member">IP6_FRAG_HLEN</ref>))<sp/>&amp;<sp/><ref refid="prot_2ip6_8h_1a4ada75ee94d08af1a0d2656e6d14d7d9" kindref="member">IP6_FRAG_OFFSET_MASK</ref>;</highlight></codeline>
<codeline lineno="689"><highlight class="normal"></highlight></codeline>
<codeline lineno="690"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(left)<sp/>{</highlight></codeline>
<codeline lineno="691"><highlight class="normal"><sp/><sp/><sp/><sp/>last<sp/>=<sp/>(left<sp/>&lt;=<sp/>nfb);</highlight></codeline>
<codeline lineno="692"><highlight class="normal"></highlight></codeline>
<codeline lineno="693"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Fill<sp/>this<sp/>fragment<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="694"><highlight class="normal"><sp/><sp/><sp/><sp/>cop<sp/>=<sp/>last<sp/>?<sp/>left<sp/>:<sp/>nfb;</highlight></codeline>
<codeline lineno="695"><highlight class="normal"></highlight></codeline>
<codeline lineno="696"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_NETIF_TX_SINGLE_PBUF</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="697"><highlight class="normal"><sp/><sp/><sp/><sp/>rambuf<sp/>=<sp/><ref refid="group__pbuf_1gacfcb0a2af918658ba0afe36499c65f47" kindref="member">pbuf_alloc</ref>(<ref refid="group__pbuf_1ggaee1baa59bb2f85ba575b5a8619ac1ebfafcc1e506061ba69dfa142eb6b3da5f13" kindref="member">PBUF_IP</ref>,<sp/>cop<sp/>+<sp/><ref refid="prot_2ip6_8h_1aacda00cc76d9e7f9f3197de3b27089ea" kindref="member">IP6_FRAG_HLEN</ref>,<sp/><ref refid="group__pbuf_1ggab7e0e32fcc292c0d7107721766ed92fbac5e9f28455bca98944a030d4b84ecfab" kindref="member">PBUF_RAM</ref>);</highlight></codeline>
<codeline lineno="698"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(rambuf<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="699"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1ac74aa05083bf4034fe2cc1efd5fde36c" kindref="member">IP6_FRAG_STATS_INC</ref>(ip6_frag.memerr);</highlight></codeline>
<codeline lineno="700"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaaaeafdbf3aecc46864daa3cd829c7e05" kindref="member">ERR_MEM</ref>;</highlight></codeline>
<codeline lineno="701"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="702"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;this<sp/>needs<sp/>a<sp/>pbuf<sp/>in<sp/>one<sp/>piece!&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="703"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>(rambuf-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref><sp/>==<sp/>rambuf-&gt;<ref refid="structpbuf_1a5259e7ec29bab9c0999b64f2e86b411f" kindref="member">tot_len</ref>)<sp/>&amp;&amp;<sp/>(rambuf-&gt;<ref refid="structpbuf_1a5e5763c94fd18d78937b0b58ce7df341" kindref="member">next</ref><sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>));</highlight></codeline>
<codeline lineno="704"><highlight class="normal"><sp/><sp/><sp/><sp/>poff<sp/>+=<sp/><ref refid="group__pbuf_1gac2f1f58fd36042e82af46f5015720899" kindref="member">pbuf_copy_partial</ref>(p,<sp/>(<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref>*)rambuf-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref><sp/>+<sp/><ref refid="prot_2ip6_8h_1aacda00cc76d9e7f9f3197de3b27089ea" kindref="member">IP6_FRAG_HLEN</ref>,<sp/>cop,<sp/>poff);</highlight></codeline>
<codeline lineno="705"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>make<sp/>room<sp/>for<sp/>the<sp/>IP<sp/>header<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="706"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="pbuf_8h_1aaa17c1951cf2d207b6adfd3947d91f00" kindref="member">pbuf_header</ref>(rambuf,<sp/><ref refid="prot_2ip6_8h_1afb4c1dc527be76d8f27591dfb726c023" kindref="member">IP6_HLEN</ref>))<sp/>{</highlight></codeline>
<codeline lineno="707"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(rambuf);</highlight></codeline>
<codeline lineno="708"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1ac74aa05083bf4034fe2cc1efd5fde36c" kindref="member">IP6_FRAG_STATS_INC</ref>(ip6_frag.memerr);</highlight></codeline>
<codeline lineno="709"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaaaeafdbf3aecc46864daa3cd829c7e05" kindref="member">ERR_MEM</ref>;</highlight></codeline>
<codeline lineno="710"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="711"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>fill<sp/>in<sp/>the<sp/>IP<sp/>header<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="712"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="lwipopts_8h_1a8c6e3c1e4f74acb16376188dbf8909ec" kindref="member">SMEMCPY</ref>(rambuf-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref>,<sp/>original_ip6hdr,<sp/><ref refid="prot_2ip6_8h_1afb4c1dc527be76d8f27591dfb726c023" kindref="member">IP6_HLEN</ref>);</highlight></codeline>
<codeline lineno="713"><highlight class="normal"><sp/><sp/><sp/><sp/>ip6hdr<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structip6__hdr" kindref="compound">ip6_hdr</ref><sp/>*)rambuf-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref>;</highlight></codeline>
<codeline lineno="714"><highlight class="normal"><sp/><sp/><sp/><sp/>frag_hdr<sp/>=<sp/>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structip6__frag__hdr" kindref="compound">ip6_frag_hdr</ref><sp/>*)((<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref>*)rambuf-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref><sp/>+<sp/><ref refid="prot_2ip6_8h_1afb4c1dc527be76d8f27591dfb726c023" kindref="member">IP6_HLEN</ref>);</highlight></codeline>
<codeline lineno="715"><highlight class="normal"></highlight><highlight class="preprocessor">#else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="716"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>When<sp/>not<sp/>using<sp/>a<sp/>static<sp/>buffer,<sp/>create<sp/>a<sp/>chain<sp/>of<sp/>pbufs.</highlight></codeline>
<codeline lineno="717"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>*<sp/>The<sp/>first<sp/>will<sp/>be<sp/>a<sp/>PBUF_RAM<sp/>holding<sp/>the<sp/>link,<sp/>IPv6,<sp/>and<sp/>Fragment<sp/>header.</highlight></codeline>
<codeline lineno="718"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>*<sp/>The<sp/>rest<sp/>will<sp/>be<sp/>PBUF_REFs<sp/>mirroring<sp/>the<sp/>pbuf<sp/>chain<sp/>to<sp/>be<sp/>fragged,</highlight></codeline>
<codeline lineno="719"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>*<sp/>but<sp/>limited<sp/>to<sp/>the<sp/>size<sp/>of<sp/>an<sp/>mtu.</highlight></codeline>
<codeline lineno="720"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="721"><highlight class="normal"><sp/><sp/><sp/><sp/>rambuf<sp/>=<sp/><ref refid="group__pbuf_1gacfcb0a2af918658ba0afe36499c65f47" kindref="member">pbuf_alloc</ref>(<ref refid="group__pbuf_1ggaee1baa59bb2f85ba575b5a8619ac1ebfab4de441e737330558b609a990cd17346" kindref="member">PBUF_LINK</ref>,<sp/><ref refid="prot_2ip6_8h_1afb4c1dc527be76d8f27591dfb726c023" kindref="member">IP6_HLEN</ref><sp/>+<sp/><ref refid="prot_2ip6_8h_1aacda00cc76d9e7f9f3197de3b27089ea" kindref="member">IP6_FRAG_HLEN</ref>,<sp/><ref refid="group__pbuf_1ggab7e0e32fcc292c0d7107721766ed92fbac5e9f28455bca98944a030d4b84ecfab" kindref="member">PBUF_RAM</ref>);</highlight></codeline>
<codeline lineno="722"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(rambuf<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="723"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1ac74aa05083bf4034fe2cc1efd5fde36c" kindref="member">IP6_FRAG_STATS_INC</ref>(ip6_frag.memerr);</highlight></codeline>
<codeline lineno="724"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaaaeafdbf3aecc46864daa3cd829c7e05" kindref="member">ERR_MEM</ref>;</highlight></codeline>
<codeline lineno="725"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="726"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;this<sp/>needs<sp/>a<sp/>pbuf<sp/>in<sp/>one<sp/>piece!&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="727"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(p-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref><sp/>&gt;=<sp/>(<ref refid="prot_2ip6_8h_1afb4c1dc527be76d8f27591dfb726c023" kindref="member">IP6_HLEN</ref>)));</highlight></codeline>
<codeline lineno="728"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="lwipopts_8h_1a8c6e3c1e4f74acb16376188dbf8909ec" kindref="member">SMEMCPY</ref>(rambuf-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref>,<sp/>original_ip6hdr,<sp/><ref refid="prot_2ip6_8h_1afb4c1dc527be76d8f27591dfb726c023" kindref="member">IP6_HLEN</ref>);</highlight></codeline>
<codeline lineno="729"><highlight class="normal"><sp/><sp/><sp/><sp/>ip6hdr<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structip6__hdr" kindref="compound">ip6_hdr</ref><sp/>*)rambuf-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref>;</highlight></codeline>
<codeline lineno="730"><highlight class="normal"><sp/><sp/><sp/><sp/>frag_hdr<sp/>=<sp/>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structip6__frag__hdr" kindref="compound">ip6_frag_hdr</ref><sp/>*)((<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref>*)rambuf-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref><sp/>+<sp/><ref refid="prot_2ip6_8h_1afb4c1dc527be76d8f27591dfb726c023" kindref="member">IP6_HLEN</ref>);</highlight></codeline>
<codeline lineno="731"><highlight class="normal"></highlight></codeline>
<codeline lineno="732"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Can<sp/>just<sp/>adjust<sp/>p<sp/>directly<sp/>for<sp/>needed<sp/>offset.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="733"><highlight class="normal"><sp/><sp/><sp/><sp/>p-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref><sp/>=<sp/>(<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>*)p-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref><sp/>+<sp/>poff;</highlight></codeline>
<codeline lineno="734"><highlight class="normal"><sp/><sp/><sp/><sp/>p-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref><sp/>-=<sp/>poff;</highlight></codeline>
<codeline lineno="735"><highlight class="normal"><sp/><sp/><sp/><sp/>p-&gt;<ref refid="structpbuf_1a5259e7ec29bab9c0999b64f2e86b411f" kindref="member">tot_len</ref><sp/>-=<sp/>poff;</highlight></codeline>
<codeline lineno="736"><highlight class="normal"></highlight></codeline>
<codeline lineno="737"><highlight class="normal"><sp/><sp/><sp/><sp/>left_to_copy<sp/>=<sp/>cop;</highlight></codeline>
<codeline lineno="738"><highlight class="normal"><sp/><sp/><sp/><sp/>while<sp/>(left_to_copy)<sp/>{</highlight></codeline>
<codeline lineno="739"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">pbuf_custom_ref<sp/>*pcr;</highlight></codeline>
<codeline lineno="740"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>newpbuflen<sp/>=<sp/>(left_to_copy<sp/>&lt;<sp/>p-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref>)<sp/>?<sp/>left_to_copy<sp/>:<sp/>p-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref>;</highlight></codeline>
<codeline lineno="741"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Is<sp/>this<sp/>pbuf<sp/>already<sp/>empty?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="742"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>if<sp/>(!newpbuflen)<sp/>{</highlight></codeline>
<codeline lineno="743"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>p<sp/>=<sp/>p-&gt;<ref refid="structpbuf_1a5e5763c94fd18d78937b0b58ce7df341" kindref="member">next</ref>;</highlight></codeline>
<codeline lineno="744"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">continue</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="745"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="746"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>pcr<sp/>=<sp/>ip6_frag_alloc_pbuf_custom_ref();</highlight></codeline>
<codeline lineno="747"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(pcr<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="748"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(rambuf);</highlight></codeline>
<codeline lineno="749"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1ac74aa05083bf4034fe2cc1efd5fde36c" kindref="member">IP6_FRAG_STATS_INC</ref>(ip6_frag.memerr);</highlight></codeline>
<codeline lineno="750"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaaaeafdbf3aecc46864daa3cd829c7e05" kindref="member">ERR_MEM</ref>;</highlight></codeline>
<codeline lineno="751"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="752"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Mirror<sp/>this<sp/>pbuf,<sp/>although<sp/>we<sp/>might<sp/>not<sp/>need<sp/>all<sp/>of<sp/>it.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="753"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>newpbuf<sp/>=<sp/>pbuf_alloced_custom(<ref refid="group__pbuf_1ggaee1baa59bb2f85ba575b5a8619ac1ebfa21116654fbab6d5a4dfeb87a1bb8f0ba" kindref="member">PBUF_RAW</ref>,<sp/>newpbuflen,<sp/><ref refid="group__pbuf_1ggab7e0e32fcc292c0d7107721766ed92fbac9b6ba960fdea6f2e8f35c8313b77e4e" kindref="member">PBUF_REF</ref>,<sp/>&amp;pcr-&gt;pc,<sp/>p-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref>,<sp/>newpbuflen);</highlight></codeline>
<codeline lineno="754"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(newpbuf<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="755"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ip6_frag_free_pbuf_custom_ref(pcr);</highlight></codeline>
<codeline lineno="756"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(rambuf);</highlight></codeline>
<codeline lineno="757"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1ac74aa05083bf4034fe2cc1efd5fde36c" kindref="member">IP6_FRAG_STATS_INC</ref>(ip6_frag.memerr);</highlight></codeline>
<codeline lineno="758"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaaaeafdbf3aecc46864daa3cd829c7e05" kindref="member">ERR_MEM</ref>;</highlight></codeline>
<codeline lineno="759"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="760"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1ga77f6bbd69e45e542014d9c547c7da74e" kindref="member">pbuf_ref</ref>(p);</highlight></codeline>
<codeline lineno="761"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>pcr-&gt;original<sp/>=<sp/>p;</highlight></codeline>
<codeline lineno="762"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>pcr-&gt;pc.custom_free_function<sp/>=<sp/>ip6_frag_free_pbuf_custom;</highlight></codeline>
<codeline lineno="763"><highlight class="normal"></highlight></codeline>
<codeline lineno="764"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Add<sp/>it<sp/>to<sp/>end<sp/>of<sp/>rambuf&apos;s<sp/>chain,<sp/>but<sp/>using<sp/>pbuf_cat,<sp/>not<sp/>pbuf_chain</highlight></codeline>
<codeline lineno="765"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*<sp/>so<sp/>that<sp/>it<sp/>is<sp/>removed<sp/>when<sp/>pbuf_dechain<sp/>is<sp/>later<sp/>called<sp/>on<sp/>rambuf.</highlight></codeline>
<codeline lineno="766"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="767"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1ga82429084fe29015509c9b4a072707cd4" kindref="member">pbuf_cat</ref>(rambuf,<sp/>newpbuf);</highlight></codeline>
<codeline lineno="768"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>left_to_copy<sp/>-=<sp/>newpbuflen;</highlight></codeline>
<codeline lineno="769"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(left_to_copy)<sp/>{</highlight></codeline>
<codeline lineno="770"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>p<sp/>=<sp/>p-&gt;<ref refid="structpbuf_1a5e5763c94fd18d78937b0b58ce7df341" kindref="member">next</ref>;</highlight></codeline>
<codeline lineno="771"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="772"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="773"><highlight class="normal"><sp/><sp/><sp/><sp/>poff<sp/>=<sp/>newpbuflen;</highlight></codeline>
<codeline lineno="774"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_NETIF_TX_SINGLE_PBUF<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="775"><highlight class="normal"></highlight></codeline>
<codeline lineno="776"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Set<sp/>headers<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="777"><highlight class="normal"><sp/><sp/><sp/><sp/>frag_hdr-&gt;_nexth<sp/>=<sp/>original_ip6hdr-&gt;_nexth;</highlight></codeline>
<codeline lineno="778"><highlight class="normal"><sp/><sp/><sp/><sp/>frag_hdr-&gt;reserved<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="779"><highlight class="normal"><sp/><sp/><sp/><sp/>frag_hdr-&gt;_fragment_offset<sp/>=<sp/><ref refid="def_8c_1ad637280639de4066392e6b5614fa3e56" kindref="member">lwip_htons</ref>((fragment_offset<sp/>&amp;<sp/><ref refid="prot_2ip6_8h_1a4ada75ee94d08af1a0d2656e6d14d7d9" kindref="member">IP6_FRAG_OFFSET_MASK</ref>)<sp/>|<sp/>(last<sp/>?<sp/>0<sp/>:<sp/><ref refid="prot_2ip6_8h_1a4e60dc945c0061d3d4dc4a84132a506b" kindref="member">IP6_FRAG_MORE_FLAG</ref>));</highlight></codeline>
<codeline lineno="780"><highlight class="normal"><sp/><sp/><sp/><sp/>frag_hdr-&gt;_identification<sp/>=<sp/><ref refid="def_8c_1a14f94347a5b9b9e3602705b75b7ae524" kindref="member">lwip_htonl</ref>(identification);</highlight></codeline>
<codeline lineno="781"><highlight class="normal"></highlight></codeline>
<codeline lineno="782"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="prot_2ip6_8h_1a85d62e6278b0bed9e3b88df777be612c" kindref="member">IP6H_NEXTH_SET</ref>(ip6hdr,<sp/><ref refid="prot_2ip6_8h_1a1a72bdc1494ea84cbf16424e9aedcd79" kindref="member">IP6_NEXTH_FRAGMENT</ref>);</highlight></codeline>
<codeline lineno="783"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="prot_2ip6_8h_1a2d727ccfecc56fb1e35ea4f7249f399b" kindref="member">IP6H_PLEN_SET</ref>(ip6hdr,<sp/>cop<sp/>+<sp/><ref refid="prot_2ip6_8h_1aacda00cc76d9e7f9f3197de3b27089ea" kindref="member">IP6_FRAG_HLEN</ref>);</highlight></codeline>
<codeline lineno="784"><highlight class="normal"></highlight></codeline>
<codeline lineno="785"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>No<sp/>need<sp/>for<sp/>separate<sp/>header<sp/>pbuf<sp/>-<sp/>we<sp/>allowed<sp/>room<sp/>for<sp/>it<sp/>in<sp/>rambuf</highlight></codeline>
<codeline lineno="786"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>*<sp/>when<sp/>allocated.</highlight></codeline>
<codeline lineno="787"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="788"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="stats_8h_1ac74aa05083bf4034fe2cc1efd5fde36c" kindref="member">IP6_FRAG_STATS_INC</ref>(ip6_frag.xmit);</highlight></codeline>
<codeline lineno="789"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structnetif" kindref="compound">netif</ref>-&gt;output_ip6(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>rambuf,<sp/>dest);</highlight></codeline>
<codeline lineno="790"><highlight class="normal"></highlight></codeline>
<codeline lineno="791"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Unfortunately<sp/>we<sp/>can&apos;t<sp/>reuse<sp/>rambuf<sp/>-<sp/>the<sp/>hardware<sp/>may<sp/>still<sp/>be</highlight></codeline>
<codeline lineno="792"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>*<sp/>using<sp/>the<sp/>buffer.<sp/>Instead<sp/>we<sp/>free<sp/>it<sp/>(and<sp/>the<sp/>ensuing<sp/>chain)<sp/>and</highlight></codeline>
<codeline lineno="793"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>*<sp/>recreate<sp/>it<sp/>next<sp/>time<sp/>round<sp/>the<sp/>loop.<sp/>If<sp/>we&apos;re<sp/>lucky<sp/>the<sp/>hardware</highlight></codeline>
<codeline lineno="794"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>*<sp/>will<sp/>have<sp/>already<sp/>sent<sp/>the<sp/>packet,<sp/>the<sp/>free<sp/>will<sp/>really<sp/>free,<sp/>and</highlight></codeline>
<codeline lineno="795"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>*<sp/>there<sp/>will<sp/>be<sp/>zero<sp/>memory<sp/>penalty.</highlight></codeline>
<codeline lineno="796"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="797"><highlight class="normal"></highlight></codeline>
<codeline lineno="798"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(rambuf);</highlight></codeline>
<codeline lineno="799"><highlight class="normal"><sp/><sp/><sp/><sp/>left<sp/>-=<sp/>cop;</highlight></codeline>
<codeline lineno="800"><highlight class="normal"><sp/><sp/><sp/><sp/>fragment_offset<sp/>+=<sp/>cop;</highlight></codeline>
<codeline lineno="801"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="802"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" kindref="member">ERR_OK</ref>;</highlight></codeline>
<codeline lineno="803"><highlight class="normal">}</highlight></codeline>
<codeline lineno="804"><highlight class="normal"></highlight></codeline>
<codeline lineno="805"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_IPV6<sp/>&amp;&amp;<sp/>LWIP_IPV6_FRAG<sp/>*/</highlight><highlight class="preprocessor"></highlight></codeline>
    </programlisting>
    <location file="C:/Dev/git/UbixOS/sys/net/core/ipv6/ip6_frag.c"/>
  </compounddef>
</doxygen>
