<?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="ip4_8c" kind="file" language="C++">
    <compoundname>ip4.c</compoundname>
    <includes refid="opt_8h" local="yes">net/opt.h</includes>
    <incdepgraph>
      <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="15">
        <label>sys/io.h</label>
        <link refid="io_8h"/>
      </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="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="3">
        <label>net/lwipopts.h</label>
        <link refid="lwipopts_8h"/>
      </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="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="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="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="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="10">
        <label>sys/_timespec.h</label>
        <link refid="__timespec_8h"/>
        <childnode refid="7" relation="include">
        </childnode>
      </node>
      <node id="1">
        <label>C:/Dev/git/UbixOS/sys/net/core/ipv4/ip4.c</label>
        <link refid="ip4_8c"/>
        <childnode refid="2" relation="include">
        </childnode>
      </node>
      <node id="11">
        <label>sys/_timeval.h</label>
        <link refid="__timeval_8h"/>
        <childnode refid="7" relation="include">
        </childnode>
      </node>
    </incdepgraph>
    <briefdescription>
    </briefdescription>
    <detaileddescription>
<para>This is the IPv4 layer implementation for incoming and outgoing IP traffic.</para>
<para><simplesect kind="see"><para>ip_frag.c </para>
</simplesect>
</para>
    </detaileddescription>
    <programlisting>
