<?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="etharp_8c" kind="file" language="C++">
    <compoundname>etharp.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="1">
        <label>C:/Dev/git/UbixOS/sys/net/core/ipv4/etharp.c</label>
        <link refid="etharp_8c"/>
        <childnode refid="2" 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="11">
        <label>sys/_timeval.h</label>
        <link refid="__timeval_8h"/>
        <childnode refid="7" relation="include">
        </childnode>
      </node>
    </incdepgraph>
    <briefdescription>
    </briefdescription>
    <detaileddescription>
<para>Address Resolution Protocol module for IP over Ethernet</para>
<para>Functionally, ARP is divided into two parts. The first maps an IP address to a physical address when sending a packet, and the second part answers requests from other machines for our physical address.</para>
<para>This implementation complies with RFC 826 (Ethernet ARP). It supports Gratuitious ARP from RFC3220 (IP Mobility Support for IPv4) section 4.6 if an interface calls etharp_gratuitous(our_netif) upon address change. </para>
    </detaileddescription>
    <programlisting>
<codeline lineno="1"></codeline>
<codeline lineno="14"><highlight class="comment">/*</highlight></codeline>
<codeline lineno="15"><highlight class="comment"><sp/>*<sp/>Copyright<sp/>(c)<sp/>2001-2003<sp/>Swedish<sp/>Institute<sp/>of<sp/>Computer<sp/>Science.</highlight></codeline>
<codeline lineno="16"><highlight class="comment"><sp/>*<sp/>Copyright<sp/>(c)<sp/>2003-2004<sp/>Leon<sp/>Woestenberg<sp/>&lt;leon.woestenberg@axon.tv&gt;</highlight></codeline>
<codeline lineno="17"><highlight class="comment"><sp/>*<sp/>Copyright<sp/>(c)<sp/>2003-2004<sp/>Axon<sp/>Digital<sp/>Design<sp/>B.V.,<sp/>The<sp/>Netherlands.</highlight></codeline>
<codeline lineno="18"><highlight class="comment"><sp/>*<sp/>All<sp/>rights<sp/>reserved.</highlight></codeline>
<codeline lineno="19"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="20"><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="21"><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="22"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="23"><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="24"><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="25"><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="26"><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="27"><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="28"><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="29"><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="30"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="31"><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="32"><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="33"><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="34"><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="35"><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="36"><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="37"><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="38"><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="39"><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="40"><highlight class="comment"><sp/>*<sp/>OF<sp/>SUCH<sp/>DAMAGE.</highlight></codeline>
<codeline lineno="41"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="42"><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="43"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="44"><highlight class="comment"><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="45"><highlight class="normal"></highlight></codeline>
<codeline lineno="46"><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="47"><highlight class="normal"></highlight></codeline>
<codeline lineno="48"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_ARP<sp/>||<sp/>LWIP_ETHERNET</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="49"><highlight class="normal"></highlight></codeline>
<codeline lineno="50"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="etharp_8h" kindref="compound">net/etharp.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="51"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="stats_8h" kindref="compound">net/stats.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="52"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="snmp_8h" kindref="compound">net/snmp.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="53"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="dhcp_8h" kindref="compound">net/dhcp.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="54"><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="55"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="f_2ethernet_8h" kindref="compound">netif/ethernet.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="56"><highlight class="normal"></highlight></codeline>
<codeline lineno="57"><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="58"><highlight class="normal"></highlight></codeline>
<codeline lineno="59"><highlight class="normal"></highlight><highlight class="preprocessor">#ifdef<sp/>LWIP_HOOK_FILENAME</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="60"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>LWIP_HOOK_FILENAME</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="61"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="62"><highlight class="normal"></highlight></codeline>
<codeline lineno="63"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_IPV4<sp/>&amp;&amp;<sp/>LWIP_ARP<sp/></highlight><highlight class="comment">/*<sp/>don&apos;t<sp/>build<sp/>if<sp/>not<sp/>configured<sp/>for<sp/>use<sp/>in<sp/>lwipopts.h<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="64"><highlight class="normal"></highlight></codeline>
<codeline lineno="67"><highlight class="preprocessor">#define<sp/>ARP_AGE_REREQUEST_USED_UNICAST<sp/><sp/><sp/>(ARP_MAXAGE<sp/>-<sp/>30)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="68"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>ARP_AGE_REREQUEST_USED_BROADCAST<sp/>(ARP_MAXAGE<sp/>-<sp/>15)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="69"><highlight class="normal"></highlight></codeline>
<codeline lineno="77"><highlight class="preprocessor">#define<sp/>ARP_MAXPENDING<sp/>5</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="78"><highlight class="normal"></highlight></codeline>
<codeline lineno="80"><highlight class="keyword">enum</highlight><highlight class="normal"><sp/>etharp_state<sp/>{</highlight></codeline>
<codeline lineno="81"><highlight class="normal"><sp/><sp/>ETHARP_STATE_EMPTY<sp/>=<sp/>0,</highlight></codeline>
<codeline lineno="82"><highlight class="normal"><sp/><sp/>ETHARP_STATE_PENDING,</highlight></codeline>
<codeline lineno="83"><highlight class="normal"><sp/><sp/>ETHARP_STATE_STABLE,</highlight></codeline>
<codeline lineno="84"><highlight class="normal"><sp/><sp/>ETHARP_STATE_STABLE_REREQUESTING_1,</highlight></codeline>
<codeline lineno="85"><highlight class="normal"><sp/><sp/>ETHARP_STATE_STABLE_REREQUESTING_2</highlight></codeline>
<codeline lineno="86"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>ETHARP_SUPPORT_STATIC_ENTRIES</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="87"><highlight class="normal"><sp/><sp/>,ETHARP_STATE_STATIC</highlight></codeline>
<codeline lineno="88"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>ETHARP_SUPPORT_STATIC_ENTRIES<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="89"><highlight class="normal">};</highlight></codeline>
<codeline lineno="90"><highlight class="normal"></highlight></codeline>
<codeline lineno="91"><highlight class="normal"></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">etharp_entry<sp/>{</highlight></codeline>
<codeline lineno="92"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>ARP_QUEUEING</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="93"><highlight class="normal"></highlight></codeline>
<codeline lineno="94"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">etharp_q_entry<sp/>*q;</highlight></codeline>
<codeline lineno="95"><highlight class="normal"></highlight><highlight class="preprocessor">#else<sp/></highlight><highlight class="comment">/*<sp/>ARP_QUEUEING<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="96"><highlight class="normal"></highlight></codeline>
<codeline lineno="97"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*q;</highlight></codeline>
<codeline lineno="98"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>ARP_QUEUEING<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="99"><highlight class="normal"><sp/><sp/>ip4_addr_t<sp/>ipaddr;</highlight></codeline>
<codeline lineno="100"><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="101"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structeth__addr" kindref="compound">eth_addr</ref><sp/>ethaddr;</highlight></codeline>
<codeline lineno="102"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>ctime;</highlight></codeline>
<codeline lineno="103"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>state;</highlight></codeline>
<codeline lineno="104"><highlight class="normal">};</highlight></codeline>
<codeline lineno="105"><highlight class="normal"></highlight></codeline>
<codeline lineno="106"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">etharp_entry<sp/>arp_table[<ref refid="lwipopts_8h_1a924936a814564dbdb0bc950d255a83b9" kindref="member">ARP_TABLE_SIZE</ref>];</highlight></codeline>
<codeline lineno="107"><highlight class="normal"></highlight></codeline>
<codeline lineno="108"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>!LWIP_NETIF_HWADDRHINT</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="109"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>etharp_cached_entry;</highlight></codeline>
<codeline lineno="110"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>!LWIP_NETIF_HWADDRHINT<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="111"><highlight class="normal"></highlight></codeline>
<codeline lineno="114"><highlight class="preprocessor">#define<sp/>ETHARP_FLAG_TRY_HARD<sp/><sp/><sp/><sp/><sp/>1</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="115"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>ETHARP_FLAG_FIND_ONLY<sp/><sp/><sp/><sp/>2</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="116"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>ETHARP_SUPPORT_STATIC_ENTRIES</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="117"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>ETHARP_FLAG_STATIC_ENTRY<sp/>4</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="118"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>ETHARP_SUPPORT_STATIC_ENTRIES<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="119"><highlight class="normal"></highlight></codeline>
<codeline lineno="120"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_NETIF_HWADDRHINT</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="121"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>ETHARP_SET_HINT(netif,<sp/>hint)<sp/><sp/>if<sp/>(((netif)<sp/>!=<sp/>NULL)<sp/>&amp;&amp;<sp/>((netif)-&gt;addr_hint<sp/>!=<sp/>NULL))<sp/><sp/>\</highlight></codeline>
<codeline lineno="122"><highlight class="preprocessor"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*((netif)-&gt;addr_hint)<sp/>=<sp/>(hint);</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="123"><highlight class="normal"></highlight><highlight class="preprocessor">#else<sp/></highlight><highlight class="comment">/*<sp/>LWIP_NETIF_HWADDRHINT<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="124"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>ETHARP_SET_HINT(netif,<sp/>hint)<sp/><sp/>(etharp_cached_entry<sp/>=<sp/>(hint))</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="125"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_NETIF_HWADDRHINT<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="126"><highlight class="normal"></highlight></codeline>
<codeline lineno="127"><highlight class="normal"></highlight></codeline>
<codeline lineno="128"><highlight class="normal"></highlight><highlight class="comment">/*<sp/>Some<sp/>checks,<sp/>instead<sp/>of<sp/>etharp_init():<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="129"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>(LWIP_ARP<sp/>&amp;&amp;<sp/>(ARP_TABLE_SIZE<sp/>&gt;<sp/>0x7f))</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="130"><highlight class="normal"></highlight><highlight class="preprocessor"><sp/><sp/>#error<sp/>&quot;ARP_TABLE_SIZE<sp/>must<sp/>fit<sp/>in<sp/>an<sp/>s8_t,<sp/>you<sp/>have<sp/>to<sp/>reduce<sp/>it<sp/>in<sp/>your<sp/>lwipopts.h&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="131"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="132"><highlight class="normal"></highlight></codeline>
<codeline lineno="133"><highlight class="normal"></highlight></codeline>
<codeline lineno="134"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref><sp/>etharp_request_dst(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>ip4_addr_t<sp/>*ipaddr,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structeth__addr" kindref="compound">eth_addr</ref>*<sp/>hw_dst_addr);</highlight></codeline>
<codeline lineno="135"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref><sp/>etharp_raw(</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="136"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structeth__addr" kindref="compound">eth_addr</ref><sp/>*ethsrc_addr,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structeth__addr" kindref="compound">eth_addr</ref><sp/>*ethdst_addr,</highlight></codeline>
<codeline lineno="137"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structeth__addr" kindref="compound">eth_addr</ref><sp/>*hwsrc_addr,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>ip4_addr_t<sp/>*ipsrc_addr,</highlight></codeline>
<codeline lineno="138"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structeth__addr" kindref="compound">eth_addr</ref><sp/>*hwdst_addr,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>ip4_addr_t<sp/>*ipdst_addr,</highlight></codeline>
<codeline lineno="139"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>opcode);</highlight></codeline>
<codeline lineno="140"><highlight class="normal"></highlight></codeline>
<codeline lineno="141"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>ARP_QUEUEING</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="142"><highlight class="normal"></highlight></codeline>
<codeline lineno="147"><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="148"><highlight class="normal">free_etharp_q(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>etharp_q_entry<sp/>*q)</highlight></codeline>
<codeline lineno="149"><highlight class="normal">{</highlight></codeline>
<codeline lineno="150"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">etharp_q_entry<sp/>*r;</highlight></codeline>
<codeline lineno="151"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;q<sp/>!=<sp/>NULL&quot;</highlight><highlight class="normal">,<sp/>q<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>);</highlight></codeline>
<codeline lineno="152"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;q-&gt;p<sp/>!=<sp/>NULL&quot;</highlight><highlight class="normal">,<sp/>q-&gt;p<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>);</highlight></codeline>
<codeline lineno="153"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(q)<sp/>{</highlight></codeline>
<codeline lineno="154"><highlight class="normal"><sp/><sp/><sp/><sp/>r<sp/>=<sp/>q;</highlight></codeline>
<codeline lineno="155"><highlight class="normal"><sp/><sp/><sp/><sp/>q<sp/>=<sp/>q-&gt;next;</highlight></codeline>
<codeline lineno="156"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;r-&gt;p<sp/>!=<sp/>NULL&quot;</highlight><highlight class="normal">,<sp/>(r-&gt;p<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>));</highlight></codeline>
<codeline lineno="157"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(r-&gt;p);</highlight></codeline>
<codeline lineno="158"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="memp_8h_1aecd94926b7c2a0e23ae195f4ae97581f" kindref="member">memp_free</ref>(MEMP_ARP_QUEUE,<sp/>r);</highlight></codeline>
<codeline lineno="159"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="160"><highlight class="normal">}</highlight></codeline>
<codeline lineno="161"><highlight class="normal"></highlight><highlight class="preprocessor">#else<sp/></highlight><highlight class="comment">/*<sp/>ARP_QUEUEING<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="162"><highlight class="normal"></highlight></codeline>
<codeline lineno="164"><highlight class="preprocessor">#define<sp/>free_etharp_q(q)<sp/>pbuf_free(q)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="165"><highlight class="normal"></highlight></codeline>
<codeline lineno="166"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>ARP_QUEUEING<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="167"><highlight class="normal"></highlight></codeline>
<codeline lineno="169"><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="170"><highlight class="normal">etharp_free_entry(</highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>i)</highlight></codeline>
<codeline lineno="171"><highlight class="normal">{</highlight></codeline>
<codeline lineno="172"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>remove<sp/>from<sp/>SNMP<sp/>ARP<sp/>index<sp/>tree<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="173"><highlight class="normal"><sp/><sp/><ref refid="snmp_8h_1a8f86f7f089ed2ecf4ed14aa01db3b173" kindref="member">mib2_remove_arp_entry</ref>(arp_table[i].<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>&amp;arp_table[i].ipaddr);</highlight></codeline>
<codeline lineno="174"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>and<sp/>empty<sp/>packet<sp/>queue<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="175"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(arp_table[i].q<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="176"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>remove<sp/>all<sp/>queued<sp/>packets<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="177"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1abff5d1e0b334f5b45bd2b8bbb675411e" kindref="member">ETHARP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;etharp_free_entry:<sp/>freeing<sp/>entry<sp/>%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;,<sp/>packet<sp/>queue<sp/>%p.\n&quot;</highlight><highlight class="normal">,<sp/>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)i,<sp/>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*)(arp_table[i].q)));</highlight></codeline>
<codeline lineno="178"><highlight class="normal"><sp/><sp/><sp/><sp/>free_etharp_q(arp_table[i].q);</highlight></codeline>
<codeline lineno="179"><highlight class="normal"><sp/><sp/><sp/><sp/>arp_table[i].q<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="180"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="181"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>recycle<sp/>entry<sp/>for<sp/>re-use<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="182"><highlight class="normal"><sp/><sp/>arp_table[i].state<sp/>=<sp/>ETHARP_STATE_EMPTY;</highlight></codeline>
<codeline lineno="183"><highlight class="normal"></highlight><highlight class="preprocessor">#ifdef<sp/>LWIP_DEBUG</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="184"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>for<sp/>debugging,<sp/>clean<sp/>out<sp/>the<sp/>complete<sp/>entry<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="185"><highlight class="normal"><sp/><sp/>arp_table[i].ctime<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="186"><highlight class="normal"><sp/><sp/>arp_table[i].netif<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="187"><highlight class="normal"><sp/><sp/>ip4_addr_set_zero(&amp;arp_table[i].ipaddr);</highlight></codeline>
<codeline lineno="188"><highlight class="normal"><sp/><sp/>arp_table[i].ethaddr<sp/>=<sp/>ethzero;</highlight></codeline>
<codeline lineno="189"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_DEBUG<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="190"><highlight class="normal">}</highlight></codeline>
<codeline lineno="191"><highlight class="normal"></highlight></codeline>
<codeline lineno="198"><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="199"><highlight class="normal">etharp_tmr(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">)</highlight></codeline>
<codeline lineno="200"><highlight class="normal">{</highlight></codeline>
<codeline lineno="201"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>i;</highlight></codeline>
<codeline lineno="202"><highlight class="normal"></highlight></codeline>
<codeline lineno="203"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1abff5d1e0b334f5b45bd2b8bbb675411e" kindref="member">ETHARP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;etharp_timer\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="204"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>remove<sp/>expired<sp/>entries<sp/>from<sp/>the<sp/>ARP<sp/>table<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="205"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i<sp/>=<sp/>0;<sp/>i<sp/>&lt;<sp/><ref refid="lwipopts_8h_1a924936a814564dbdb0bc950d255a83b9" kindref="member">ARP_TABLE_SIZE</ref>;<sp/>++i)<sp/>{</highlight></codeline>
<codeline lineno="206"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>state<sp/>=<sp/>arp_table[i].state;</highlight></codeline>
<codeline lineno="207"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(state<sp/>!=<sp/>ETHARP_STATE_EMPTY</highlight></codeline>
<codeline lineno="208"><highlight class="normal">#</highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/><ref refid="lwipopts_8h_1a4675829464156f3d665f4de171c212d7" kindref="member">ETHARP_SUPPORT_STATIC_ENTRIES</ref></highlight></codeline>
<codeline lineno="209"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>&amp;&amp;<sp/>(state<sp/>!=<sp/>ETHARP_STATE_STATIC)</highlight></codeline>
<codeline lineno="210"><highlight class="normal">#endif<sp/></highlight><highlight class="comment">/*<sp/>ETHARP_SUPPORT_STATIC_ENTRIES<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="211"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>)<sp/>{</highlight></codeline>
<codeline lineno="212"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>arp_table[i].ctime++;</highlight></codeline>
<codeline lineno="213"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((arp_table[i].ctime<sp/>&gt;=<sp/><ref refid="lwipopts_8h_1a741a0710dc126ed3ae9e305472df3432" kindref="member">ARP_MAXAGE</ref>)<sp/>||</highlight></codeline>
<codeline lineno="214"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>((arp_table[i].state<sp/>==<sp/>ETHARP_STATE_PENDING)<sp/><sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="215"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(arp_table[i].ctime<sp/>&gt;=<sp/>ARP_MAXPENDING)))<sp/>{</highlight></codeline>
<codeline lineno="216"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>pending<sp/>or<sp/>stable<sp/>entry<sp/>has<sp/>become<sp/>old!<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="217"><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_1abff5d1e0b334f5b45bd2b8bbb675411e" kindref="member">ETHARP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;etharp_timer:<sp/>expired<sp/>%s<sp/>entry<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="218"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>arp_table[i].state<sp/>&gt;=<sp/>ETHARP_STATE_STABLE<sp/>?<sp/></highlight><highlight class="stringliteral">&quot;stable&quot;</highlight><highlight class="normal"><sp/>:<sp/></highlight><highlight class="stringliteral">&quot;pending&quot;</highlight><highlight class="normal">,<sp/>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)i));</highlight></codeline>
<codeline lineno="219"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>clean<sp/>up<sp/>entries<sp/>that<sp/>have<sp/>just<sp/>been<sp/>expired<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="220"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>etharp_free_entry(i);</highlight></codeline>
<codeline lineno="221"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(arp_table[i].state<sp/>==<sp/>ETHARP_STATE_STABLE_REREQUESTING_1)<sp/>{</highlight></codeline>
<codeline lineno="222"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Don&apos;t<sp/>send<sp/>more<sp/>than<sp/>one<sp/>request<sp/>every<sp/>2<sp/>seconds.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="223"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>arp_table[i].state<sp/>=<sp/>ETHARP_STATE_STABLE_REREQUESTING_2;</highlight></codeline>
<codeline lineno="224"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(arp_table[i].state<sp/>==<sp/>ETHARP_STATE_STABLE_REREQUESTING_2)<sp/>{</highlight></codeline>
<codeline lineno="225"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Reset<sp/>state<sp/>to<sp/>stable,<sp/>so<sp/>that<sp/>the<sp/>next<sp/>transmitted<sp/>packet<sp/>will</highlight></codeline>
<codeline lineno="226"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>re-send<sp/>an<sp/>ARP<sp/>request.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="227"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>arp_table[i].state<sp/>=<sp/>ETHARP_STATE_STABLE;</highlight></codeline>
<codeline lineno="228"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(arp_table[i].state<sp/>==<sp/>ETHARP_STATE_PENDING)<sp/>{</highlight></codeline>
<codeline lineno="229"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>still<sp/>pending,<sp/>resend<sp/>an<sp/>ARP<sp/>query<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="230"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>etharp_request(arp_table[i].<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>&amp;arp_table[i].ipaddr);</highlight></codeline>
<codeline lineno="231"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="232"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="233"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="234"><highlight class="normal">}</highlight></codeline>
<codeline lineno="235"><highlight class="normal"></highlight></codeline>
<codeline lineno="257"><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__compiler__abstraction_1ga9cd1d7891fe315de1201e2c6e45f4f57" kindref="member">s8_t</ref></highlight></codeline>
<codeline lineno="258"><highlight class="normal">etharp_find_entry(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>ip4_addr_t<sp/>*ipaddr,<sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>flags,<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="259"><highlight class="normal">{</highlight></codeline>
<codeline lineno="260"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga9cd1d7891fe315de1201e2c6e45f4f57" kindref="member">s8_t</ref><sp/>old_pending<sp/>=<sp/><ref refid="lwipopts_8h_1a924936a814564dbdb0bc950d255a83b9" kindref="member">ARP_TABLE_SIZE</ref>,<sp/>old_stable<sp/>=<sp/><ref refid="lwipopts_8h_1a924936a814564dbdb0bc950d255a83b9" kindref="member">ARP_TABLE_SIZE</ref>;</highlight></codeline>
<codeline lineno="261"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga9cd1d7891fe315de1201e2c6e45f4f57" kindref="member">s8_t</ref><sp/>empty<sp/>=<sp/><ref refid="lwipopts_8h_1a924936a814564dbdb0bc950d255a83b9" kindref="member">ARP_TABLE_SIZE</ref>;</highlight></codeline>
<codeline lineno="262"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>i<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="263"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>oldest<sp/>entry<sp/>with<sp/>packets<sp/>on<sp/>queue<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="264"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga9cd1d7891fe315de1201e2c6e45f4f57" kindref="member">s8_t</ref><sp/>old_queue<sp/>=<sp/><ref refid="lwipopts_8h_1a924936a814564dbdb0bc950d255a83b9" kindref="member">ARP_TABLE_SIZE</ref>;</highlight></codeline>
<codeline lineno="265"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>its<sp/>age<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="266"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>age_queue<sp/>=<sp/>0,<sp/>age_pending<sp/>=<sp/>0,<sp/>age_stable<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="267"><highlight class="normal"></highlight></codeline>
<codeline lineno="268"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga70624a5deb8b9199406372a7f3603ecf" kindref="member">LWIP_UNUSED_ARG</ref>(<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="269"><highlight class="normal"></highlight></codeline>
<codeline lineno="276"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>a)<sp/>in<sp/>a<sp/>single<sp/>search<sp/>sweep,<sp/>do<sp/>all<sp/>of<sp/>this</highlight></codeline>
<codeline lineno="277"><highlight class="comment"><sp/><sp/><sp/>*<sp/>1)<sp/>remember<sp/>the<sp/>first<sp/>empty<sp/>entry<sp/>(if<sp/>any)</highlight></codeline>
<codeline lineno="278"><highlight class="comment"><sp/><sp/><sp/>*<sp/>2)<sp/>remember<sp/>the<sp/>oldest<sp/>stable<sp/>entry<sp/>(if<sp/>any)</highlight></codeline>
<codeline lineno="279"><highlight class="comment"><sp/><sp/><sp/>*<sp/>3)<sp/>remember<sp/>the<sp/>oldest<sp/>pending<sp/>entry<sp/>without<sp/>queued<sp/>packets<sp/>(if<sp/>any)</highlight></codeline>
<codeline lineno="280"><highlight class="comment"><sp/><sp/><sp/>*<sp/>4)<sp/>remember<sp/>the<sp/>oldest<sp/>pending<sp/>entry<sp/>with<sp/>queued<sp/>packets<sp/>(if<sp/>any)</highlight></codeline>
<codeline lineno="281"><highlight class="comment"><sp/><sp/><sp/>*<sp/>5)<sp/>search<sp/>for<sp/>a<sp/>matching<sp/>IP<sp/>entry,<sp/>either<sp/>pending<sp/>or<sp/>stable</highlight></codeline>
<codeline lineno="282"><highlight class="comment"><sp/><sp/><sp/>*<sp/><sp/><sp/><sp/>until<sp/>5<sp/>matches,<sp/>or<sp/>all<sp/>entries<sp/>are<sp/>searched<sp/>for.</highlight></codeline>
<codeline lineno="283"><highlight class="comment"><sp/><sp/><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="284"><highlight class="normal"></highlight></codeline>
<codeline lineno="285"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i<sp/>=<sp/>0;<sp/>i<sp/>&lt;<sp/><ref refid="lwipopts_8h_1a924936a814564dbdb0bc950d255a83b9" kindref="member">ARP_TABLE_SIZE</ref>;<sp/>++i)<sp/>{</highlight></codeline>
<codeline lineno="286"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>state<sp/>=<sp/>arp_table[i].state;</highlight></codeline>
<codeline lineno="287"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>no<sp/>empty<sp/>entry<sp/>found<sp/>yet<sp/>and<sp/>now<sp/>we<sp/>do<sp/>find<sp/>one?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="288"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((empty<sp/>==<sp/><ref refid="lwipopts_8h_1a924936a814564dbdb0bc950d255a83b9" kindref="member">ARP_TABLE_SIZE</ref>)<sp/>&amp;&amp;<sp/>(state<sp/>==<sp/>ETHARP_STATE_EMPTY))<sp/>{</highlight></codeline>
<codeline lineno="289"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1abff5d1e0b334f5b45bd2b8bbb675411e" kindref="member">ETHARP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;etharp_find_entry:<sp/>found<sp/>empty<sp/>entry<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>)i));</highlight></codeline>
<codeline lineno="290"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>remember<sp/>first<sp/>empty<sp/>entry<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="291"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>empty<sp/>=<sp/>i;</highlight></codeline>
<codeline lineno="292"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(state<sp/>!=<sp/>ETHARP_STATE_EMPTY)<sp/>{</highlight></codeline>
<codeline lineno="293"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;state<sp/>==<sp/>ETHARP_STATE_PENDING<sp/>||<sp/>state<sp/>&gt;=<sp/>ETHARP_STATE_STABLE&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="294"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>state<sp/>==<sp/>ETHARP_STATE_PENDING<sp/>||<sp/>state<sp/>&gt;=<sp/>ETHARP_STATE_STABLE);</highlight></codeline>
<codeline lineno="295"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>if<sp/>given,<sp/>does<sp/>IP<sp/>address<sp/>match<sp/>IP<sp/>address<sp/>in<sp/>ARP<sp/>entry?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="296"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ipaddr<sp/>&amp;&amp;<sp/>ip4_addr_cmp(ipaddr,<sp/>&amp;arp_table[i].ipaddr)</highlight></codeline>
<codeline lineno="297"><highlight class="normal">#</highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/><ref refid="lwipopts_8h_1a2f762eee309a545650f80fc8dcc19084" kindref="member">ETHARP_TABLE_MATCH_NETIF</ref></highlight></codeline>
<codeline lineno="298"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>&amp;&amp;<sp/>((<ref refid="structnetif" kindref="compound">netif</ref><sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>||<sp/>(<ref refid="structnetif" kindref="compound">netif</ref><sp/>==<sp/>arp_table[i].<ref refid="structnetif" kindref="compound">netif</ref>))</highlight></codeline>
<codeline lineno="299"><highlight class="normal">#endif<sp/></highlight><highlight class="comment">/*<sp/>ETHARP_TABLE_MATCH_NETIF<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="300"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>)<sp/>{</highlight></codeline>
<codeline lineno="301"><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_1abff5d1e0b334f5b45bd2b8bbb675411e" kindref="member">ETHARP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;etharp_find_entry:<sp/>found<sp/>matching<sp/>entry<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>)i));</highlight></codeline>
<codeline lineno="302"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>found<sp/>exact<sp/>IP<sp/>address<sp/>match,<sp/>simply<sp/>bail<sp/>out<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="303"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>i;</highlight></codeline>
<codeline lineno="304"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="305"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>pending<sp/>entry?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="306"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(state<sp/>==<sp/>ETHARP_STATE_PENDING)<sp/>{</highlight></codeline>
<codeline lineno="307"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>pending<sp/>with<sp/>queued<sp/>packets?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="308"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(arp_table[i].q<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="309"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(arp_table[i].ctime<sp/>&gt;=<sp/>age_queue)<sp/>{</highlight></codeline>
<codeline lineno="310"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>old_queue<sp/>=<sp/>i;</highlight></codeline>
<codeline lineno="311"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>age_queue<sp/>=<sp/>arp_table[i].ctime;</highlight></codeline>
<codeline lineno="312"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="313"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="314"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>pending<sp/>without<sp/>queued<sp/>packets?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="315"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="316"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(arp_table[i].ctime<sp/>&gt;=<sp/>age_pending)<sp/>{</highlight></codeline>
<codeline lineno="317"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>old_pending<sp/>=<sp/>i;</highlight></codeline>
<codeline lineno="318"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>age_pending<sp/>=<sp/>arp_table[i].ctime;</highlight></codeline>
<codeline lineno="319"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="320"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="321"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>stable<sp/>entry?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="322"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(state<sp/>&gt;=<sp/>ETHARP_STATE_STABLE)<sp/>{</highlight></codeline>
<codeline lineno="323"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>ETHARP_SUPPORT_STATIC_ENTRIES</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="324"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>don&apos;t<sp/>record<sp/>old_stable<sp/>for<sp/>static<sp/>entries<sp/>since<sp/>they<sp/>never<sp/>expire<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="325"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(state<sp/>&lt;<sp/>ETHARP_STATE_STATIC)</highlight></codeline>
<codeline lineno="326"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>ETHARP_SUPPORT_STATIC_ENTRIES<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="327"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="328"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>remember<sp/>entry<sp/>with<sp/>oldest<sp/>stable<sp/>entry<sp/>in<sp/>oldest,<sp/>its<sp/>age<sp/>in<sp/>maxtime<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="329"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(arp_table[i].ctime<sp/>&gt;=<sp/>age_stable)<sp/>{</highlight></codeline>
<codeline lineno="330"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>old_stable<sp/>=<sp/>i;</highlight></codeline>
<codeline lineno="331"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>age_stable<sp/>=<sp/>arp_table[i].ctime;</highlight></codeline>
<codeline lineno="332"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="333"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="334"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="335"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="336"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="337"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>{<sp/>we<sp/>have<sp/>no<sp/>match<sp/>}<sp/>=&gt;<sp/>try<sp/>to<sp/>create<sp/>a<sp/>new<sp/>entry<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="338"><highlight class="normal"></highlight></codeline>
<codeline lineno="339"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>don&apos;t<sp/>create<sp/>new<sp/>entry,<sp/>only<sp/>search?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="340"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(((flags<sp/>&amp;<sp/>ETHARP_FLAG_FIND_ONLY)<sp/>!=<sp/>0)<sp/>||</highlight></codeline>
<codeline lineno="341"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>or<sp/>no<sp/>empty<sp/>entry<sp/>found<sp/>and<sp/>not<sp/>allowed<sp/>to<sp/>recycle?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="342"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>((empty<sp/>==<sp/><ref refid="lwipopts_8h_1a924936a814564dbdb0bc950d255a83b9" kindref="member">ARP_TABLE_SIZE</ref>)<sp/>&amp;&amp;<sp/>((flags<sp/>&amp;<sp/>ETHARP_FLAG_TRY_HARD)<sp/>==<sp/>0)))<sp/>{</highlight></codeline>
<codeline lineno="343"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1abff5d1e0b334f5b45bd2b8bbb675411e" kindref="member">ETHARP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;etharp_find_entry:<sp/>no<sp/>empty<sp/>entry<sp/>found<sp/>and<sp/>not<sp/>allowed<sp/>to<sp/>recycle\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="344"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>(<ref refid="group__compiler__abstraction_1ga9cd1d7891fe315de1201e2c6e45f4f57" kindref="member">s8_t</ref>)<ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaaaeafdbf3aecc46864daa3cd829c7e05" kindref="member">ERR_MEM</ref>;</highlight></codeline>
<codeline lineno="345"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="346"><highlight class="normal"></highlight></codeline>
<codeline lineno="347"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>b)<sp/>choose<sp/>the<sp/>least<sp/>destructive<sp/>entry<sp/>to<sp/>recycle:</highlight></codeline>
<codeline lineno="348"><highlight class="comment"><sp/><sp/><sp/>*<sp/>1)<sp/>empty<sp/>entry</highlight></codeline>
<codeline lineno="349"><highlight class="comment"><sp/><sp/><sp/>*<sp/>2)<sp/>oldest<sp/>stable<sp/>entry</highlight></codeline>
<codeline lineno="350"><highlight class="comment"><sp/><sp/><sp/>*<sp/>3)<sp/>oldest<sp/>pending<sp/>entry<sp/>without<sp/>queued<sp/>packets</highlight></codeline>
<codeline lineno="351"><highlight class="comment"><sp/><sp/><sp/>*<sp/>4)<sp/>oldest<sp/>pending<sp/>entry<sp/>with<sp/>queued<sp/>packets</highlight></codeline>
<codeline lineno="352"><highlight class="comment"><sp/><sp/><sp/>*</highlight></codeline>
<codeline lineno="353"><highlight class="comment"><sp/><sp/><sp/>*<sp/>{<sp/>ETHARP_FLAG_TRY_HARD<sp/>is<sp/>set<sp/>at<sp/>this<sp/>point<sp/>}</highlight></codeline>
<codeline lineno="354"><highlight class="comment"><sp/><sp/><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="355"><highlight class="normal"></highlight></codeline>
<codeline lineno="356"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>1)<sp/>empty<sp/>entry<sp/>available?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="357"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(empty<sp/>&lt;<sp/><ref refid="lwipopts_8h_1a924936a814564dbdb0bc950d255a83b9" kindref="member">ARP_TABLE_SIZE</ref>)<sp/>{</highlight></codeline>
<codeline lineno="358"><highlight class="normal"><sp/><sp/><sp/><sp/>i<sp/>=<sp/>empty;</highlight></codeline>
<codeline lineno="359"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1abff5d1e0b334f5b45bd2b8bbb675411e" kindref="member">ETHARP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;etharp_find_entry:<sp/>selecting<sp/>empty<sp/>entry<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>)i));</highlight></codeline>
<codeline lineno="360"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="361"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>2)<sp/>found<sp/>recyclable<sp/>stable<sp/>entry?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="362"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(old_stable<sp/>&lt;<sp/><ref refid="lwipopts_8h_1a924936a814564dbdb0bc950d255a83b9" kindref="member">ARP_TABLE_SIZE</ref>)<sp/>{</highlight></codeline>
<codeline lineno="363"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>recycle<sp/>oldest<sp/>stable*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="364"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>i<sp/>=<sp/>old_stable;</highlight></codeline>
<codeline lineno="365"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1abff5d1e0b334f5b45bd2b8bbb675411e" kindref="member">ETHARP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;etharp_find_entry:<sp/>selecting<sp/>oldest<sp/>stable<sp/>entry<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>)i));</highlight></codeline>
<codeline lineno="366"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>no<sp/>queued<sp/>packets<sp/>should<sp/>exist<sp/>on<sp/>stable<sp/>entries<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="367"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;arp_table[i].q<sp/>==<sp/>NULL&quot;</highlight><highlight class="normal">,<sp/>arp_table[i].q<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>);</highlight></codeline>
<codeline lineno="368"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>3)<sp/>found<sp/>recyclable<sp/>pending<sp/>entry<sp/>without<sp/>queued<sp/>packets?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="369"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(old_pending<sp/>&lt;<sp/><ref refid="lwipopts_8h_1a924936a814564dbdb0bc950d255a83b9" kindref="member">ARP_TABLE_SIZE</ref>)<sp/>{</highlight></codeline>
<codeline lineno="370"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>recycle<sp/>oldest<sp/>pending<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="371"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>i<sp/>=<sp/>old_pending;</highlight></codeline>
<codeline lineno="372"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1abff5d1e0b334f5b45bd2b8bbb675411e" kindref="member">ETHARP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;etharp_find_entry:<sp/>selecting<sp/>oldest<sp/>pending<sp/>entry<sp/>%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;<sp/>(without<sp/>queue)\n&quot;</highlight><highlight class="normal">,<sp/>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)i));</highlight></codeline>
<codeline lineno="373"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>4)<sp/>found<sp/>recyclable<sp/>pending<sp/>entry<sp/>with<sp/>queued<sp/>packets?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="374"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(old_queue<sp/>&lt;<sp/><ref refid="lwipopts_8h_1a924936a814564dbdb0bc950d255a83b9" kindref="member">ARP_TABLE_SIZE</ref>)<sp/>{</highlight></codeline>
<codeline lineno="375"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>recycle<sp/>oldest<sp/>pending<sp/>(queued<sp/>packets<sp/>are<sp/>free<sp/>in<sp/>etharp_free_entry)<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="376"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>i<sp/>=<sp/>old_queue;</highlight></codeline>
<codeline lineno="377"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1abff5d1e0b334f5b45bd2b8bbb675411e" kindref="member">ETHARP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;etharp_find_entry:<sp/>selecting<sp/>oldest<sp/>pending<sp/>entry<sp/>%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;,<sp/>freeing<sp/>packet<sp/>queue<sp/>%p\n&quot;</highlight><highlight class="normal">,<sp/>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)i,<sp/>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*)(arp_table[i].q)));</highlight></codeline>
<codeline lineno="378"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>no<sp/>empty<sp/>or<sp/>recyclable<sp/>entries<sp/>found<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="379"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="380"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1abff5d1e0b334f5b45bd2b8bbb675411e" kindref="member">ETHARP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;etharp_find_entry:<sp/>no<sp/>empty<sp/>or<sp/>recyclable<sp/>entries<sp/>found\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="381"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>(<ref refid="group__compiler__abstraction_1ga9cd1d7891fe315de1201e2c6e45f4f57" kindref="member">s8_t</ref>)<ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaaaeafdbf3aecc46864daa3cd829c7e05" kindref="member">ERR_MEM</ref>;</highlight></codeline>
<codeline lineno="382"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="383"><highlight class="normal"></highlight></codeline>
<codeline lineno="384"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>{<sp/>empty<sp/>or<sp/>recyclable<sp/>entry<sp/>found<sp/>}<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="385"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;i<sp/>&lt;<sp/>ARP_TABLE_SIZE&quot;</highlight><highlight class="normal">,<sp/>i<sp/>&lt;<sp/><ref refid="lwipopts_8h_1a924936a814564dbdb0bc950d255a83b9" kindref="member">ARP_TABLE_SIZE</ref>);</highlight></codeline>
<codeline lineno="386"><highlight class="normal"><sp/><sp/><sp/><sp/>etharp_free_entry(i);</highlight></codeline>
<codeline lineno="387"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="388"><highlight class="normal"></highlight></codeline>
<codeline lineno="389"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;i<sp/>&lt;<sp/>ARP_TABLE_SIZE&quot;</highlight><highlight class="normal">,<sp/>i<sp/>&lt;<sp/><ref refid="lwipopts_8h_1a924936a814564dbdb0bc950d255a83b9" kindref="member">ARP_TABLE_SIZE</ref>);</highlight></codeline>
<codeline lineno="390"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;arp_table[i].state<sp/>==<sp/>ETHARP_STATE_EMPTY&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="391"><highlight class="normal"><sp/><sp/><sp/><sp/>arp_table[i].state<sp/>==<sp/>ETHARP_STATE_EMPTY);</highlight></codeline>
<codeline lineno="392"><highlight class="normal"></highlight></codeline>
<codeline lineno="393"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>IP<sp/>address<sp/>given?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="394"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ipaddr<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="395"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>set<sp/>IP<sp/>address<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="396"><highlight class="normal"><sp/><sp/><sp/><sp/>ip4_addr_copy(arp_table[i].ipaddr,<sp/>*ipaddr);</highlight></codeline>
<codeline lineno="397"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="398"><highlight class="normal"><sp/><sp/>arp_table[i].ctime<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="399"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>ETHARP_TABLE_MATCH_NETIF</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="400"><highlight class="normal"><sp/><sp/>arp_table[i].netif<sp/>=<sp/><ref refid="structnetif" kindref="compound">netif</ref>;</highlight></codeline>
<codeline lineno="401"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>ETHARP_TABLE_MATCH_NETIF*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="402"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>(<ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref>)i;</highlight></codeline>
<codeline lineno="403"><highlight class="normal">}</highlight></codeline>
<codeline lineno="404"><highlight class="normal"></highlight></codeline>
<codeline lineno="423"><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="424"><highlight class="normal">etharp_update_arp_entry(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>ip4_addr_t<sp/>*ipaddr,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structeth__addr" kindref="compound">eth_addr</ref><sp/>*ethaddr,<sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>flags)</highlight></codeline>
<codeline lineno="425"><highlight class="normal">{</highlight></codeline>
<codeline lineno="426"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga9cd1d7891fe315de1201e2c6e45f4f57" kindref="member">s8_t</ref><sp/>i;</highlight></codeline>
<codeline lineno="427"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;netif-&gt;hwaddr_len<sp/>==<sp/>ETH_HWADDR_LEN&quot;</highlight><highlight class="normal">,<sp/><ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1afe1181561cb16241f3cb5ed01e567d42" kindref="member">hwaddr_len</ref><sp/>==<sp/><ref refid="prot_2ethernet_8h_1ac9426049770b40fcd9556ffbd7e56907" kindref="member">ETH_HWADDR_LEN</ref>);</highlight></codeline>
<codeline lineno="428"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1abff5d1e0b334f5b45bd2b8bbb675411e" kindref="member">ETHARP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;etharp_update_arp_entry:<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/>-<sp/>%02&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1ga1418f92673e54a36b6e376109e526382" kindref="member">X16_F</ref></highlight><highlight class="stringliteral">&quot;:%02&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1ga1418f92673e54a36b6e376109e526382" kindref="member">X16_F</ref></highlight><highlight class="stringliteral">&quot;:%02&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1ga1418f92673e54a36b6e376109e526382" kindref="member">X16_F</ref></highlight><highlight class="stringliteral">&quot;:%02&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1ga1418f92673e54a36b6e376109e526382" kindref="member">X16_F</ref></highlight><highlight class="stringliteral">&quot;:%02&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1ga1418f92673e54a36b6e376109e526382" kindref="member">X16_F</ref></highlight><highlight class="stringliteral">&quot;:%02&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1ga1418f92673e54a36b6e376109e526382" kindref="member">X16_F</ref></highlight><highlight class="stringliteral">&quot;\n&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="429"><highlight class="normal"><sp/><sp/><sp/><sp/>ip4_addr1_16(ipaddr),<sp/>ip4_addr2_16(ipaddr),<sp/>ip4_addr3_16(ipaddr),<sp/>ip4_addr4_16(ipaddr),</highlight></codeline>
<codeline lineno="430"><highlight class="normal"><sp/><sp/><sp/><sp/>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)ethaddr-&gt;addr[0],<sp/>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)ethaddr-&gt;addr[1],<sp/>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)ethaddr-&gt;addr[2],</highlight></codeline>
<codeline lineno="431"><highlight class="normal"><sp/><sp/><sp/><sp/>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)ethaddr-&gt;addr[3],<sp/>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)ethaddr-&gt;addr[4],<sp/>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)ethaddr-&gt;addr[5]));</highlight></codeline>
<codeline lineno="432"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>non-unicast<sp/>address?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="433"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ip4_addr_isany(ipaddr)<sp/>||</highlight></codeline>
<codeline lineno="434"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>ip4_addr_isbroadcast(ipaddr,<sp/><ref refid="structnetif" kindref="compound">netif</ref>)<sp/>||</highlight></codeline>
<codeline lineno="435"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>ip4_addr_ismulticast(ipaddr))<sp/>{</highlight></codeline>
<codeline lineno="436"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1abff5d1e0b334f5b45bd2b8bbb675411e" kindref="member">ETHARP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;etharp_update_arp_entry:<sp/>will<sp/>not<sp/>add<sp/>non-unicast<sp/>IP<sp/>address<sp/>to<sp/>ARP<sp/>cache\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="437"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcab508ce0ebdf3ca735208b00a80a45c91" kindref="member">ERR_ARG</ref>;</highlight></codeline>
<codeline lineno="438"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="439"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>find<sp/>or<sp/>create<sp/>ARP<sp/>entry<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="440"><highlight class="normal"><sp/><sp/>i<sp/>=<sp/>etharp_find_entry(ipaddr,<sp/>flags,<sp/><ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="441"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>bail<sp/>out<sp/>if<sp/>no<sp/>entry<sp/>could<sp/>be<sp/>found<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="442"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(i<sp/>&lt;<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="443"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>(<ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref>)i;</highlight></codeline>
<codeline lineno="444"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="445"><highlight class="normal"></highlight></codeline>
<codeline lineno="446"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>ETHARP_SUPPORT_STATIC_ENTRIES</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="447"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(flags<sp/>&amp;<sp/>ETHARP_FLAG_STATIC_ENTRY)<sp/>{</highlight></codeline>
<codeline lineno="448"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>record<sp/>static<sp/>type<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="449"><highlight class="normal"><sp/><sp/><sp/><sp/>arp_table[i].state<sp/>=<sp/>ETHARP_STATE_STATIC;</highlight></codeline>
<codeline lineno="450"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(arp_table[i].state<sp/>==<sp/>ETHARP_STATE_STATIC)<sp/>{</highlight></codeline>
<codeline lineno="451"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>found<sp/>entry<sp/>is<sp/>a<sp/>static<sp/>type,<sp/>don&apos;t<sp/>overwrite<sp/>it<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="452"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa9a1c5a6fdeed0aad7fe41d538482bbd" kindref="member">ERR_VAL</ref>;</highlight></codeline>
<codeline lineno="453"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="454"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>ETHARP_SUPPORT_STATIC_ENTRIES<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="455"><highlight class="normal"><sp/><sp/>{</highlight></codeline>
<codeline lineno="456"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>mark<sp/>it<sp/>stable<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="457"><highlight class="normal"><sp/><sp/><sp/><sp/>arp_table[i].state<sp/>=<sp/>ETHARP_STATE_STABLE;</highlight></codeline>
<codeline lineno="458"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="459"><highlight class="normal"></highlight></codeline>
<codeline lineno="460"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>record<sp/>network<sp/>interface<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="461"><highlight class="normal"><sp/><sp/>arp_table[i].netif<sp/>=<sp/><ref refid="structnetif" kindref="compound">netif</ref>;</highlight></codeline>
<codeline lineno="462"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>insert<sp/>in<sp/>SNMP<sp/>ARP<sp/>index<sp/>tree<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="463"><highlight class="normal"><sp/><sp/><ref refid="snmp_8h_1adb03de79d2e1fc600c78d8f72a757f34" kindref="member">mib2_add_arp_entry</ref>(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>&amp;arp_table[i].ipaddr);</highlight></codeline>
<codeline lineno="464"><highlight class="normal"></highlight></codeline>
<codeline lineno="465"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1abff5d1e0b334f5b45bd2b8bbb675411e" kindref="member">ETHARP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;etharp_update_arp_entry:<sp/>updating<sp/>stable<sp/>entry<sp/>%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gac05a82d37afb251470f5e17ca15ab6e9" kindref="member">S16_F</ref></highlight><highlight class="stringliteral">&quot;\n&quot;</highlight><highlight class="normal">,<sp/>(<ref refid="group__compiler__abstraction_1gacf46f4df0ebab84edebcb69967fdf86b" kindref="member">s16_t</ref>)i));</highlight></codeline>
<codeline lineno="466"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>update<sp/>address<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="467"><highlight class="normal"><sp/><sp/><ref refid="prot_2ethernet_8h_1a0622da8fb6eb72cd4cd7c3ea4f5a5b79" kindref="member">ETHADDR32_COPY</ref>(&amp;arp_table[i].ethaddr,<sp/>ethaddr);</highlight></codeline>
<codeline lineno="468"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>reset<sp/>time<sp/>stamp<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="469"><highlight class="normal"><sp/><sp/>arp_table[i].ctime<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="470"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>this<sp/>is<sp/>where<sp/>we<sp/>will<sp/>send<sp/>out<sp/>queued<sp/>packets!<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="471"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>ARP_QUEUEING</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="472"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(arp_table[i].q<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="473"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*p;</highlight></codeline>
<codeline lineno="474"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>remember<sp/>remainder<sp/>of<sp/>queue<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="475"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">etharp_q_entry<sp/>*q<sp/>=<sp/>arp_table[i].q;</highlight></codeline>
<codeline lineno="476"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>pop<sp/>first<sp/>item<sp/>off<sp/>the<sp/>queue<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="477"><highlight class="normal"><sp/><sp/><sp/><sp/>arp_table[i].q<sp/>=<sp/>q-&gt;<ref refid="structpbuf_1a5e5763c94fd18d78937b0b58ce7df341" kindref="member">next</ref>;</highlight></codeline>
<codeline lineno="478"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>get<sp/>the<sp/>packet<sp/>pointer<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="479"><highlight class="normal"><sp/><sp/><sp/><sp/>p<sp/>=<sp/>q-&gt;p;</highlight></codeline>
<codeline lineno="480"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>now<sp/>queue<sp/>entry<sp/>can<sp/>be<sp/>freed<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="481"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="memp_8h_1aecd94926b7c2a0e23ae195f4ae97581f" kindref="member">memp_free</ref>(MEMP_ARP_QUEUE,<sp/>q);</highlight></codeline>
<codeline lineno="482"><highlight class="normal"></highlight><highlight class="preprocessor">#else<sp/></highlight><highlight class="comment">/*<sp/>ARP_QUEUEING<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="483"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(arp_table[i].q<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="484"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*p<sp/>=<sp/>arp_table[i].q;</highlight></codeline>
<codeline lineno="485"><highlight class="normal"><sp/><sp/><sp/><sp/>arp_table[i].q<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="486"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>ARP_QUEUEING<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="487"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>send<sp/>the<sp/>queued<sp/>IP<sp/>packet<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="488"><highlight class="normal"><sp/><sp/><sp/><sp/>ethernet_output(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>p,<sp/>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structeth__addr" kindref="compound">eth_addr</ref>*)(<ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1aee967965d999fc1a4c40a66709304e69" kindref="member">hwaddr</ref>),<sp/>ethaddr,<sp/><ref refid="group__ethernet_1gga4f8559808037803168499a3803900339ac95756b20fde70b868ef4185dd221c79" kindref="member">ETHTYPE_IP</ref>);</highlight></codeline>
<codeline lineno="489"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>free<sp/>the<sp/>queued<sp/>IP<sp/>packet<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="490"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(p);</highlight></codeline>
<codeline lineno="491"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="492"><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="493"><highlight class="normal">}</highlight></codeline>
<codeline lineno="494"><highlight class="normal"></highlight></codeline>
<codeline lineno="495"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>ETHARP_SUPPORT_STATIC_ENTRIES</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="496"><highlight class="normal"></highlight></codeline>
<codeline lineno="504"><highlight class="normal"><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="505"><highlight class="normal">etharp_add_static_entry(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>ip4_addr_t<sp/>*ipaddr,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structeth__addr" kindref="compound">eth_addr</ref><sp/>*ethaddr)</highlight></codeline>
<codeline lineno="506"><highlight class="normal">{</highlight></codeline>
<codeline lineno="507"><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="508"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1abff5d1e0b334f5b45bd2b8bbb675411e" kindref="member">ETHARP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;etharp_add_static_entry:<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/>-<sp/>%02&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1ga1418f92673e54a36b6e376109e526382" kindref="member">X16_F</ref></highlight><highlight class="stringliteral">&quot;:%02&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1ga1418f92673e54a36b6e376109e526382" kindref="member">X16_F</ref></highlight><highlight class="stringliteral">&quot;:%02&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1ga1418f92673e54a36b6e376109e526382" kindref="member">X16_F</ref></highlight><highlight class="stringliteral">&quot;:%02&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1ga1418f92673e54a36b6e376109e526382" kindref="member">X16_F</ref></highlight><highlight class="stringliteral">&quot;:%02&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1ga1418f92673e54a36b6e376109e526382" kindref="member">X16_F</ref></highlight><highlight class="stringliteral">&quot;:%02&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1ga1418f92673e54a36b6e376109e526382" kindref="member">X16_F</ref></highlight><highlight class="stringliteral">&quot;\n&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="509"><highlight class="normal"><sp/><sp/><sp/><sp/>ip4_addr1_16(ipaddr),<sp/>ip4_addr2_16(ipaddr),<sp/>ip4_addr3_16(ipaddr),<sp/>ip4_addr4_16(ipaddr),</highlight></codeline>
<codeline lineno="510"><highlight class="normal"><sp/><sp/><sp/><sp/>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)ethaddr-&gt;addr[0],<sp/>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)ethaddr-&gt;addr[1],<sp/>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)ethaddr-&gt;addr[2],</highlight></codeline>
<codeline lineno="511"><highlight class="normal"><sp/><sp/><sp/><sp/>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)ethaddr-&gt;addr[3],<sp/>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)ethaddr-&gt;addr[4],<sp/>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)ethaddr-&gt;addr[5]));</highlight></codeline>
<codeline lineno="512"><highlight class="normal"></highlight></codeline>
<codeline lineno="513"><highlight class="normal"><sp/><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>=<sp/>ip4_route(ipaddr);</highlight></codeline>
<codeline lineno="514"><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="515"><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="516"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="517"><highlight class="normal"></highlight></codeline>
<codeline lineno="518"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>etharp_update_arp_entry(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>ipaddr,<sp/>ethaddr,<sp/>ETHARP_FLAG_TRY_HARD<sp/>|<sp/>ETHARP_FLAG_STATIC_ENTRY);</highlight></codeline>
<codeline lineno="519"><highlight class="normal">}</highlight></codeline>
<codeline lineno="520"><highlight class="normal"></highlight></codeline>
<codeline lineno="529"><highlight class="normal"><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="530"><highlight class="normal">etharp_remove_static_entry(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>ip4_addr_t<sp/>*ipaddr)</highlight></codeline>
<codeline lineno="531"><highlight class="normal">{</highlight></codeline>
<codeline lineno="532"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga9cd1d7891fe315de1201e2c6e45f4f57" kindref="member">s8_t</ref><sp/>i;</highlight></codeline>
<codeline lineno="533"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1abff5d1e0b334f5b45bd2b8bbb675411e" kindref="member">ETHARP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;etharp_remove_static_entry:<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="534"><highlight class="normal"><sp/><sp/><sp/><sp/>ip4_addr1_16(ipaddr),<sp/>ip4_addr2_16(ipaddr),<sp/>ip4_addr3_16(ipaddr),<sp/>ip4_addr4_16(ipaddr)));</highlight></codeline>
<codeline lineno="535"><highlight class="normal"></highlight></codeline>
<codeline lineno="536"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>find<sp/>or<sp/>create<sp/>ARP<sp/>entry<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="537"><highlight class="normal"><sp/><sp/>i<sp/>=<sp/>etharp_find_entry(ipaddr,<sp/>ETHARP_FLAG_FIND_ONLY,<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>);</highlight></codeline>
<codeline lineno="538"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>bail<sp/>out<sp/>if<sp/>no<sp/>entry<sp/>could<sp/>be<sp/>found<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="539"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(i<sp/>&lt;<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="540"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>(<ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref>)i;</highlight></codeline>
<codeline lineno="541"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="542"><highlight class="normal"></highlight></codeline>
<codeline lineno="543"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(arp_table[i].<ref refid="structnetif_1a809cc57c0dff09c5c9ae45b02c2002f3" kindref="member">state</ref><sp/>!=<sp/>ETHARP_STATE_STATIC)<sp/>{</highlight></codeline>
<codeline lineno="544"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>entry<sp/>wasn&apos;t<sp/>a<sp/>static<sp/>entry,<sp/>cannot<sp/>remove<sp/>it<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="545"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcab508ce0ebdf3ca735208b00a80a45c91" kindref="member">ERR_ARG</ref>;</highlight></codeline>
<codeline lineno="546"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="547"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>entry<sp/>found,<sp/>free<sp/>it<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="548"><highlight class="normal"><sp/><sp/>etharp_free_entry(i);</highlight></codeline>
<codeline lineno="549"><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="550"><highlight class="normal">}</highlight></codeline>
<codeline lineno="551"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>ETHARP_SUPPORT_STATIC_ENTRIES<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="552"><highlight class="normal"></highlight></codeline>
<codeline lineno="558"><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="559"><highlight class="normal">etharp_cleanup_netif(</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="560"><highlight class="normal">{</highlight></codeline>
<codeline lineno="561"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>i;</highlight></codeline>
<codeline lineno="562"><highlight class="normal"></highlight></codeline>
<codeline lineno="563"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i<sp/>=<sp/>0;<sp/>i<sp/>&lt;<sp/><ref refid="lwipopts_8h_1a924936a814564dbdb0bc950d255a83b9" kindref="member">ARP_TABLE_SIZE</ref>;<sp/>++i)<sp/>{</highlight></codeline>
<codeline lineno="564"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/><ref refid="structnetif_1a809cc57c0dff09c5c9ae45b02c2002f3" kindref="member">state</ref><sp/>=<sp/>arp_table[i].state;</highlight></codeline>
<codeline lineno="565"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((<ref refid="structnetif_1a809cc57c0dff09c5c9ae45b02c2002f3" kindref="member">state</ref><sp/>!=<sp/>ETHARP_STATE_EMPTY)<sp/>&amp;&amp;<sp/>(arp_table[i].<ref refid="structnetif" kindref="compound">netif</ref><sp/>==<sp/><ref refid="structnetif" kindref="compound">netif</ref>))<sp/>{</highlight></codeline>
<codeline lineno="566"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>etharp_free_entry(i);</highlight></codeline>
<codeline lineno="567"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="568"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="569"><highlight class="normal">}</highlight></codeline>
<codeline lineno="570"><highlight class="normal"></highlight></codeline>
<codeline lineno="582"><highlight class="normal"><ref refid="group__compiler__abstraction_1ga9cd1d7891fe315de1201e2c6e45f4f57" kindref="member">s8_t</ref></highlight></codeline>
<codeline lineno="583"><highlight class="normal">etharp_find_addr(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>ip4_addr_t<sp/>*ipaddr,</highlight></codeline>
<codeline lineno="584"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structeth__addr" kindref="compound">eth_addr</ref><sp/>**eth_ret,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>ip4_addr_t<sp/>**ip_ret)</highlight></codeline>
<codeline lineno="585"><highlight class="normal">{</highlight></codeline>
<codeline lineno="586"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga9cd1d7891fe315de1201e2c6e45f4f57" kindref="member">s8_t</ref><sp/>i;</highlight></codeline>
<codeline lineno="587"><highlight class="normal"></highlight></codeline>
<codeline lineno="588"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;eth_ret<sp/>!=<sp/>NULL<sp/>&amp;&amp;<sp/>ip_ret<sp/>!=<sp/>NULL&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="589"><highlight class="normal"><sp/><sp/><sp/><sp/>eth_ret<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref><sp/>&amp;&amp;<sp/>ip_ret<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>);</highlight></codeline>
<codeline lineno="590"><highlight class="normal"></highlight></codeline>
<codeline lineno="591"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga70624a5deb8b9199406372a7f3603ecf" kindref="member">LWIP_UNUSED_ARG</ref>(<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="592"><highlight class="normal"></highlight></codeline>
<codeline lineno="593"><highlight class="normal"><sp/><sp/>i<sp/>=<sp/>etharp_find_entry(ipaddr,<sp/>ETHARP_FLAG_FIND_ONLY,<sp/><ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="594"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((i<sp/>&gt;=<sp/>0)<sp/>&amp;&amp;<sp/>(arp_table[i].<ref refid="structnetif_1a809cc57c0dff09c5c9ae45b02c2002f3" kindref="member">state</ref><sp/>&gt;=<sp/>ETHARP_STATE_STABLE))<sp/>{</highlight></codeline>
<codeline lineno="595"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>*eth_ret<sp/>=<sp/>&amp;arp_table[i].ethaddr;</highlight></codeline>
<codeline lineno="596"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>*ip_ret<sp/>=<sp/>&amp;arp_table[i].ipaddr;</highlight></codeline>
<codeline lineno="597"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>i;</highlight></codeline>
<codeline lineno="598"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="599"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>-1;</highlight></codeline>
<codeline lineno="600"><highlight class="normal">}</highlight></codeline>
<codeline lineno="601"><highlight class="normal"></highlight></codeline>
<codeline lineno="611"><highlight class="normal"><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref></highlight></codeline>
<codeline lineno="612"><highlight class="normal">etharp_get_entry(<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>i,<sp/>ip4_addr_t<sp/>**ipaddr,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>**<ref refid="structnetif" kindref="compound">netif</ref>,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structeth__addr" kindref="compound">eth_addr</ref><sp/>**eth_ret)</highlight></codeline>
<codeline lineno="613"><highlight class="normal">{</highlight></codeline>
<codeline lineno="614"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;ipaddr<sp/>!=<sp/>NULL&quot;</highlight><highlight class="normal">,<sp/>ipaddr<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>);</highlight></codeline>
<codeline lineno="615"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;netif<sp/>!=<sp/>NULL&quot;</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="616"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;eth_ret<sp/>!=<sp/>NULL&quot;</highlight><highlight class="normal">,<sp/>eth_ret<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>);</highlight></codeline>
<codeline lineno="617"><highlight class="normal"></highlight></codeline>
<codeline lineno="618"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">((i<sp/>&lt;<sp/><ref refid="lwipopts_8h_1a924936a814564dbdb0bc950d255a83b9" kindref="member">ARP_TABLE_SIZE</ref>)<sp/>&amp;&amp;<sp/>(arp_table[i].<ref refid="structnetif_1a809cc57c0dff09c5c9ae45b02c2002f3" kindref="member">state</ref><sp/>&gt;=<sp/>ETHARP_STATE_STABLE))<sp/>{</highlight></codeline>
<codeline lineno="619"><highlight class="normal"><sp/><sp/><sp/><sp/>*ipaddr<sp/><sp/>=<sp/>&amp;arp_table[i].ipaddr;</highlight></codeline>
<codeline lineno="620"><highlight class="normal"><sp/><sp/><sp/><sp/>*<ref refid="structnetif" kindref="compound">netif</ref><sp/><sp/><sp/>=<sp/>arp_table[i].netif;</highlight></codeline>
<codeline lineno="621"><highlight class="normal"><sp/><sp/><sp/><sp/>*eth_ret<sp/>=<sp/>&amp;arp_table[i].ethaddr;</highlight></codeline>
<codeline lineno="622"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>1;</highlight></codeline>
<codeline lineno="623"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="624"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0;</highlight></codeline>
<codeline lineno="625"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="626"><highlight class="normal">}</highlight></codeline>
<codeline lineno="627"><highlight class="normal"></highlight></codeline>
<codeline lineno="640"><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="641"><highlight class="normal">etharp_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/>*<ref refid="structnetif" kindref="compound">netif</ref>)</highlight></codeline>
<codeline lineno="642"><highlight class="normal">{</highlight></codeline>
<codeline lineno="643"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structetharp__hdr" kindref="compound">etharp_hdr</ref><sp/>*hdr;</highlight></codeline>
<codeline lineno="644"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>these<sp/>are<sp/>aligned<sp/>properly,<sp/>whereas<sp/>the<sp/>ARP<sp/>header<sp/>fields<sp/>might<sp/>not<sp/>be<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="645"><highlight class="normal"><sp/><sp/>ip4_addr_t<sp/>sipaddr,<sp/>dipaddr;</highlight></codeline>
<codeline lineno="646"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>for_us;</highlight></codeline>
<codeline lineno="647"><highlight class="normal"></highlight></codeline>
<codeline lineno="648"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;netif<sp/>!=<sp/>NULL&quot;</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><highlight class="keywordflow">return</highlight><highlight class="normal">;);</highlight></codeline>
<codeline lineno="649"><highlight class="normal"></highlight></codeline>
<codeline lineno="650"><highlight class="normal"><sp/><sp/>hdr<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structetharp__hdr" kindref="compound">etharp_hdr</ref><sp/>*)p-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref>;</highlight></codeline>
<codeline lineno="651"><highlight class="normal"></highlight></codeline>
<codeline lineno="652"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>RFC<sp/>826<sp/>&quot;Packet<sp/>Reception&quot;:<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="653"><highlight class="normal"><sp/><sp/>if<sp/>((hdr-&gt;hwtype<sp/>!=<sp/><ref refid="def_8h_1a0dfd02d7c09f9c698a5a7ecc0b7287ad" kindref="member">PP_HTONS</ref>(<ref refid="prot_2etharp_8h_1a2bfef84e6dba235e7019834a4b493a66a6e4adc4f5f733878a0173c6fb98a5f93" kindref="member">HWTYPE_ETHERNET</ref>))<sp/>||</highlight></codeline>
<codeline lineno="654"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>(hdr-&gt;hwlen<sp/>!=<sp/><ref refid="prot_2ethernet_8h_1ac9426049770b40fcd9556ffbd7e56907" kindref="member">ETH_HWADDR_LEN</ref>)<sp/>||</highlight></codeline>
<codeline lineno="655"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>(hdr-&gt;protolen<sp/>!=<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(ip4_addr_t))<sp/>||</highlight></codeline>
<codeline lineno="656"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>(hdr-&gt;proto<sp/>!=<sp/><ref refid="def_8h_1a0dfd02d7c09f9c698a5a7ecc0b7287ad" kindref="member">PP_HTONS</ref>(<ref refid="group__ethernet_1gga4f8559808037803168499a3803900339ac95756b20fde70b868ef4185dd221c79" kindref="member">ETHTYPE_IP</ref>)))<sp/><sp/>{</highlight></codeline>
<codeline lineno="657"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1abff5d1e0b334f5b45bd2b8bbb675411e" kindref="member">ETHARP_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>,</highlight></codeline>
<codeline lineno="658"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>(</highlight><highlight class="stringliteral">&quot;etharp_input:<sp/>packet<sp/>dropped,<sp/>wrong<sp/>hw<sp/>type,<sp/>hwlen,<sp/>proto,<sp/>protolen<sp/>or<sp/>ethernet<sp/>type<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="659"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>hdr-&gt;hwtype,<sp/>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)hdr-&gt;hwlen,<sp/>hdr-&gt;proto,<sp/>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)hdr-&gt;protolen));</highlight></codeline>
<codeline lineno="660"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="stats_8h_1aea3a36c64f7159af04b7acc985402edc" kindref="member">ETHARP_STATS_INC</ref>(etharp.proterr);</highlight></codeline>
<codeline lineno="661"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="stats_8h_1aea3a36c64f7159af04b7acc985402edc" kindref="member">ETHARP_STATS_INC</ref>(etharp.drop);</highlight></codeline>
<codeline lineno="662"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(p);</highlight></codeline>
<codeline lineno="663"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="664"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="665"><highlight class="normal"><sp/><sp/><ref refid="stats_8h_1aea3a36c64f7159af04b7acc985402edc" kindref="member">ETHARP_STATS_INC</ref>(etharp.recv);</highlight></codeline>
<codeline lineno="666"><highlight class="normal"></highlight></codeline>
<codeline lineno="667"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_AUTOIP</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="668"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>We<sp/>have<sp/>to<sp/>check<sp/>if<sp/>a<sp/>host<sp/>already<sp/>has<sp/>configured<sp/>our<sp/>random</highlight></codeline>
<codeline lineno="669"><highlight class="comment"><sp/><sp/><sp/>*<sp/>created<sp/>link<sp/>local<sp/>address<sp/>and<sp/>continuously<sp/>check<sp/>if<sp/>there<sp/>is</highlight></codeline>
<codeline lineno="670"><highlight class="comment"><sp/><sp/><sp/>*<sp/>a<sp/>host<sp/>with<sp/>this<sp/>IP-address<sp/>so<sp/>we<sp/>can<sp/>detect<sp/>collisions<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="671"><highlight class="normal"><sp/><sp/>autoip_arp_reply(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>hdr);</highlight></codeline>
<codeline lineno="672"><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="673"><highlight class="normal"></highlight></codeline>
<codeline lineno="674"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Copy<sp/>struct<sp/>ip4_addr2<sp/>to<sp/>aligned<sp/>ip4_addr,<sp/>to<sp/>support<sp/>compilers<sp/>without</highlight></codeline>
<codeline lineno="675"><highlight class="comment"><sp/><sp/><sp/>*<sp/>structure<sp/>packing<sp/>(not<sp/>using<sp/>structure<sp/>copy<sp/>which<sp/>breaks<sp/>strict-aliasing<sp/>rules).<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="676"><highlight class="normal"><sp/><sp/>IPADDR2_COPY(&amp;sipaddr,<sp/>&amp;hdr-&gt;sipaddr);</highlight></codeline>
<codeline lineno="677"><highlight class="normal"><sp/><sp/>IPADDR2_COPY(&amp;dipaddr,<sp/>&amp;hdr-&gt;dipaddr);</highlight></codeline>
<codeline lineno="678"><highlight class="normal"></highlight></codeline>
<codeline lineno="679"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>this<sp/>interface<sp/>is<sp/>not<sp/>configured?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="680"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ip4_addr_isany_val(*netif_ip4_addr(<ref refid="structnetif" kindref="compound">netif</ref>)))<sp/>{</highlight></codeline>
<codeline lineno="681"><highlight class="normal"><sp/><sp/><sp/><sp/>for_us<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="682"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="683"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>ARP<sp/>packet<sp/>directed<sp/>to<sp/>us?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="684"><highlight class="normal"><sp/><sp/><sp/><sp/>for_us<sp/>=<sp/>(<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref>)ip4_addr_cmp(&amp;dipaddr,<sp/>netif_ip4_addr(<ref refid="structnetif" kindref="compound">netif</ref>));</highlight></codeline>
<codeline lineno="685"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="686"><highlight class="normal"></highlight></codeline>
<codeline lineno="687"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>ARP<sp/>message<sp/>directed<sp/>to<sp/>us?</highlight></codeline>
<codeline lineno="688"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/>-&gt;<sp/>add<sp/>IP<sp/>address<sp/>in<sp/>ARP<sp/>cache;<sp/>assume<sp/>requester<sp/>wants<sp/>to<sp/>talk<sp/>to<sp/>us,</highlight></codeline>
<codeline lineno="689"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>can<sp/>result<sp/>in<sp/>directly<sp/>sending<sp/>the<sp/>queued<sp/>packets<sp/>for<sp/>this<sp/>host.</highlight></codeline>
<codeline lineno="690"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>ARP<sp/>message<sp/>not<sp/>directed<sp/>to<sp/>us?</highlight></codeline>
<codeline lineno="691"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/>-&gt;<sp/><sp/>update<sp/>the<sp/>source<sp/>IP<sp/>address<sp/>in<sp/>the<sp/>cache,<sp/>if<sp/>present<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="692"><highlight class="normal"><sp/><sp/>etharp_update_arp_entry(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>&amp;sipaddr,<sp/>&amp;(hdr-&gt;shwaddr),</highlight></codeline>
<codeline lineno="693"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>for_us<sp/>?<sp/>ETHARP_FLAG_TRY_HARD<sp/>:<sp/>ETHARP_FLAG_FIND_ONLY);</highlight></codeline>
<codeline lineno="694"><highlight class="normal"></highlight></codeline>
<codeline lineno="695"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>now<sp/>act<sp/>on<sp/>the<sp/>message<sp/>itself<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="696"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">switch</highlight><highlight class="normal"><sp/>(hdr-&gt;opcode)<sp/>{</highlight></codeline>
<codeline lineno="697"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>ARP<sp/>request?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="698"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="def_8h_1a0dfd02d7c09f9c698a5a7ecc0b7287ad" kindref="member">PP_HTONS</ref>(<ref refid="prot_2etharp_8h_1af8a1068cba34f11d56afb73cdd879cabafb58ccf8b7b11505ff2117a10bf6ff61" kindref="member">ARP_REQUEST</ref>):</highlight></codeline>
<codeline lineno="699"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>ARP<sp/>request.<sp/>If<sp/>it<sp/>asked<sp/>for<sp/>our<sp/>address,<sp/>we<sp/>send<sp/>out<sp/>a</highlight></codeline>
<codeline lineno="700"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>*<sp/>reply.<sp/>In<sp/>any<sp/>case,<sp/>we<sp/>time-stamp<sp/>any<sp/>existing<sp/>ARP<sp/>entry,</highlight></codeline>
<codeline lineno="701"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>*<sp/>and<sp/>possibly<sp/>send<sp/>out<sp/>an<sp/>IP<sp/>packet<sp/>that<sp/>was<sp/>queued<sp/>on<sp/>it.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="702"><highlight class="normal"></highlight></codeline>
<codeline lineno="703"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref><sp/>(<ref refid="lwipopts_8h_1abff5d1e0b334f5b45bd2b8bbb675411e" kindref="member">ETHARP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;etharp_input:<sp/>incoming<sp/>ARP<sp/>request\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="704"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>ARP<sp/>request<sp/>for<sp/>our<sp/>address?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="705"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(for_us)<sp/>{</highlight></codeline>
<codeline lineno="706"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>send<sp/>ARP<sp/>response<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="707"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>etharp_raw(<ref refid="structnetif" kindref="compound">netif</ref>,</highlight></codeline>
<codeline lineno="708"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structeth__addr" kindref="compound">eth_addr</ref><sp/>*)<ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1aee967965d999fc1a4c40a66709304e69" kindref="member">hwaddr</ref>,<sp/>&amp;hdr-&gt;shwaddr,</highlight></codeline>
<codeline lineno="709"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structeth__addr" kindref="compound">eth_addr</ref><sp/>*)<ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1aee967965d999fc1a4c40a66709304e69" kindref="member">hwaddr</ref>,<sp/>netif_ip4_addr(<ref refid="structnetif" kindref="compound">netif</ref>),</highlight></codeline>
<codeline lineno="710"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>&amp;hdr-&gt;shwaddr,<sp/>&amp;sipaddr,</highlight></codeline>
<codeline lineno="711"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="prot_2etharp_8h_1af8a1068cba34f11d56afb73cdd879caba8bb24a026264a5b22435864179f874d9" kindref="member">ARP_REPLY</ref>);</highlight></codeline>
<codeline lineno="712"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>we<sp/>are<sp/>not<sp/>configured?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="713"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ip4_addr_isany_val(*netif_ip4_addr(<ref refid="structnetif" kindref="compound">netif</ref>)))<sp/>{</highlight></codeline>
<codeline lineno="714"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>{<sp/>for_us<sp/>==<sp/>0<sp/>and<sp/>netif-&gt;ip_addr.addr<sp/>==<sp/>0<sp/>}<sp/>*/</highlight><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_1abff5d1e0b334f5b45bd2b8bbb675411e" kindref="member">ETHARP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;etharp_input:<sp/>we<sp/>are<sp/>unconfigured,<sp/>ARP<sp/>request<sp/>ignored.\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="716"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>request<sp/>was<sp/>not<sp/>directed<sp/>to<sp/>us<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="717"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="718"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>{<sp/>for_us<sp/>==<sp/>0<sp/>and<sp/>netif-&gt;ip_addr.addr<sp/>!=<sp/>0<sp/>}<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="719"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1abff5d1e0b334f5b45bd2b8bbb675411e" kindref="member">ETHARP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;etharp_input:<sp/>ARP<sp/>request<sp/>was<sp/>not<sp/>for<sp/>us.\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="720"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="721"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="722"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="def_8h_1a0dfd02d7c09f9c698a5a7ecc0b7287ad" kindref="member">PP_HTONS</ref>(<ref refid="prot_2etharp_8h_1af8a1068cba34f11d56afb73cdd879caba8bb24a026264a5b22435864179f874d9" kindref="member">ARP_REPLY</ref>):</highlight></codeline>
<codeline lineno="723"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>ARP<sp/>reply.<sp/>We<sp/>already<sp/>updated<sp/>the<sp/>ARP<sp/>cache<sp/>earlier.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="724"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1abff5d1e0b334f5b45bd2b8bbb675411e" kindref="member">ETHARP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;etharp_input:<sp/>incoming<sp/>ARP<sp/>reply\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="725"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>(LWIP_DHCP<sp/>&amp;&amp;<sp/>DHCP_DOES_ARP_CHECK)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="726"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>DHCP<sp/>wants<sp/>to<sp/>know<sp/>about<sp/>ARP<sp/>replies<sp/>from<sp/>any<sp/>host<sp/>with<sp/>an</highlight></codeline>
<codeline lineno="727"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>*<sp/>IP<sp/>address<sp/>also<sp/>offered<sp/>to<sp/>us<sp/>by<sp/>the<sp/>DHCP<sp/>server.<sp/>We<sp/>do<sp/>not</highlight></codeline>
<codeline lineno="728"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>*<sp/>want<sp/>to<sp/>take<sp/>a<sp/>duplicate<sp/>IP<sp/>address<sp/>on<sp/>a<sp/>single<sp/>network.</highlight></codeline>
<codeline lineno="729"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>*<sp/>@todo<sp/>How<sp/>should<sp/>we<sp/>handle<sp/>redundant<sp/>(fail-over)<sp/>interfaces?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="730"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp_arp_reply(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>&amp;sipaddr);</highlight></codeline>
<codeline lineno="731"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>(LWIP_DHCP<sp/>&amp;&amp;<sp/>DHCP_DOES_ARP_CHECK)<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="732"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="733"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">default</highlight><highlight class="normal">:</highlight></codeline>
<codeline lineno="734"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1abff5d1e0b334f5b45bd2b8bbb675411e" kindref="member">ETHARP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;etharp_input:<sp/>ARP<sp/>unknown<sp/>opcode<sp/>type<sp/>%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gac05a82d37afb251470f5e17ca15ab6e9" kindref="member">S16_F</ref></highlight><highlight class="stringliteral">&quot;\n&quot;</highlight><highlight class="normal">,<sp/><ref refid="def_8c_1ad637280639de4066392e6b5614fa3e56" kindref="member">lwip_htons</ref>(hdr-&gt;opcode)));</highlight></codeline>
<codeline lineno="735"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="stats_8h_1aea3a36c64f7159af04b7acc985402edc" kindref="member">ETHARP_STATS_INC</ref>(etharp.err);</highlight></codeline>
<codeline lineno="736"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="737"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="738"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>free<sp/>ARP<sp/>packet<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="739"><highlight class="normal"><sp/><sp/><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(p);</highlight></codeline>
<codeline lineno="740"><highlight class="normal">}</highlight></codeline>
<codeline lineno="741"><highlight class="normal"></highlight></codeline>
<codeline lineno="745"><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="746"><highlight class="normal">etharp_output_to_arp_index(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*q,<sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>arp_idx)</highlight></codeline>
<codeline lineno="747"><highlight class="normal">{</highlight></codeline>
<codeline lineno="748"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;arp_table[arp_idx].state<sp/>&gt;=<sp/>ETHARP_STATE_STABLE&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="749"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>arp_table[arp_idx].state<sp/>&gt;=<sp/>ETHARP_STATE_STABLE);</highlight></codeline>
<codeline lineno="750"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>if<sp/>arp<sp/>table<sp/>entry<sp/>is<sp/>about<sp/>to<sp/>expire:<sp/>re-request<sp/>it,</highlight></codeline>
<codeline lineno="751"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>but<sp/>only<sp/>if<sp/>its<sp/>state<sp/>is<sp/>ETHARP_STATE_STABLE<sp/>to<sp/>prevent<sp/>flooding<sp/>the</highlight></codeline>
<codeline lineno="752"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>network<sp/>with<sp/>ARP<sp/>requests<sp/>if<sp/>this<sp/>address<sp/>is<sp/>used<sp/>frequently.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="753"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(arp_table[arp_idx].state<sp/>==<sp/>ETHARP_STATE_STABLE)<sp/>{</highlight></codeline>
<codeline lineno="754"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(arp_table[arp_idx].ctime<sp/>&gt;=<sp/>ARP_AGE_REREQUEST_USED_BROADCAST)<sp/>{</highlight></codeline>
<codeline lineno="755"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>issue<sp/>a<sp/>standard<sp/>request<sp/>using<sp/>broadcast<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="756"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(etharp_request(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>&amp;arp_table[arp_idx].ipaddr)<sp/>==<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" kindref="member">ERR_OK</ref>)<sp/>{</highlight></codeline>
<codeline lineno="757"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>arp_table[arp_idx].state<sp/>=<sp/>ETHARP_STATE_STABLE_REREQUESTING_1;</highlight></codeline>
<codeline lineno="758"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="759"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(arp_table[arp_idx].ctime<sp/>&gt;=<sp/>ARP_AGE_REREQUEST_USED_UNICAST)<sp/>{</highlight></codeline>
<codeline lineno="760"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>issue<sp/>a<sp/>unicast<sp/>request<sp/>(for<sp/>15<sp/>seconds)<sp/>to<sp/>prevent<sp/>unnecessary<sp/>broadcast<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="761"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(etharp_request_dst(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>&amp;arp_table[arp_idx].ipaddr,<sp/>&amp;arp_table[arp_idx].ethaddr)<sp/>==<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" kindref="member">ERR_OK</ref>)<sp/>{</highlight></codeline>
<codeline lineno="762"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>arp_table[arp_idx].state<sp/>=<sp/>ETHARP_STATE_STABLE_REREQUESTING_1;</highlight></codeline>
<codeline lineno="763"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="764"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="765"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="766"><highlight class="normal"></highlight></codeline>
<codeline lineno="767"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>ethernet_output(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>q,<sp/>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structeth__addr" kindref="compound">eth_addr</ref>*)(<ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1aee967965d999fc1a4c40a66709304e69" kindref="member">hwaddr</ref>),<sp/>&amp;arp_table[arp_idx].ethaddr,<sp/><ref refid="group__ethernet_1gga4f8559808037803168499a3803900339ac95756b20fde70b868ef4185dd221c79" kindref="member">ETHTYPE_IP</ref>);</highlight></codeline>
<codeline lineno="768"><highlight class="normal">}</highlight></codeline>
<codeline lineno="769"><highlight class="normal"></highlight></codeline>
<codeline lineno="788"><highlight class="normal"><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="789"><highlight class="normal">etharp_output(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*q,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>ip4_addr_t<sp/>*ipaddr)</highlight></codeline>
<codeline lineno="790"><highlight class="normal">{</highlight></codeline>
<codeline lineno="791"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structeth__addr" kindref="compound">eth_addr</ref><sp/>*dest;</highlight></codeline>
<codeline lineno="792"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structeth__addr" kindref="compound">eth_addr</ref><sp/>mcastaddr;</highlight></codeline>
<codeline lineno="793"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>ip4_addr_t<sp/>*dst_addr<sp/>=<sp/>ipaddr;</highlight></codeline>
<codeline lineno="794"><highlight class="normal"></highlight></codeline>
<codeline lineno="795"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;netif<sp/>!=<sp/>NULL&quot;</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="796"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;q<sp/>!=<sp/>NULL&quot;</highlight><highlight class="normal">,<sp/>q<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>);</highlight></codeline>
<codeline lineno="797"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;ipaddr<sp/>!=<sp/>NULL&quot;</highlight><highlight class="normal">,<sp/>ipaddr<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>);</highlight></codeline>
<codeline lineno="798"><highlight class="normal"></highlight></codeline>
<codeline lineno="799"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Determine<sp/>on<sp/>destination<sp/>hardware<sp/>address.<sp/>Broadcasts<sp/>and<sp/>multicasts</highlight></codeline>
<codeline lineno="800"><highlight class="comment"><sp/><sp/><sp/>*<sp/>are<sp/>special,<sp/>other<sp/>IP<sp/>addresses<sp/>are<sp/>looked<sp/>up<sp/>in<sp/>the<sp/>ARP<sp/>table.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="801"><highlight class="normal"></highlight></codeline>
<codeline lineno="802"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>broadcast<sp/>destination<sp/>IP<sp/>address?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="803"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ip4_addr_isbroadcast(ipaddr,<sp/><ref refid="structnetif" kindref="compound">netif</ref>))<sp/>{</highlight></codeline>
<codeline lineno="804"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>broadcast<sp/>on<sp/>Ethernet<sp/>also<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="805"><highlight class="normal"><sp/><sp/><sp/><sp/>dest<sp/>=<sp/>(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structeth__addr" kindref="compound">eth_addr</ref><sp/>*)&amp;ethbroadcast;</highlight></codeline>
<codeline lineno="806"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>multicast<sp/>destination<sp/>IP<sp/>address?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="807"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ip4_addr_ismulticast(ipaddr))<sp/>{</highlight></codeline>
<codeline lineno="808"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Hash<sp/>IP<sp/>multicast<sp/>address<sp/>to<sp/>MAC<sp/>address.*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="809"><highlight class="normal"><sp/><sp/><sp/><sp/>mcastaddr.addr[0]<sp/>=<sp/><ref refid="prot_2ethernet_8h_1afaf6cbccf9477c3505660e3a17860e07" kindref="member">LL_IP4_MULTICAST_ADDR_0</ref>;</highlight></codeline>
<codeline lineno="810"><highlight class="normal"><sp/><sp/><sp/><sp/>mcastaddr.addr[1]<sp/>=<sp/><ref refid="prot_2ethernet_8h_1ac08b2a99f6ff9cbafaa1cb5a6405d225" kindref="member">LL_IP4_MULTICAST_ADDR_1</ref>;</highlight></codeline>
<codeline lineno="811"><highlight class="normal"><sp/><sp/><sp/><sp/>mcastaddr.addr[2]<sp/>=<sp/><ref refid="prot_2ethernet_8h_1a98285b6f76c2eb6b6c738da62176bce0" kindref="member">LL_IP4_MULTICAST_ADDR_2</ref>;</highlight></codeline>
<codeline lineno="812"><highlight class="normal"><sp/><sp/><sp/><sp/>mcastaddr.addr[3]<sp/>=<sp/>ip4_addr2(ipaddr)<sp/>&amp;<sp/>0x7f;</highlight></codeline>
<codeline lineno="813"><highlight class="normal"><sp/><sp/><sp/><sp/>mcastaddr.addr[4]<sp/>=<sp/>ip4_addr3(ipaddr);</highlight></codeline>
<codeline lineno="814"><highlight class="normal"><sp/><sp/><sp/><sp/>mcastaddr.addr[5]<sp/>=<sp/>ip4_addr4(ipaddr);</highlight></codeline>
<codeline lineno="815"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>destination<sp/>Ethernet<sp/>address<sp/>is<sp/>multicast<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="816"><highlight class="normal"><sp/><sp/><sp/><sp/>dest<sp/>=<sp/>&amp;mcastaddr;</highlight></codeline>
<codeline lineno="817"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>unicast<sp/>destination<sp/>IP<sp/>address?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="818"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="819"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__compiler__abstraction_1ga9cd1d7891fe315de1201e2c6e45f4f57" kindref="member">s8_t</ref><sp/>i;</highlight></codeline>
<codeline lineno="820"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>outside<sp/>local<sp/>network?<sp/>if<sp/>so,<sp/>this<sp/>can<sp/>neither<sp/>be<sp/>a<sp/>global<sp/>broadcast<sp/>nor</highlight></codeline>
<codeline lineno="821"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>a<sp/>subnet<sp/>broadcast.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="822"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!ip4_addr_netcmp(ipaddr,<sp/>netif_ip4_addr(<ref refid="structnetif" kindref="compound">netif</ref>),<sp/>netif_ip4_netmask(<ref refid="structnetif" kindref="compound">netif</ref>))<sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="823"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>!ip4_addr_islinklocal(ipaddr))<sp/>{</highlight></codeline>
<codeline lineno="824"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_AUTOIP</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="825"><highlight class="normal"><sp/><sp/><sp/><sp/><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/><ref refid="group__compiler__abstraction_1gaade87973d72135b0b3afccfff4f62eb8" kindref="member">LWIP_ALIGNMENT_CAST</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structip__hdr" kindref="compound">ip_hdr</ref>*,<sp/>q-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref>);</highlight></codeline>
<codeline lineno="826"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>According<sp/>to<sp/>RFC<sp/>3297,<sp/>chapter<sp/>2.6.2<sp/>(Forwarding<sp/>Rules),<sp/>a<sp/>packet<sp/>with</highlight></codeline>
<codeline lineno="827"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>a<sp/>link-local<sp/>source<sp/>address<sp/>must<sp/>always<sp/>be<sp/>&quot;directly<sp/>to<sp/>its<sp/>destination</highlight></codeline>
<codeline lineno="828"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>on<sp/>the<sp/>same<sp/>physical<sp/>link.<sp/>The<sp/>host<sp/>MUST<sp/>NOT<sp/>send<sp/>the<sp/>packet<sp/>to<sp/>any</highlight></codeline>
<codeline lineno="829"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>router<sp/>for<sp/>forwarding&quot;.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="830"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!ip4_addr_islinklocal(&amp;iphdr-&gt;src))</highlight></codeline>
<codeline lineno="831"><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="832"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="833"><highlight class="normal"></highlight><highlight class="preprocessor">#ifdef<sp/>LWIP_HOOK_ETHARP_GET_GW</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="834"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>For<sp/>advanced<sp/>routing,<sp/>a<sp/>single<sp/>default<sp/>gateway<sp/>might<sp/>not<sp/>be<sp/>enough,<sp/>so<sp/>get</highlight></codeline>
<codeline lineno="835"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>the<sp/>IP<sp/>address<sp/>of<sp/>the<sp/>gateway<sp/>to<sp/>handle<sp/>the<sp/>current<sp/>destination<sp/>address.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="836"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>dst_addr<sp/>=<sp/>LWIP_HOOK_ETHARP_GET_GW(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>ipaddr);</highlight></codeline>
<codeline lineno="837"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dst_addr<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)</highlight></codeline>
<codeline lineno="838"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_HOOK_ETHARP_GET_GW<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="839"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="840"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>interface<sp/>has<sp/>default<sp/>gateway?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="841"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!ip4_addr_isany_val(*netif_ip4_gw(<ref refid="structnetif" kindref="compound">netif</ref>)))<sp/>{</highlight></codeline>
<codeline lineno="842"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>send<sp/>to<sp/>hardware<sp/>address<sp/>of<sp/>default<sp/>gateway<sp/>IP<sp/>address<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="843"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>dst_addr<sp/>=<sp/>netif_ip4_gw(<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="844"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>no<sp/>default<sp/>gateway<sp/>available<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="845"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="846"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>no<sp/>route<sp/>to<sp/>destination<sp/>error<sp/>(default<sp/>gateway<sp/>missing)<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="847"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><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="848"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="849"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="850"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="851"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="852"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_NETIF_HWADDRHINT</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="853"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="structnetif" kindref="compound">netif</ref>-&gt;addr_hint<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="854"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>per-pcb<sp/>cached<sp/>entry<sp/>was<sp/>given<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="855"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>etharp_cached_entry<sp/>=<sp/>*(<ref refid="structnetif" kindref="compound">netif</ref>-&gt;addr_hint);</highlight></codeline>
<codeline lineno="856"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(etharp_cached_entry<sp/>&lt;<sp/><ref refid="lwipopts_8h_1a924936a814564dbdb0bc950d255a83b9" kindref="member">ARP_TABLE_SIZE</ref>)<sp/>{</highlight></codeline>
<codeline lineno="857"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_NETIF_HWADDRHINT<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="858"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((arp_table[etharp_cached_entry].state<sp/>&gt;=<sp/>ETHARP_STATE_STABLE)<sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="859"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>ETHARP_TABLE_MATCH_NETIF</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="860"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(arp_table[etharp_cached_entry].netif<sp/>==<sp/><ref refid="structnetif" kindref="compound">netif</ref>)<sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="861"><highlight class="normal">#endif</highlight></codeline>
<codeline lineno="862"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(ip4_addr_cmp(dst_addr,<sp/>&amp;arp_table[etharp_cached_entry].ipaddr)))<sp/>{</highlight></codeline>
<codeline lineno="863"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>the<sp/>per-pcb-cached<sp/>entry<sp/>is<sp/>stable<sp/>and<sp/>the<sp/>right<sp/>one!<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="864"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1aea3a36c64f7159af04b7acc985402edc" kindref="member">ETHARP_STATS_INC</ref>(etharp.cachehit);</highlight></codeline>
<codeline lineno="865"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>etharp_output_to_arp_index(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>q,<sp/>etharp_cached_entry);</highlight></codeline>
<codeline lineno="866"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="867"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_NETIF_HWADDRHINT</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="868"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="869"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="870"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_NETIF_HWADDRHINT<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="871"><highlight class="normal"></highlight></codeline>
<codeline lineno="872"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>find<sp/>stable<sp/>entry:<sp/>do<sp/>this<sp/>here<sp/>since<sp/>this<sp/>is<sp/>a<sp/>critical<sp/>path<sp/>for</highlight></codeline>
<codeline lineno="873"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>throughput<sp/>and<sp/>etharp_find_entry()<sp/>is<sp/>kind<sp/>of<sp/>slow<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="874"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i<sp/>=<sp/>0;<sp/>i<sp/>&lt;<sp/><ref refid="lwipopts_8h_1a924936a814564dbdb0bc950d255a83b9" kindref="member">ARP_TABLE_SIZE</ref>;<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="875"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((arp_table[i].state<sp/>&gt;=<sp/>ETHARP_STATE_STABLE)<sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="876"><highlight class="normal">#</highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/><ref refid="lwipopts_8h_1a2f762eee309a545650f80fc8dcc19084" kindref="member">ETHARP_TABLE_MATCH_NETIF</ref></highlight></codeline>
<codeline lineno="877"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(arp_table[i].<ref refid="structnetif" kindref="compound">netif</ref><sp/>==<sp/><ref refid="structnetif" kindref="compound">netif</ref>)<sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="878"><highlight class="normal">#endif</highlight></codeline>
<codeline lineno="879"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(ip4_addr_cmp(dst_addr,<sp/>&amp;arp_table[i].ipaddr)))<sp/>{</highlight></codeline>
<codeline lineno="880"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>found<sp/>an<sp/>existing,<sp/>stable<sp/>entry<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="881"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ETHARP_SET_HINT(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>i);</highlight></codeline>
<codeline lineno="882"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>etharp_output_to_arp_index(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>q,<sp/>i);</highlight></codeline>
<codeline lineno="883"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="884"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="885"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>no<sp/>stable<sp/>entry<sp/>found,<sp/>use<sp/>the<sp/>(slower)<sp/>query<sp/>function:</highlight></codeline>
<codeline lineno="886"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>queue<sp/>on<sp/>destination<sp/>Ethernet<sp/>address<sp/>belonging<sp/>to<sp/>ipaddr<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="887"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>etharp_query(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>dst_addr,<sp/>q);</highlight></codeline>
<codeline lineno="888"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="889"><highlight class="normal"></highlight></codeline>
<codeline lineno="890"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>continuation<sp/>for<sp/>multicast/broadcast<sp/>destinations<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="891"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>obtain<sp/>source<sp/>Ethernet<sp/>address<sp/>of<sp/>the<sp/>given<sp/>interface<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="892"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>send<sp/>packet<sp/>directly<sp/>on<sp/>the<sp/>link<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="893"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>ethernet_output(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>q,<sp/>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structeth__addr" kindref="compound">eth_addr</ref>*)(<ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1aee967965d999fc1a4c40a66709304e69" kindref="member">hwaddr</ref>),<sp/>dest,<sp/><ref refid="group__ethernet_1gga4f8559808037803168499a3803900339ac95756b20fde70b868ef4185dd221c79" kindref="member">ETHTYPE_IP</ref>);</highlight></codeline>
<codeline lineno="894"><highlight class="normal">}</highlight></codeline>
<codeline lineno="895"><highlight class="normal"></highlight></codeline>
<codeline lineno="929"><highlight class="normal"><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="930"><highlight class="normal">etharp_query(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>ip4_addr_t<sp/>*ipaddr,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*q)</highlight></codeline>
<codeline lineno="931"><highlight class="normal">{</highlight></codeline>
<codeline lineno="932"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structeth__addr" kindref="compound">eth_addr</ref><sp/>*<sp/>srcaddr<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structeth__addr" kindref="compound">eth_addr</ref><sp/>*)<ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1aee967965d999fc1a4c40a66709304e69" kindref="member">hwaddr</ref>;</highlight></codeline>
<codeline lineno="933"><highlight class="normal"><sp/><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref><sp/>result<sp/>=<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaaaeafdbf3aecc46864daa3cd829c7e05" kindref="member">ERR_MEM</ref>;</highlight></codeline>
<codeline lineno="934"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>is_new_entry<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="935"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga9cd1d7891fe315de1201e2c6e45f4f57" kindref="member">s8_t</ref><sp/>i;<sp/></highlight><highlight class="comment">/*<sp/>ARP<sp/>entry<sp/>index<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="936"><highlight class="normal"></highlight></codeline>
<codeline lineno="937"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>non-unicast<sp/>address?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="938"><highlight class="normal"><sp/><sp/>if<sp/>(ip4_addr_isbroadcast(ipaddr,<sp/><ref refid="structnetif" kindref="compound">netif</ref>)<sp/>||</highlight></codeline>
<codeline lineno="939"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>ip4_addr_ismulticast(ipaddr)<sp/>||</highlight></codeline>
<codeline lineno="940"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>ip4_addr_isany(ipaddr))<sp/>{</highlight></codeline>
<codeline lineno="941"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1abff5d1e0b334f5b45bd2b8bbb675411e" kindref="member">ETHARP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;etharp_query:<sp/>will<sp/>not<sp/>add<sp/>non-unicast<sp/>IP<sp/>address<sp/>to<sp/>ARP<sp/>cache\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="942"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcab508ce0ebdf3ca735208b00a80a45c91" kindref="member">ERR_ARG</ref>;</highlight></codeline>
<codeline lineno="943"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="944"><highlight class="normal"></highlight></codeline>
<codeline lineno="945"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>find<sp/>entry<sp/>in<sp/>ARP<sp/>cache,<sp/>ask<sp/>to<sp/>create<sp/>entry<sp/>if<sp/>queueing<sp/>packet<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="946"><highlight class="normal"><sp/><sp/>i<sp/>=<sp/>etharp_find_entry(ipaddr,<sp/>ETHARP_FLAG_TRY_HARD,<sp/><ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="947"><highlight class="normal"></highlight></codeline>
<codeline lineno="948"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>could<sp/>not<sp/>find<sp/>or<sp/>create<sp/>entry?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="949"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(i<sp/>&lt;<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="950"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1abff5d1e0b334f5b45bd2b8bbb675411e" kindref="member">ETHARP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;etharp_query:<sp/>could<sp/>not<sp/>create<sp/>ARP<sp/>entry\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="951"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(q)<sp/>{</highlight></codeline>
<codeline lineno="952"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1abff5d1e0b334f5b45bd2b8bbb675411e" kindref="member">ETHARP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;etharp_query:<sp/>packet<sp/>dropped\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="953"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1aea3a36c64f7159af04b7acc985402edc" kindref="member">ETHARP_STATS_INC</ref>(etharp.memerr);</highlight></codeline>
<codeline lineno="954"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="955"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>(<ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref>)i;</highlight></codeline>
<codeline lineno="956"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="957"><highlight class="normal"></highlight></codeline>
<codeline lineno="958"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>mark<sp/>a<sp/>fresh<sp/>entry<sp/>as<sp/>pending<sp/>(we<sp/>just<sp/>sent<sp/>a<sp/>request)<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="959"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(arp_table[i].state<sp/>==<sp/>ETHARP_STATE_EMPTY)<sp/>{</highlight></codeline>
<codeline lineno="960"><highlight class="normal"><sp/><sp/><sp/><sp/>is_new_entry<sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="961"><highlight class="normal"><sp/><sp/><sp/><sp/>arp_table[i].state<sp/>=<sp/>ETHARP_STATE_PENDING;</highlight></codeline>
<codeline lineno="962"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>record<sp/>network<sp/>interface<sp/>for<sp/>re-sending<sp/>arp<sp/>request<sp/>in<sp/>etharp_tmr<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="963"><highlight class="normal"><sp/><sp/><sp/><sp/>arp_table[i].netif<sp/>=<sp/><ref refid="structnetif" kindref="compound">netif</ref>;</highlight></codeline>
<codeline lineno="964"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="965"><highlight class="normal"></highlight></codeline>
<codeline lineno="966"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>{<sp/>i<sp/>is<sp/>either<sp/>a<sp/>STABLE<sp/>or<sp/>(new<sp/>or<sp/>existing)<sp/>PENDING<sp/>entry<sp/>}<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="967"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;arp_table[i].state<sp/>==<sp/>PENDING<sp/>or<sp/>STABLE&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="968"><highlight class="normal"><sp/><sp/>((arp_table[i].state<sp/>==<sp/>ETHARP_STATE_PENDING)<sp/>||</highlight></codeline>
<codeline lineno="969"><highlight class="normal"><sp/><sp/><sp/>(arp_table[i].state<sp/>&gt;=<sp/>ETHARP_STATE_STABLE)));</highlight></codeline>
<codeline lineno="970"><highlight class="normal"></highlight></codeline>
<codeline lineno="971"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>do<sp/>we<sp/>have<sp/>a<sp/>new<sp/>entry?<sp/>or<sp/>an<sp/>implicit<sp/>query<sp/>request?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="972"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(is_new_entry<sp/>||<sp/>(q<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>))<sp/>{</highlight></codeline>
<codeline lineno="973"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>try<sp/>to<sp/>resolve<sp/>it;<sp/>send<sp/>out<sp/>ARP<sp/>request<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="974"><highlight class="normal"><sp/><sp/><sp/><sp/>result<sp/>=<sp/>etharp_request(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>ipaddr);</highlight></codeline>
<codeline lineno="975"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(result<sp/>!=<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" kindref="member">ERR_OK</ref>)<sp/>{</highlight></codeline>
<codeline lineno="976"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>ARP<sp/>request<sp/>couldn&apos;t<sp/>be<sp/>sent<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="977"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>We<sp/>don&apos;t<sp/>re-send<sp/>arp<sp/>request<sp/>in<sp/>etharp_tmr,<sp/>but<sp/>we<sp/>still<sp/>queue<sp/>packets,</highlight></codeline>
<codeline lineno="978"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>since<sp/>this<sp/>failure<sp/>could<sp/>be<sp/>temporary,<sp/>and<sp/>the<sp/>next<sp/>packet<sp/>calling</highlight></codeline>
<codeline lineno="979"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>etharp_query<sp/>again<sp/>could<sp/>lead<sp/>to<sp/>sending<sp/>the<sp/>queued<sp/>packets.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="980"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="981"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(q<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="982"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>result;</highlight></codeline>
<codeline lineno="983"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="984"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="985"><highlight class="normal"></highlight></codeline>
<codeline lineno="986"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>packet<sp/>given?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="987"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;q<sp/>!=<sp/>NULL&quot;</highlight><highlight class="normal">,<sp/>q<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>);</highlight></codeline>
<codeline lineno="988"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>stable<sp/>entry?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="989"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(arp_table[i].state<sp/>&gt;=<sp/>ETHARP_STATE_STABLE)<sp/>{</highlight></codeline>
<codeline lineno="990"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>we<sp/>have<sp/>a<sp/>valid<sp/>IP-&gt;Ethernet<sp/>address<sp/>mapping<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="991"><highlight class="normal"><sp/><sp/><sp/><sp/>ETHARP_SET_HINT(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>i);</highlight></codeline>
<codeline lineno="992"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>send<sp/>the<sp/>packet<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="993"><highlight class="normal"><sp/><sp/><sp/><sp/>result<sp/>=<sp/>ethernet_output(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>q,<sp/>srcaddr,<sp/>&amp;(arp_table[i].ethaddr),<sp/><ref refid="group__ethernet_1gga4f8559808037803168499a3803900339ac95756b20fde70b868ef4185dd221c79" kindref="member">ETHTYPE_IP</ref>);</highlight></codeline>
<codeline lineno="994"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>pending<sp/>entry?<sp/>(either<sp/>just<sp/>created<sp/>or<sp/>already<sp/>pending<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="995"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(arp_table[i].state<sp/>==<sp/>ETHARP_STATE_PENDING)<sp/>{</highlight></codeline>
<codeline lineno="996"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>entry<sp/>is<sp/>still<sp/>pending,<sp/>queue<sp/>the<sp/>given<sp/>packet<sp/>&apos;q&apos;<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="997"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*p;</highlight></codeline>
<codeline lineno="998"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>copy_needed<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="999"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>IF<sp/>q<sp/>includes<sp/>a<sp/>PBUF_REF,<sp/>PBUF_POOL<sp/>or<sp/>PBUF_RAM,<sp/>we<sp/>have<sp/>no<sp/>choice<sp/>but</highlight></codeline>
<codeline lineno="1000"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>*<sp/>to<sp/>copy<sp/>the<sp/>whole<sp/>queue<sp/>into<sp/>a<sp/>new<sp/>PBUF_RAM<sp/>(see<sp/>bug<sp/>#11400)</highlight></codeline>
<codeline lineno="1001"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>*<sp/>PBUF_ROMs<sp/>can<sp/>be<sp/>left<sp/>as<sp/>they<sp/>are,<sp/>since<sp/>ROM<sp/>must<sp/>not<sp/>get<sp/>changed.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1002"><highlight class="normal"><sp/><sp/><sp/><sp/>p<sp/>=<sp/>q;</highlight></codeline>
<codeline lineno="1003"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(p)<sp/>{</highlight></codeline>
<codeline lineno="1004"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;no<sp/>packet<sp/>queues<sp/>allowed!&quot;</highlight><highlight class="normal">,<sp/>(p-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref><sp/>!=<sp/>p-&gt;<ref refid="structpbuf_1a5259e7ec29bab9c0999b64f2e86b411f" kindref="member">tot_len</ref>)<sp/>||<sp/>(p-&gt;<ref refid="structpbuf_1a5e5763c94fd18d78937b0b58ce7df341" kindref="member">next</ref><sp/>==<sp/>0));</highlight></codeline>
<codeline lineno="1005"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(p-&gt;<ref refid="structpbuf_1afd7bff5210a022424caa97d2f25fe8e6" kindref="member">type</ref><sp/>!=<sp/><ref refid="group__pbuf_1ggab7e0e32fcc292c0d7107721766ed92fbac120b0fe39efe35bb682e4aa3b82e2c9" kindref="member">PBUF_ROM</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1006"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>copy_needed<sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="1007"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="1008"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1009"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>p<sp/>=<sp/>p-&gt;<ref refid="structpbuf_1a5e5763c94fd18d78937b0b58ce7df341" kindref="member">next</ref>;</highlight></codeline>
<codeline lineno="1010"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1011"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(copy_needed)<sp/>{</highlight></codeline>
<codeline lineno="1012"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>copy<sp/>the<sp/>whole<sp/>packet<sp/>into<sp/>new<sp/>pbufs<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1013"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>p<sp/>=<sp/><ref refid="group__pbuf_1gacfcb0a2af918658ba0afe36499c65f47" kindref="member">pbuf_alloc</ref>(<ref refid="group__pbuf_1ggaee1baa59bb2f85ba575b5a8619ac1ebfab4de441e737330558b609a990cd17346" kindref="member">PBUF_LINK</ref>,<sp/>p-&gt;<ref refid="structpbuf_1a5259e7ec29bab9c0999b64f2e86b411f" kindref="member">tot_len</ref>,<sp/><ref refid="group__pbuf_1ggab7e0e32fcc292c0d7107721766ed92fbac5e9f28455bca98944a030d4b84ecfab" kindref="member">PBUF_RAM</ref>);</highlight></codeline>
<codeline lineno="1014"><highlight class="normal"><sp/><sp/><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="1015"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="group__pbuf_1gaba88511dee3df4b631fde691f421320d" kindref="member">pbuf_copy</ref>(p,<sp/>q)<sp/>!=<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" kindref="member">ERR_OK</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1016"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(p);</highlight></codeline>
<codeline lineno="1017"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>p<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="1018"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1019"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1020"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="1021"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>referencing<sp/>the<sp/>old<sp/>pbuf<sp/>is<sp/>enough<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1022"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>p<sp/>=<sp/>q;</highlight></codeline>
<codeline lineno="1023"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1ga77f6bbd69e45e542014d9c547c7da74e" kindref="member">pbuf_ref</ref>(p);</highlight></codeline>
<codeline lineno="1024"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1025"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>packet<sp/>could<sp/>be<sp/>taken<sp/>over?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1026"><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="1027"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>queue<sp/>packet<sp/>...<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1028"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>ARP_QUEUEING</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1029"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">etharp_q_entry<sp/>*new_entry;</highlight></codeline>
<codeline lineno="1030"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>allocate<sp/>a<sp/>new<sp/>arp<sp/>queue<sp/>entry<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1031"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>new_entry<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">etharp_q_entry<sp/>*)<ref refid="memp_8h_1a2b00593d086313c267b54a976bf67aa5" kindref="member">memp_malloc</ref>(MEMP_ARP_QUEUE);</highlight></codeline>
<codeline lineno="1032"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(new_entry<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/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">unsigned</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>qlen<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1034"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>new_entry-&gt;next<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1035"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>new_entry-&gt;p<sp/>=<sp/>p;</highlight></codeline>
<codeline lineno="1036"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(arp_table[i].q<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1037"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>queue<sp/>was<sp/>already<sp/>existent,<sp/>append<sp/>the<sp/>new<sp/>entry<sp/>to<sp/>the<sp/>end<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1038"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">etharp_q_entry<sp/>*r;</highlight></codeline>
<codeline lineno="1039"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>r<sp/>=<sp/>arp_table[i].q;</highlight></codeline>
<codeline lineno="1040"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>qlen++;</highlight></codeline>
<codeline lineno="1041"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(r-&gt;next<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1042"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>r<sp/>=<sp/>r-&gt;<ref refid="structpbuf_1a5e5763c94fd18d78937b0b58ce7df341" kindref="member">next</ref>;</highlight></codeline>
<codeline lineno="1043"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>qlen++;</highlight></codeline>
<codeline lineno="1044"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1045"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>r-&gt;<ref refid="structpbuf_1a5e5763c94fd18d78937b0b58ce7df341" kindref="member">next</ref><sp/>=<sp/>new_entry;</highlight></codeline>
<codeline lineno="1046"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="1047"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>queue<sp/>did<sp/>not<sp/>exist,<sp/>first<sp/>item<sp/>in<sp/>queue<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1048"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>arp_table[i].q<sp/>=<sp/>new_entry;</highlight></codeline>
<codeline lineno="1049"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1050"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>ARP_QUEUE_LEN</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1051"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(qlen<sp/>&gt;=<sp/><ref refid="lwipopts_8h_1a29f41a6ebdbb23f46688d381b3609fd1" kindref="member">ARP_QUEUE_LEN</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1052"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">etharp_q_entry<sp/>*old;</highlight></codeline>
<codeline lineno="1053"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>old<sp/>=<sp/>arp_table[i].q;</highlight></codeline>
<codeline lineno="1054"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>arp_table[i].q<sp/>=<sp/>arp_table[i].q-&gt;<ref refid="structpbuf_1a5e5763c94fd18d78937b0b58ce7df341" kindref="member">next</ref>;</highlight></codeline>
<codeline lineno="1055"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(old-&gt;p);</highlight></codeline>
<codeline lineno="1056"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="memp_8h_1aecd94926b7c2a0e23ae195f4ae97581f" kindref="member">memp_free</ref>(MEMP_ARP_QUEUE,<sp/>old);</highlight></codeline>
<codeline lineno="1057"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1058"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1059"><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_1abff5d1e0b334f5b45bd2b8bbb675411e" kindref="member">ETHARP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;etharp_query:<sp/>queued<sp/>packet<sp/>%p<sp/>on<sp/>ARP<sp/>entry<sp/>%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gac05a82d37afb251470f5e17ca15ab6e9" kindref="member">S16_F</ref></highlight><highlight class="stringliteral">&quot;\n&quot;</highlight><highlight class="normal">,<sp/>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*)q,<sp/>(<ref refid="group__compiler__abstraction_1gacf46f4df0ebab84edebcb69967fdf86b" kindref="member">s16_t</ref>)i));</highlight></codeline>
<codeline lineno="1060"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>result<sp/>=<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" kindref="member">ERR_OK</ref>;</highlight></codeline>
<codeline lineno="1061"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="1062"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>the<sp/>pool<sp/>MEMP_ARP_QUEUE<sp/>is<sp/>empty<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1063"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(p);</highlight></codeline>
<codeline lineno="1064"><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_1abff5d1e0b334f5b45bd2b8bbb675411e" kindref="member">ETHARP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;etharp_query:<sp/>could<sp/>not<sp/>queue<sp/>a<sp/>copy<sp/>of<sp/>PBUF_REF<sp/>packet<sp/>%p<sp/>(out<sp/>of<sp/>memory)\n&quot;</highlight><highlight class="normal">,<sp/>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*)q));</highlight></codeline>
<codeline lineno="1065"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>result<sp/>=<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaaaeafdbf3aecc46864daa3cd829c7e05" kindref="member">ERR_MEM</ref>;</highlight></codeline>
<codeline lineno="1066"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1067"><highlight class="normal"></highlight><highlight class="preprocessor">#else<sp/></highlight><highlight class="comment">/*<sp/>ARP_QUEUEING<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1068"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>always<sp/>queue<sp/>one<sp/>packet<sp/>per<sp/>ARP<sp/>request<sp/>only,<sp/>freeing<sp/>a<sp/>previously<sp/>queued<sp/>packet<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1069"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(arp_table[i].q<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1070"><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_1abff5d1e0b334f5b45bd2b8bbb675411e" kindref="member">ETHARP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;etharp_query:<sp/>dropped<sp/>previously<sp/>queued<sp/>packet<sp/>%p<sp/>for<sp/>ARP<sp/>entry<sp/>%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gac05a82d37afb251470f5e17ca15ab6e9" kindref="member">S16_F</ref></highlight><highlight class="stringliteral">&quot;\n&quot;</highlight><highlight class="normal">,<sp/>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*)q,<sp/>(<ref refid="group__compiler__abstraction_1gacf46f4df0ebab84edebcb69967fdf86b" kindref="member">s16_t</ref>)i));</highlight></codeline>
<codeline lineno="1071"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(arp_table[i].q);</highlight></codeline>
<codeline lineno="1072"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1073"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>arp_table[i].q<sp/>=<sp/>p;</highlight></codeline>
<codeline lineno="1074"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>result<sp/>=<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" kindref="member">ERR_OK</ref>;</highlight></codeline>
<codeline lineno="1075"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1abff5d1e0b334f5b45bd2b8bbb675411e" kindref="member">ETHARP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;etharp_query:<sp/>queued<sp/>packet<sp/>%p<sp/>on<sp/>ARP<sp/>entry<sp/>%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gac05a82d37afb251470f5e17ca15ab6e9" kindref="member">S16_F</ref></highlight><highlight class="stringliteral">&quot;\n&quot;</highlight><highlight class="normal">,<sp/>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*)q,<sp/>(<ref refid="group__compiler__abstraction_1gacf46f4df0ebab84edebcb69967fdf86b" kindref="member">s16_t</ref>)i));</highlight></codeline>
<codeline lineno="1076"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>ARP_QUEUEING<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1077"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="1078"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1aea3a36c64f7159af04b7acc985402edc" kindref="member">ETHARP_STATS_INC</ref>(etharp.memerr);</highlight></codeline>
<codeline lineno="1079"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1abff5d1e0b334f5b45bd2b8bbb675411e" kindref="member">ETHARP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;etharp_query:<sp/>could<sp/>not<sp/>queue<sp/>a<sp/>copy<sp/>of<sp/>PBUF_REF<sp/>packet<sp/>%p<sp/>(out<sp/>of<sp/>memory)\n&quot;</highlight><highlight class="normal">,<sp/>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*)q));</highlight></codeline>
<codeline lineno="1080"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>result<sp/>=<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaaaeafdbf3aecc46864daa3cd829c7e05" kindref="member">ERR_MEM</ref>;</highlight></codeline>
<codeline lineno="1081"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1082"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1083"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>result;</highlight></codeline>
<codeline lineno="1084"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1085"><highlight class="normal"></highlight></codeline>
<codeline lineno="1101"><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="1102"><highlight class="normal">etharp_raw(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structeth__addr" kindref="compound">eth_addr</ref><sp/>*ethsrc_addr,</highlight></codeline>
<codeline lineno="1103"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structeth__addr" kindref="compound">eth_addr</ref><sp/>*ethdst_addr,</highlight></codeline>
<codeline lineno="1104"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structeth__addr" kindref="compound">eth_addr</ref><sp/>*hwsrc_addr,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>ip4_addr_t<sp/>*ipsrc_addr,</highlight></codeline>
<codeline lineno="1105"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structeth__addr" kindref="compound">eth_addr</ref><sp/>*hwdst_addr,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>ip4_addr_t<sp/>*ipdst_addr,</highlight></codeline>
<codeline lineno="1106"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>opcode)</highlight></codeline>
<codeline lineno="1107"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1108"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*p;</highlight></codeline>
<codeline lineno="1109"><highlight class="normal"><sp/><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref><sp/>result<sp/>=<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" kindref="member">ERR_OK</ref>;</highlight></codeline>
<codeline lineno="1110"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structetharp__hdr" kindref="compound">etharp_hdr</ref><sp/>*hdr;</highlight></codeline>
<codeline lineno="1111"><highlight class="normal"></highlight></codeline>
<codeline lineno="1112"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;netif<sp/>!=<sp/>NULL&quot;</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="1113"><highlight class="normal"></highlight></codeline>
<codeline lineno="1114"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>allocate<sp/>a<sp/>pbuf<sp/>for<sp/>the<sp/>outgoing<sp/>ARP<sp/>request<sp/>packet<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1115"><highlight class="normal"><sp/><sp/>p<sp/>=<sp/><ref refid="group__pbuf_1gacfcb0a2af918658ba0afe36499c65f47" kindref="member">pbuf_alloc</ref>(<ref refid="group__pbuf_1ggaee1baa59bb2f85ba575b5a8619ac1ebfab4de441e737330558b609a990cd17346" kindref="member">PBUF_LINK</ref>,<sp/><ref refid="prot_2etharp_8h_1a58f300020d1e3a91cad207410a2a82ab" kindref="member">SIZEOF_ETHARP_HDR</ref>,<sp/><ref refid="group__pbuf_1ggab7e0e32fcc292c0d7107721766ed92fbac5e9f28455bca98944a030d4b84ecfab" kindref="member">PBUF_RAM</ref>);</highlight></codeline>
<codeline lineno="1116"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>could<sp/>allocate<sp/>a<sp/>pbuf<sp/>for<sp/>an<sp/>ARP<sp/>request?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1117"><highlight class="normal"><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="1118"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1abff5d1e0b334f5b45bd2b8bbb675411e" kindref="member">ETHARP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga0269bdc51f1e8a5ecf9af72c6e1c996c" kindref="member">LWIP_DBG_LEVEL_SERIOUS</ref>,</highlight></codeline>
<codeline lineno="1119"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>(</highlight><highlight class="stringliteral">&quot;etharp_raw:<sp/>could<sp/>not<sp/>allocate<sp/>pbuf<sp/>for<sp/>ARP<sp/>request.\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="1120"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="stats_8h_1aea3a36c64f7159af04b7acc985402edc" kindref="member">ETHARP_STATS_INC</ref>(etharp.memerr);</highlight></codeline>
<codeline lineno="1121"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaaaeafdbf3aecc46864daa3cd829c7e05" kindref="member">ERR_MEM</ref>;</highlight></codeline>
<codeline lineno="1122"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1123"><highlight class="normal"><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/>etharp_hdr&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="1124"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(p-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref><sp/>&gt;=<sp/><ref refid="prot_2etharp_8h_1a58f300020d1e3a91cad207410a2a82ab" kindref="member">SIZEOF_ETHARP_HDR</ref>));</highlight></codeline>
<codeline lineno="1125"><highlight class="normal"></highlight></codeline>
<codeline lineno="1126"><highlight class="normal"><sp/><sp/>hdr<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structetharp__hdr" kindref="compound">etharp_hdr</ref><sp/>*)p-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref>;</highlight></codeline>
<codeline lineno="1127"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1abff5d1e0b334f5b45bd2b8bbb675411e" kindref="member">ETHARP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;etharp_raw:<sp/>sending<sp/>raw<sp/>ARP<sp/>packet.\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="1128"><highlight class="normal"><sp/><sp/>hdr-&gt;opcode<sp/>=<sp/><ref refid="def_8c_1ad637280639de4066392e6b5614fa3e56" kindref="member">lwip_htons</ref>(opcode);</highlight></codeline>
<codeline lineno="1129"><highlight class="normal"></highlight></codeline>
<codeline lineno="1130"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;netif-&gt;hwaddr_len<sp/>must<sp/>be<sp/>the<sp/>same<sp/>as<sp/>ETH_HWADDR_LEN<sp/>for<sp/>etharp!&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="1131"><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_1afe1181561cb16241f3cb5ed01e567d42" kindref="member">hwaddr_len</ref><sp/>==<sp/><ref refid="prot_2ethernet_8h_1ac9426049770b40fcd9556ffbd7e56907" kindref="member">ETH_HWADDR_LEN</ref>));</highlight></codeline>
<codeline lineno="1132"><highlight class="normal"></highlight></codeline>
<codeline lineno="1133"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Write<sp/>the<sp/>ARP<sp/>MAC-Addresses<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1134"><highlight class="normal"><sp/><sp/><ref refid="prot_2ethernet_8h_1a10cbd9cd91e7e0ebed3a1159e385c037" kindref="member">ETHADDR16_COPY</ref>(&amp;hdr-&gt;shwaddr,<sp/>hwsrc_addr);</highlight></codeline>
<codeline lineno="1135"><highlight class="normal"><sp/><sp/><ref refid="prot_2ethernet_8h_1a10cbd9cd91e7e0ebed3a1159e385c037" kindref="member">ETHADDR16_COPY</ref>(&amp;hdr-&gt;dhwaddr,<sp/>hwdst_addr);</highlight></codeline>
<codeline lineno="1136"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Copy<sp/>struct<sp/>ip4_addr2<sp/>to<sp/>aligned<sp/>ip4_addr,<sp/>to<sp/>support<sp/>compilers<sp/>without</highlight></codeline>
<codeline lineno="1137"><highlight class="comment"><sp/><sp/><sp/>*<sp/>structure<sp/>packing.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1138"><highlight class="normal"><sp/><sp/>IPADDR2_COPY(&amp;hdr-&gt;sipaddr,<sp/>ipsrc_addr);</highlight></codeline>
<codeline lineno="1139"><highlight class="normal"><sp/><sp/>IPADDR2_COPY(&amp;hdr-&gt;dipaddr,<sp/>ipdst_addr);</highlight></codeline>
<codeline lineno="1140"><highlight class="normal"></highlight></codeline>
<codeline lineno="1141"><highlight class="normal"><sp/><sp/>hdr-&gt;hwtype<sp/>=<sp/><ref refid="def_8h_1a0dfd02d7c09f9c698a5a7ecc0b7287ad" kindref="member">PP_HTONS</ref>(<ref refid="prot_2etharp_8h_1a2bfef84e6dba235e7019834a4b493a66a6e4adc4f5f733878a0173c6fb98a5f93" kindref="member">HWTYPE_ETHERNET</ref>);</highlight></codeline>
<codeline lineno="1142"><highlight class="normal"><sp/><sp/>hdr-&gt;proto<sp/>=<sp/><ref refid="def_8h_1a0dfd02d7c09f9c698a5a7ecc0b7287ad" kindref="member">PP_HTONS</ref>(<ref refid="group__ethernet_1gga4f8559808037803168499a3803900339ac95756b20fde70b868ef4185dd221c79" kindref="member">ETHTYPE_IP</ref>);</highlight></codeline>
<codeline lineno="1143"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>set<sp/>hwlen<sp/>and<sp/>protolen<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1144"><highlight class="normal"><sp/><sp/>hdr-&gt;hwlen<sp/>=<sp/><ref refid="prot_2ethernet_8h_1ac9426049770b40fcd9556ffbd7e56907" kindref="member">ETH_HWADDR_LEN</ref>;</highlight></codeline>
<codeline lineno="1145"><highlight class="normal"><sp/><sp/>hdr-&gt;protolen<sp/>=<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(ip4_addr_t);</highlight></codeline>
<codeline lineno="1146"><highlight class="normal"></highlight></codeline>
<codeline lineno="1147"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>send<sp/>ARP<sp/>query<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1148"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_AUTOIP</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1149"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>If<sp/>we<sp/>are<sp/>using<sp/>Link-Local,<sp/>all<sp/>ARP<sp/>packets<sp/>that<sp/>contain<sp/>a<sp/>Link-Local</highlight></codeline>
<codeline lineno="1150"><highlight class="comment"><sp/><sp/><sp/>*<sp/>&apos;sender<sp/>IP<sp/>address&apos;<sp/>MUST<sp/>be<sp/>sent<sp/>using<sp/>link-layer<sp/>broadcast<sp/>instead<sp/>of</highlight></codeline>
<codeline lineno="1151"><highlight class="comment"><sp/><sp/><sp/>*<sp/>link-layer<sp/>unicast.<sp/>(See<sp/>RFC3927<sp/>Section<sp/>2.5,<sp/>last<sp/>paragraph)<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1152"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(ip4_addr_islinklocal(ipsrc_addr))<sp/>{</highlight></codeline>
<codeline lineno="1153"><highlight class="normal"><sp/><sp/><sp/><sp/>ethernet_output(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>p,<sp/>ethsrc_addr,<sp/>&amp;ethbroadcast,<sp/><ref refid="group__ethernet_1gga4f8559808037803168499a3803900339a41217db03576ea59c44b28b248c39be5" kindref="member">ETHTYPE_ARP</ref>);</highlight></codeline>
<codeline lineno="1154"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1155"><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="1156"><highlight class="normal"><sp/><sp/>{</highlight></codeline>
<codeline lineno="1157"><highlight class="normal"><sp/><sp/><sp/><sp/>ethernet_output(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>p,<sp/>ethsrc_addr,<sp/>ethdst_addr,<sp/><ref refid="group__ethernet_1gga4f8559808037803168499a3803900339a41217db03576ea59c44b28b248c39be5" kindref="member">ETHTYPE_ARP</ref>);</highlight></codeline>
<codeline lineno="1158"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1159"><highlight class="normal"></highlight></codeline>
<codeline lineno="1160"><highlight class="normal"><sp/><sp/><ref refid="stats_8h_1aea3a36c64f7159af04b7acc985402edc" kindref="member">ETHARP_STATS_INC</ref>(etharp.xmit);</highlight></codeline>
<codeline lineno="1161"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>free<sp/>ARP<sp/>query<sp/>packet<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1162"><highlight class="normal"><sp/><sp/><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(p);</highlight></codeline>
<codeline lineno="1163"><highlight class="normal"><sp/><sp/>p<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="1164"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>could<sp/>not<sp/>allocate<sp/>pbuf<sp/>for<sp/>ARP<sp/>request<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1165"><highlight class="normal"></highlight></codeline>
<codeline lineno="1166"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>result;</highlight></codeline>
<codeline lineno="1167"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1168"><highlight class="normal"></highlight></codeline>
<codeline lineno="1181"><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="1182"><highlight class="normal">etharp_request_dst(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>ip4_addr_t<sp/>*ipaddr,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structeth__addr" kindref="compound">eth_addr</ref>*<sp/>hw_dst_addr)</highlight></codeline>
<codeline lineno="1183"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1184"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>etharp_raw(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structeth__addr" kindref="compound">eth_addr</ref><sp/>*)<ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1aee967965d999fc1a4c40a66709304e69" kindref="member">hwaddr</ref>,<sp/>hw_dst_addr,</highlight></codeline>
<codeline lineno="1185"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structeth__addr" kindref="compound">eth_addr</ref><sp/>*)<ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1aee967965d999fc1a4c40a66709304e69" kindref="member">hwaddr</ref>,<sp/>netif_ip4_addr(<ref refid="structnetif" kindref="compound">netif</ref>),<sp/>&amp;ethzero,</highlight></codeline>
<codeline lineno="1186"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ipaddr,<sp/><ref refid="prot_2etharp_8h_1af8a1068cba34f11d56afb73cdd879cabafb58ccf8b7b11505ff2117a10bf6ff61" kindref="member">ARP_REQUEST</ref>);</highlight></codeline>
<codeline lineno="1187"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1188"><highlight class="normal"></highlight></codeline>
<codeline lineno="1198"><highlight class="normal"><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="1199"><highlight class="normal">etharp_request(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>ip4_addr_t<sp/>*ipaddr)</highlight></codeline>
<codeline lineno="1200"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1201"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1abff5d1e0b334f5b45bd2b8bbb675411e" kindref="member">ETHARP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;etharp_request:<sp/>sending<sp/>ARP<sp/>request.\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="1202"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>etharp_request_dst(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>ipaddr,<sp/>&amp;ethbroadcast);</highlight></codeline>
<codeline lineno="1203"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1204"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_IPV4<sp/>&amp;&amp;<sp/>LWIP_ARP<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1205"><highlight class="normal"></highlight></codeline>
<codeline lineno="1206"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_ARP<sp/>||<sp/>LWIP_ETHERNET<sp/>*/</highlight><highlight class="preprocessor"></highlight></codeline>
    </programlisting>
    <location file="C:/Dev/git/UbixOS/sys/net/core/ipv4/etharp.c"/>
  </compounddef>
</doxygen>