<codeline lineno="1"></codeline>
<codeline lineno="9"><highlight class="comment">/*</highlight></codeline>
<codeline lineno="10"><highlight class="comment"><sp/>*<sp/>Copyright<sp/>(c)<sp/>2001-2004<sp/>Swedish<sp/>Institute<sp/>of<sp/>Computer<sp/>Science.</highlight></codeline>
<codeline lineno="11"><highlight class="comment"><sp/>*<sp/>All<sp/>rights<sp/>reserved.</highlight></codeline>
<codeline lineno="12"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="13"><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="14"><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="15"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="16"><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="17"><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="18"><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="19"><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="20"><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="21"><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="22"><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="23"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="24"><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="25"><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="26"><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="27"><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="28"><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="29"><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="30"><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="31"><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="32"><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="33"><highlight class="comment"><sp/>*<sp/>OF<sp/>SUCH<sp/>DAMAGE.</highlight></codeline>
<codeline lineno="34"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="35"><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="36"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="37"><highlight class="comment"><sp/>*<sp/>Author:<sp/>Adam<sp/>Dunkels<sp/>&lt;adam@sics.se&gt;</highlight></codeline>
<codeline lineno="38"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="39"><highlight class="comment"><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="40"><highlight class="normal"></highlight></codeline>
<codeline lineno="41"><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="42"><highlight class="normal"></highlight></codeline>
<codeline lineno="43"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_IPV4</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="44"><highlight class="normal"></highlight></codeline>
<codeline lineno="45"><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="46"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="def_8h" kindref="compound">net/def.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="47"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="mem_8h" kindref="compound">net/mem.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="48"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="ip4__frag_8h" kindref="compound">net/ip4_frag.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="49"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="inet__chksum_8h" kindref="compound">net/inet_chksum.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="50"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="netif_8h" kindref="compound">net/netif.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="51"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="icmp_8h" kindref="compound">net/icmp.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="52"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="igmp_8h" kindref="compound">net/igmp.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="53"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="raw_8h" kindref="compound">net/raw.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="54"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="udp_8h" kindref="compound">net/udp.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="55"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="tcp__priv_8h" kindref="compound">net/priv/tcp_priv.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="56"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="autoip_8h" kindref="compound">net/autoip.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="57"><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="58"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="prot_2dhcp_8h" kindref="compound">net/prot/dhcp.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="59"><highlight class="normal"></highlight></codeline>
<codeline lineno="60"><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="61"><highlight class="normal"></highlight></codeline>
<codeline lineno="62"><highlight class="normal"></highlight><highlight class="preprocessor">#ifdef<sp/>LWIP_HOOK_FILENAME</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="63"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>LWIP_HOOK_FILENAME</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="64"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="65"><highlight class="normal"></highlight></codeline>
<codeline lineno="68"><highlight class="preprocessor">#ifndef<sp/>LWIP_INLINE_IP_CHKSUM</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="69"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_CHECKSUM_CTRL_PER_NETIF</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="70"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>LWIP_INLINE_IP_CHKSUM<sp/><sp/><sp/>0</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="71"><highlight class="normal"></highlight><highlight class="preprocessor">#else<sp/></highlight><highlight class="comment">/*<sp/>LWIP_CHECKSUM_CTRL_PER_NETIF<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="72"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>LWIP_INLINE_IP_CHKSUM<sp/><sp/><sp/>1</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="73"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_CHECKSUM_CTRL_PER_NETIF<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="74"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="75"><highlight class="normal"></highlight></codeline>
<codeline lineno="76"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_INLINE_IP_CHKSUM<sp/>&amp;&amp;<sp/>CHECKSUM_GEN_IP</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="77"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>CHECKSUM_GEN_IP_INLINE<sp/><sp/>1</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="78"><highlight class="normal"></highlight><highlight class="preprocessor">#else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="79"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>CHECKSUM_GEN_IP_INLINE<sp/><sp/>0</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="80"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="81"><highlight class="normal"></highlight></codeline>
<codeline lineno="82"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_DHCP<sp/>||<sp/>defined(LWIP_IP_ACCEPT_UDP_PORT)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="83"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>IP_ACCEPT_LINK_LAYER_ADDRESSING<sp/>1</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="84"><highlight class="normal"></highlight></codeline>
<codeline lineno="90"><highlight class="preprocessor">#if<sp/>LWIP_DHCP<sp/>&amp;&amp;<sp/>defined(LWIP_IP_ACCEPT_UDP_PORT)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="91"><highlight class="normal"></highlight><highlight class="comment">/*<sp/>accept<sp/>DHCP<sp/>client<sp/>port<sp/>and<sp/>custom<sp/>port<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="92"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>IP_ACCEPT_LINK_LAYER_ADDRESSED_PORT(port)<sp/>(((port)<sp/>==<sp/>PP_NTOHS(DHCP_CLIENT_PORT))<sp/>\</highlight></codeline>
<codeline lineno="93"><highlight class="preprocessor"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>||<sp/>(LWIP_IP_ACCEPT_UDP_PORT(port)))</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="94"><highlight class="normal"></highlight><highlight class="preprocessor">#elif<sp/>defined(LWIP_IP_ACCEPT_UDP_PORT)<sp/></highlight><highlight class="comment">/*<sp/>LWIP_DHCP<sp/>&amp;&amp;<sp/>defined(LWIP_IP_ACCEPT_UDP_PORT)<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="95"><highlight class="normal"></highlight><highlight class="comment">/*<sp/>accept<sp/>custom<sp/>port<sp/>only<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="96"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>IP_ACCEPT_LINK_LAYER_ADDRESSED_PORT(port)<sp/>(LWIP_IP_ACCEPT_UDP_PORT(port))</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="97"><highlight class="normal"></highlight><highlight class="preprocessor">#else<sp/></highlight><highlight class="comment">/*<sp/>LWIP_DHCP<sp/>&amp;&amp;<sp/>defined(LWIP_IP_ACCEPT_UDP_PORT)<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="98"><highlight class="normal"></highlight><highlight class="comment">/*<sp/>accept<sp/>DHCP<sp/>client<sp/>port<sp/>only<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="99"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>IP_ACCEPT_LINK_LAYER_ADDRESSED_PORT(port)<sp/>((port)<sp/>==<sp/>PP_NTOHS(DHCP_CLIENT_PORT))</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="100"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_DHCP<sp/>&amp;&amp;<sp/>defined(LWIP_IP_ACCEPT_UDP_PORT)<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="101"><highlight class="normal"></highlight></codeline>
<codeline lineno="102"><highlight class="normal"></highlight><highlight class="preprocessor">#else<sp/></highlight><highlight class="comment">/*<sp/>LWIP_DHCP<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="103"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>IP_ACCEPT_LINK_LAYER_ADDRESSING<sp/>0</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="104"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_DHCP<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="105"><highlight class="normal"></highlight></codeline>
<codeline lineno="107"><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>ip_id;</highlight></codeline>
<codeline lineno="108"><highlight class="normal"></highlight></codeline>
<codeline lineno="109"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_MULTICAST_TX_OPTIONS</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="110"><highlight class="normal"></highlight></codeline>
<codeline lineno="111"><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structnetif" kindref="compound">netif</ref>*<sp/>ip4_default_multicast_netif;</highlight></codeline>
<codeline lineno="112"><highlight class="normal"></highlight></codeline>
<codeline lineno="116"><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="117"><highlight class="normal">ip4_set_default_multicast_netif(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref>*<sp/>default_multicast_netif)</highlight></codeline>
<codeline lineno="118"><highlight class="normal">{</highlight></codeline>
<codeline lineno="119"><highlight class="normal"><sp/><sp/>ip4_default_multicast_netif<sp/>=<sp/>default_multicast_netif;</highlight></codeline>
<codeline lineno="120"><highlight class="normal">}</highlight></codeline>
<codeline lineno="121"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_MULTICAST_TX_OPTIONS<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="122"><highlight class="normal"></highlight></codeline>
<codeline lineno="123"><highlight class="normal"></highlight><highlight class="preprocessor">#ifdef<sp/>LWIP_HOOK_IP4_ROUTE_SRC</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="124"><highlight class="normal"></highlight></codeline>
<codeline lineno="128"><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structnetif" kindref="compound">netif</ref><sp/>*</highlight></codeline>
<codeline lineno="129"><highlight class="normal">ip4_route_src(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>ip4_addr_t<sp/>*dest,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>ip4_addr_t<sp/>*src)</highlight></codeline>
<codeline lineno="130"><highlight class="normal">{</highlight></codeline>
<codeline lineno="131"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(src<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="132"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>when<sp/>src==NULL,<sp/>the<sp/>hook<sp/>is<sp/>called<sp/>from<sp/>ip4_route(dest)<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="133"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref><sp/>=<sp/>LWIP_HOOK_IP4_ROUTE_SRC(dest,<sp/>src);</highlight></codeline>
<codeline lineno="134"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="structnetif" kindref="compound">netif</ref><sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="135"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref>;</highlight></codeline>
<codeline lineno="136"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="137"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="138"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>ip4_route(dest);</highlight></codeline>
<codeline lineno="139"><highlight class="normal">}</highlight></codeline>
<codeline lineno="140"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_HOOK_IP4_ROUTE_SRC<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="141"><highlight class="normal"></highlight></codeline>
<codeline lineno="151"><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structnetif" kindref="compound">netif</ref><sp/>*</highlight></codeline>
<codeline lineno="152"><highlight class="normal">ip4_route(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>ip4_addr_t<sp/>*dest)</highlight></codeline>
<codeline lineno="153"><highlight class="normal">{</highlight></codeline>
<codeline lineno="154"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>;</highlight></codeline>
<codeline lineno="155"><highlight class="normal"></highlight></codeline>
<codeline lineno="156"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_MULTICAST_TX_OPTIONS</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="157"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Use<sp/>administratively<sp/>selected<sp/>interface<sp/>for<sp/>multicast<sp/>by<sp/>default<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="158"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ip4_addr_ismulticast(dest)<sp/>&amp;&amp;<sp/>ip4_default_multicast_netif)<sp/>{</highlight></codeline>
<codeline lineno="159"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>ip4_default_multicast_netif;</highlight></codeline>
<codeline lineno="160"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="161"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_MULTICAST_TX_OPTIONS<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="162"><highlight class="normal"></highlight></codeline>
<codeline lineno="163"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>iterate<sp/>through<sp/>netifs<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="164"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(<ref refid="structnetif" kindref="compound">netif</ref><sp/>=<sp/><ref refid="netif_8h_1a1c8141eaa98f6dc6dfddbb23a706656c" kindref="member">netif_list</ref>;<sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;<sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>=<sp/><ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1ae77736b64df442242795220d76be6b86" kindref="member">next</ref>)<sp/>{</highlight></codeline>
<codeline lineno="165"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>is<sp/>the<sp/>netif<sp/>up,<sp/>does<sp/>it<sp/>have<sp/>a<sp/>link<sp/>and<sp/>a<sp/>valid<sp/>address?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="166"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="group__netif_1ga94a4c24c988afc0a577387730f303b19" kindref="member">netif_is_up</ref>(<ref refid="structnetif" kindref="compound">netif</ref>)<sp/>&amp;&amp;<sp/><ref refid="netif_8h_1a780be4c3fa9f7f2534f7865666c3a1b8" kindref="member">netif_is_link_up</ref>(<ref refid="structnetif" kindref="compound">netif</ref>)<sp/>&amp;&amp;<sp/>!ip4_addr_isany_val(*netif_ip4_addr(<ref refid="structnetif" kindref="compound">netif</ref>)))<sp/>{</highlight></codeline>
<codeline lineno="167"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>network<sp/>mask<sp/>matches?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="168"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ip4_addr_netcmp(dest,<sp/>netif_ip4_addr(<ref refid="structnetif" kindref="compound">netif</ref>),<sp/>netif_ip4_netmask(<ref refid="structnetif" kindref="compound">netif</ref>)))<sp/>{</highlight></codeline>
<codeline lineno="169"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>return<sp/>netif<sp/>on<sp/>which<sp/>to<sp/>forward<sp/>IP<sp/>packet<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="170"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref>;</highlight></codeline>
<codeline lineno="171"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="172"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>gateway<sp/>matches<sp/>on<sp/>a<sp/>non<sp/>broadcast<sp/>interface?<sp/>(i.e.<sp/>peer<sp/>in<sp/>a<sp/>point<sp/>to<sp/>point<sp/>interface)<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="173"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(((<ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1a1c171db6097bbb6f09f63549a66e00ea" kindref="member">flags</ref><sp/>&amp;<sp/><ref refid="group__netif__flags_1gaef64fe15c82bc7b235366923e517104e" kindref="member">NETIF_FLAG_BROADCAST</ref>)<sp/>==<sp/>0)<sp/>&amp;&amp;<sp/>ip4_addr_cmp(dest,<sp/>netif_ip4_gw(<ref refid="structnetif" kindref="compound">netif</ref>)))<sp/>{</highlight></codeline>
<codeline lineno="174"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>return<sp/>netif<sp/>on<sp/>which<sp/>to<sp/>forward<sp/>IP<sp/>packet<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="175"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref>;</highlight></codeline>
<codeline lineno="176"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="177"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="178"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="179"><highlight class="normal"></highlight></codeline>
<codeline lineno="180"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_NETIF_LOOPBACK<sp/>&amp;&amp;<sp/>!LWIP_HAVE_LOOPIF</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="181"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>loopif<sp/>is<sp/>disabled,<sp/>looopback<sp/>traffic<sp/>is<sp/>passed<sp/>through<sp/>any<sp/>netif<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="182"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ip4_addr_isloopback(dest))<sp/>{</highlight></codeline>
<codeline lineno="183"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>don&apos;t<sp/>check<sp/>for<sp/>link<sp/>on<sp/>loopback<sp/>traffic<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="184"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="netif_8h_1a3d0925cbce550ed461907aee816713ba" kindref="member">netif_default</ref><sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref><sp/>&amp;&amp;<sp/><ref refid="group__netif_1ga94a4c24c988afc0a577387730f303b19" kindref="member">netif_is_up</ref>(<ref refid="netif_8h_1a3d0925cbce550ed461907aee816713ba" kindref="member">netif_default</ref>))<sp/>{</highlight></codeline>
<codeline lineno="185"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="netif_8h_1a3d0925cbce550ed461907aee816713ba" kindref="member">netif_default</ref>;</highlight></codeline>
<codeline lineno="186"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="187"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>default<sp/>netif<sp/>is<sp/>not<sp/>up,<sp/>just<sp/>use<sp/>any<sp/>netif<sp/>for<sp/>loopback<sp/>traffic<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="188"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(<ref refid="structnetif" kindref="compound">netif</ref><sp/>=<sp/><ref refid="netif_8h_1a1c8141eaa98f6dc6dfddbb23a706656c" kindref="member">netif_list</ref>;<sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;<sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>=<sp/><ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1ae77736b64df442242795220d76be6b86" kindref="member">next</ref>)<sp/>{</highlight></codeline>
<codeline lineno="189"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="group__netif_1ga94a4c24c988afc0a577387730f303b19" kindref="member">netif_is_up</ref>(<ref refid="structnetif" kindref="compound">netif</ref>))<sp/>{</highlight></codeline>
<codeline lineno="190"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref>;</highlight></codeline>
<codeline lineno="191"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="192"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="193"><highlight class="normal"><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="194"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="195"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_NETIF_LOOPBACK<sp/>&amp;&amp;<sp/>!LWIP_HAVE_LOOPIF<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="196"><highlight class="normal"></highlight></codeline>
<codeline lineno="197"><highlight class="normal"></highlight><highlight class="preprocessor">#ifdef<sp/>LWIP_HOOK_IP4_ROUTE_SRC</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="198"><highlight class="normal"><sp/><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>=<sp/>LWIP_HOOK_IP4_ROUTE_SRC(dest,<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>);</highlight></codeline>
<codeline lineno="199"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="structnetif" kindref="compound">netif</ref><sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="200"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref>;</highlight></codeline>
<codeline lineno="201"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="202"><highlight class="normal"></highlight><highlight class="preprocessor">#elif<sp/>defined(LWIP_HOOK_IP4_ROUTE)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="203"><highlight class="normal"><sp/><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>=<sp/>LWIP_HOOK_IP4_ROUTE(dest);</highlight></codeline>
<codeline lineno="204"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="structnetif" kindref="compound">netif</ref><sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="205"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref>;</highlight></codeline>
<codeline lineno="206"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="207"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="208"><highlight class="normal"></highlight></codeline>
<codeline lineno="209"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((<ref refid="netif_8h_1a3d0925cbce550ed461907aee816713ba" kindref="member">netif_default</ref><sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>||<sp/>!<ref refid="group__netif_1ga94a4c24c988afc0a577387730f303b19" kindref="member">netif_is_up</ref>(<ref refid="netif_8h_1a3d0925cbce550ed461907aee816713ba" kindref="member">netif_default</ref>)<sp/>||<sp/>!<ref refid="netif_8h_1a780be4c3fa9f7f2534f7865666c3a1b8" kindref="member">netif_is_link_up</ref>(<ref refid="netif_8h_1a3d0925cbce550ed461907aee816713ba" kindref="member">netif_default</ref>)<sp/>||</highlight></codeline>
<codeline lineno="210"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>ip4_addr_isany_val(*netif_ip4_addr(<ref refid="netif_8h_1a3d0925cbce550ed461907aee816713ba" kindref="member">netif_default</ref>)))<sp/>{</highlight></codeline>
<codeline lineno="211"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>No<sp/>matching<sp/>netif<sp/>found<sp/>and<sp/>default<sp/>netif<sp/>is<sp/>not<sp/>usable.</highlight></codeline>
<codeline lineno="212"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>If<sp/>this<sp/>is<sp/>not<sp/>good<sp/>enough<sp/>for<sp/>you,<sp/>use<sp/>LWIP_HOOK_IP4_ROUTE()<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="213"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a5d3348778951e7bc5cd397c6575eef3a" kindref="member">IP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga0269bdc51f1e8a5ecf9af72c6e1c996c" kindref="member">LWIP_DBG_LEVEL_SERIOUS</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;ip4_route:<sp/>No<sp/>route<sp/>to<sp/>%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;.%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;.%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;.%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;\n&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="214"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>ip4_addr1_16(dest),<sp/>ip4_addr2_16(dest),<sp/>ip4_addr3_16(dest),<sp/>ip4_addr4_16(dest)));</highlight></codeline>
<codeline lineno="215"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="stats_8h_1af0a2079f449ce75c1eb49b8a5c922de8" kindref="member">IP_STATS_INC</ref>(ip.rterr);</highlight></codeline>
<codeline lineno="216"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="stats_8h_1a237a8f1e47af42fb612e936e928a9ced" kindref="member">MIB2_STATS_INC</ref>(mib2.ipoutnoroutes);</highlight></codeline>
<codeline lineno="217"><highlight class="normal"><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="218"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="219"><highlight class="normal"></highlight></codeline>
<codeline lineno="220"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="netif_8h_1a3d0925cbce550ed461907aee816713ba" kindref="member">netif_default</ref>;</highlight></codeline>
<codeline lineno="221"><highlight class="normal">}</highlight></codeline>
<codeline lineno="222"><highlight class="normal"></highlight></codeline>
<codeline lineno="223"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>IP_FORWARD</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="224"><highlight class="normal"></highlight></codeline>
<codeline lineno="231"><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="232"><highlight class="normal">ip4_canforward(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*p)</highlight></codeline>
<codeline lineno="233"><highlight class="normal">{</highlight></codeline>
<codeline lineno="234"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga4c14294869aceba3ef9d4c0c302d0f33" kindref="member">u32_t</ref><sp/>addr<sp/>=<sp/><ref refid="def_8c_1a14f94347a5b9b9e3602705b75b7ae524" kindref="member">lwip_htonl</ref>(ip4_addr_get_u32(ip4_current_dest_addr()));</highlight></codeline>
<codeline lineno="235"><highlight class="normal"></highlight></codeline>
<codeline lineno="236"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(p-&gt;<ref refid="structpbuf_1aa4d1af2cab3d9280d29212095b5b872a" kindref="member">flags</ref><sp/>&amp;<sp/><ref refid="pbuf_8h_1a6772c16662bbb78597399add086500c0" kindref="member">PBUF_FLAG_LLBCAST</ref>)<sp/>{</highlight></codeline>
<codeline lineno="237"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>don&apos;t<sp/>route<sp/>link-layer<sp/>broadcasts<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="238"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0;</highlight></codeline>
<codeline lineno="239"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="240"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((p-&gt;<ref refid="structpbuf_1aa4d1af2cab3d9280d29212095b5b872a" kindref="member">flags</ref><sp/>&amp;<sp/><ref refid="pbuf_8h_1ac0d56cde47aca24ef410d730d7c89887" kindref="member">PBUF_FLAG_LLMCAST</ref>)<sp/>&amp;&amp;<sp/>!IP_MULTICAST(addr))<sp/>{</highlight></codeline>
<codeline lineno="241"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>don&apos;t<sp/>route<sp/>link-layer<sp/>multicasts<sp/>unless<sp/>the<sp/>destination<sp/>address<sp/>is<sp/>an<sp/>IP</highlight></codeline>
<codeline lineno="242"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>multicast<sp/>address<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="243"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0;</highlight></codeline>
<codeline lineno="244"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="245"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(IP_EXPERIMENTAL(addr))<sp/>{</highlight></codeline>
<codeline lineno="246"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0;</highlight></codeline>
<codeline lineno="247"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="248"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(IP_CLASSA(addr))<sp/>{</highlight></codeline>
<codeline lineno="249"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__compiler__abstraction_1ga4c14294869aceba3ef9d4c0c302d0f33" kindref="member">u32_t</ref><sp/><ref refid="structnet" kindref="compound">net</ref><sp/>=<sp/>addr<sp/>&amp;<sp/>IP_CLASSA_NET;</highlight></codeline>
<codeline lineno="250"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((<ref refid="structnet" kindref="compound">net</ref><sp/>==<sp/>0)<sp/>||<sp/>(<ref refid="structnet" kindref="compound">net</ref><sp/>==<sp/>((<ref refid="group__compiler__abstraction_1ga4c14294869aceba3ef9d4c0c302d0f33" kindref="member">u32_t</ref>)IP_LOOPBACKNET<sp/>&lt;&lt;<sp/>IP_CLASSA_NSHIFT)))<sp/>{</highlight></codeline>
<codeline lineno="251"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>don&apos;t<sp/>route<sp/>loopback<sp/>packets<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="252"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0;</highlight></codeline>
<codeline lineno="253"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="254"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="255"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>1;</highlight></codeline>
<codeline lineno="256"><highlight class="normal">}</highlight></codeline>
<codeline lineno="257"><highlight class="normal"></highlight></codeline>
<codeline lineno="267"><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="268"><highlight class="normal">ip4_forward(</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="structip__hdr" kindref="compound">ip_hdr</ref><sp/>*iphdr,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*inp)</highlight></codeline>
<codeline lineno="269"><highlight class="normal">{</highlight></codeline>
<codeline lineno="270"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>;</highlight></codeline>
<codeline lineno="271"><highlight class="normal"></highlight></codeline>
<codeline lineno="272"><highlight class="normal"><sp/><sp/><ref refid="perf_8h_1aa1d6977095e51331f65dcfb2b076da52" kindref="member">PERF_START</ref>;</highlight></codeline>
<codeline lineno="273"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga70624a5deb8b9199406372a7f3603ecf" kindref="member">LWIP_UNUSED_ARG</ref>(inp);</highlight></codeline>
<codeline lineno="274"><highlight class="normal"></highlight></codeline>
<codeline lineno="275"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!ip4_canforward(p))<sp/>{</highlight></codeline>
<codeline lineno="276"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">goto</highlight><highlight class="normal"><sp/>return_noroute;</highlight></codeline>
<codeline lineno="277"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="278"><highlight class="normal"></highlight></codeline>
<codeline lineno="279"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>RFC3927<sp/>2.7:<sp/>do<sp/>not<sp/>forward<sp/>link-local<sp/>addresses<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="280"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ip4_addr_islinklocal(ip4_current_dest_addr()))<sp/>{</highlight></codeline>
<codeline lineno="281"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a5d3348778951e7bc5cd397c6575eef3a" kindref="member">IP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;ip4_forward:<sp/>not<sp/>forwarding<sp/>LLA<sp/>%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;.%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;.%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;.%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;\n&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="282"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>ip4_addr1_16(ip4_current_dest_addr()),<sp/>ip4_addr2_16(ip4_current_dest_addr()),</highlight></codeline>
<codeline lineno="283"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>ip4_addr3_16(ip4_current_dest_addr()),<sp/>ip4_addr4_16(ip4_current_dest_addr())));</highlight></codeline>
<codeline lineno="284"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">goto</highlight><highlight class="normal"><sp/>return_noroute;</highlight></codeline>
<codeline lineno="285"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="286"><highlight class="normal"></highlight></codeline>
<codeline lineno="287"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Find<sp/>network<sp/>interface<sp/>where<sp/>to<sp/>forward<sp/>this<sp/>IP<sp/>packet<sp/>to.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="288"><highlight class="normal"><sp/><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>=<sp/>ip4_route_src(ip4_current_dest_addr(),<sp/>ip4_current_src_addr());</highlight></codeline>
<codeline lineno="289"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="structnetif" kindref="compound">netif</ref><sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="290"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a5d3348778951e7bc5cd397c6575eef3a" kindref="member">IP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;ip4_forward:<sp/>no<sp/>forwarding<sp/>route<sp/>for<sp/>%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;.%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;.%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;.%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;<sp/>found\n&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="291"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>ip4_addr1_16(ip4_current_dest_addr()),<sp/>ip4_addr2_16(ip4_current_dest_addr()),</highlight></codeline>
<codeline lineno="292"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>ip4_addr3_16(ip4_current_dest_addr()),<sp/>ip4_addr4_16(ip4_current_dest_addr())));</highlight></codeline>
<codeline lineno="293"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>@todo:<sp/>send<sp/>ICMP_DUR_NET?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="294"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">goto</highlight><highlight class="normal"><sp/>return_noroute;</highlight></codeline>
<codeline lineno="295"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="296"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>!IP_FORWARD_ALLOW_TX_ON_RX_NETIF</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="297"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Do<sp/>not<sp/>forward<sp/>packets<sp/>onto<sp/>the<sp/>same<sp/>network<sp/>interface<sp/>on<sp/>which</highlight></codeline>
<codeline lineno="298"><highlight class="comment"><sp/><sp/><sp/>*<sp/>they<sp/>arrived.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="299"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="structnetif" kindref="compound">netif</ref><sp/>==<sp/>inp)<sp/>{</highlight></codeline>
<codeline lineno="300"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a5d3348778951e7bc5cd397c6575eef3a" kindref="member">IP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;ip4_forward:<sp/>not<sp/>bouncing<sp/>packets<sp/>back<sp/>on<sp/>incoming<sp/>interface.\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="301"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">goto</highlight><highlight class="normal"><sp/>return_noroute;</highlight></codeline>
<codeline lineno="302"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="303"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>IP_FORWARD_ALLOW_TX_ON_RX_NETIF<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="304"><highlight class="normal"></highlight></codeline>
<codeline lineno="305"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>decrement<sp/>TTL<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="306"><highlight class="normal"><sp/><sp/><ref refid="prot_2ip4_8h_1aa0e49f03bd4c3144e3548a0db72d1deb" kindref="member">IPH_TTL_SET</ref>(iphdr,<sp/><ref refid="prot_2ip4_8h_1a0d8238411ce35a007170f652e62209b3" kindref="member">IPH_TTL</ref>(iphdr)<sp/>-<sp/>1);</highlight></codeline>
<codeline lineno="307"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>send<sp/>ICMP<sp/>if<sp/>TTL<sp/>==<sp/>0<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="308"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="prot_2ip4_8h_1a0d8238411ce35a007170f652e62209b3" kindref="member">IPH_TTL</ref>(iphdr)<sp/>==<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="309"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="stats_8h_1a237a8f1e47af42fb612e936e928a9ced" kindref="member">MIB2_STATS_INC</ref>(mib2.ipinhdrerrors);</highlight></codeline>
<codeline lineno="310"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_ICMP</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="311"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Don&apos;t<sp/>send<sp/>ICMP<sp/>messages<sp/>in<sp/>response<sp/>to<sp/>ICMP<sp/>messages<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="312"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="prot_2ip4_8h_1aa2de6f9d35337b4be67d799805665e11" kindref="member">IPH_PROTO</ref>(iphdr)<sp/>!=<sp/><ref refid="prot_2ip_8h_1aacaea7b8c4c8a5229c02b653766b4793" kindref="member">IP_PROTO_ICMP</ref>)<sp/>{</highlight></codeline>
<codeline lineno="313"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>icmp_time_exceeded(p,<sp/><ref refid="icmp_8h_1a058d0a0769bd38db99fc6fd1dad1324aa827a1f8705826a6cc3c22e2571acf02c" kindref="member">ICMP_TE_TTL</ref>);</highlight></codeline>
<codeline lineno="314"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="315"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_ICMP<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="316"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="317"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="318"><highlight class="normal"></highlight></codeline>
<codeline lineno="319"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Incrementally<sp/>update<sp/>the<sp/>IP<sp/>checksum.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="320"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="prot_2ip4_8h_1a773b96f54c75b35bcd24e7f857fcf988" kindref="member">IPH_CHKSUM</ref>(iphdr)<sp/>&gt;=<sp/><ref refid="def_8h_1a0dfd02d7c09f9c698a5a7ecc0b7287ad" kindref="member">PP_HTONS</ref>(0xffffU<sp/>-<sp/>0x100))<sp/>{</highlight></codeline>
<codeline lineno="321"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="prot_2ip4_8h_1aec30403fb98b013bd094688de55cdaef" kindref="member">IPH_CHKSUM_SET</ref>(iphdr,<sp/><ref refid="prot_2ip4_8h_1a773b96f54c75b35bcd24e7f857fcf988" kindref="member">IPH_CHKSUM</ref>(iphdr)<sp/>+<sp/><ref refid="def_8h_1a0dfd02d7c09f9c698a5a7ecc0b7287ad" kindref="member">PP_HTONS</ref>(0x100)<sp/>+<sp/>1);</highlight></codeline>
<codeline lineno="322"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="323"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="prot_2ip4_8h_1aec30403fb98b013bd094688de55cdaef" kindref="member">IPH_CHKSUM_SET</ref>(iphdr,<sp/><ref refid="prot_2ip4_8h_1a773b96f54c75b35bcd24e7f857fcf988" kindref="member">IPH_CHKSUM</ref>(iphdr)<sp/>+<sp/><ref refid="def_8h_1a0dfd02d7c09f9c698a5a7ecc0b7287ad" kindref="member">PP_HTONS</ref>(0x100));</highlight></codeline>
<codeline lineno="324"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="325"><highlight class="normal"></highlight></codeline>
<codeline lineno="326"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a5d3348778951e7bc5cd397c6575eef3a" kindref="member">IP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;ip4_forward:<sp/>forwarding<sp/>packet<sp/>to<sp/>%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;.%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;.%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;.%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;\n&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="327"><highlight class="normal"><sp/><sp/><sp/><sp/>ip4_addr1_16(ip4_current_dest_addr()),<sp/>ip4_addr2_16(ip4_current_dest_addr()),</highlight></codeline>
<codeline lineno="328"><highlight class="normal"><sp/><sp/><sp/><sp/>ip4_addr3_16(ip4_current_dest_addr()),<sp/>ip4_addr4_16(ip4_current_dest_addr())));</highlight></codeline>
<codeline lineno="329"><highlight class="normal"></highlight></codeline>
<codeline lineno="330"><highlight class="normal"><sp/><sp/><ref refid="stats_8h_1af0a2079f449ce75c1eb49b8a5c922de8" kindref="member">IP_STATS_INC</ref>(ip.fw);</highlight></codeline>
<codeline lineno="331"><highlight class="normal"><sp/><sp/><ref refid="stats_8h_1a237a8f1e47af42fb612e936e928a9ced" kindref="member">MIB2_STATS_INC</ref>(mib2.ipforwdatagrams);</highlight></codeline>
<codeline lineno="332"><highlight class="normal"><sp/><sp/><ref refid="stats_8h_1af0a2079f449ce75c1eb49b8a5c922de8" kindref="member">IP_STATS_INC</ref>(ip.xmit);</highlight></codeline>
<codeline lineno="333"><highlight class="normal"></highlight></codeline>
<codeline lineno="334"><highlight class="normal"><sp/><sp/><ref refid="perf_8h_1a8ac3afe5d720793a229fbf70a78eb82f" kindref="member">PERF_STOP</ref>(</highlight><highlight class="stringliteral">&quot;ip4_forward&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="335"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>don&apos;t<sp/>fragment<sp/>if<sp/>interface<sp/>has<sp/>mtu<sp/>set<sp/>to<sp/>0<sp/>[loopif]<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="336"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1aca7d56b4e0f822b0ced2885f222b8d48" kindref="member">mtu</ref><sp/>&amp;&amp;<sp/>(p-&gt;<ref refid="structpbuf_1a5259e7ec29bab9c0999b64f2e86b411f" kindref="member">tot_len</ref><sp/>&gt;<sp/><ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1aca7d56b4e0f822b0ced2885f222b8d48" kindref="member">mtu</ref>))<sp/>{</highlight></codeline>
<codeline lineno="337"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((<ref refid="prot_2ip4_8h_1a559dce3878f1d6a46bcb4cb312962397" kindref="member">IPH_OFFSET</ref>(iphdr)<sp/>&amp;<sp/><ref refid="def_8h_1a7d17b88eabf7766c0bfa89d8f965f67e" kindref="member">PP_NTOHS</ref>(<ref refid="prot_2ip4_8h_1ae2473f4a88d141d5298f92a4335b714a" kindref="member">IP_DF</ref>))<sp/>==<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="338"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>IP_FRAG</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="339"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>ip4_frag(p,<sp/><ref refid="structnetif" kindref="compound">netif</ref>,<sp/>ip4_current_dest_addr());</highlight></codeline>
<codeline lineno="340"><highlight class="normal"></highlight><highlight class="preprocessor">#else<sp/></highlight><highlight class="comment">/*<sp/>IP_FRAG<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="341"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>@todo:<sp/>send<sp/>ICMP<sp/>Destination<sp/>Unreachable<sp/>code<sp/>13<sp/>&quot;Communication<sp/>administratively<sp/>prohibited&quot;?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="342"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>IP_FRAG<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="343"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="344"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_ICMP</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="345"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>send<sp/>ICMP<sp/>Destination<sp/>Unreachable<sp/>code<sp/>4:<sp/>&quot;Fragmentation<sp/>Needed<sp/>and<sp/>DF<sp/>Set&quot;<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="346"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>icmp_dest_unreach(p,<sp/><ref refid="icmp_8h_1a17637465f209385e5d19ef47fd9266a5a8be2bc49d42aa1a6ee1da93a8700ef5f" kindref="member">ICMP_DUR_FRAG</ref>);</highlight></codeline>
<codeline lineno="347"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_ICMP<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="348"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="349"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="350"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="351"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>transmit<sp/>pbuf<sp/>on<sp/>chosen<sp/>interface<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="352"><highlight class="normal"><sp/><sp/><ref refid="structnetif" kindref="compound">netif</ref>-&gt;output(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>p,<sp/>ip4_current_dest_addr());</highlight></codeline>
<codeline lineno="353"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="354"><highlight class="normal">return_noroute:</highlight></codeline>
<codeline lineno="355"><highlight class="normal"><sp/><sp/><ref refid="stats_8h_1a237a8f1e47af42fb612e936e928a9ced" kindref="member">MIB2_STATS_INC</ref>(mib2.ipoutnoroutes);</highlight></codeline>
<codeline lineno="356"><highlight class="normal">}</highlight></codeline>
<codeline lineno="357"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>IP_FORWARD<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="358"><highlight class="normal"></highlight></codeline>
<codeline lineno="373"><highlight class="normal"><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="374"><highlight class="normal">ip4_input(</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/>*inp)</highlight></codeline>
<codeline lineno="375"><highlight class="normal">{</highlight></codeline>
<codeline lineno="376"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structip__hdr" kindref="compound">ip_hdr</ref><sp/>*iphdr;</highlight></codeline>
<codeline lineno="377"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>;</highlight></codeline>
<codeline lineno="378"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>iphdr_hlen;</highlight></codeline>
<codeline lineno="379"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>iphdr_len;</highlight></codeline>
<codeline lineno="380"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>IP_ACCEPT_LINK_LAYER_ADDRESSING<sp/>||<sp/>LWIP_IGMP</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="381"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>check_ip_src<sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="382"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>IP_ACCEPT_LINK_LAYER_ADDRESSING<sp/>||<sp/>LWIP_IGMP<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="383"><highlight class="normal"></highlight></codeline>
<codeline lineno="384"><highlight class="normal"><sp/><sp/><ref refid="stats_8h_1af0a2079f449ce75c1eb49b8a5c922de8" kindref="member">IP_STATS_INC</ref>(ip.recv);</highlight></codeline>
<codeline lineno="385"><highlight class="normal"><sp/><sp/><ref refid="stats_8h_1a237a8f1e47af42fb612e936e928a9ced" kindref="member">MIB2_STATS_INC</ref>(mib2.ipinreceives);</highlight></codeline>
<codeline lineno="386"><highlight class="normal"></highlight></codeline>
<codeline lineno="387"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>identify<sp/>the<sp/>IP<sp/>header<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="388"><highlight class="normal"><sp/><sp/>iphdr<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structip__hdr" kindref="compound">ip_hdr</ref><sp/>*)p-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref>;</highlight></codeline>
<codeline lineno="389"><highlight class="normal"><sp/><sp/>if<sp/>(<ref refid="prot_2ip4_8h_1a05a9e8ecf4eff38244b4c13c7e70094c" kindref="member">IPH_V</ref>(iphdr)<sp/>!=<sp/>4)<sp/>{</highlight></codeline>
<codeline lineno="390"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a5d3348778951e7bc5cd397c6575eef3a" kindref="member">IP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga77c491e468bf7d9a1bc48430c1866a96" kindref="member">LWIP_DBG_LEVEL_WARNING</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;IP<sp/>packet<sp/>dropped<sp/>due<sp/>to<sp/>bad<sp/>version<sp/>number<sp/>%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;\n&quot;</highlight><highlight class="normal">,<sp/>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)<ref refid="prot_2ip4_8h_1a05a9e8ecf4eff38244b4c13c7e70094c" kindref="member">IPH_V</ref>(iphdr)));</highlight></codeline>
<codeline lineno="391"><highlight class="normal"><sp/><sp/><sp/><sp/>ip4_debug_print(p);</highlight></codeline>
<codeline lineno="392"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(p);</highlight></codeline>
<codeline lineno="393"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="stats_8h_1af0a2079f449ce75c1eb49b8a5c922de8" kindref="member">IP_STATS_INC</ref>(ip.err);</highlight></codeline>
<codeline lineno="394"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="stats_8h_1af0a2079f449ce75c1eb49b8a5c922de8" kindref="member">IP_STATS_INC</ref>(ip.drop);</highlight></codeline>
<codeline lineno="395"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="stats_8h_1a237a8f1e47af42fb612e936e928a9ced" kindref="member">MIB2_STATS_INC</ref>(mib2.ipinhdrerrors);</highlight></codeline>
<codeline lineno="396"><highlight class="normal"><sp/><sp/><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="397"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="398"><highlight class="normal"></highlight></codeline>
<codeline lineno="399"><highlight class="normal"></highlight><highlight class="preprocessor">#ifdef<sp/>LWIP_HOOK_IP4_INPUT</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="400"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(LWIP_HOOK_IP4_INPUT(p,<sp/>inp))<sp/>{</highlight></codeline>
<codeline lineno="401"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>the<sp/>packet<sp/>has<sp/>been<sp/>eaten<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="402"><highlight class="normal"><sp/><sp/><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="403"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="404"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="405"><highlight class="normal"></highlight></codeline>
<codeline lineno="406"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>obtain<sp/>IP<sp/>header<sp/>length<sp/>in<sp/>number<sp/>of<sp/>32-bit<sp/>words<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="407"><highlight class="normal"><sp/><sp/>iphdr_hlen<sp/>=<sp/><ref refid="prot_2ip4_8h_1a7c60caeb708571a07a44309c10ec3a01" kindref="member">IPH_HL</ref>(iphdr);</highlight></codeline>
<codeline lineno="408"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>calculate<sp/>IP<sp/>header<sp/>length<sp/>in<sp/>bytes<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="409"><highlight class="normal"><sp/><sp/>iphdr_hlen<sp/>*=<sp/>4;</highlight></codeline>
<codeline lineno="410"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>obtain<sp/>ip<sp/>length<sp/>in<sp/>bytes<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="411"><highlight class="normal"><sp/><sp/>iphdr_len<sp/>=<sp/><ref refid="def_8h_1ac642bf6057869696d7807564d8309ffc" kindref="member">lwip_ntohs</ref>(<ref refid="prot_2ip4_8h_1aec0328fe4711b8c1ef4dd6709e4fd6d5" kindref="member">IPH_LEN</ref>(iphdr));</highlight></codeline>
<codeline lineno="412"><highlight class="normal"></highlight></codeline>
<codeline lineno="413"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Trim<sp/>pbuf.<sp/>This<sp/>is<sp/>especially<sp/>required<sp/>for<sp/>packets<sp/>&lt;<sp/>60<sp/>bytes.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="414"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(iphdr_len<sp/>&lt;<sp/>p-&gt;tot_len)<sp/>{</highlight></codeline>
<codeline lineno="415"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1ga50abfe830a33a1a47a562febee66015d" kindref="member">pbuf_realloc</ref>(p,<sp/>iphdr_len);</highlight></codeline>
<codeline lineno="416"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="417"><highlight class="normal"></highlight></codeline>
<codeline lineno="418"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>header<sp/>length<sp/>exceeds<sp/>first<sp/>pbuf<sp/>length,<sp/>or<sp/>ip<sp/>length<sp/>exceeds<sp/>total<sp/>pbuf<sp/>length?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="419"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((iphdr_hlen<sp/>&gt;<sp/>p-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref>)<sp/>||<sp/>(iphdr_len<sp/>&gt;<sp/>p-&gt;<ref refid="structpbuf_1a5259e7ec29bab9c0999b64f2e86b411f" kindref="member">tot_len</ref>)<sp/>||<sp/>(iphdr_hlen<sp/>&lt;<sp/><ref refid="prot_2ip4_8h_1ad76777d4d34f33ab5f715f9ca15503c3" kindref="member">IP_HLEN</ref>))<sp/>{</highlight></codeline>
<codeline lineno="420"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(iphdr_hlen<sp/>&lt;<sp/><ref refid="prot_2ip4_8h_1ad76777d4d34f33ab5f715f9ca15503c3" kindref="member">IP_HLEN</ref>)<sp/>{</highlight></codeline>
<codeline lineno="421"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a5d3348778951e7bc5cd397c6575eef3a" kindref="member">IP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga0269bdc51f1e8a5ecf9af72c6e1c996c" kindref="member">LWIP_DBG_LEVEL_SERIOUS</ref>,</highlight></codeline>
<codeline lineno="422"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(</highlight><highlight class="stringliteral">&quot;ip4_input:<sp/>short<sp/>IP<sp/>header<sp/>(%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;<sp/>bytes)<sp/>received,<sp/>IP<sp/>packet<sp/>dropped\n&quot;</highlight><highlight class="normal">,<sp/>iphdr_hlen));</highlight></codeline>
<codeline lineno="423"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="424"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(iphdr_hlen<sp/>&gt;<sp/>p-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref>)<sp/>{</highlight></codeline>
<codeline lineno="425"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a5d3348778951e7bc5cd397c6575eef3a" kindref="member">IP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga0269bdc51f1e8a5ecf9af72c6e1c996c" kindref="member">LWIP_DBG_LEVEL_SERIOUS</ref>,</highlight></codeline>
<codeline lineno="426"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(</highlight><highlight class="stringliteral">&quot;IP<sp/>header<sp/>(len<sp/>%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;)<sp/>does<sp/>not<sp/>fit<sp/>in<sp/>first<sp/>pbuf<sp/>(len<sp/>%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;),<sp/>IP<sp/>packet<sp/>dropped.\n&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="427"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>iphdr_hlen,<sp/>p-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref>));</highlight></codeline>
<codeline lineno="428"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="429"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(iphdr_len<sp/>&gt;<sp/>p-&gt;<ref refid="structpbuf_1a5259e7ec29bab9c0999b64f2e86b411f" kindref="member">tot_len</ref>)<sp/>{</highlight></codeline>
<codeline lineno="430"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a5d3348778951e7bc5cd397c6575eef3a" kindref="member">IP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga0269bdc51f1e8a5ecf9af72c6e1c996c" kindref="member">LWIP_DBG_LEVEL_SERIOUS</ref>,</highlight></codeline>
<codeline lineno="431"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(</highlight><highlight class="stringliteral">&quot;IP<sp/>(len<sp/>%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;)<sp/>is<sp/>longer<sp/>than<sp/>pbuf<sp/>(len<sp/>%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;),<sp/>IP<sp/>packet<sp/>dropped.\n&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="432"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>iphdr_len,<sp/>p-&gt;<ref refid="structpbuf_1a5259e7ec29bab9c0999b64f2e86b411f" kindref="member">tot_len</ref>));</highlight></codeline>
<codeline lineno="433"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="434"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>free<sp/>(drop)<sp/>packet<sp/>pbufs<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="435"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(p);</highlight></codeline>
<codeline lineno="436"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="stats_8h_1af0a2079f449ce75c1eb49b8a5c922de8" kindref="member">IP_STATS_INC</ref>(ip.lenerr);</highlight></codeline>
<codeline lineno="437"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="stats_8h_1af0a2079f449ce75c1eb49b8a5c922de8" kindref="member">IP_STATS_INC</ref>(ip.drop);</highlight></codeline>
<codeline lineno="438"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="stats_8h_1a237a8f1e47af42fb612e936e928a9ced" kindref="member">MIB2_STATS_INC</ref>(mib2.ipindiscards);</highlight></codeline>
<codeline lineno="439"><highlight class="normal"><sp/><sp/><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="440"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="441"><highlight class="normal"></highlight></codeline>
<codeline lineno="442"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>verify<sp/>checksum<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="443"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>CHECKSUM_CHECK_IP</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="444"><highlight class="normal"><sp/><sp/><ref refid="netif_8h_1ad968df1b35c2fae368e087966e3bc677" kindref="member">IF__NETIF_CHECKSUM_ENABLED</ref>(inp,<sp/>NETIF_CHECKSUM_CHECK_IP)<sp/>{</highlight></codeline>
<codeline lineno="445"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="inet__chksum_8h_1a34f1aa1587562a09e11b704b51bab043" kindref="member">inet_chksum</ref>(iphdr,<sp/>iphdr_hlen)<sp/>!=<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="446"><highlight class="normal"></highlight></codeline>
<codeline lineno="447"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a5d3348778951e7bc5cd397c6575eef3a" kindref="member">IP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga0269bdc51f1e8a5ecf9af72c6e1c996c" kindref="member">LWIP_DBG_LEVEL_SERIOUS</ref>,</highlight></codeline>
<codeline lineno="448"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(</highlight><highlight class="stringliteral">&quot;Checksum<sp/>(0x%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1ga1418f92673e54a36b6e376109e526382" kindref="member">X16_F</ref></highlight><highlight class="stringliteral">&quot;)<sp/>failed,<sp/>IP<sp/>packet<sp/>dropped.\n&quot;</highlight><highlight class="normal">,<sp/><ref refid="inet__chksum_8h_1a34f1aa1587562a09e11b704b51bab043" kindref="member">inet_chksum</ref>(iphdr,<sp/>iphdr_hlen)));</highlight></codeline>
<codeline lineno="449"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>ip4_debug_print(p);</highlight></codeline>
<codeline lineno="450"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(p);</highlight></codeline>
<codeline lineno="451"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1af0a2079f449ce75c1eb49b8a5c922de8" kindref="member">IP_STATS_INC</ref>(ip.chkerr);</highlight></codeline>
<codeline lineno="452"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1af0a2079f449ce75c1eb49b8a5c922de8" kindref="member">IP_STATS_INC</ref>(ip.drop);</highlight></codeline>
<codeline lineno="453"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1a237a8f1e47af42fb612e936e928a9ced" kindref="member">MIB2_STATS_INC</ref>(mib2.ipinhdrerrors);</highlight></codeline>
<codeline lineno="454"><highlight class="normal"><sp/><sp/><sp/><sp/><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="455"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="456"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="457"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="458"><highlight class="normal"></highlight></codeline>
<codeline lineno="459"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>copy<sp/>IP<sp/>addresses<sp/>to<sp/>aligned<sp/>ip_addr_t<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="460"><highlight class="normal"><sp/><sp/>ip_addr_copy_from_ip4(<ref refid="ip_8h_1ac944fb6564f181bc90bc7c2b8b00d94c" kindref="member">ip_data</ref>.<ref refid="structip__globals_1a0b4e54250c692c638408de54593d2aa1" kindref="member">current_iphdr_dest</ref>,<sp/>iphdr-&gt;dest);</highlight></codeline>
<codeline lineno="461"><highlight class="normal"><sp/><sp/>ip_addr_copy_from_ip4(<ref refid="ip_8h_1ac944fb6564f181bc90bc7c2b8b00d94c" kindref="member">ip_data</ref>.<ref refid="structip__globals_1a04d85a3dc2c417050b3e088fa58a74b0" kindref="member">current_iphdr_src</ref>,<sp/>iphdr-&gt;src);</highlight></codeline>
<codeline lineno="462"><highlight class="normal"></highlight></codeline>
<codeline lineno="463"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>match<sp/>packet<sp/>against<sp/>an<sp/>interface,<sp/>i.e.<sp/>is<sp/>this<sp/>packet<sp/>for<sp/>us?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="464"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ip4_addr_ismulticast(ip4_current_dest_addr()))<sp/>{</highlight></codeline>
<codeline lineno="465"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_IGMP</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="466"><highlight class="normal"><ref refid="armv6_2kpanic_8c_1adb9a182aa071791a306163d50d653deb" kindref="member">kpanic</ref>(</highlight><highlight class="stringliteral">&quot;A&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="467"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((inp-&gt;<ref refid="structnetif_1a1c171db6097bbb6f09f63549a66e00ea" kindref="member">flags</ref><sp/>&amp;<sp/><ref refid="group__netif__flags_1gac9493b923d733c73f6006d9714826558" kindref="member">NETIF_FLAG_IGMP</ref>)<sp/>&amp;&amp;<sp/>(igmp_lookfor_group(inp,<sp/>ip4_current_dest_addr())))<sp/>{</highlight></codeline>
<codeline lineno="468"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>IGMP<sp/>snooping<sp/>switches<sp/>need<sp/>0.0.0.0<sp/>to<sp/>be<sp/>allowed<sp/>as<sp/>source<sp/>address<sp/>(RFC<sp/>4541)<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="469"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>ip4_addr_t<sp/>allsystems;</highlight></codeline>
<codeline lineno="470"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>IP4_ADDR(&amp;allsystems,<sp/>224,<sp/>0,<sp/>0,<sp/>1);</highlight></codeline>
<codeline lineno="471"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ip4_addr_cmp(ip4_current_dest_addr(),<sp/>&amp;allsystems)<sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="472"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ip4_addr_isany(ip4_current_src_addr()))<sp/>{</highlight></codeline>
<codeline lineno="473"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>check_ip_src<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="474"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="475"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>=<sp/>inp;</highlight></codeline>
<codeline lineno="476"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="477"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="478"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="479"><highlight class="normal"></highlight><highlight class="preprocessor">#else<sp/></highlight><highlight class="comment">/*<sp/>LWIP_IGMP<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="480"><highlight class="normal"><ref refid="armv6_2kpanic_8c_1adb9a182aa071791a306163d50d653deb" kindref="member">kpanic</ref>(</highlight><highlight class="stringliteral">&quot;B&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="481"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((<ref refid="group__netif_1ga94a4c24c988afc0a577387730f303b19" kindref="member">netif_is_up</ref>(inp))<sp/>&amp;&amp;<sp/>(!ip4_addr_isany_val(*netif_ip4_addr(inp))))<sp/>{</highlight></codeline>
<codeline lineno="482"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>=<sp/>inp;</highlight></codeline>
<codeline lineno="483"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="484"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="485"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="486"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_IGMP<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="487"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="488"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>start<sp/>trying<sp/>with<sp/>inp.<sp/>if<sp/>that&apos;s<sp/>not<sp/>acceptable,<sp/>start<sp/>walking<sp/>the</highlight></codeline>
<codeline lineno="489"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>list<sp/>of<sp/>configured<sp/>netifs.</highlight></codeline>
<codeline lineno="490"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>&apos;first&apos;<sp/>is<sp/>used<sp/>as<sp/>a<sp/>boolean<sp/>to<sp/>mark<sp/>whether<sp/>we<sp/>started<sp/>walking<sp/>the<sp/>list<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="491"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>first<sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="492"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>=<sp/>inp;</highlight></codeline>
<codeline lineno="493"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">do</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="494"><highlight class="normal"></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ip4_addr_get_u32(&amp;iphdr-&gt;dest)<sp/><sp/>==<sp/>ip4_addr_get_u32(netif_ip4_addr(<ref refid="structnetif" kindref="compound">netif</ref>)))</highlight></codeline>
<codeline lineno="495"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a5d3348778951e7bc5cd397c6575eef3a" kindref="member">IP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;ip_input:<sp/>iphdr-&gt;dest<sp/>0x%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gac219830a93d05c5f18f64ce87a34be14" kindref="member">X32_F</ref></highlight><highlight class="stringliteral">&quot;<sp/>netif-&gt;ip_addr<sp/>0x%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gac219830a93d05c5f18f64ce87a34be14" kindref="member">X32_F</ref></highlight><highlight class="stringliteral">&quot;<sp/>(0x%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gac219830a93d05c5f18f64ce87a34be14" kindref="member">X32_F</ref></highlight><highlight class="stringliteral">&quot;,<sp/>0x%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gac219830a93d05c5f18f64ce87a34be14" kindref="member">X32_F</ref></highlight><highlight class="stringliteral">&quot;,<sp/>0x%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gac219830a93d05c5f18f64ce87a34be14" kindref="member">X32_F</ref></highlight><highlight class="stringliteral">&quot;)\n&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="496"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ip4_addr_get_u32(&amp;iphdr-&gt;dest),<sp/>ip4_addr_get_u32(netif_ip4_addr(<ref refid="structnetif" kindref="compound">netif</ref>)),</highlight></codeline>
<codeline lineno="497"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ip4_addr_get_u32(&amp;iphdr-&gt;dest)<sp/>&amp;<sp/>ip4_addr_get_u32(netif_ip4_netmask(<ref refid="structnetif" kindref="compound">netif</ref>)),</highlight></codeline>
<codeline lineno="498"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ip4_addr_get_u32(netif_ip4_addr(<ref refid="structnetif" kindref="compound">netif</ref>))<sp/>&amp;<sp/>ip4_addr_get_u32(netif_ip4_netmask(<ref refid="structnetif" kindref="compound">netif</ref>)),</highlight></codeline>
<codeline lineno="499"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ip4_addr_get_u32(&amp;iphdr-&gt;dest)<sp/>&amp;<sp/>~ip4_addr_get_u32(netif_ip4_netmask(<ref refid="structnetif" kindref="compound">netif</ref>))));</highlight></codeline>
<codeline lineno="500"><highlight class="normal"></highlight></codeline>
<codeline lineno="501"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>interface<sp/>is<sp/>up<sp/>and<sp/>configured?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="502"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((<ref refid="group__netif_1ga94a4c24c988afc0a577387730f303b19" kindref="member">netif_is_up</ref>(<ref refid="structnetif" kindref="compound">netif</ref>))<sp/>&amp;&amp;<sp/>(!ip4_addr_isany_val(*netif_ip4_addr(<ref refid="structnetif" kindref="compound">netif</ref>))))<sp/>{</highlight></codeline>
<codeline lineno="503"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>unicast<sp/>to<sp/>this<sp/>interface<sp/>address?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="504"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ip4_addr_cmp(ip4_current_dest_addr(),<sp/>netif_ip4_addr(<ref refid="structnetif" kindref="compound">netif</ref>))<sp/>||</highlight></codeline>
<codeline lineno="505"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>or<sp/>broadcast<sp/>on<sp/>this<sp/>interface<sp/>network<sp/>address?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="506"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ip4_addr_isbroadcast(ip4_current_dest_addr(),<sp/><ref refid="structnetif" kindref="compound">netif</ref>)</highlight></codeline>
<codeline lineno="507"><highlight class="normal">#</highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/><ref refid="lwipopts_8h_1a724a0ea765d5a47d026d529725f31c01" kindref="member">LWIP_NETIF_LOOPBACK</ref><sp/>&amp;&amp;<sp/>!<ref refid="lwipopts_8h_1aa2b1f736373cd896e212644aa453fbaf" kindref="member">LWIP_HAVE_LOOPIF</ref></highlight></codeline>
<codeline lineno="508"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>||<sp/>(ip4_addr_get_u32(ip4_current_dest_addr())<sp/>==<sp/><ref refid="def_8h_1afea9c21aa1f56180cdf6fb42ef14a294" kindref="member">PP_HTONL</ref>(IPADDR_LOOPBACK))</highlight></codeline>
<codeline lineno="509"><highlight class="normal">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_NETIF_LOOPBACK<sp/>&amp;&amp;<sp/>!LWIP_HAVE_LOOPIF<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="510"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>)<sp/>{</highlight></codeline>
<codeline lineno="511"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a5d3348778951e7bc5cd397c6575eef3a" kindref="member">IP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;ip4_input:<sp/>packet<sp/>accepted<sp/>on<sp/>interface<sp/>%c%c\n&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="512"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1a32fca6ffd28bb9af3f891a378827a67e" kindref="member">name</ref>[0],<sp/><ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1a32fca6ffd28bb9af3f891a378827a67e" kindref="member">name</ref>[1]));</highlight></codeline>
<codeline lineno="513"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>break<sp/>out<sp/>of<sp/>for<sp/>loop<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="514"><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="515"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="516"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_AUTOIP</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="517"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>connections<sp/>to<sp/>link-local<sp/>addresses<sp/>must<sp/>persist<sp/>after<sp/>changing</highlight></codeline>
<codeline lineno="518"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>the<sp/>netif&apos;s<sp/>address<sp/>(RFC3927<sp/>ch.<sp/>1.9)<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="519"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(autoip_accept_packet(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>ip4_current_dest_addr()))<sp/>{</highlight></codeline>
<codeline lineno="520"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a5d3348778951e7bc5cd397c6575eef3a" kindref="member">IP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;ip4_input:<sp/>LLA<sp/>packet<sp/>accepted<sp/>on<sp/>interface<sp/>%c%c\n&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="521"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1a32fca6ffd28bb9af3f891a378827a67e" kindref="member">name</ref>[0],<sp/><ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1a32fca6ffd28bb9af3f891a378827a67e" kindref="member">name</ref>[1]));</highlight></codeline>
<codeline lineno="522"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>break<sp/>out<sp/>of<sp/>for<sp/>loop<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="523"><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="524"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="525"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_AUTOIP<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="526"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="527"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(first)<sp/>{</highlight></codeline>
<codeline lineno="528"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>!LWIP_NETIF_LOOPBACK<sp/>||<sp/>LWIP_HAVE_LOOPIF</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="529"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Packets<sp/>sent<sp/>to<sp/>the<sp/>loopback<sp/>address<sp/>must<sp/>not<sp/>be<sp/>accepted<sp/>on<sp/>an</highlight></codeline>
<codeline lineno="530"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*<sp/>interface<sp/>that<sp/>does<sp/>not<sp/>have<sp/>the<sp/>loopback<sp/>address<sp/>assigned<sp/>to<sp/>it,</highlight></codeline>
<codeline lineno="531"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*<sp/>unless<sp/>a<sp/>non-loopback<sp/>interface<sp/>is<sp/>used<sp/>for<sp/>loopback<sp/>traffic.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="532"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ip4_addr_isloopback(ip4_current_dest_addr()))<sp/>{</highlight></codeline>
<codeline lineno="533"><highlight class="normal"><ref refid="armv6_2kpanic_8c_1adb9a182aa071791a306163d50d653deb" kindref="member">kpanic</ref>(</highlight><highlight class="stringliteral">&quot;D&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="534"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="535"><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="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<sp/></highlight><highlight class="comment">/*<sp/>!LWIP_NETIF_LOOPBACK<sp/>||<sp/>LWIP_HAVE_LOOPIF<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="538"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>first<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="539"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>=<sp/><ref refid="netif_8h_1a1c8141eaa98f6dc6dfddbb23a706656c" kindref="member">netif_list</ref>;</highlight></codeline>
<codeline lineno="540"><highlight class="normal"><sp/><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/><ref refid="structnetif" kindref="compound">netif</ref><sp/>=<sp/><ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1ae77736b64df442242795220d76be6b86" kindref="member">next</ref>;</highlight></codeline>
<codeline lineno="542"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="543"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="structnetif" kindref="compound">netif</ref><sp/>==<sp/>inp)<sp/>{</highlight></codeline>
<codeline lineno="544"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>=<sp/><ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1ae77736b64df442242795220d76be6b86" kindref="member">next</ref>;</highlight></codeline>
<codeline lineno="545"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="546"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(<ref refid="structnetif" kindref="compound">netif</ref><sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>);</highlight></codeline>
<codeline lineno="547"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="548"><highlight class="normal"></highlight></codeline>
<codeline lineno="549"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>IP_ACCEPT_LINK_LAYER_ADDRESSING</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="550"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Pass<sp/>DHCP<sp/>messages<sp/>regardless<sp/>of<sp/>destination<sp/>address.<sp/>DHCP<sp/>traffic<sp/>is<sp/>addressed</highlight></codeline>
<codeline lineno="551"><highlight class="comment"><sp/><sp/><sp/>*<sp/>using<sp/>link<sp/>layer<sp/>addressing<sp/>(such<sp/>as<sp/>Ethernet<sp/>MAC)<sp/>so<sp/>we<sp/>must<sp/>not<sp/>filter<sp/>on<sp/>IP.</highlight></codeline>
<codeline lineno="552"><highlight class="comment"><sp/><sp/><sp/>*<sp/>According<sp/>to<sp/>RFC<sp/>1542<sp/>section<sp/>3.1.1,<sp/>referred<sp/>by<sp/>RFC<sp/>2131).</highlight></codeline>
<codeline lineno="553"><highlight class="comment"><sp/><sp/><sp/>*</highlight></codeline>
<codeline lineno="554"><highlight class="comment"><sp/><sp/><sp/>*<sp/>If<sp/>you<sp/>want<sp/>to<sp/>accept<sp/>private<sp/>broadcast<sp/>communication<sp/>while<sp/>a<sp/>netif<sp/>is<sp/>down,</highlight></codeline>
<codeline lineno="555"><highlight class="comment"><sp/><sp/><sp/>*<sp/>define<sp/>LWIP_IP_ACCEPT_UDP_PORT(dst_port),<sp/>e.g.:</highlight></codeline>
<codeline lineno="556"><highlight class="comment"><sp/><sp/><sp/>*</highlight></codeline>
<codeline lineno="557"><highlight class="comment"><sp/><sp/><sp/>*<sp/>#define<sp/>LWIP_IP_ACCEPT_UDP_PORT(dst_port)<sp/>((dst_port)<sp/>==<sp/>PP_NTOHS(12345))</highlight></codeline>
<codeline lineno="558"><highlight class="comment"><sp/><sp/><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="559"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="structnetif" kindref="compound">netif</ref><sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="560"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>remote<sp/>port<sp/>is<sp/>DHCP<sp/>server?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="561"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="prot_2ip4_8h_1aa2de6f9d35337b4be67d799805665e11" kindref="member">IPH_PROTO</ref>(iphdr)<sp/>==<sp/><ref refid="prot_2ip_8h_1a76212e7ef71a99646040d2e454388bed" kindref="member">IP_PROTO_UDP</ref>)<sp/>{</highlight></codeline>
<codeline lineno="562"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structudp__hdr" kindref="compound">udp_hdr</ref><sp/>*udphdr<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structudp__hdr" kindref="compound">udp_hdr</ref><sp/>*)((<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>*)iphdr<sp/>+<sp/>iphdr_hlen);</highlight></codeline>
<codeline lineno="563"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a5d3348778951e7bc5cd397c6575eef3a" kindref="member">IP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;ip4_input:<sp/>UDP<sp/>packet<sp/>to<sp/>DHCP<sp/>client<sp/>port<sp/>%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;\n&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="564"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="def_8h_1ac642bf6057869696d7807564d8309ffc" kindref="member">lwip_ntohs</ref>(udphdr-&gt;dest)));</highlight></codeline>
<codeline lineno="565"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(IP_ACCEPT_LINK_LAYER_ADDRESSED_PORT(udphdr-&gt;dest))<sp/>{</highlight></codeline>
<codeline lineno="566"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a5d3348778951e7bc5cd397c6575eef3a" kindref="member">IP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;ip4_input:<sp/>DHCP<sp/>packet<sp/>accepted.\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="567"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>=<sp/>inp;</highlight></codeline>
<codeline lineno="568"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>check_ip_src<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="569"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="570"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="571"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="572"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>IP_ACCEPT_LINK_LAYER_ADDRESSING<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="573"><highlight class="normal"></highlight></codeline>
<codeline lineno="574"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>broadcast<sp/>or<sp/>multicast<sp/>packet<sp/>source<sp/>address?<sp/>Compliant<sp/>with<sp/>RFC<sp/>1122:<sp/>3.2.1.3<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="575"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_IGMP<sp/>||<sp/>IP_ACCEPT_LINK_LAYER_ADDRESSING</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="576"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(check_ip_src</highlight></codeline>
<codeline lineno="577"><highlight class="normal">#</highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>IP_ACCEPT_LINK_LAYER_ADDRESSING</highlight></codeline>
<codeline lineno="578"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>DHCP<sp/>servers<sp/>need<sp/>0.0.0.0<sp/>to<sp/>be<sp/>allowed<sp/>as<sp/>source<sp/>address<sp/>(RFC<sp/>1.1.2.2:<sp/>3.2.1.3/a)<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="579"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>&amp;&amp;<sp/>!ip4_addr_isany_val(*ip4_current_src_addr())</highlight></codeline>
<codeline lineno="580"><highlight class="normal">#endif<sp/></highlight><highlight class="comment">/*<sp/>IP_ACCEPT_LINK_LAYER_ADDRESSING<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="581"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/>)</highlight></codeline>
<codeline lineno="582"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_IGMP<sp/>||<sp/>IP_ACCEPT_LINK_LAYER_ADDRESSING<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="583"><highlight class="normal"><sp/><sp/>{</highlight></codeline>
<codeline lineno="584"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((ip4_addr_isbroadcast(ip4_current_src_addr(),<sp/>inp))<sp/>||</highlight></codeline>
<codeline lineno="585"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(ip4_addr_ismulticast(ip4_current_src_addr())))<sp/>{</highlight></codeline>
<codeline lineno="586"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>packet<sp/>source<sp/>is<sp/>not<sp/>valid<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="587"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a5d3348778951e7bc5cd397c6575eef3a" kindref="member">IP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga77c491e468bf7d9a1bc48430c1866a96" kindref="member">LWIP_DBG_LEVEL_WARNING</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;ip4_input:<sp/>packet<sp/>source<sp/>is<sp/>not<sp/>valid.\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="588"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>free<sp/>(drop)<sp/>packet<sp/>pbufs<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="589"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(p);</highlight></codeline>
<codeline lineno="590"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1af0a2079f449ce75c1eb49b8a5c922de8" kindref="member">IP_STATS_INC</ref>(ip.drop);</highlight></codeline>
<codeline lineno="591"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1a237a8f1e47af42fb612e936e928a9ced" kindref="member">MIB2_STATS_INC</ref>(mib2.ipinaddrerrors);</highlight></codeline>
<codeline lineno="592"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1a237a8f1e47af42fb612e936e928a9ced" kindref="member">MIB2_STATS_INC</ref>(mib2.ipindiscards);</highlight></codeline>
<codeline lineno="593"><highlight class="normal"><sp/><sp/><sp/><sp/><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="594"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="595"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="596"><highlight class="normal"></highlight></codeline>
<codeline lineno="597"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>packet<sp/>not<sp/>for<sp/>us?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="598"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="structnetif" kindref="compound">netif</ref><sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="599"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>packet<sp/>not<sp/>for<sp/>us,<sp/>route<sp/>or<sp/>discard<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="600"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a5d3348778951e7bc5cd397c6575eef3a" kindref="member">IP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;ip4_input:<sp/>packet<sp/>not<sp/>for<sp/>us.\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="601"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>IP_FORWARD</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="602"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>non-broadcast<sp/>packet?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="603"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!ip4_addr_isbroadcast(ip4_current_dest_addr(),<sp/>inp))<sp/>{</highlight></codeline>
<codeline lineno="604"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>try<sp/>to<sp/>forward<sp/>IP<sp/>packet<sp/>on<sp/>(other)<sp/>interfaces<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="605"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>ip4_forward(p,<sp/>iphdr,<sp/>inp);</highlight></codeline>
<codeline lineno="606"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="607"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>IP_FORWARD<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="608"><highlight class="normal"><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="609"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1af0a2079f449ce75c1eb49b8a5c922de8" kindref="member">IP_STATS_INC</ref>(ip.drop);</highlight></codeline>
<codeline lineno="610"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1a237a8f1e47af42fb612e936e928a9ced" kindref="member">MIB2_STATS_INC</ref>(mib2.ipinaddrerrors);</highlight></codeline>
<codeline lineno="611"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1a237a8f1e47af42fb612e936e928a9ced" kindref="member">MIB2_STATS_INC</ref>(mib2.ipindiscards);</highlight></codeline>
<codeline lineno="612"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="613"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(p);</highlight></codeline>
<codeline lineno="614"><highlight class="normal"><sp/><sp/><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="615"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="616"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>packet<sp/>consists<sp/>of<sp/>multiple<sp/>fragments?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="617"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((<ref refid="prot_2ip4_8h_1a559dce3878f1d6a46bcb4cb312962397" kindref="member">IPH_OFFSET</ref>(iphdr)<sp/>&amp;<sp/><ref refid="def_8h_1a0dfd02d7c09f9c698a5a7ecc0b7287ad" kindref="member">PP_HTONS</ref>(<ref refid="prot_2ip4_8h_1ad059798b16d1f615b5af8770175121ba" kindref="member">IP_OFFMASK</ref><sp/>|<sp/><ref refid="prot_2ip4_8h_1ae8afe1e04bb9bad791443556c3b2cd73" kindref="member">IP_MF</ref>))<sp/>!=<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="618"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>IP_REASSEMBLY<sp/></highlight><highlight class="comment">/*<sp/>packet<sp/>fragment<sp/>reassembly<sp/>code<sp/>present?<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="619"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a5d3348778951e7bc5cd397c6575eef3a" kindref="member">IP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;IP<sp/>packet<sp/>is<sp/>a<sp/>fragment<sp/>(id=0x%04&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1ga1418f92673e54a36b6e376109e526382" kindref="member">X16_F</ref></highlight><highlight class="stringliteral">&quot;<sp/>tot_len=%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;<sp/>len=%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;<sp/>MF=%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;<sp/>offset=%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;),<sp/>calling<sp/>ip4_reass()\n&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="620"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="def_8h_1ac642bf6057869696d7807564d8309ffc" kindref="member">lwip_ntohs</ref>(<ref refid="prot_2ip4_8h_1ae79eaecc0bf9e4dbb9e47ea56ad2157a" kindref="member">IPH_ID</ref>(iphdr)),<sp/>p-&gt;<ref refid="structpbuf_1a5259e7ec29bab9c0999b64f2e86b411f" kindref="member">tot_len</ref>,<sp/><ref refid="def_8h_1ac642bf6057869696d7807564d8309ffc" kindref="member">lwip_ntohs</ref>(<ref refid="prot_2ip4_8h_1aec0328fe4711b8c1ef4dd6709e4fd6d5" kindref="member">IPH_LEN</ref>(iphdr)),<sp/>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)!!(<ref refid="prot_2ip4_8h_1a559dce3878f1d6a46bcb4cb312962397" kindref="member">IPH_OFFSET</ref>(iphdr)<sp/>&amp;<sp/><ref refid="def_8h_1a0dfd02d7c09f9c698a5a7ecc0b7287ad" kindref="member">PP_HTONS</ref>(<ref refid="prot_2ip4_8h_1ae8afe1e04bb9bad791443556c3b2cd73" kindref="member">IP_MF</ref>)),<sp/>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)((<ref refid="def_8h_1ac642bf6057869696d7807564d8309ffc" kindref="member">lwip_ntohs</ref>(<ref refid="prot_2ip4_8h_1a559dce3878f1d6a46bcb4cb312962397" kindref="member">IPH_OFFSET</ref>(iphdr))<sp/>&amp;<sp/><ref refid="prot_2ip4_8h_1ad059798b16d1f615b5af8770175121ba" kindref="member">IP_OFFMASK</ref>)*8)));</highlight></codeline>
<codeline lineno="621"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>reassemble<sp/>the<sp/>packet*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="622"><highlight class="normal"><sp/><sp/><sp/><sp/>p<sp/>=<sp/>ip4_reass(p);</highlight></codeline>
<codeline lineno="623"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>packet<sp/>not<sp/>fully<sp/>reassembled<sp/>yet?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="624"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(p<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="625"><highlight class="normal"><sp/><sp/><sp/><sp/><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="626"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="627"><highlight class="normal"><sp/><sp/><sp/><sp/>iphdr<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structip__hdr" kindref="compound">ip_hdr</ref><sp/>*)p-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref>;</highlight></codeline>
<codeline lineno="628"><highlight class="normal">#</highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="comment">/*<sp/>IP_REASSEMBLY<sp/>==<sp/>0,<sp/>no<sp/>packet<sp/>fragment<sp/>reassembly<sp/>code<sp/>present<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="629"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(p);</highlight></codeline>
<codeline lineno="630"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a5d3348778951e7bc5cd397c6575eef3a" kindref="member">IP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga0269bdc51f1e8a5ecf9af72c6e1c996c" kindref="member">LWIP_DBG_LEVEL_SERIOUS</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;IP<sp/>packet<sp/>dropped<sp/>since<sp/>it<sp/>was<sp/>fragmented<sp/>(0x%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1ga1418f92673e54a36b6e376109e526382" kindref="member">X16_F</ref></highlight><highlight class="stringliteral">&quot;)<sp/>(while<sp/>IP_REASSEMBLY<sp/>==<sp/>0).\n&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="631"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="def_8h_1ac642bf6057869696d7807564d8309ffc" kindref="member">lwip_ntohs</ref>(<ref refid="prot_2ip4_8h_1a559dce3878f1d6a46bcb4cb312962397" kindref="member">IPH_OFFSET</ref>(iphdr))));</highlight></codeline>
<codeline lineno="632"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="stats_8h_1af0a2079f449ce75c1eb49b8a5c922de8" kindref="member">IP_STATS_INC</ref>(ip.opterr);</highlight></codeline>
<codeline lineno="633"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="stats_8h_1af0a2079f449ce75c1eb49b8a5c922de8" kindref="member">IP_STATS_INC</ref>(ip.drop);</highlight></codeline>
<codeline lineno="634"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>unsupported<sp/>protocol<sp/>feature<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="635"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="stats_8h_1a237a8f1e47af42fb612e936e928a9ced" kindref="member">MIB2_STATS_INC</ref>(mib2.ipinunknownprotos);</highlight></codeline>
<codeline lineno="636"><highlight class="normal"><sp/><sp/><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="637"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>IP_REASSEMBLY<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="638"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="639"><highlight class="normal"></highlight></codeline>
<codeline lineno="640"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>IP_OPTIONS_ALLOWED<sp/>==<sp/>0<sp/></highlight><highlight class="comment">/*<sp/>no<sp/>support<sp/>for<sp/>IP<sp/>options<sp/>in<sp/>the<sp/>IP<sp/>header?<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="641"><highlight class="normal"></highlight></codeline>
<codeline lineno="642"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_IGMP</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="643"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>there<sp/>is<sp/>an<sp/>extra<sp/>&quot;router<sp/>alert&quot;<sp/>option<sp/>in<sp/>IGMP<sp/>messages<sp/>which<sp/>we<sp/>allow<sp/>for<sp/>but<sp/>do<sp/>not<sp/>police<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="644"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((iphdr_hlen<sp/>&gt;<sp/><ref refid="prot_2ip4_8h_1ad76777d4d34f33ab5f715f9ca15503c3" kindref="member">IP_HLEN</ref>)<sp/>&amp;&amp;<sp/><sp/>(<ref refid="prot_2ip4_8h_1aa2de6f9d35337b4be67d799805665e11" kindref="member">IPH_PROTO</ref>(iphdr)<sp/>!=<sp/><ref refid="prot_2ip_8h_1a4f8609139fce15ace0c6d117021e29a4" kindref="member">IP_PROTO_IGMP</ref>))<sp/>{</highlight></codeline>
<codeline lineno="645"><highlight class="normal"></highlight><highlight class="preprocessor">#else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="646"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(iphdr_hlen<sp/>&gt;<sp/><ref refid="prot_2ip4_8h_1ad76777d4d34f33ab5f715f9ca15503c3" kindref="member">IP_HLEN</ref>)<sp/>{</highlight></codeline>
<codeline lineno="647"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_IGMP<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="648"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a5d3348778951e7bc5cd397c6575eef3a" kindref="member">IP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga0269bdc51f1e8a5ecf9af72c6e1c996c" kindref="member">LWIP_DBG_LEVEL_SERIOUS</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;IP<sp/>packet<sp/>dropped<sp/>since<sp/>there<sp/>were<sp/>IP<sp/>options<sp/>(while<sp/>IP_OPTIONS_ALLOWED<sp/>==<sp/>0).\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="649"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(p);</highlight></codeline>
<codeline lineno="650"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="stats_8h_1af0a2079f449ce75c1eb49b8a5c922de8" kindref="member">IP_STATS_INC</ref>(ip.opterr);</highlight></codeline>
<codeline lineno="651"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="stats_8h_1af0a2079f449ce75c1eb49b8a5c922de8" kindref="member">IP_STATS_INC</ref>(ip.drop);</highlight></codeline>
<codeline lineno="652"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>unsupported<sp/>protocol<sp/>feature<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="653"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="stats_8h_1a237a8f1e47af42fb612e936e928a9ced" kindref="member">MIB2_STATS_INC</ref>(mib2.ipinunknownprotos);</highlight></codeline>
<codeline lineno="654"><highlight class="normal"><sp/><sp/><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="655"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="656"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>IP_OPTIONS_ALLOWED<sp/>==<sp/>0<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="657"><highlight class="normal"></highlight></codeline>
<codeline lineno="658"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>send<sp/>to<sp/>upper<sp/>layers<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="659"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a5d3348778951e7bc5cd397c6575eef3a" kindref="member">IP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;ip4_input:<sp/>\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="660"><highlight class="normal"><sp/><sp/>ip4_debug_print(p);</highlight></codeline>
<codeline lineno="661"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a5d3348778951e7bc5cd397c6575eef3a" kindref="member">IP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;ip4_input:<sp/>p-&gt;len<sp/>%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;<sp/>p-&gt;tot_len<sp/>%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;\n&quot;</highlight><highlight class="normal">,<sp/>p-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref>,<sp/>p-&gt;<ref refid="structpbuf_1a5259e7ec29bab9c0999b64f2e86b411f" kindref="member">tot_len</ref>));</highlight></codeline>
<codeline lineno="662"><highlight class="normal"></highlight></codeline>
<codeline lineno="663"><highlight class="normal"><sp/><sp/><ref refid="ip_8h_1ac944fb6564f181bc90bc7c2b8b00d94c" kindref="member">ip_data</ref>.<ref refid="structip__globals_1a7803dc5950d143e4433a0df689989bab" kindref="member">current_netif</ref><sp/>=<sp/><ref refid="structnetif" kindref="compound">netif</ref>;</highlight></codeline>
<codeline lineno="664"><highlight class="normal"><sp/><sp/><ref refid="ip_8h_1ac944fb6564f181bc90bc7c2b8b00d94c" kindref="member">ip_data</ref>.<ref refid="structip__globals_1a7da899c663b1d560b61d92ba6d544701" kindref="member">current_input_netif</ref><sp/>=<sp/>inp;</highlight></codeline>
<codeline lineno="665"><highlight class="normal"><sp/><sp/><ref refid="ip_8h_1ac944fb6564f181bc90bc7c2b8b00d94c" kindref="member">ip_data</ref>.current_ip4_header<sp/>=<sp/>iphdr;</highlight></codeline>
<codeline lineno="666"><highlight class="normal"><sp/><sp/><ref refid="ip_8h_1ac944fb6564f181bc90bc7c2b8b00d94c" kindref="member">ip_data</ref>.<ref refid="structip__globals_1a17004526e6f1a164c0bab01aeac5e34a" kindref="member">current_ip_header_tot_len</ref><sp/>=<sp/><ref refid="prot_2ip4_8h_1a7c60caeb708571a07a44309c10ec3a01" kindref="member">IPH_HL</ref>(iphdr)<sp/>*<sp/>4;</highlight></codeline>
<codeline lineno="667"><highlight class="normal"></highlight></codeline>
<codeline lineno="668"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_RAW</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="669"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>raw<sp/>input<sp/>did<sp/>not<sp/>eat<sp/>the<sp/>packet?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="670"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(raw_input(p,<sp/>inp)<sp/>==<sp/>0)</highlight></codeline>
<codeline lineno="671"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_RAW<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="672"><highlight class="normal"><sp/><sp/>{</highlight></codeline>
<codeline lineno="673"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="pbuf_8h_1aaa17c1951cf2d207b6adfd3947d91f00" kindref="member">pbuf_header</ref>(p,<sp/>-(<ref refid="group__compiler__abstraction_1gacf46f4df0ebab84edebcb69967fdf86b" kindref="member">s16_t</ref>)iphdr_hlen);<sp/></highlight><highlight class="comment">/*<sp/>Move<sp/>to<sp/>payload,<sp/>no<sp/>check<sp/>necessary.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="674"><highlight class="normal"></highlight></codeline>
<codeline lineno="675"><highlight class="normal"></highlight></codeline>
<codeline lineno="676"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">switch</highlight><highlight class="normal"><sp/>(<ref refid="prot_2ip4_8h_1aa2de6f9d35337b4be67d799805665e11" kindref="member">IPH_PROTO</ref>(iphdr))<sp/>{</highlight></codeline>
<codeline lineno="677"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_UDP</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="678"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="prot_2ip_8h_1a76212e7ef71a99646040d2e454388bed" kindref="member">IP_PROTO_UDP</ref>:</highlight></codeline>
<codeline lineno="679"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_UDPLITE</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="680"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="prot_2ip_8h_1a3ef2b8a1cb4f7acee3142337438dfd0d" kindref="member">IP_PROTO_UDPLITE</ref>:</highlight></codeline>
<codeline lineno="681"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_UDPLITE<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="682"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1a237a8f1e47af42fb612e936e928a9ced" kindref="member">MIB2_STATS_INC</ref>(mib2.ipindelivers);</highlight></codeline>
<codeline lineno="683"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>udp_input(p,<sp/>inp);</highlight></codeline>
<codeline lineno="684"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="685"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_UDP<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="686"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_TCP</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="687"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="prot_2ip_8h_1a634284ee3a136d6ad61bc5d917ebb82f" kindref="member">IP_PROTO_TCP</ref>:</highlight></codeline>
<codeline lineno="688"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1a237a8f1e47af42fb612e936e928a9ced" kindref="member">MIB2_STATS_INC</ref>(mib2.ipindelivers);</highlight></codeline>
<codeline lineno="689"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>tcp_input(p,<sp/>inp);</highlight></codeline>
<codeline lineno="690"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="691"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_TCP<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="692"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_ICMP</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="693"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="prot_2ip_8h_1aacaea7b8c4c8a5229c02b653766b4793" kindref="member">IP_PROTO_ICMP</ref>:</highlight></codeline>
<codeline lineno="694"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1a237a8f1e47af42fb612e936e928a9ced" kindref="member">MIB2_STATS_INC</ref>(mib2.ipindelivers);</highlight></codeline>
<codeline lineno="695"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>icmp_input(p,<sp/>inp);</highlight></codeline>
<codeline lineno="696"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="697"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_ICMP<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="698"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_IGMP</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="699"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="prot_2ip_8h_1a4f8609139fce15ace0c6d117021e29a4" kindref="member">IP_PROTO_IGMP</ref>:</highlight></codeline>
<codeline lineno="700"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>igmp_input(p,<sp/>inp,<sp/>ip4_current_dest_addr());</highlight></codeline>
<codeline lineno="701"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="702"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_IGMP<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="703"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">default</highlight><highlight class="normal">:</highlight></codeline>
<codeline lineno="704"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_ICMP</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="705"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>send<sp/>ICMP<sp/>destination<sp/>protocol<sp/>unreachable<sp/>unless<sp/>is<sp/>was<sp/>a<sp/>broadcast<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="706"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!ip4_addr_isbroadcast(ip4_current_dest_addr(),<sp/><ref refid="structnetif" kindref="compound">netif</ref>)<sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="707"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>!ip4_addr_ismulticast(ip4_current_dest_addr()))<sp/>{</highlight></codeline>
<codeline lineno="708"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="pbuf_8h_1a27480c41c34021d4417691d327163626" kindref="member">pbuf_header_force</ref>(p,<sp/>iphdr_hlen);<sp/></highlight><highlight class="comment">/*<sp/>Move<sp/>to<sp/>ip<sp/>header,<sp/>no<sp/>check<sp/>necessary.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="709"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>p-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref><sp/>=<sp/>iphdr;</highlight></codeline>
<codeline lineno="710"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>icmp_dest_unreach(p,<sp/><ref refid="icmp_8h_1a17637465f209385e5d19ef47fd9266a5a3c7bbd13b613990413ef167017dfbcef" kindref="member">ICMP_DUR_PROTO</ref>);</highlight></codeline>
<codeline lineno="711"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="712"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_ICMP<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="713"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(p);</highlight></codeline>
<codeline lineno="714"><highlight class="normal"></highlight></codeline>
<codeline lineno="715"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a5d3348778951e7bc5cd397c6575eef3a" kindref="member">IP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga0269bdc51f1e8a5ecf9af72c6e1c996c" kindref="member">LWIP_DBG_LEVEL_SERIOUS</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;Unsupported<sp/>transport<sp/>protocol<sp/>%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;\n&quot;</highlight><highlight class="normal">,<sp/>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)<ref refid="prot_2ip4_8h_1aa2de6f9d35337b4be67d799805665e11" kindref="member">IPH_PROTO</ref>(iphdr)));</highlight></codeline>
<codeline lineno="716"><highlight class="normal"></highlight></codeline>
<codeline lineno="717"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1af0a2079f449ce75c1eb49b8a5c922de8" kindref="member">IP_STATS_INC</ref>(ip.proterr);</highlight></codeline>
<codeline lineno="718"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1af0a2079f449ce75c1eb49b8a5c922de8" kindref="member">IP_STATS_INC</ref>(ip.drop);</highlight></codeline>
<codeline lineno="719"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1a237a8f1e47af42fb612e936e928a9ced" kindref="member">MIB2_STATS_INC</ref>(mib2.ipinunknownprotos);</highlight></codeline>
<codeline lineno="720"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="721"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="722"><highlight class="normal"></highlight></codeline>
<codeline lineno="723"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>@todo:<sp/>this<sp/>is<sp/>not<sp/>really<sp/>necessary...<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="724"><highlight class="normal"><sp/><sp/><ref refid="ip_8h_1ac944fb6564f181bc90bc7c2b8b00d94c" kindref="member">ip_data</ref>.<ref refid="structip__globals_1a7803dc5950d143e4433a0df689989bab" kindref="member">current_netif</ref><sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="725"><highlight class="normal"><sp/><sp/><ref refid="ip_8h_1ac944fb6564f181bc90bc7c2b8b00d94c" kindref="member">ip_data</ref>.<ref refid="structip__globals_1a7da899c663b1d560b61d92ba6d544701" kindref="member">current_input_netif</ref><sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="726"><highlight class="normal"><sp/><sp/><ref refid="ip_8h_1ac944fb6564f181bc90bc7c2b8b00d94c" kindref="member">ip_data</ref>.current_ip4_header<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="727"><highlight class="normal"><sp/><sp/><ref refid="ip_8h_1ac944fb6564f181bc90bc7c2b8b00d94c" kindref="member">ip_data</ref>.<ref refid="structip__globals_1a17004526e6f1a164c0bab01aeac5e34a" kindref="member">current_ip_header_tot_len</ref><sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="728"><highlight class="normal"><sp/><sp/>ip4_addr_set_any(ip4_current_src_addr());</highlight></codeline>
<codeline lineno="729"><highlight class="normal"><sp/><sp/>ip4_addr_set_any(ip4_current_dest_addr());</highlight></codeline>
<codeline lineno="730"><highlight class="normal"></highlight></codeline>
<codeline lineno="731"><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="732"><highlight class="normal">}</highlight></codeline>
<codeline lineno="733"><highlight class="normal"></highlight></codeline>
<codeline lineno="759"><highlight class="normal"><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="760"><highlight class="normal">ip4_output_if(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*p,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>ip4_addr_t<sp/>*src,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>ip4_addr_t<sp/>*dest,</highlight></codeline>
<codeline lineno="761"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>ttl,<sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>tos,</highlight></codeline>
<codeline lineno="762"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>proto,<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>)</highlight></codeline>
<codeline lineno="763"><highlight class="normal">{</highlight></codeline>
<codeline lineno="764"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>IP_OPTIONS_SEND</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="765"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>ip4_output_if_opt(p,<sp/>src,<sp/>dest,<sp/>ttl,<sp/>tos,<sp/>proto,<sp/><ref refid="structnetif" kindref="compound">netif</ref>,<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>,<sp/>0);</highlight></codeline>
<codeline lineno="766"><highlight class="normal">}</highlight></codeline>
<codeline lineno="767"><highlight class="normal"></highlight></codeline>
<codeline lineno="774"><highlight class="normal"><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="775"><highlight class="normal">ip4_output_if_opt(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*p,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>ip4_addr_t<sp/>*src,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>ip4_addr_t<sp/>*dest,</highlight></codeline>
<codeline lineno="776"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>ttl,<sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>tos,<sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>proto,<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="keywordtype">void</highlight><highlight class="normal"><sp/>*ip_options,</highlight></codeline>
<codeline lineno="777"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>optlen)</highlight></codeline>
<codeline lineno="778"><highlight class="normal">{</highlight></codeline>
<codeline lineno="779"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>IP_OPTIONS_SEND<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="780"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>ip4_addr_t<sp/>*src_used<sp/>=<sp/>src;</highlight></codeline>
<codeline lineno="781"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dest<sp/>!=<sp/><ref refid="ip_8h_1a2b7dff1859ced5f2be3fc3da231819d7" kindref="member">LWIP_IP_HDRINCL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="782"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ip4_addr_isany(src))<sp/>{</highlight></codeline>
<codeline lineno="783"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>src_used<sp/>=<sp/>netif_ip4_addr(<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="784"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="785"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="786"><highlight class="normal"></highlight></codeline>
<codeline lineno="787"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>IP_OPTIONS_SEND</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="788"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>ip4_output_if_opt_src(p,<sp/>src_used,<sp/>dest,<sp/>ttl,<sp/>tos,<sp/>proto,<sp/><ref refid="structnetif" kindref="compound">netif</ref>,</highlight></codeline>
<codeline lineno="789"><highlight class="normal"><sp/><sp/><sp/><sp/>ip_options,<sp/>optlen);</highlight></codeline>
<codeline lineno="790"><highlight class="normal"></highlight><highlight class="preprocessor">#else<sp/></highlight><highlight class="comment">/*<sp/>IP_OPTIONS_SEND<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="791"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>ip4_output_if_src(p,<sp/>src_used,<sp/>dest,<sp/>ttl,<sp/>tos,<sp/>proto,<sp/><ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="792"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>IP_OPTIONS_SEND<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="793"><highlight class="normal">}</highlight></codeline>
<codeline lineno="794"><highlight class="normal"></highlight></codeline>
<codeline lineno="799"><highlight class="normal"><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="800"><highlight class="normal">ip4_output_if_src(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*p,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>ip4_addr_t<sp/>*src,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>ip4_addr_t<sp/>*dest,</highlight></codeline>
<codeline lineno="801"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>ttl,<sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>tos,</highlight></codeline>
<codeline lineno="802"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>proto,<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>)</highlight></codeline>
<codeline lineno="803"><highlight class="normal">{</highlight></codeline>
<codeline lineno="804"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>IP_OPTIONS_SEND</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="805"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>ip4_output_if_opt_src(p,<sp/>src,<sp/>dest,<sp/>ttl,<sp/>tos,<sp/>proto,<sp/><ref refid="structnetif" kindref="compound">netif</ref>,<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>,<sp/>0);</highlight></codeline>
<codeline lineno="806"><highlight class="normal">}</highlight></codeline>
<codeline lineno="807"><highlight class="normal"></highlight></codeline>
<codeline lineno="812"><highlight class="normal"><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="813"><highlight class="normal">ip4_output_if_opt_src(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*p,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>ip4_addr_t<sp/>*src,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>ip4_addr_t<sp/>*dest,</highlight></codeline>
<codeline lineno="814"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>ttl,<sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>tos,<sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>proto,<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="keywordtype">void</highlight><highlight class="normal"><sp/>*ip_options,</highlight></codeline>
<codeline lineno="815"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>optlen)</highlight></codeline>
<codeline lineno="816"><highlight class="normal">{</highlight></codeline>
<codeline lineno="817"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>IP_OPTIONS_SEND<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="818"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structip__hdr" kindref="compound">ip_hdr</ref><sp/>*iphdr;</highlight></codeline>
<codeline lineno="819"><highlight class="normal"><sp/><sp/>ip4_addr_t<sp/>dest_addr;</highlight></codeline>
<codeline lineno="820"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>CHECKSUM_GEN_IP_INLINE</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="821"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga4c14294869aceba3ef9d4c0c302d0f33" kindref="member">u32_t</ref><sp/>chk_sum<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="822"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>CHECKSUM_GEN_IP_INLINE<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="823"><highlight class="normal"></highlight></codeline>
<codeline lineno="824"><highlight class="normal"><sp/><sp/><ref refid="ip_8h_1a355679dba1c0d8ef07ce3abcd28e3063" kindref="member">LWIP_IP_CHECK_PBUF_REF_COUNT_FOR_TX</ref>(p);</highlight></codeline>
<codeline lineno="825"><highlight class="normal"></highlight></codeline>
<codeline lineno="826"><highlight class="normal"><sp/><sp/><ref refid="stats_8h_1a237a8f1e47af42fb612e936e928a9ced" kindref="member">MIB2_STATS_INC</ref>(mib2.ipoutrequests);</highlight></codeline>
<codeline lineno="827"><highlight class="normal"></highlight></codeline>
<codeline lineno="828"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Should<sp/>the<sp/>IP<sp/>header<sp/>be<sp/>generated<sp/>or<sp/>is<sp/>it<sp/>already<sp/>included<sp/>in<sp/>p?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="829"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dest<sp/>!=<sp/><ref refid="ip_8h_1a2b7dff1859ced5f2be3fc3da231819d7" kindref="member">LWIP_IP_HDRINCL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="830"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>ip_hlen<sp/>=<sp/><ref refid="prot_2ip4_8h_1ad76777d4d34f33ab5f715f9ca15503c3" kindref="member">IP_HLEN</ref>;</highlight></codeline>
<codeline lineno="831"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>IP_OPTIONS_SEND</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="832"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>optlen_aligned<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="833"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(optlen<sp/>!=<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="834"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>CHECKSUM_GEN_IP_INLINE</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="835"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>i;</highlight></codeline>
<codeline lineno="836"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>CHECKSUM_GEN_IP_INLINE<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="837"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>round<sp/>up<sp/>to<sp/>a<sp/>multiple<sp/>of<sp/>4<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="838"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>optlen_aligned<sp/>=<sp/>((optlen<sp/>+<sp/>3)<sp/>&amp;<sp/>~3);</highlight></codeline>
<codeline lineno="839"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>ip_hlen<sp/>+=<sp/>optlen_aligned;</highlight></codeline>
<codeline lineno="840"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>First<sp/>write<sp/>in<sp/>the<sp/>IP<sp/>options<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="841"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="pbuf_8h_1aaa17c1951cf2d207b6adfd3947d91f00" kindref="member">pbuf_header</ref>(p,<sp/>optlen_aligned))<sp/>{</highlight></codeline>
<codeline lineno="842"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a5d3348778951e7bc5cd397c6575eef3a" kindref="member">IP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga0269bdc51f1e8a5ecf9af72c6e1c996c" kindref="member">LWIP_DBG_LEVEL_SERIOUS</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;ip4_output_if_opt:<sp/>not<sp/>enough<sp/>room<sp/>for<sp/>IP<sp/>options<sp/>in<sp/>pbuf\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="843"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1af0a2079f449ce75c1eb49b8a5c922de8" kindref="member">IP_STATS_INC</ref>(ip.err);</highlight></codeline>
<codeline lineno="844"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1a237a8f1e47af42fb612e936e928a9ced" kindref="member">MIB2_STATS_INC</ref>(mib2.ipoutdiscards);</highlight></codeline>
<codeline lineno="845"><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_1ggae2e66c7d13afc90ffecd6151680fbadca05c91366f1b5203a5db9a241b415cd63" kindref="member">ERR_BUF</ref>;</highlight></codeline>
<codeline lineno="846"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="847"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="lwipopts_8h_1aa1dd57a66b6de8c0593e9e3e8d1411f6" kindref="member">MEMCPY</ref>(p-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref>,<sp/>ip_options,<sp/>optlen);</highlight></codeline>
<codeline lineno="848"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(optlen<sp/>&lt;<sp/>optlen_aligned)<sp/>{</highlight></codeline>
<codeline lineno="849"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>zero<sp/>the<sp/>remaining<sp/>bytes<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="850"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="string_8h_1ace4b911463887af5e748326323e99a23" kindref="member">memset</ref>(((</highlight><highlight class="keywordtype">char</highlight><highlight class="normal">*)p-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref>)<sp/>+<sp/>optlen,<sp/>0,<sp/>optlen_aligned<sp/>-<sp/>optlen);</highlight></codeline>
<codeline lineno="851"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="852"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>CHECKSUM_GEN_IP_INLINE</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="853"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i<sp/>=<sp/>0;<sp/>i<sp/>&lt;<sp/>optlen_aligned/2;<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="854"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>chk_sum<sp/>+=<sp/>((<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>*)p-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref>)[i];</highlight></codeline>
<codeline lineno="855"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="856"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>CHECKSUM_GEN_IP_INLINE<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="857"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="858"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>IP_OPTIONS_SEND<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="859"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>generate<sp/>IP<sp/>header<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="860"><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>(p,<sp/><ref refid="prot_2ip4_8h_1ad76777d4d34f33ab5f715f9ca15503c3" kindref="member">IP_HLEN</ref>))<sp/>{</highlight></codeline>
<codeline lineno="861"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a5d3348778951e7bc5cd397c6575eef3a" kindref="member">IP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga0269bdc51f1e8a5ecf9af72c6e1c996c" kindref="member">LWIP_DBG_LEVEL_SERIOUS</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;ip4_output:<sp/>not<sp/>enough<sp/>room<sp/>for<sp/>IP<sp/>header<sp/>in<sp/>pbuf\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="862"><highlight class="normal"></highlight></codeline>
<codeline lineno="863"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1af0a2079f449ce75c1eb49b8a5c922de8" kindref="member">IP_STATS_INC</ref>(ip.err);</highlight></codeline>
<codeline lineno="864"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1a237a8f1e47af42fb612e936e928a9ced" kindref="member">MIB2_STATS_INC</ref>(mib2.ipoutdiscards);</highlight></codeline>
<codeline lineno="865"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadca05c91366f1b5203a5db9a241b415cd63" kindref="member">ERR_BUF</ref>;</highlight></codeline>
<codeline lineno="866"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="867"><highlight class="normal"></highlight></codeline>
<codeline lineno="868"><highlight class="normal"><sp/><sp/><sp/><sp/>iphdr<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structip__hdr" kindref="compound">ip_hdr</ref><sp/>*)p-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref>;</highlight></codeline>
<codeline lineno="869"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;check<sp/>that<sp/>first<sp/>pbuf<sp/>can<sp/>hold<sp/>struct<sp/>ip_hdr&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="870"><highlight class="normal"><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/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structip__hdr" kindref="compound">ip_hdr</ref>)));</highlight></codeline>
<codeline lineno="871"><highlight class="normal"></highlight></codeline>
<codeline lineno="872"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="prot_2ip4_8h_1aa0e49f03bd4c3144e3548a0db72d1deb" kindref="member">IPH_TTL_SET</ref>(iphdr,<sp/>ttl);</highlight></codeline>
<codeline lineno="873"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="prot_2ip4_8h_1a49753f7668f741b1877340bff6fb97c3" kindref="member">IPH_PROTO_SET</ref>(iphdr,<sp/>proto);</highlight></codeline>
<codeline lineno="874"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>CHECKSUM_GEN_IP_INLINE</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="875"><highlight class="normal"><sp/><sp/><sp/><sp/>chk_sum<sp/>+=<sp/><ref refid="def_8h_1a7d17b88eabf7766c0bfa89d8f965f67e" kindref="member">PP_NTOHS</ref>(proto<sp/>|<sp/>(ttl<sp/>&lt;&lt;<sp/>8));</highlight></codeline>
<codeline lineno="876"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>CHECKSUM_GEN_IP_INLINE<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="877"><highlight class="normal"></highlight></codeline>
<codeline lineno="878"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>dest<sp/>cannot<sp/>be<sp/>NULL<sp/>here<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="879"><highlight class="normal"><sp/><sp/><sp/><sp/>ip4_addr_copy(iphdr-&gt;dest,<sp/>*dest);</highlight></codeline>
<codeline lineno="880"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>CHECKSUM_GEN_IP_INLINE</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="881"><highlight class="normal"><sp/><sp/><sp/><sp/>chk_sum<sp/>+=<sp/>ip4_addr_get_u32(&amp;iphdr-&gt;dest)<sp/>&amp;<sp/>0xFFFF;</highlight></codeline>
<codeline lineno="882"><highlight class="normal"><sp/><sp/><sp/><sp/>chk_sum<sp/>+=<sp/>ip4_addr_get_u32(&amp;iphdr-&gt;dest)<sp/>&gt;&gt;<sp/>16;</highlight></codeline>
<codeline lineno="883"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>CHECKSUM_GEN_IP_INLINE<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="884"><highlight class="normal"></highlight></codeline>
<codeline lineno="885"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="prot_2ip4_8h_1a037908f4291c62a7336362506cea01af" kindref="member">IPH_VHL_SET</ref>(iphdr,<sp/>4,<sp/>ip_hlen<sp/>/<sp/>4);</highlight></codeline>
<codeline lineno="886"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="prot_2ip4_8h_1af4e4d0cbbb1de541eea2b53b91e8b172" kindref="member">IPH_TOS_SET</ref>(iphdr,<sp/>tos);</highlight></codeline>
<codeline lineno="887"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>CHECKSUM_GEN_IP_INLINE</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="888"><highlight class="normal"><sp/><sp/><sp/><sp/>chk_sum<sp/>+=<sp/><ref refid="def_8h_1a7d17b88eabf7766c0bfa89d8f965f67e" kindref="member">PP_NTOHS</ref>(tos<sp/>|<sp/>(iphdr-&gt;_v_hl<sp/>&lt;&lt;<sp/>8));</highlight></codeline>
<codeline lineno="889"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>CHECKSUM_GEN_IP_INLINE<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="890"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="prot_2ip4_8h_1a069cb9b3765c4bdd63d13efb2df0206e" kindref="member">IPH_LEN_SET</ref>(iphdr,<sp/><ref refid="def_8c_1ad637280639de4066392e6b5614fa3e56" kindref="member">lwip_htons</ref>(p-&gt;<ref refid="structpbuf_1a5259e7ec29bab9c0999b64f2e86b411f" kindref="member">tot_len</ref>));</highlight></codeline>
<codeline lineno="891"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>CHECKSUM_GEN_IP_INLINE</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="892"><highlight class="normal"><sp/><sp/><sp/><sp/>chk_sum<sp/>+=<sp/>iphdr-&gt;_len;</highlight></codeline>
<codeline lineno="893"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>CHECKSUM_GEN_IP_INLINE<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="894"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="prot_2ip4_8h_1a4c2189e1400dca1c0f785de96ceda2b6" kindref="member">IPH_OFFSET_SET</ref>(iphdr,<sp/>0);</highlight></codeline>
<codeline lineno="895"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="prot_2ip4_8h_1a3b2c57b6a9dc9cc32fc2f145a96bbf8f" kindref="member">IPH_ID_SET</ref>(iphdr,<sp/><ref refid="def_8c_1ad637280639de4066392e6b5614fa3e56" kindref="member">lwip_htons</ref>(ip_id));</highlight></codeline>
<codeline lineno="896"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>CHECKSUM_GEN_IP_INLINE</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="897"><highlight class="normal"><sp/><sp/><sp/><sp/>chk_sum<sp/>+=<sp/>iphdr-&gt;_id;</highlight></codeline>
<codeline lineno="898"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>CHECKSUM_GEN_IP_INLINE<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="899"><highlight class="normal"><sp/><sp/><sp/><sp/>++ip_id;</highlight></codeline>
<codeline lineno="900"><highlight class="normal"></highlight></codeline>
<codeline lineno="901"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(src<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="902"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>ip4_addr_copy(iphdr-&gt;src,<sp/>*IP4_ADDR_ANY4);</highlight></codeline>
<codeline lineno="903"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="904"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>src<sp/>cannot<sp/>be<sp/>NULL<sp/>here<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="905"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>ip4_addr_copy(iphdr-&gt;src,<sp/>*src);</highlight></codeline>
<codeline lineno="906"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="907"><highlight class="normal"></highlight></codeline>
<codeline lineno="908"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>CHECKSUM_GEN_IP_INLINE</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="909"><highlight class="normal"><sp/><sp/><sp/><sp/>chk_sum<sp/>+=<sp/>ip4_addr_get_u32(&amp;iphdr-&gt;src)<sp/>&amp;<sp/>0xFFFF;</highlight></codeline>
<codeline lineno="910"><highlight class="normal"><sp/><sp/><sp/><sp/>chk_sum<sp/>+=<sp/>ip4_addr_get_u32(&amp;iphdr-&gt;src)<sp/>&gt;&gt;<sp/>16;</highlight></codeline>
<codeline lineno="911"><highlight class="normal"><sp/><sp/><sp/><sp/>chk_sum<sp/>=<sp/>(chk_sum<sp/>&gt;&gt;<sp/>16)<sp/>+<sp/>(chk_sum<sp/>&amp;<sp/>0xFFFF);</highlight></codeline>
<codeline lineno="912"><highlight class="normal"><sp/><sp/><sp/><sp/>chk_sum<sp/>=<sp/>(chk_sum<sp/>&gt;&gt;<sp/>16)<sp/>+<sp/>chk_sum;</highlight></codeline>
<codeline lineno="913"><highlight class="normal"><sp/><sp/><sp/><sp/>chk_sum<sp/>=<sp/>~chk_sum;</highlight></codeline>
<codeline lineno="914"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="netif_8h_1ad968df1b35c2fae368e087966e3bc677" kindref="member">IF__NETIF_CHECKSUM_ENABLED</ref>(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>NETIF_CHECKSUM_GEN_IP)<sp/>{</highlight></codeline>
<codeline lineno="915"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>iphdr-&gt;_chksum<sp/>=<sp/>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)chk_sum;<sp/></highlight><highlight class="comment">/*<sp/>network<sp/>order<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="916"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="917"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_CHECKSUM_CTRL_PER_NETIF</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="918"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="919"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="prot_2ip4_8h_1aec30403fb98b013bd094688de55cdaef" kindref="member">IPH_CHKSUM_SET</ref>(iphdr,<sp/>0);</highlight></codeline>
<codeline lineno="920"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="921"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_CHECKSUM_CTRL_PER_NETIF*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="922"><highlight class="normal"></highlight><highlight class="preprocessor">#else<sp/></highlight><highlight class="comment">/*<sp/>CHECKSUM_GEN_IP_INLINE<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="923"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="prot_2ip4_8h_1aec30403fb98b013bd094688de55cdaef" kindref="member">IPH_CHKSUM_SET</ref>(iphdr,<sp/>0);</highlight></codeline>
<codeline lineno="924"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>CHECKSUM_GEN_IP</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="925"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="netif_8h_1ad968df1b35c2fae368e087966e3bc677" kindref="member">IF__NETIF_CHECKSUM_ENABLED</ref>(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>NETIF_CHECKSUM_GEN_IP)<sp/>{</highlight></codeline>
<codeline lineno="926"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="prot_2ip4_8h_1aec30403fb98b013bd094688de55cdaef" kindref="member">IPH_CHKSUM_SET</ref>(iphdr,<sp/><ref refid="inet__chksum_8h_1a34f1aa1587562a09e11b704b51bab043" kindref="member">inet_chksum</ref>(iphdr,<sp/>ip_hlen));</highlight></codeline>
<codeline lineno="927"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="928"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>CHECKSUM_GEN_IP<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="929"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>CHECKSUM_GEN_IP_INLINE<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="930"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="931"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>IP<sp/>header<sp/>already<sp/>included<sp/>in<sp/>p<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="932"><highlight class="normal"><sp/><sp/><sp/><sp/>iphdr<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structip__hdr" kindref="compound">ip_hdr</ref><sp/>*)p-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref>;</highlight></codeline>
<codeline lineno="933"><highlight class="normal"><sp/><sp/><sp/><sp/>ip4_addr_copy(dest_addr,<sp/>iphdr-&gt;dest);</highlight></codeline>
<codeline lineno="934"><highlight class="normal"><sp/><sp/><sp/><sp/>dest<sp/>=<sp/>&amp;dest_addr;</highlight></codeline>
<codeline lineno="935"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="936"><highlight class="normal"></highlight></codeline>
<codeline lineno="937"><highlight class="normal"><sp/><sp/><ref refid="stats_8h_1af0a2079f449ce75c1eb49b8a5c922de8" kindref="member">IP_STATS_INC</ref>(ip.xmit);</highlight></codeline>
<codeline lineno="938"><highlight class="normal"></highlight></codeline>
<codeline lineno="939"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a5d3348778951e7bc5cd397c6575eef3a" kindref="member">IP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;ip4_output_if:<sp/>%c%c%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;\n&quot;</highlight><highlight class="normal">,<sp/><ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1a32fca6ffd28bb9af3f891a378827a67e" kindref="member">name</ref>[0],<sp/><ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1a32fca6ffd28bb9af3f891a378827a67e" kindref="member">name</ref>[1],<sp/>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)<ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1ab7ef01e505dd2feb781fe86756b1c973" kindref="member">num</ref>));</highlight></codeline>
<codeline lineno="940"><highlight class="normal"><sp/><sp/>ip4_debug_print(p);</highlight></codeline>
<codeline lineno="941"><highlight class="normal"></highlight></codeline>
<codeline lineno="942"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>ENABLE_LOOPBACK</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="943"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ip4_addr_cmp(dest,<sp/>netif_ip4_addr(<ref refid="structnetif" kindref="compound">netif</ref>))</highlight></codeline>
<codeline lineno="944"><highlight class="normal">#</highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>!<ref refid="lwipopts_8h_1aa2b1f736373cd896e212644aa453fbaf" kindref="member">LWIP_HAVE_LOOPIF</ref></highlight></codeline>
<codeline lineno="945"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>||<sp/>ip4_addr_isloopback(dest)</highlight></codeline>
<codeline lineno="946"><highlight class="normal">#endif<sp/></highlight><highlight class="comment">/*<sp/>!LWIP_HAVE_LOOPIF<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="947"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>)<sp/>{</highlight></codeline>
<codeline lineno="948"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Packet<sp/>to<sp/>self,<sp/>enqueue<sp/>it<sp/>for<sp/>loopback<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="949"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a5d3348778951e7bc5cd397c6575eef3a" kindref="member">IP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;netif_loop_output()&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="950"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>netif_loop_output(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>p);</highlight></codeline>
<codeline lineno="951"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="952"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_MULTICAST_TX_OPTIONS</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="953"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((p-&gt;<ref refid="structpbuf_1aa4d1af2cab3d9280d29212095b5b872a" kindref="member">flags</ref><sp/>&amp;<sp/><ref refid="pbuf_8h_1ab8ad153151a8c157335d9c0cedc007e6" kindref="member">PBUF_FLAG_MCASTLOOP</ref>)<sp/>!=<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="954"><highlight class="normal"><sp/><sp/><sp/><sp/>netif_loop_output(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>p);</highlight></codeline>
<codeline lineno="955"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="956"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_MULTICAST_TX_OPTIONS<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="957"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>ENABLE_LOOPBACK<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="958"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>IP_FRAG</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="959"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>don&apos;t<sp/>fragment<sp/>if<sp/>interface<sp/>has<sp/>mtu<sp/>set<sp/>to<sp/>0<sp/>[loopif]<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="960"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1aca7d56b4e0f822b0ced2885f222b8d48" kindref="member">mtu</ref><sp/>&amp;&amp;<sp/>(p-&gt;<ref refid="structpbuf_1a5259e7ec29bab9c0999b64f2e86b411f" kindref="member">tot_len</ref><sp/>&gt;<sp/><ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1aca7d56b4e0f822b0ced2885f222b8d48" kindref="member">mtu</ref>))<sp/>{</highlight></codeline>
<codeline lineno="961"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>ip4_frag(p,<sp/><ref refid="structnetif" kindref="compound">netif</ref>,<sp/>dest);</highlight></codeline>
<codeline lineno="962"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="963"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>IP_FRAG<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="964"><highlight class="normal"></highlight></codeline>
<codeline lineno="965"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a5d3348778951e7bc5cd397c6575eef3a" kindref="member">IP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;ip4_output_if:<sp/>call<sp/>netif-&gt;output()\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="966"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref>-&gt;output(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>p,<sp/>dest);</highlight></codeline>
<codeline lineno="967"><highlight class="normal">}</highlight></codeline>
<codeline lineno="968"><highlight class="normal"></highlight></codeline>
<codeline lineno="986"><highlight class="normal"><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="987"><highlight class="normal">ip4_output(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*p,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>ip4_addr_t<sp/>*src,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>ip4_addr_t<sp/>*dest,</highlight></codeline>
<codeline lineno="988"><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/>ttl,<sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>tos,<sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>proto)</highlight></codeline>
<codeline lineno="989"><highlight class="normal">{</highlight></codeline>
<codeline lineno="990"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>;</highlight></codeline>
<codeline lineno="991"><highlight class="normal"></highlight></codeline>
<codeline lineno="992"><highlight class="normal"><sp/><sp/><ref refid="ip_8h_1a355679dba1c0d8ef07ce3abcd28e3063" kindref="member">LWIP_IP_CHECK_PBUF_REF_COUNT_FOR_TX</ref>(p);</highlight></codeline>
<codeline lineno="993"><highlight class="normal"></highlight></codeline>
<codeline lineno="994"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((<ref refid="structnetif" kindref="compound">netif</ref><sp/>=<sp/>ip4_route_src(dest,<sp/>src))<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="995"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a5d3348778951e7bc5cd397c6575eef3a" kindref="member">IP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;ip4_output:<sp/>No<sp/>route<sp/>to<sp/>%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;.%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;.%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;.%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;\n&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="996"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>ip4_addr1_16(dest),<sp/>ip4_addr2_16(dest),<sp/>ip4_addr3_16(dest),<sp/>ip4_addr4_16(dest)));</highlight></codeline>
<codeline lineno="997"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="stats_8h_1af0a2079f449ce75c1eb49b8a5c922de8" kindref="member">IP_STATS_INC</ref>(ip.rterr);</highlight></codeline>
<codeline lineno="998"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadca9448893187313c0c5a502ca9a9ad1c2a" kindref="member">ERR_RTE</ref>;</highlight></codeline>
<codeline lineno="999"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1000"><highlight class="normal"></highlight></codeline>
<codeline lineno="1001"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>ip4_output_if(p,<sp/>src,<sp/>dest,<sp/>ttl,<sp/>tos,<sp/>proto,<sp/><ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="1002"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1003"><highlight class="normal"></highlight></codeline>
<codeline lineno="1004"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_NETIF_HWADDRHINT</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1005"><highlight class="normal"></highlight></codeline>
<codeline lineno="1023"><highlight class="normal"><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="1024"><highlight class="normal">ip4_output_hinted(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*p,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>ip4_addr_t<sp/>*src,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>ip4_addr_t<sp/>*dest,</highlight></codeline>
<codeline lineno="1025"><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/>ttl,<sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>tos,<sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>proto,<sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>*addr_hint)</highlight></codeline>
<codeline lineno="1026"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1027"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>;</highlight></codeline>
<codeline lineno="1028"><highlight class="normal"><sp/><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref><sp/>err;</highlight></codeline>
<codeline lineno="1029"><highlight class="normal"></highlight></codeline>
<codeline lineno="1030"><highlight class="normal"><sp/><sp/><ref refid="ip_8h_1a355679dba1c0d8ef07ce3abcd28e3063" kindref="member">LWIP_IP_CHECK_PBUF_REF_COUNT_FOR_TX</ref>(p);</highlight></codeline>
<codeline lineno="1031"><highlight class="normal"></highlight></codeline>
<codeline lineno="1032"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((<ref refid="structnetif" kindref="compound">netif</ref><sp/>=<sp/>ip4_route_src(dest,<sp/>src))<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1033"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a5d3348778951e7bc5cd397c6575eef3a" kindref="member">IP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;ip4_output:<sp/>No<sp/>route<sp/>to<sp/>%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;.%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;.%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;.%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;\n&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="1034"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>ip4_addr1_16(dest),<sp/>ip4_addr2_16(dest),<sp/>ip4_addr3_16(dest),<sp/>ip4_addr4_16(dest)));</highlight></codeline>
<codeline lineno="1035"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="stats_8h_1af0a2079f449ce75c1eb49b8a5c922de8" kindref="member">IP_STATS_INC</ref>(ip.rterr);</highlight></codeline>
<codeline lineno="1036"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadca9448893187313c0c5a502ca9a9ad1c2a" kindref="member">ERR_RTE</ref>;</highlight></codeline>
<codeline lineno="1037"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1038"><highlight class="normal"></highlight></codeline>
<codeline lineno="1039"><highlight class="normal"><sp/><sp/><ref refid="netif_8h_1ae1c22f1dab74a84d9e31316fd5fdfa11" kindref="member">NETIF_SET_HWADDRHINT</ref>(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>addr_hint);</highlight></codeline>
<codeline lineno="1040"><highlight class="normal"><sp/><sp/>err<sp/>=<sp/>ip4_output_if(p,<sp/>src,<sp/>dest,<sp/>ttl,<sp/>tos,<sp/>proto,<sp/><ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="1041"><highlight class="normal"><sp/><sp/><ref refid="netif_8h_1ae1c22f1dab74a84d9e31316fd5fdfa11" kindref="member">NETIF_SET_HWADDRHINT</ref>(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>);</highlight></codeline>
<codeline lineno="1042"><highlight class="normal"></highlight></codeline>
<codeline lineno="1043"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>err;</highlight></codeline>
<codeline lineno="1044"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1045"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_NETIF_HWADDRHINT*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1046"><highlight class="normal"></highlight></codeline>
<codeline lineno="1047"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>IP_DEBUG</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1048"><highlight class="normal"></highlight><highlight class="comment">/*<sp/>Print<sp/>an<sp/>IP<sp/>header<sp/>by<sp/>using<sp/>LWIP_DEBUGF</highlight></codeline>
<codeline lineno="1049"><highlight class="comment"><sp/>*<sp/>@param<sp/>p<sp/>an<sp/>IP<sp/>packet,<sp/>p-&gt;payload<sp/>pointing<sp/>to<sp/>the<sp/>IP<sp/>header</highlight></codeline>
<codeline lineno="1050"><highlight class="comment"><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1051"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1052"><highlight class="normal">ip4_debug_print(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*p)</highlight></codeline>
<codeline lineno="1053"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1054"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structip__hdr" kindref="compound">ip_hdr</ref><sp/>*iphdr<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structip__hdr" kindref="compound">ip_hdr</ref><sp/>*)p-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref>;</highlight></codeline>
<codeline lineno="1055"><highlight class="normal"></highlight></codeline>
<codeline lineno="1056"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a5d3348778951e7bc5cd397c6575eef3a" kindref="member">IP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;IP<sp/>header:\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="1057"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a5d3348778951e7bc5cd397c6575eef3a" kindref="member">IP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;+-------------------------------+\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="1058"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a5d3348778951e7bc5cd397c6575eef3a" kindref="member">IP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;|%2&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gac05a82d37afb251470f5e17ca15ab6e9" kindref="member">S16_F</ref></highlight><highlight class="stringliteral">&quot;<sp/>|%2&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gac05a82d37afb251470f5e17ca15ab6e9" kindref="member">S16_F</ref></highlight><highlight class="stringliteral">&quot;<sp/>|<sp/><sp/>0x%02&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1ga1418f92673e54a36b6e376109e526382" kindref="member">X16_F</ref></highlight><highlight class="stringliteral">&quot;<sp/>|<sp/><sp/><sp/><sp/><sp/>%5&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;<sp/><sp/><sp/><sp/><sp/>|<sp/>(v,<sp/>hl,<sp/>tos,<sp/>len)\n&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="1059"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)<ref refid="prot_2ip4_8h_1a05a9e8ecf4eff38244b4c13c7e70094c" kindref="member">IPH_V</ref>(iphdr),</highlight></codeline>
<codeline lineno="1060"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)<ref refid="prot_2ip4_8h_1a7c60caeb708571a07a44309c10ec3a01" kindref="member">IPH_HL</ref>(iphdr),</highlight></codeline>
<codeline lineno="1061"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)<ref refid="prot_2ip4_8h_1a13fb5476ab97db9c5de6c1f5ca0d82e6" kindref="member">IPH_TOS</ref>(iphdr),</highlight></codeline>
<codeline lineno="1062"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="def_8h_1ac642bf6057869696d7807564d8309ffc" kindref="member">lwip_ntohs</ref>(<ref refid="prot_2ip4_8h_1aec0328fe4711b8c1ef4dd6709e4fd6d5" kindref="member">IPH_LEN</ref>(iphdr))));</highlight></codeline>
<codeline lineno="1063"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a5d3348778951e7bc5cd397c6575eef3a" kindref="member">IP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;+-------------------------------+\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="1064"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a5d3348778951e7bc5cd397c6575eef3a" kindref="member">IP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;|<sp/><sp/><sp/><sp/>%5&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;<sp/><sp/><sp/><sp/><sp/><sp/>|%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;|<sp/><sp/><sp/><sp/>%4&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;<sp/><sp/><sp/>|<sp/>(id,<sp/>flags,<sp/>offset)\n&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="1065"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="def_8h_1ac642bf6057869696d7807564d8309ffc" kindref="member">lwip_ntohs</ref>(<ref refid="prot_2ip4_8h_1ae79eaecc0bf9e4dbb9e47ea56ad2157a" kindref="member">IPH_ID</ref>(iphdr)),</highlight></codeline>
<codeline lineno="1066"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)(<ref refid="def_8h_1ac642bf6057869696d7807564d8309ffc" kindref="member">lwip_ntohs</ref>(<ref refid="prot_2ip4_8h_1a559dce3878f1d6a46bcb4cb312962397" kindref="member">IPH_OFFSET</ref>(iphdr))<sp/>&gt;&gt;<sp/>15<sp/>&amp;<sp/>1),</highlight></codeline>
<codeline lineno="1067"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)(<ref refid="def_8h_1ac642bf6057869696d7807564d8309ffc" kindref="member">lwip_ntohs</ref>(<ref refid="prot_2ip4_8h_1a559dce3878f1d6a46bcb4cb312962397" kindref="member">IPH_OFFSET</ref>(iphdr))<sp/>&gt;&gt;<sp/>14<sp/>&amp;<sp/>1),</highlight></codeline>
<codeline lineno="1068"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)(<ref refid="def_8h_1ac642bf6057869696d7807564d8309ffc" kindref="member">lwip_ntohs</ref>(<ref refid="prot_2ip4_8h_1a559dce3878f1d6a46bcb4cb312962397" kindref="member">IPH_OFFSET</ref>(iphdr))<sp/>&gt;&gt;<sp/>13<sp/>&amp;<sp/>1),</highlight></codeline>
<codeline lineno="1069"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)(<ref refid="def_8h_1ac642bf6057869696d7807564d8309ffc" kindref="member">lwip_ntohs</ref>(<ref refid="prot_2ip4_8h_1a559dce3878f1d6a46bcb4cb312962397" kindref="member">IPH_OFFSET</ref>(iphdr))<sp/>&amp;<sp/><ref refid="prot_2ip4_8h_1ad059798b16d1f615b5af8770175121ba" kindref="member">IP_OFFMASK</ref>)));</highlight></codeline>
<codeline lineno="1070"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a5d3348778951e7bc5cd397c6575eef3a" kindref="member">IP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;+-------------------------------+\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="1071"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a5d3348778951e7bc5cd397c6575eef3a" kindref="member">IP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;|<sp/><sp/>%3&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;<sp/><sp/>|<sp/><sp/>%3&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;<sp/><sp/>|<sp/><sp/><sp/><sp/>0x%04&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1ga1418f92673e54a36b6e376109e526382" kindref="member">X16_F</ref></highlight><highlight class="stringliteral">&quot;<sp/><sp/><sp/><sp/><sp/>|<sp/>(ttl,<sp/>proto,<sp/>chksum)\n&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="1072"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)<ref refid="prot_2ip4_8h_1a0d8238411ce35a007170f652e62209b3" kindref="member">IPH_TTL</ref>(iphdr),</highlight></codeline>
<codeline lineno="1073"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)<ref refid="prot_2ip4_8h_1aa2de6f9d35337b4be67d799805665e11" kindref="member">IPH_PROTO</ref>(iphdr),</highlight></codeline>
<codeline lineno="1074"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="def_8h_1ac642bf6057869696d7807564d8309ffc" kindref="member">lwip_ntohs</ref>(<ref refid="prot_2ip4_8h_1a773b96f54c75b35bcd24e7f857fcf988" kindref="member">IPH_CHKSUM</ref>(iphdr))));</highlight></codeline>
<codeline lineno="1075"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a5d3348778951e7bc5cd397c6575eef3a" kindref="member">IP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;+-------------------------------+\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="1076"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a5d3348778951e7bc5cd397c6575eef3a" kindref="member">IP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;|<sp/><sp/>%3&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;<sp/><sp/>|<sp/><sp/>%3&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;<sp/><sp/>|<sp/><sp/>%3&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;<sp/><sp/>|<sp/><sp/>%3&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;<sp/><sp/>|<sp/>(src)\n&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="1077"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ip4_addr1_16(&amp;iphdr-&gt;src),</highlight></codeline>
<codeline lineno="1078"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ip4_addr2_16(&amp;iphdr-&gt;src),</highlight></codeline>
<codeline lineno="1079"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ip4_addr3_16(&amp;iphdr-&gt;src),</highlight></codeline>
<codeline lineno="1080"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ip4_addr4_16(&amp;iphdr-&gt;src)));</highlight></codeline>
<codeline lineno="1081"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a5d3348778951e7bc5cd397c6575eef3a" kindref="member">IP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;+-------------------------------+\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="1082"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a5d3348778951e7bc5cd397c6575eef3a" kindref="member">IP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;|<sp/><sp/>%3&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;<sp/><sp/>|<sp/><sp/>%3&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;<sp/><sp/>|<sp/><sp/>%3&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;<sp/><sp/>|<sp/><sp/>%3&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;<sp/><sp/>|<sp/>(dest)\n&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="1083"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ip4_addr1_16(&amp;iphdr-&gt;dest),</highlight></codeline>
<codeline lineno="1084"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ip4_addr2_16(&amp;iphdr-&gt;dest),</highlight></codeline>
<codeline lineno="1085"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ip4_addr3_16(&amp;iphdr-&gt;dest),</highlight></codeline>
<codeline lineno="1086"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ip4_addr4_16(&amp;iphdr-&gt;dest)));</highlight></codeline>
<codeline lineno="1087"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a5d3348778951e7bc5cd397c6575eef3a" kindref="member">IP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;+-------------------------------+\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="1088"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1089"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>IP_DEBUG<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1090"><highlight class="normal"></highlight></codeline>
<codeline lineno="1091"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_IPV4<sp/>*/</highlight><highlight class="preprocessor"></highlight></codeline>
    </programlisting>
    <location file="C:/Dev/git/UbixOS/sys/net/core/ipv4/ip4.c"/>
  </compounddef>
</doxygen>
