<?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="nd6_8c" kind="file" language="C++">
    <compoundname>nd6.c</compoundname>
    <includes refid="opt_8h" local="yes">net/opt.h</includes>
    <incdepgraph>
      <node id="17">
        <label>stdarg.h</label>
        <link refid="stdarg_8h"/>
      </node>
      <node id="18">
        <label>ubixos/kpanic.h</label>
        <link refid="kpanic_8h"/>
      </node>
      <node id="15">
        <label>sys/io.h</label>
        <link refid="io_8h"/>
      </node>
      <node id="8">
        <label>sys/select.h</label>
        <link refid="select_8h"/>
        <childnode refid="9" relation="include">
        </childnode>
        <childnode refid="7" relation="include">
        </childnode>
        <childnode refid="10" relation="include">
        </childnode>
        <childnode refid="11" relation="include">
        </childnode>
        <childnode refid="12" relation="include">
        </childnode>
      </node>
      <node id="13">
        <label>net/arch/cc.h</label>
        <link refid="cc_8h"/>
        <childnode refid="14" relation="include">
        </childnode>
      </node>
      <node id="12">
        <label>sys/_sigset.h</label>
        <link refid="__sigset_8h"/>
        <childnode refid="7" relation="include">
        </childnode>
      </node>
      <node id="3">
        <label>net/lwipopts.h</label>
        <link refid="lwipopts_8h"/>
      </node>
      <node id="6">
        <label>sys/types.h</label>
        <link refid="include_2sys_2types_8h"/>
        <childnode refid="7" relation="include">
        </childnode>
        <childnode refid="8" relation="include">
        </childnode>
      </node>
      <node id="5">
        <label>net/arch.h</label>
        <link refid="arch_8h"/>
        <childnode refid="6" relation="include">
        </childnode>
        <childnode refid="13" relation="include">
        </childnode>
        <childnode refid="16" relation="include">
        </childnode>
        <childnode refid="18" relation="include">
        </childnode>
      </node>
      <node id="2">
        <label>net/opt.h</label>
        <link refid="opt_8h"/>
        <childnode refid="3" relation="include">
        </childnode>
        <childnode refid="4" relation="include">
        </childnode>
      </node>
      <node id="16">
        <label>lib/kprintf.h</label>
        <link refid="kprintf_8h"/>
        <childnode refid="6" relation="include">
        </childnode>
        <childnode refid="17" relation="include">
        </childnode>
      </node>
      <node id="4">
        <label>net/debug.h</label>
        <link refid="debug_8h"/>
        <childnode refid="5" relation="include">
        </childnode>
        <childnode refid="2" relation="include">
        </childnode>
      </node>
      <node id="9">
        <label>sys/cdefs.h</label>
        <link refid="cdefs_8h"/>
      </node>
      <node id="14">
        <label>ubixos/time.h</label>
        <link refid="time_8h"/>
        <childnode refid="6" relation="include">
        </childnode>
        <childnode refid="10" relation="include">
        </childnode>
        <childnode refid="15" relation="include">
        </childnode>
      </node>
      <node id="7">
        <label>sys/_types.h</label>
        <link refid="__types_8h"/>
      </node>
      <node id="10">
        <label>sys/_timespec.h</label>
        <link refid="__timespec_8h"/>
        <childnode refid="7" relation="include">
        </childnode>
      </node>
      <node id="1">
        <label>C:/Dev/git/UbixOS/sys/net/core/ipv6/nd6.c</label>
        <link refid="nd6_8c"/>
        <childnode refid="2" relation="include">
        </childnode>
      </node>
      <node id="11">
        <label>sys/_timeval.h</label>
        <link refid="__timeval_8h"/>
        <childnode refid="7" relation="include">
        </childnode>
      </node>
    </incdepgraph>
    <briefdescription>
    </briefdescription>
    <detaileddescription>
<para>Neighbor discovery and stateless address autoconfiguration for IPv6. Aims to be compliant with RFC 4861 (Neighbor discovery) and RFC 4862 (Address autoconfiguration). </para>
    </detaileddescription>
    <programlisting>
<codeline lineno="1"></codeline>
<codeline lineno="9"><highlight class="comment">/*</highlight></codeline>
<codeline lineno="10"><highlight class="comment"><sp/>*<sp/>Copyright<sp/>(c)<sp/>2010<sp/>Inico<sp/>Technologies<sp/>Ltd.</highlight></codeline>
<codeline lineno="11"><highlight class="comment"><sp/>*<sp/>All<sp/>rights<sp/>reserved.</highlight></codeline>
<codeline lineno="12"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="13"><highlight class="comment"><sp/>*<sp/>Redistribution<sp/>and<sp/>use<sp/>in<sp/>source<sp/>and<sp/>binary<sp/>forms,<sp/>with<sp/>or<sp/>without<sp/>modification,</highlight></codeline>
<codeline lineno="14"><highlight class="comment"><sp/>*<sp/>are<sp/>permitted<sp/>provided<sp/>that<sp/>the<sp/>following<sp/>conditions<sp/>are<sp/>met:</highlight></codeline>
<codeline lineno="15"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="16"><highlight class="comment"><sp/>*<sp/>1.<sp/>Redistributions<sp/>of<sp/>source<sp/>code<sp/>must<sp/>retain<sp/>the<sp/>above<sp/>copyright<sp/>notice,</highlight></codeline>
<codeline lineno="17"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/>this<sp/>list<sp/>of<sp/>conditions<sp/>and<sp/>the<sp/>following<sp/>disclaimer.</highlight></codeline>
<codeline lineno="18"><highlight class="comment"><sp/>*<sp/>2.<sp/>Redistributions<sp/>in<sp/>binary<sp/>form<sp/>must<sp/>reproduce<sp/>the<sp/>above<sp/>copyright<sp/>notice,</highlight></codeline>
<codeline lineno="19"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/>this<sp/>list<sp/>of<sp/>conditions<sp/>and<sp/>the<sp/>following<sp/>disclaimer<sp/>in<sp/>the<sp/>documentation</highlight></codeline>
<codeline lineno="20"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/>and/or<sp/>other<sp/>materials<sp/>provided<sp/>with<sp/>the<sp/>distribution.</highlight></codeline>
<codeline lineno="21"><highlight class="comment"><sp/>*<sp/>3.<sp/>The<sp/>name<sp/>of<sp/>the<sp/>author<sp/>may<sp/>not<sp/>be<sp/>used<sp/>to<sp/>endorse<sp/>or<sp/>promote<sp/>products</highlight></codeline>
<codeline lineno="22"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/>derived<sp/>from<sp/>this<sp/>software<sp/>without<sp/>specific<sp/>prior<sp/>written<sp/>permission.</highlight></codeline>
<codeline lineno="23"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="24"><highlight class="comment"><sp/>*<sp/>THIS<sp/>SOFTWARE<sp/>IS<sp/>PROVIDED<sp/>BY<sp/>THE<sp/>AUTHOR<sp/>``AS<sp/>IS&apos;&apos;<sp/>AND<sp/>ANY<sp/>EXPRESS<sp/>OR<sp/>IMPLIED</highlight></codeline>
<codeline lineno="25"><highlight class="comment"><sp/>*<sp/>WARRANTIES,<sp/>INCLUDING,<sp/>BUT<sp/>NOT<sp/>LIMITED<sp/>TO,<sp/>THE<sp/>IMPLIED<sp/>WARRANTIES<sp/>OF</highlight></codeline>
<codeline lineno="26"><highlight class="comment"><sp/>*<sp/>MERCHANTABILITY<sp/>AND<sp/>FITNESS<sp/>FOR<sp/>A<sp/>PARTICULAR<sp/>PURPOSE<sp/>ARE<sp/>DISCLAIMED.<sp/>IN<sp/>NO<sp/>EVENT</highlight></codeline>
<codeline lineno="27"><highlight class="comment"><sp/>*<sp/>SHALL<sp/>THE<sp/>AUTHOR<sp/>BE<sp/>LIABLE<sp/>FOR<sp/>ANY<sp/>DIRECT,<sp/>INDIRECT,<sp/>INCIDENTAL,<sp/>SPECIAL,</highlight></codeline>
<codeline lineno="28"><highlight class="comment"><sp/>*<sp/>EXEMPLARY,<sp/>OR<sp/>CONSEQUENTIAL<sp/>DAMAGES<sp/>(INCLUDING,<sp/>BUT<sp/>NOT<sp/>LIMITED<sp/>TO,<sp/>PROCUREMENT</highlight></codeline>
<codeline lineno="29"><highlight class="comment"><sp/>*<sp/>OF<sp/>SUBSTITUTE<sp/>GOODS<sp/>OR<sp/>SERVICES;<sp/>LOSS<sp/>OF<sp/>USE,<sp/>DATA,<sp/>OR<sp/>PROFITS;<sp/>OR<sp/>BUSINESS</highlight></codeline>
<codeline lineno="30"><highlight class="comment"><sp/>*<sp/>INTERRUPTION)<sp/>HOWEVER<sp/>CAUSED<sp/>AND<sp/>ON<sp/>ANY<sp/>THEORY<sp/>OF<sp/>LIABILITY,<sp/>WHETHER<sp/>IN</highlight></codeline>
<codeline lineno="31"><highlight class="comment"><sp/>*<sp/>CONTRACT,<sp/>STRICT<sp/>LIABILITY,<sp/>OR<sp/>TORT<sp/>(INCLUDING<sp/>NEGLIGENCE<sp/>OR<sp/>OTHERWISE)<sp/>ARISING</highlight></codeline>
<codeline lineno="32"><highlight class="comment"><sp/>*<sp/>IN<sp/>ANY<sp/>WAY<sp/>OUT<sp/>OF<sp/>THE<sp/>USE<sp/>OF<sp/>THIS<sp/>SOFTWARE,<sp/>EVEN<sp/>IF<sp/>ADVISED<sp/>OF<sp/>THE<sp/>POSSIBILITY</highlight></codeline>
<codeline lineno="33"><highlight class="comment"><sp/>*<sp/>OF<sp/>SUCH<sp/>DAMAGE.</highlight></codeline>
<codeline lineno="34"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="35"><highlight class="comment"><sp/>*<sp/>This<sp/>file<sp/>is<sp/>part<sp/>of<sp/>the<sp/>lwIP<sp/>TCP/IP<sp/>stack.</highlight></codeline>
<codeline lineno="36"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="37"><highlight class="comment"><sp/>*<sp/>Author:<sp/>Ivan<sp/>Delamer<sp/>&lt;delamer@inicotech.com&gt;</highlight></codeline>
<codeline lineno="38"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="39"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="40"><highlight class="comment"><sp/>*<sp/>Please<sp/>coordinate<sp/>changes<sp/>and<sp/>requests<sp/>with<sp/>Ivan<sp/>Delamer</highlight></codeline>
<codeline lineno="41"><highlight class="comment"><sp/>*<sp/>&lt;delamer@inicotech.com&gt;</highlight></codeline>
<codeline lineno="42"><highlight class="comment"><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="43"><highlight class="normal"></highlight></codeline>
<codeline lineno="44"><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="45"><highlight class="normal"></highlight></codeline>
<codeline lineno="46"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_IPV6<sp/><sp/></highlight><highlight class="comment">/*<sp/>don&apos;t<sp/>build<sp/>if<sp/>not<sp/>configured<sp/>for<sp/>use<sp/>in<sp/>lwipopts.h<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="47"><highlight class="normal"></highlight></codeline>
<codeline lineno="48"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="nd6_8h" kindref="compound">net/nd6.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="49"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="nd6__priv_8h" kindref="compound">net/priv/nd6_priv.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="50"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="prot_2nd6_8h" kindref="compound">net/prot/nd6.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="51"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="prot_2icmp6_8h" kindref="compound">net/prot/icmp6.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="52"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="pbuf_8h" kindref="compound">net/pbuf.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="53"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="mem_8h" kindref="compound">net/mem.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="54"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="memp_8h" kindref="compound">net/memp.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="55"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="ip6_8h" kindref="compound">net/ip6.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="56"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="ip6__addr_8h" kindref="compound">net/ip6_addr.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="57"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="inet__chksum_8h" kindref="compound">net/inet_chksum.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="58"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="netif_8h" kindref="compound">net/netif.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="59"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="icmp6_8h" kindref="compound">net/icmp6.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="60"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="mld6_8h" kindref="compound">net/mld6.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="61"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="ip_8h" kindref="compound">net/ip.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="62"><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="63"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="dns_8h" kindref="compound">net/dns.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="64"><highlight class="normal"></highlight></codeline>
<codeline lineno="65"><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="66"><highlight class="normal"></highlight></codeline>
<codeline lineno="67"><highlight class="normal"></highlight><highlight class="preprocessor">#ifdef<sp/>LWIP_HOOK_FILENAME</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="68"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>LWIP_HOOK_FILENAME</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="69"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="70"><highlight class="normal"></highlight></codeline>
<codeline lineno="71"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_IPV6_DUP_DETECT_ATTEMPTS<sp/>&gt;<sp/>IP6_ADDR_TENTATIVE_COUNT_MASK</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="72"><highlight class="normal"></highlight><highlight class="preprocessor">#error<sp/>LWIP_IPV6_DUP_DETECT_ATTEMPTS<sp/>&gt;<sp/>IP6_ADDR_TENTATIVE_COUNT_MASK</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="73"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="74"><highlight class="normal"></highlight></codeline>
<codeline lineno="75"><highlight class="normal"></highlight><highlight class="comment">/*<sp/>Router<sp/>tables.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="76"><highlight class="normal"></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">nd6_neighbor_cache_entry<sp/>neighbor_cache[<ref refid="lwipopts_8h_1ab2fe15bdb4e0a41f295eb5577b11ad16" kindref="member">LWIP_ND6_NUM_NEIGHBORS</ref>];</highlight></codeline>
<codeline lineno="77"><highlight class="normal"></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">nd6_destination_cache_entry<sp/>destination_cache[<ref refid="lwipopts_8h_1acad118b1ae886e80137a1d4f0fb19672" kindref="member">LWIP_ND6_NUM_DESTINATIONS</ref>];</highlight></codeline>
<codeline lineno="78"><highlight class="normal"></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">nd6_prefix_list_entry<sp/>prefix_list[<ref refid="lwipopts_8h_1ad9cc576b5951f1b5e1c2b0d0bb831d9a" kindref="member">LWIP_ND6_NUM_PREFIXES</ref>];</highlight></codeline>
<codeline lineno="79"><highlight class="normal"></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">nd6_router_list_entry<sp/>default_router_list[<ref refid="lwipopts_8h_1a75e81a96148f266c8fad8c0bcab2f36a" kindref="member">LWIP_ND6_NUM_ROUTERS</ref>];</highlight></codeline>
<codeline lineno="80"><highlight class="normal"></highlight></codeline>
<codeline lineno="81"><highlight class="normal"></highlight><highlight class="comment">/*<sp/>Default<sp/>values,<sp/>can<sp/>be<sp/>updated<sp/>by<sp/>a<sp/>RA<sp/>message.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="82"><highlight class="normal"><ref refid="group__compiler__abstraction_1ga4c14294869aceba3ef9d4c0c302d0f33" kindref="member">u32_t</ref><sp/>reachable_time<sp/>=<sp/><ref refid="lwipopts_8h_1a269db9d61cdfc2fd3bc7b12c56261c74" kindref="member">LWIP_ND6_REACHABLE_TIME</ref>;</highlight></codeline>
<codeline lineno="83"><highlight class="normal"><ref refid="group__compiler__abstraction_1ga4c14294869aceba3ef9d4c0c302d0f33" kindref="member">u32_t</ref><sp/>retrans_timer<sp/>=<sp/><ref refid="lwipopts_8h_1a461abcbeef1d236d1f3201827dd28ad9" kindref="member">LWIP_ND6_RETRANS_TIMER</ref>;<sp/></highlight><highlight class="comment">/*<sp/>@todo<sp/>implement<sp/>this<sp/>value<sp/>in<sp/>timer<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="84"><highlight class="normal"></highlight></codeline>
<codeline lineno="85"><highlight class="normal"></highlight><highlight class="comment">/*<sp/>Index<sp/>for<sp/>cache<sp/>entries.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="86"><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/>nd6_cached_neighbor_index;</highlight></codeline>
<codeline lineno="87"><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/>nd6_cached_destination_index;</highlight></codeline>
<codeline lineno="88"><highlight class="normal"></highlight></codeline>
<codeline lineno="89"><highlight class="normal"></highlight><highlight class="comment">/*<sp/>Multicast<sp/>address<sp/>holder.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="90"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/>ip6_addr_t<sp/>multicast_address;</highlight></codeline>
<codeline lineno="91"><highlight class="normal"></highlight></codeline>
<codeline lineno="92"><highlight class="normal"></highlight><highlight class="comment">/*<sp/>Static<sp/>buffer<sp/>to<sp/>parse<sp/>RA<sp/>packet<sp/>options<sp/>(size<sp/>of<sp/>a<sp/>prefix<sp/>option,<sp/>biggest<sp/>option)<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="93"><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/>nd6_ra_buffer[</highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structprefix__option" kindref="compound">prefix_option</ref>)];</highlight></codeline>
<codeline lineno="94"><highlight class="normal"></highlight></codeline>
<codeline lineno="95"><highlight class="normal"></highlight><highlight class="comment">/*<sp/>Forward<sp/>declarations.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="96"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__compiler__abstraction_1ga9cd1d7891fe315de1201e2c6e45f4f57" kindref="member">s8_t</ref><sp/>nd6_find_neighbor_cache_entry(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>ip6_addr_t<sp/>*ip6addr);</highlight></codeline>
<codeline lineno="97"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__compiler__abstraction_1ga9cd1d7891fe315de1201e2c6e45f4f57" kindref="member">s8_t</ref><sp/>nd6_new_neighbor_cache_entry(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="98"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>nd6_free_neighbor_cache_entry(<ref refid="group__compiler__abstraction_1ga9cd1d7891fe315de1201e2c6e45f4f57" kindref="member">s8_t</ref><sp/>i);</highlight></codeline>
<codeline lineno="99"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__compiler__abstraction_1ga9cd1d7891fe315de1201e2c6e45f4f57" kindref="member">s8_t</ref><sp/>nd6_find_destination_cache_entry(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>ip6_addr_t<sp/>*ip6addr);</highlight></codeline>
<codeline lineno="100"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__compiler__abstraction_1ga9cd1d7891fe315de1201e2c6e45f4f57" kindref="member">s8_t</ref><sp/>nd6_new_destination_cache_entry(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="101"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__compiler__abstraction_1ga9cd1d7891fe315de1201e2c6e45f4f57" kindref="member">s8_t</ref><sp/>nd6_is_prefix_in_netif(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>ip6_addr_t<sp/>*ip6addr,<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="102"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__compiler__abstraction_1ga9cd1d7891fe315de1201e2c6e45f4f57" kindref="member">s8_t</ref><sp/>nd6_select_router(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>ip6_addr_t<sp/>*ip6addr,<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="103"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__compiler__abstraction_1ga9cd1d7891fe315de1201e2c6e45f4f57" kindref="member">s8_t</ref><sp/>nd6_get_router(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>ip6_addr_t<sp/>*router_addr,<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="104"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__compiler__abstraction_1ga9cd1d7891fe315de1201e2c6e45f4f57" kindref="member">s8_t</ref><sp/>nd6_new_router(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>ip6_addr_t<sp/>*router_addr,<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="105"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__compiler__abstraction_1ga9cd1d7891fe315de1201e2c6e45f4f57" kindref="member">s8_t</ref><sp/>nd6_get_onlink_prefix(ip6_addr_t<sp/>*prefix,<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="106"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__compiler__abstraction_1ga9cd1d7891fe315de1201e2c6e45f4f57" kindref="member">s8_t</ref><sp/>nd6_new_onlink_prefix(ip6_addr_t<sp/>*prefix,<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="107"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__compiler__abstraction_1ga9cd1d7891fe315de1201e2c6e45f4f57" kindref="member">s8_t</ref><sp/>nd6_get_next_hop_entry(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>ip6_addr_t<sp/>*ip6addr,<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="108"><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/>nd6_queue_packet(<ref refid="group__compiler__abstraction_1ga9cd1d7891fe315de1201e2c6e45f4f57" kindref="member">s8_t</ref><sp/>neighbor_index,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*q);</highlight></codeline>
<codeline lineno="109"><highlight class="normal"></highlight></codeline>
<codeline lineno="110"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>ND6_SEND_FLAG_MULTICAST_DEST<sp/>0x01</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="111"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>ND6_SEND_FLAG_ALLNODES_DEST<sp/>0x02</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="112"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>nd6_send_ns(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>ip6_addr_t<sp/>*target_addr,<sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>flags);</highlight></codeline>
<codeline lineno="113"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>nd6_send_na(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>ip6_addr_t<sp/>*target_addr,<sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>flags);</highlight></codeline>
<codeline lineno="114"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>nd6_send_neighbor_cache_probe(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>nd6_neighbor_cache_entry<sp/>*entry,<sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>flags);</highlight></codeline>
<codeline lineno="115"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_IPV6_SEND_ROUTER_SOLICIT</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="116"><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/>nd6_send_rs(</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="117"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_IPV6_SEND_ROUTER_SOLICIT<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="118"><highlight class="normal"></highlight></codeline>
<codeline lineno="119"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_ND6_QUEUEING</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="120"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>nd6_free_q(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>nd6_q_entry<sp/>*q);</highlight></codeline>
<codeline lineno="121"><highlight class="normal"></highlight><highlight class="preprocessor">#else<sp/></highlight><highlight class="comment">/*<sp/>LWIP_ND6_QUEUEING<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="122"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>nd6_free_q(q)<sp/>pbuf_free(q)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="123"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_ND6_QUEUEING<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="124"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>nd6_send_q(<ref refid="group__compiler__abstraction_1ga9cd1d7891fe315de1201e2c6e45f4f57" kindref="member">s8_t</ref><sp/>i);</highlight></codeline>
<codeline lineno="125"><highlight class="normal"></highlight></codeline>
<codeline lineno="126"><highlight class="normal"></highlight></codeline>
<codeline lineno="133"><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="134"><highlight class="normal">nd6_input(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*p,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*inp)</highlight></codeline>
<codeline lineno="135"><highlight class="normal">{</highlight></codeline>
<codeline lineno="136"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>msg_type;</highlight></codeline>
<codeline lineno="137"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga9cd1d7891fe315de1201e2c6e45f4f57" kindref="member">s8_t</ref><sp/>i;</highlight></codeline>
<codeline lineno="138"><highlight class="normal"></highlight></codeline>
<codeline lineno="139"><highlight class="normal"><sp/><sp/><ref refid="stats_8h_1a5c508f5734163d7ce6ac7c1227500867" kindref="member">ND6_STATS_INC</ref>(nd6.recv);</highlight></codeline>
<codeline lineno="140"><highlight class="normal"></highlight></codeline>
<codeline lineno="141"><highlight class="normal"><sp/><sp/>msg_type<sp/>=<sp/>*((<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>*)p-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref>);</highlight></codeline>
<codeline lineno="142"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">switch</highlight><highlight class="normal"><sp/>(msg_type)<sp/>{</highlight></codeline>
<codeline lineno="143"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="prot_2icmp6_8h_1a6e10428d8f6102013b30013065716858a1f99d333f425c28d3840e029cc9c46f3" kindref="member">ICMP6_TYPE_NA</ref>:<sp/></highlight><highlight class="comment">/*<sp/>Neighbor<sp/>Advertisement.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="144"><highlight class="normal"><sp/><sp/>{</highlight></codeline>
<codeline lineno="145"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structna__header" kindref="compound">na_header</ref><sp/>*na_hdr;</highlight></codeline>
<codeline lineno="146"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structlladdr__option" kindref="compound">lladdr_option</ref><sp/>*lladdr_opt;</highlight></codeline>
<codeline lineno="147"><highlight class="normal"></highlight></codeline>
<codeline lineno="148"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Check<sp/>that<sp/>na<sp/>header<sp/>fits<sp/>in<sp/>packet.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="149"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(p-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref><sp/>&lt;<sp/>(</highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structna__header" kindref="compound">na_header</ref>)))<sp/>{</highlight></codeline>
<codeline lineno="150"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>@todo<sp/>debug<sp/>message<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="151"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(p);</highlight></codeline>
<codeline lineno="152"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1a5c508f5734163d7ce6ac7c1227500867" kindref="member">ND6_STATS_INC</ref>(nd6.lenerr);</highlight></codeline>
<codeline lineno="153"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1a5c508f5734163d7ce6ac7c1227500867" kindref="member">ND6_STATS_INC</ref>(nd6.drop);</highlight></codeline>
<codeline lineno="154"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="155"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="156"><highlight class="normal"></highlight></codeline>
<codeline lineno="157"><highlight class="normal"><sp/><sp/><sp/><sp/>na_hdr<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structna__header" kindref="compound">na_header</ref><sp/>*)p-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref>;</highlight></codeline>
<codeline lineno="158"><highlight class="normal"></highlight></codeline>
<codeline lineno="159"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Unsolicited<sp/>NA?*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="160"><highlight class="normal"><sp/><sp/><sp/><sp/>if<sp/>(ip6_addr_ismulticast(ip6_current_dest_addr()))<sp/>{</highlight></codeline>
<codeline lineno="161"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>ip6_addr_t<sp/>target_address;</highlight></codeline>
<codeline lineno="162"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight></codeline>
<codeline lineno="163"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>This<sp/>is<sp/>an<sp/>unsolicited<sp/>NA.</highlight></codeline>
<codeline lineno="164"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*<sp/>link-layer<sp/>changed?</highlight></codeline>
<codeline lineno="165"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*<sp/>part<sp/>of<sp/>DAD<sp/>mechanism?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="166"><highlight class="normal"></highlight></codeline>
<codeline lineno="167"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Create<sp/>an<sp/>aligned<sp/>copy.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="168"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>ip6_addr_set(&amp;target_address,<sp/>&amp;(na_hdr-&gt;target_address));</highlight></codeline>
<codeline lineno="169"><highlight class="normal"></highlight></codeline>
<codeline lineno="170"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_IPV6_DUP_DETECT_ATTEMPTS</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="171"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>If<sp/>the<sp/>target<sp/>address<sp/>matches<sp/>this<sp/>netif,<sp/>it<sp/>is<sp/>a<sp/>DAD<sp/>response.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="172"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i<sp/>=<sp/>0;<sp/>i<sp/>&lt;<sp/><ref refid="lwipopts_8h_1a16c1b672604bfb0a66a6aeeb854589d3" kindref="member">LWIP_IPV6_NUM_ADDRESSES</ref>;<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="173"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!ip6_addr_isinvalid(netif_ip6_addr_state(inp,<sp/>i))<sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="174"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ip6_addr_cmp(&amp;target_address,<sp/>netif_ip6_addr(inp,<sp/>i)))<sp/>{</highlight></codeline>
<codeline lineno="175"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>We<sp/>are<sp/>using<sp/>a<sp/>duplicate<sp/>address.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="176"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>netif_ip6_addr_set_state(inp,<sp/>i,<sp/>IP6_ADDR_INVALID);</highlight></codeline>
<codeline lineno="177"><highlight class="normal"></highlight></codeline>
<codeline lineno="178"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_IPV6_AUTOCONFIG</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="179"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Check<sp/>to<sp/>see<sp/>if<sp/>this<sp/>address<sp/>was<sp/>autoconfigured.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="180"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!ip6_addr_islinklocal(&amp;target_address))<sp/>{</highlight></codeline>
<codeline lineno="181"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>i<sp/>=<sp/>nd6_get_onlink_prefix(&amp;target_address,<sp/>inp);</highlight></codeline>
<codeline lineno="182"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(i<sp/>&gt;=<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="183"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Mark<sp/>this<sp/>prefix<sp/>as<sp/>duplicate,<sp/>so<sp/>that<sp/>we<sp/>don&apos;t<sp/>use<sp/>it</highlight></codeline>
<codeline lineno="184"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*<sp/>to<sp/>generate<sp/>this<sp/>address<sp/>again.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="185"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>prefix_list[i].flags<sp/>|=<sp/>ND6_PREFIX_AUTOCONFIG_ADDRESS_DUPLICATE;</highlight></codeline>
<codeline lineno="186"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="187"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="188"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_IPV6_AUTOCONFIG<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="189"><highlight class="normal"></highlight></codeline>
<codeline lineno="190"><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="191"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="192"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="193"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="194"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_IPV6_DUP_DETECT_ATTEMPTS<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="195"><highlight class="normal"></highlight></codeline>
<codeline lineno="196"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Check<sp/>that<sp/>link-layer<sp/>address<sp/>option<sp/>also<sp/>fits<sp/>in<sp/>packet.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="197"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(p-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref><sp/>&lt;<sp/>(</highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structna__header" kindref="compound">na_header</ref>)<sp/>+<sp/>2))<sp/>{</highlight></codeline>
<codeline lineno="198"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>@todo<sp/>debug<sp/>message<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="199"><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="200"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1a5c508f5734163d7ce6ac7c1227500867" kindref="member">ND6_STATS_INC</ref>(nd6.lenerr);</highlight></codeline>
<codeline lineno="201"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1a5c508f5734163d7ce6ac7c1227500867" kindref="member">ND6_STATS_INC</ref>(nd6.drop);</highlight></codeline>
<codeline lineno="202"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="203"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="204"><highlight class="normal"></highlight></codeline>
<codeline lineno="205"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>lladdr_opt<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structlladdr__option" kindref="compound">lladdr_option</ref><sp/>*)((<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref>*)p-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref><sp/>+<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structna__header" kindref="compound">na_header</ref>));</highlight></codeline>
<codeline lineno="206"><highlight class="normal"></highlight></codeline>
<codeline lineno="207"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(p-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref><sp/>&lt;<sp/>(</highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structna__header" kindref="compound">na_header</ref>)<sp/>+<sp/>(lladdr_opt-&gt;length<sp/>&lt;&lt;<sp/>3)))<sp/>{</highlight></codeline>
<codeline lineno="208"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>@todo<sp/>debug<sp/>message<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="209"><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="210"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1a5c508f5734163d7ce6ac7c1227500867" kindref="member">ND6_STATS_INC</ref>(nd6.lenerr);</highlight></codeline>
<codeline lineno="211"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1a5c508f5734163d7ce6ac7c1227500867" kindref="member">ND6_STATS_INC</ref>(nd6.drop);</highlight></codeline>
<codeline lineno="212"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="213"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="214"><highlight class="normal"></highlight></codeline>
<codeline lineno="215"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>This<sp/>is<sp/>an<sp/>unsolicited<sp/>NA,<sp/>most<sp/>likely<sp/>there<sp/>was<sp/>a<sp/>LLADDR<sp/>change.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="216"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>i<sp/>=<sp/>nd6_find_neighbor_cache_entry(&amp;target_address);</highlight></codeline>
<codeline lineno="217"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(i<sp/>&gt;=<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="218"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(na_hdr-&gt;flags<sp/>&amp;<sp/><ref refid="prot_2nd6_8h_1a37fb4993bbbf3c4886291d38b1c03393" kindref="member">ND6_FLAG_OVERRIDE</ref>)<sp/>{</highlight></codeline>
<codeline lineno="219"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="lwipopts_8h_1aa1dd57a66b6de8c0593e9e3e8d1411f6" kindref="member">MEMCPY</ref>(neighbor_cache[i].lladdr,<sp/>lladdr_opt-&gt;addr,<sp/>inp-&gt;<ref refid="structnetif_1afe1181561cb16241f3cb5ed01e567d42" kindref="member">hwaddr_len</ref>);</highlight></codeline>
<codeline lineno="220"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="221"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="222"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="223"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>ip6_addr_t<sp/>target_address;</highlight></codeline>
<codeline lineno="224"><highlight class="normal"></highlight></codeline>
<codeline lineno="225"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>This<sp/>is<sp/>a<sp/>solicited<sp/>NA.</highlight></codeline>
<codeline lineno="226"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*<sp/>neighbor<sp/>address<sp/>resolution<sp/>response?</highlight></codeline>
<codeline lineno="227"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*<sp/>neighbor<sp/>unreachability<sp/>detection<sp/>response?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="228"><highlight class="normal"></highlight></codeline>
<codeline lineno="229"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Create<sp/>an<sp/>aligned<sp/>copy.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="230"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>ip6_addr_set(&amp;target_address,<sp/>&amp;(na_hdr-&gt;target_address));</highlight></codeline>
<codeline lineno="231"><highlight class="normal"></highlight></codeline>
<codeline lineno="232"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Find<sp/>the<sp/>cache<sp/>entry<sp/>corresponding<sp/>to<sp/>this<sp/>na.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="233"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>i<sp/>=<sp/>nd6_find_neighbor_cache_entry(&amp;target_address);</highlight></codeline>
<codeline lineno="234"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(i<sp/>&lt;<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="235"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>We<sp/>no<sp/>longer<sp/>care<sp/>about<sp/>this<sp/>target<sp/>address.<sp/>drop<sp/>it.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="236"><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="237"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="238"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="239"><highlight class="normal"></highlight></codeline>
<codeline lineno="240"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Update<sp/>cache<sp/>entry.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="241"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((na_hdr-&gt;flags<sp/>&amp;<sp/><ref refid="prot_2nd6_8h_1a37fb4993bbbf3c4886291d38b1c03393" kindref="member">ND6_FLAG_OVERRIDE</ref>)<sp/>||</highlight></codeline>
<codeline lineno="242"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(neighbor_cache[i].state<sp/>==<sp/>ND6_INCOMPLETE))<sp/>{</highlight></codeline>
<codeline lineno="243"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Check<sp/>that<sp/>link-layer<sp/>address<sp/>option<sp/>also<sp/>fits<sp/>in<sp/>packet.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="244"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(p-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref><sp/>&lt;<sp/>(</highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structna__header" kindref="compound">na_header</ref>)<sp/>+<sp/>2))<sp/>{</highlight></codeline>
<codeline lineno="245"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>@todo<sp/>debug<sp/>message<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="246"><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="247"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1a5c508f5734163d7ce6ac7c1227500867" kindref="member">ND6_STATS_INC</ref>(nd6.lenerr);</highlight></codeline>
<codeline lineno="248"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1a5c508f5734163d7ce6ac7c1227500867" kindref="member">ND6_STATS_INC</ref>(nd6.drop);</highlight></codeline>
<codeline lineno="249"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="250"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="251"><highlight class="normal"></highlight></codeline>
<codeline lineno="252"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>lladdr_opt<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structlladdr__option" kindref="compound">lladdr_option</ref><sp/>*)((<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref>*)p-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref><sp/>+<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structna__header" kindref="compound">na_header</ref>));</highlight></codeline>
<codeline lineno="253"><highlight class="normal"></highlight></codeline>
<codeline lineno="254"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(p-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref><sp/>&lt;<sp/>(</highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structna__header" kindref="compound">na_header</ref>)<sp/>+<sp/>(lladdr_opt-&gt;length<sp/>&lt;&lt;<sp/>3)))<sp/>{</highlight></codeline>
<codeline lineno="255"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>@todo<sp/>debug<sp/>message<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="256"><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="257"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1a5c508f5734163d7ce6ac7c1227500867" kindref="member">ND6_STATS_INC</ref>(nd6.lenerr);</highlight></codeline>
<codeline lineno="258"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1a5c508f5734163d7ce6ac7c1227500867" kindref="member">ND6_STATS_INC</ref>(nd6.drop);</highlight></codeline>
<codeline lineno="259"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="260"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="261"><highlight class="normal"></highlight></codeline>
<codeline lineno="262"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="lwipopts_8h_1aa1dd57a66b6de8c0593e9e3e8d1411f6" kindref="member">MEMCPY</ref>(neighbor_cache[i].lladdr,<sp/>lladdr_opt-&gt;addr,<sp/>inp-&gt;<ref refid="structnetif_1afe1181561cb16241f3cb5ed01e567d42" kindref="member">hwaddr_len</ref>);</highlight></codeline>
<codeline lineno="263"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="264"><highlight class="normal"></highlight></codeline>
<codeline lineno="265"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>neighbor_cache[i].netif<sp/>=<sp/>inp;</highlight></codeline>
<codeline lineno="266"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>neighbor_cache[i].<ref refid="structnetif_1a809cc57c0dff09c5c9ae45b02c2002f3" kindref="member">state</ref><sp/>=<sp/>ND6_REACHABLE;</highlight></codeline>
<codeline lineno="267"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>neighbor_cache[i].counter.reachable_time<sp/>=<sp/>reachable_time;</highlight></codeline>
<codeline lineno="268"><highlight class="normal"></highlight></codeline>
<codeline lineno="269"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Send<sp/>queued<sp/>packets,<sp/>if<sp/>any.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="270"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(neighbor_cache[i].q<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="271"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>nd6_send_q(i);</highlight></codeline>
<codeline lineno="272"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="273"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="274"><highlight class="normal"></highlight></codeline>
<codeline lineno="275"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;<sp/></highlight><highlight class="comment">/*<sp/>ICMP6_TYPE_NA<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="276"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="277"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="prot_2icmp6_8h_1a6e10428d8f6102013b30013065716858a0d8d8717c6c34053d1101932c23929fe" kindref="member">ICMP6_TYPE_NS</ref>:<sp/></highlight><highlight class="comment">/*<sp/>Neighbor<sp/>solicitation.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="278"><highlight class="normal"><sp/><sp/>{</highlight></codeline>
<codeline lineno="279"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structns__header" kindref="compound">ns_header</ref><sp/>*ns_hdr;</highlight></codeline>
<codeline lineno="280"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structlladdr__option" kindref="compound">lladdr_option</ref><sp/>*lladdr_opt;</highlight></codeline>
<codeline lineno="281"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>accepted;</highlight></codeline>
<codeline lineno="282"><highlight class="normal"></highlight></codeline>
<codeline lineno="283"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Check<sp/>that<sp/>ns<sp/>header<sp/>fits<sp/>in<sp/>packet.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="284"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(p-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref><sp/>&lt;<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structns__header" kindref="compound">ns_header</ref>))<sp/>{</highlight></codeline>
<codeline lineno="285"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>@todo<sp/>debug<sp/>message<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="286"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(p);</highlight></codeline>
<codeline lineno="287"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1a5c508f5734163d7ce6ac7c1227500867" kindref="member">ND6_STATS_INC</ref>(nd6.lenerr);</highlight></codeline>
<codeline lineno="288"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1a5c508f5734163d7ce6ac7c1227500867" kindref="member">ND6_STATS_INC</ref>(nd6.drop);</highlight></codeline>
<codeline lineno="289"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="290"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="291"><highlight class="normal"></highlight></codeline>
<codeline lineno="292"><highlight class="normal"><sp/><sp/><sp/><sp/>ns_hdr<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structns__header" kindref="compound">ns_header</ref><sp/>*)p-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref>;</highlight></codeline>
<codeline lineno="293"><highlight class="normal"></highlight></codeline>
<codeline lineno="294"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Check<sp/>if<sp/>there<sp/>is<sp/>a<sp/>link-layer<sp/>address<sp/>provided.<sp/>Only<sp/>point<sp/>to<sp/>it<sp/>if<sp/>in<sp/>this<sp/>buffer.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="295"><highlight class="normal"><sp/><sp/><sp/><sp/>if<sp/>(p-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref><sp/>&gt;=<sp/>(</highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structns__header" kindref="compound">ns_header</ref>)<sp/>+<sp/>2))<sp/>{</highlight></codeline>
<codeline lineno="296"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>lladdr_opt<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structlladdr__option" kindref="compound">lladdr_option</ref><sp/>*)((<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref>*)p-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref><sp/>+<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structns__header" kindref="compound">ns_header</ref>));</highlight></codeline>
<codeline lineno="297"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(p-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref><sp/>&lt;<sp/>(</highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structns__header" kindref="compound">ns_header</ref>)<sp/>+<sp/>(lladdr_opt-&gt;length<sp/>&lt;&lt;<sp/>3)))<sp/>{</highlight></codeline>
<codeline lineno="298"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>lladdr_opt<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="299"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="300"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="301"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>lladdr_opt<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="302"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="303"><highlight class="normal"></highlight></codeline>
<codeline lineno="304"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Check<sp/>if<sp/>the<sp/>target<sp/>address<sp/>is<sp/>configured<sp/>on<sp/>the<sp/>receiving<sp/>netif.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="305"><highlight class="normal"><sp/><sp/><sp/><sp/>accepted<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="306"><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_1a16c1b672604bfb0a66a6aeeb854589d3" kindref="member">LWIP_IPV6_NUM_ADDRESSES</ref>;<sp/>++i)<sp/>{</highlight></codeline>
<codeline lineno="307"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((ip6_addr_isvalid(netif_ip6_addr_state(inp,<sp/>i))<sp/>||</highlight></codeline>
<codeline lineno="308"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(ip6_addr_istentative(netif_ip6_addr_state(inp,<sp/>i))<sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="309"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ip6_addr_isany(ip6_current_src_addr())))<sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="310"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ip6_addr_cmp(&amp;(ns_hdr-&gt;target_address),<sp/>netif_ip6_addr(inp,<sp/>i)))<sp/>{</highlight></codeline>
<codeline lineno="311"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>accepted<sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="312"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="313"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="314"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="315"><highlight class="normal"></highlight></codeline>
<codeline lineno="316"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>NS<sp/>not<sp/>for<sp/>us?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="317"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!accepted)<sp/>{</highlight></codeline>
<codeline lineno="318"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(p);</highlight></codeline>
<codeline lineno="319"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="320"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="321"><highlight class="normal"></highlight></codeline>
<codeline lineno="322"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Check<sp/>for<sp/>ANY<sp/>address<sp/>in<sp/>src<sp/>(DAD<sp/>algorithm).<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="323"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ip6_addr_isany(ip6_current_src_addr()))<sp/>{</highlight></codeline>
<codeline lineno="324"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Sender<sp/>is<sp/>validating<sp/>this<sp/>address.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="325"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i<sp/>=<sp/>0;<sp/>i<sp/>&lt;<sp/><ref refid="lwipopts_8h_1a16c1b672604bfb0a66a6aeeb854589d3" kindref="member">LWIP_IPV6_NUM_ADDRESSES</ref>;<sp/>++i)<sp/>{</highlight></codeline>
<codeline lineno="326"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!ip6_addr_isinvalid(netif_ip6_addr_state(inp,<sp/>i))<sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="327"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ip6_addr_cmp(&amp;(ns_hdr-&gt;target_address),<sp/>netif_ip6_addr(inp,<sp/>i)))<sp/>{</highlight></codeline>
<codeline lineno="328"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Send<sp/>a<sp/>NA<sp/>back<sp/>so<sp/>that<sp/>the<sp/>sender<sp/>does<sp/>not<sp/>use<sp/>this<sp/>address.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="329"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>nd6_send_na(inp,<sp/>netif_ip6_addr(inp,<sp/>i),<sp/><ref refid="prot_2nd6_8h_1a37fb4993bbbf3c4886291d38b1c03393" kindref="member">ND6_FLAG_OVERRIDE</ref><sp/>|<sp/>ND6_SEND_FLAG_ALLNODES_DEST);</highlight></codeline>
<codeline lineno="330"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ip6_addr_istentative(netif_ip6_addr_state(inp,<sp/>i)))<sp/>{</highlight></codeline>
<codeline lineno="331"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>We<sp/>shouldn&apos;t<sp/>use<sp/>this<sp/>address<sp/>either.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="332"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>netif_ip6_addr_set_state(inp,<sp/>i,<sp/>IP6_ADDR_INVALID);</highlight></codeline>
<codeline lineno="333"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="334"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="335"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="336"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="337"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>ip6_addr_t<sp/>target_address;</highlight></codeline>
<codeline lineno="338"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight></codeline>
<codeline lineno="339"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Sender<sp/>is<sp/>trying<sp/>to<sp/>resolve<sp/>our<sp/>address.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="340"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Verify<sp/>that<sp/>they<sp/>included<sp/>their<sp/>own<sp/>link-layer<sp/>address.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="341"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(lladdr_opt<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="342"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Not<sp/>a<sp/>valid<sp/>message.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="343"><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="344"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1a5c508f5734163d7ce6ac7c1227500867" kindref="member">ND6_STATS_INC</ref>(nd6.proterr);</highlight></codeline>
<codeline lineno="345"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1a5c508f5734163d7ce6ac7c1227500867" kindref="member">ND6_STATS_INC</ref>(nd6.drop);</highlight></codeline>
<codeline lineno="346"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="347"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="348"><highlight class="normal"></highlight></codeline>
<codeline lineno="349"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>i<sp/>=<sp/>nd6_find_neighbor_cache_entry(ip6_current_src_addr());</highlight></codeline>
<codeline lineno="350"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(i&gt;=<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="351"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>We<sp/>already<sp/>have<sp/>a<sp/>record<sp/>for<sp/>the<sp/>solicitor.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="352"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(neighbor_cache[i].state<sp/>==<sp/>ND6_INCOMPLETE)<sp/>{</highlight></codeline>
<codeline lineno="353"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>neighbor_cache[i].netif<sp/>=<sp/>inp;</highlight></codeline>
<codeline lineno="354"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="lwipopts_8h_1aa1dd57a66b6de8c0593e9e3e8d1411f6" kindref="member">MEMCPY</ref>(neighbor_cache[i].lladdr,<sp/>lladdr_opt-&gt;addr,<sp/>inp-&gt;<ref refid="structnetif_1afe1181561cb16241f3cb5ed01e567d42" kindref="member">hwaddr_len</ref>);</highlight></codeline>
<codeline lineno="355"><highlight class="normal"></highlight></codeline>
<codeline lineno="356"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Delay<sp/>probe<sp/>in<sp/>case<sp/>we<sp/>get<sp/>confirmation<sp/>of<sp/>reachability<sp/>from<sp/>upper<sp/>layer<sp/>(TCP).<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="357"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>neighbor_cache[i].state<sp/>=<sp/>ND6_DELAY;</highlight></codeline>
<codeline lineno="358"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>neighbor_cache[i].counter.delay_time<sp/>=<sp/><ref refid="lwipopts_8h_1a315bd6d4a9d185766dfc3253cd9d7715" kindref="member">LWIP_ND6_DELAY_FIRST_PROBE_TIME</ref><sp/>/<sp/>ND6_TMR_INTERVAL;</highlight></codeline>
<codeline lineno="359"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="360"><highlight class="normal"><sp/><sp/><sp/><sp/><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/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Add<sp/>their<sp/>IPv6<sp/>address<sp/>and<sp/>link-layer<sp/>address<sp/>to<sp/>neighbor<sp/>cache.</highlight></codeline>
<codeline lineno="362"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*<sp/>We<sp/>will<sp/>need<sp/>it<sp/>at<sp/>least<sp/>to<sp/>send<sp/>a<sp/>unicast<sp/>NA<sp/>message,<sp/>but<sp/>most</highlight></codeline>
<codeline lineno="363"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*<sp/>likely<sp/>we<sp/>will<sp/>also<sp/>be<sp/>communicating<sp/>with<sp/>this<sp/>node<sp/>soon.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="364"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>i<sp/>=<sp/>nd6_new_neighbor_cache_entry();</highlight></codeline>
<codeline lineno="365"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(i<sp/>&lt;<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="366"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>We<sp/>couldn&apos;t<sp/>assign<sp/>a<sp/>cache<sp/>entry<sp/>for<sp/>this<sp/>neighbor.</highlight></codeline>
<codeline lineno="367"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*<sp/>we<sp/>won&apos;t<sp/>be<sp/>able<sp/>to<sp/>reply.<sp/>drop<sp/>it.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="368"><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="369"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1a5c508f5734163d7ce6ac7c1227500867" kindref="member">ND6_STATS_INC</ref>(nd6.memerr);</highlight></codeline>
<codeline lineno="370"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="371"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="372"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>neighbor_cache[i].netif<sp/>=<sp/>inp;</highlight></codeline>
<codeline lineno="373"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="lwipopts_8h_1aa1dd57a66b6de8c0593e9e3e8d1411f6" kindref="member">MEMCPY</ref>(neighbor_cache[i].lladdr,<sp/>lladdr_opt-&gt;addr,<sp/>inp-&gt;<ref refid="structnetif_1afe1181561cb16241f3cb5ed01e567d42" kindref="member">hwaddr_len</ref>);</highlight></codeline>
<codeline lineno="374"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ip6_addr_set(&amp;(neighbor_cache[i].next_hop_address),<sp/>ip6_current_src_addr());</highlight></codeline>
<codeline lineno="375"><highlight class="normal"></highlight></codeline>
<codeline lineno="376"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Receiving<sp/>a<sp/>message<sp/>does<sp/>not<sp/>prove<sp/>reachability:<sp/>only<sp/>in<sp/>one<sp/>direction.</highlight></codeline>
<codeline lineno="377"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*<sp/>Delay<sp/>probe<sp/>in<sp/>case<sp/>we<sp/>get<sp/>confirmation<sp/>of<sp/>reachability<sp/>from<sp/>upper<sp/>layer<sp/>(TCP).<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="378"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>neighbor_cache[i].state<sp/>=<sp/>ND6_DELAY;</highlight></codeline>
<codeline lineno="379"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>neighbor_cache[i].counter.delay_time<sp/>=<sp/><ref refid="lwipopts_8h_1a315bd6d4a9d185766dfc3253cd9d7715" kindref="member">LWIP_ND6_DELAY_FIRST_PROBE_TIME</ref><sp/>/<sp/>ND6_TMR_INTERVAL;</highlight></codeline>
<codeline lineno="380"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="381"><highlight class="normal"></highlight></codeline>
<codeline lineno="382"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Create<sp/>an<sp/>aligned<sp/>copy.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="383"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>ip6_addr_set(&amp;target_address,<sp/>&amp;(ns_hdr-&gt;target_address));</highlight></codeline>
<codeline lineno="384"><highlight class="normal"></highlight></codeline>
<codeline lineno="385"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Send<sp/>back<sp/>a<sp/>NA<sp/>for<sp/>us.<sp/>Allocate<sp/>the<sp/>reply<sp/>pbuf.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="386"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>nd6_send_na(inp,<sp/>&amp;target_address,<sp/><ref refid="prot_2nd6_8h_1ae6bf6657a8a6b004681948090dfa2d7c" kindref="member">ND6_FLAG_SOLICITED</ref><sp/>|<sp/><ref refid="prot_2nd6_8h_1a37fb4993bbbf3c4886291d38b1c03393" kindref="member">ND6_FLAG_OVERRIDE</ref>);</highlight></codeline>
<codeline lineno="387"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="388"><highlight class="normal"></highlight></codeline>
<codeline lineno="389"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;<sp/></highlight><highlight class="comment">/*<sp/>ICMP6_TYPE_NS<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="390"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="391"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="prot_2icmp6_8h_1a6e10428d8f6102013b30013065716858ae4ae04be7df3a2cce614af0a5cdae951" kindref="member">ICMP6_TYPE_RA</ref>:<sp/></highlight><highlight class="comment">/*<sp/>Router<sp/>Advertisement.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="392"><highlight class="normal"><sp/><sp/>{</highlight></codeline>
<codeline lineno="393"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structra__header" kindref="compound">ra_header</ref><sp/>*ra_hdr;</highlight></codeline>
<codeline lineno="394"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>*<ref refid="shell_8c_1aff2566f4c366b48d73479bef43ee4d2e" kindref="member">buffer</ref>;<sp/></highlight><highlight class="comment">/*<sp/>Used<sp/>to<sp/>copy<sp/>options.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="395"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>offset;</highlight></codeline>
<codeline lineno="396"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_ND6_RDNSS_MAX_DNS_SERVERS</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="397"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>There<sp/>can<sp/>by<sp/>multiple<sp/>RDNSS<sp/>options<sp/>per<sp/>RA<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="398"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>rdnss_server_idx<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="399"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_ND6_RDNSS_MAX_DNS_SERVERS<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="400"><highlight class="normal"></highlight></codeline>
<codeline lineno="401"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Check<sp/>that<sp/>RA<sp/>header<sp/>fits<sp/>in<sp/>packet.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="402"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(p-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref><sp/>&lt;<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structra__header" kindref="compound">ra_header</ref>))<sp/>{</highlight></codeline>
<codeline lineno="403"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>@todo<sp/>debug<sp/>message<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="404"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(p);</highlight></codeline>
<codeline lineno="405"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1a5c508f5734163d7ce6ac7c1227500867" kindref="member">ND6_STATS_INC</ref>(nd6.lenerr);</highlight></codeline>
<codeline lineno="406"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1a5c508f5734163d7ce6ac7c1227500867" kindref="member">ND6_STATS_INC</ref>(nd6.drop);</highlight></codeline>
<codeline lineno="407"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="408"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="409"><highlight class="normal"></highlight></codeline>
<codeline lineno="410"><highlight class="normal"><sp/><sp/><sp/><sp/>ra_hdr<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structra__header" kindref="compound">ra_header</ref><sp/>*)p-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref>;</highlight></codeline>
<codeline lineno="411"><highlight class="normal"></highlight></codeline>
<codeline lineno="412"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>If<sp/>we<sp/>are<sp/>sending<sp/>RS<sp/>messages,<sp/>stop.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="413"><highlight class="normal">#</highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/><ref refid="lwipopts_8h_1a273ed2e1a4e6a43713a0e4a06a34ee5c" kindref="member">LWIP_IPV6_SEND_ROUTER_SOLICIT</ref></highlight></codeline>
<codeline lineno="414"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>ensure<sp/>at<sp/>least<sp/>one<sp/>solicitation<sp/>is<sp/>sent<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="415"><highlight class="normal"><sp/><sp/><sp/><sp/>if<sp/>((inp-&gt;rs_count<sp/>&lt;<sp/><ref refid="lwipopts_8h_1a980909018aed54adc10dd68be3572b30" kindref="member">LWIP_ND6_MAX_MULTICAST_SOLICIT</ref>)<sp/>||</highlight></codeline>
<codeline lineno="416"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(nd6_send_rs(inp)<sp/>==<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" kindref="member">ERR_OK</ref>))<sp/>{</highlight></codeline>
<codeline lineno="417"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>inp-&gt;rs_count<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="418"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="419"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_IPV6_SEND_ROUTER_SOLICIT<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="420"><highlight class="normal"></highlight></codeline>
<codeline lineno="421"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Get<sp/>the<sp/>matching<sp/>default<sp/>router<sp/>entry.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="422"><highlight class="normal"><sp/><sp/><sp/><sp/>i<sp/>=<sp/>nd6_get_router(ip6_current_src_addr(),<sp/>inp);</highlight></codeline>
<codeline lineno="423"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(i<sp/>&lt;<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="424"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Create<sp/>a<sp/>new<sp/>router<sp/>entry.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="425"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>i<sp/>=<sp/>nd6_new_router(ip6_current_src_addr(),<sp/>inp);</highlight></codeline>
<codeline lineno="426"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="427"><highlight class="normal"></highlight></codeline>
<codeline lineno="428"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(i<sp/>&lt;<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="429"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Could<sp/>not<sp/>create<sp/>a<sp/>new<sp/>router<sp/>entry.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="430"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(p);</highlight></codeline>
<codeline lineno="431"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1a5c508f5734163d7ce6ac7c1227500867" kindref="member">ND6_STATS_INC</ref>(nd6.memerr);</highlight></codeline>
<codeline lineno="432"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="433"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="434"><highlight class="normal"></highlight></codeline>
<codeline lineno="435"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Re-set<sp/>invalidation<sp/>timer.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="436"><highlight class="normal"><sp/><sp/><sp/><sp/>default_router_list[i].invalidation_timer<sp/>=<sp/><ref refid="def_8c_1ad637280639de4066392e6b5614fa3e56" kindref="member">lwip_htons</ref>(ra_hdr-&gt;router_lifetime);</highlight></codeline>
<codeline lineno="437"><highlight class="normal"></highlight></codeline>
<codeline lineno="438"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Re-set<sp/>default<sp/>timer<sp/>values.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="439"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_ND6_ALLOW_RA_UPDATES</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="440"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ra_hdr-&gt;retrans_timer<sp/>&gt;<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="441"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>retrans_timer<sp/>=<sp/><ref refid="def_8c_1a14f94347a5b9b9e3602705b75b7ae524" kindref="member">lwip_htonl</ref>(ra_hdr-&gt;retrans_timer);</highlight></codeline>
<codeline lineno="442"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="443"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ra_hdr-&gt;reachable_time<sp/>&gt;<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="444"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>reachable_time<sp/>=<sp/><ref refid="def_8c_1a14f94347a5b9b9e3602705b75b7ae524" kindref="member">lwip_htonl</ref>(ra_hdr-&gt;reachable_time);</highlight></codeline>
<codeline lineno="445"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="446"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_ND6_ALLOW_RA_UPDATES<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="447"><highlight class="normal"></highlight></codeline>
<codeline lineno="448"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>@todo<sp/>set<sp/>default<sp/>hop<sp/>limit...<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="449"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>ra_hdr-&gt;current_hop_limit;*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="450"><highlight class="normal"></highlight></codeline>
<codeline lineno="451"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Update<sp/>flags<sp/>in<sp/>local<sp/>entry<sp/>(incl.<sp/>preference).<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="452"><highlight class="normal"><sp/><sp/><sp/><sp/>default_router_list[i].flags<sp/>=<sp/>ra_hdr-&gt;flags;</highlight></codeline>
<codeline lineno="453"><highlight class="normal"></highlight></codeline>
<codeline lineno="454"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Offset<sp/>to<sp/>options.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="455"><highlight class="normal"><sp/><sp/><sp/><sp/>offset<sp/>=<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structra__header" kindref="compound">ra_header</ref>);</highlight></codeline>
<codeline lineno="456"><highlight class="normal"></highlight></codeline>
<codeline lineno="457"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Process<sp/>each<sp/>option.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="458"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>((p-&gt;<ref refid="structpbuf_1a5259e7ec29bab9c0999b64f2e86b411f" kindref="member">tot_len</ref><sp/>-<sp/>offset)<sp/>&gt;<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="459"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</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/>{</highlight></codeline>
<codeline lineno="460"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>no<sp/>need<sp/>to<sp/>copy<sp/>from<sp/>contiguous<sp/>pbuf<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="461"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="shell_8c_1aff2566f4c366b48d73479bef43ee4d2e" kindref="member">buffer</ref><sp/>=<sp/>&amp;((<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref>*)p-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref>)[offset];</highlight></codeline>
<codeline lineno="462"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="463"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="shell_8c_1aff2566f4c366b48d73479bef43ee4d2e" kindref="member">buffer</ref><sp/>=<sp/>nd6_ra_buffer;</highlight></codeline>
<codeline lineno="464"><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_1gac2f1f58fd36042e82af46f5015720899" kindref="member">pbuf_copy_partial</ref>(p,<sp/><ref refid="shell_8c_1aff2566f4c366b48d73479bef43ee4d2e" kindref="member">buffer</ref>,<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structprefix__option" kindref="compound">prefix_option</ref>),<sp/>offset)<sp/>!=<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structprefix__option" kindref="compound">prefix_option</ref>))<sp/>{</highlight></codeline>
<codeline lineno="465"><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="466"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1a5c508f5734163d7ce6ac7c1227500867" kindref="member">ND6_STATS_INC</ref>(nd6.lenerr);</highlight></codeline>
<codeline lineno="467"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1a5c508f5734163d7ce6ac7c1227500867" kindref="member">ND6_STATS_INC</ref>(nd6.drop);</highlight></codeline>
<codeline lineno="468"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="469"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="470"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="471"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="shell_8c_1aff2566f4c366b48d73479bef43ee4d2e" kindref="member">buffer</ref>[1]<sp/>==<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="472"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>zero-length<sp/>extension.<sp/>drop<sp/>packet<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="473"><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="474"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1a5c508f5734163d7ce6ac7c1227500867" kindref="member">ND6_STATS_INC</ref>(nd6.lenerr);</highlight></codeline>
<codeline lineno="475"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1a5c508f5734163d7ce6ac7c1227500867" kindref="member">ND6_STATS_INC</ref>(nd6.drop);</highlight></codeline>
<codeline lineno="476"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="477"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="478"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">switch</highlight><highlight class="normal"><sp/>(<ref refid="shell_8c_1aff2566f4c366b48d73479bef43ee4d2e" kindref="member">buffer</ref>[0])<sp/>{</highlight></codeline>
<codeline lineno="479"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="prot_2nd6_8h_1a68ce8550a20cd30093d6e79e1ca51842" kindref="member">ND6_OPTION_TYPE_SOURCE_LLADDR</ref>:</highlight></codeline>
<codeline lineno="480"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="481"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structlladdr__option" kindref="compound">lladdr_option</ref><sp/>*lladdr_opt;</highlight></codeline>
<codeline lineno="482"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>lladdr_opt<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structlladdr__option" kindref="compound">lladdr_option</ref><sp/>*)<ref refid="shell_8c_1aff2566f4c366b48d73479bef43ee4d2e" kindref="member">buffer</ref>;</highlight></codeline>
<codeline lineno="483"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((default_router_list[i].neighbor_entry<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="484"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(default_router_list[i].neighbor_entry-&gt;state<sp/>==<sp/>ND6_INCOMPLETE))<sp/>{</highlight></codeline>
<codeline lineno="485"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="lwipopts_8h_1a8c6e3c1e4f74acb16376188dbf8909ec" kindref="member">SMEMCPY</ref>(default_router_list[i].neighbor_entry-&gt;lladdr,<sp/>lladdr_opt-&gt;addr,<sp/>inp-&gt;<ref refid="structnetif_1afe1181561cb16241f3cb5ed01e567d42" kindref="member">hwaddr_len</ref>);</highlight></codeline>
<codeline lineno="486"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>default_router_list[i].neighbor_entry-&gt;state<sp/>=<sp/>ND6_REACHABLE;</highlight></codeline>
<codeline lineno="487"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>default_router_list[i].neighbor_entry-&gt;counter.reachable_time<sp/>=<sp/>reachable_time;</highlight></codeline>
<codeline lineno="488"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="489"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="490"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="491"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="prot_2nd6_8h_1aab6c15c9bea51fbdcc660f718bb403a8" kindref="member">ND6_OPTION_TYPE_MTU</ref>:</highlight></codeline>
<codeline lineno="492"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="493"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structmtu__option" kindref="compound">mtu_option</ref><sp/>*mtu_opt;</highlight></codeline>
<codeline lineno="494"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>mtu_opt<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structmtu__option" kindref="compound">mtu_option</ref><sp/>*)<ref refid="shell_8c_1aff2566f4c366b48d73479bef43ee4d2e" kindref="member">buffer</ref>;</highlight></codeline>
<codeline lineno="495"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="def_8c_1a14f94347a5b9b9e3602705b75b7ae524" kindref="member">lwip_htonl</ref>(mtu_opt-&gt;mtu)<sp/>&gt;=<sp/>1280)<sp/>{</highlight></codeline>
<codeline lineno="496"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_ND6_ALLOW_RA_UPDATES</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="497"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>inp-&gt;<ref refid="structnetif_1aca7d56b4e0f822b0ced2885f222b8d48" kindref="member">mtu</ref><sp/>=<sp/>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)<ref refid="def_8c_1a14f94347a5b9b9e3602705b75b7ae524" kindref="member">lwip_htonl</ref>(mtu_opt-&gt;mtu);</highlight></codeline>
<codeline lineno="498"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_ND6_ALLOW_RA_UPDATES<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="499"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="500"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="501"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="502"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="prot_2nd6_8h_1a0225d4c8911efdbdbc2b40de208906c2" kindref="member">ND6_OPTION_TYPE_PREFIX_INFO</ref>:</highlight></codeline>
<codeline lineno="503"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="504"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structprefix__option" kindref="compound">prefix_option</ref><sp/>*prefix_opt;</highlight></codeline>
<codeline lineno="505"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>prefix_opt<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structprefix__option" kindref="compound">prefix_option</ref><sp/>*)<ref refid="shell_8c_1aff2566f4c366b48d73479bef43ee4d2e" kindref="member">buffer</ref>;</highlight></codeline>
<codeline lineno="506"><highlight class="normal"></highlight></codeline>
<codeline lineno="507"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((prefix_opt-&gt;flags<sp/>&amp;<sp/><ref refid="prot_2nd6_8h_1a5714faec71a571f2334ed750a33c61a2" kindref="member">ND6_PREFIX_FLAG_ON_LINK</ref>)<sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="508"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(prefix_opt-&gt;prefix_length<sp/>==<sp/>64)<sp/><sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="509"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>!ip6_addr_islinklocal(&amp;(prefix_opt-&gt;prefix)))<sp/>{</highlight></codeline>
<codeline lineno="510"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Add<sp/>to<sp/>on-link<sp/>prefix<sp/>list.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="511"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__compiler__abstraction_1ga9cd1d7891fe315de1201e2c6e45f4f57" kindref="member">s8_t</ref><sp/>prefix;</highlight></codeline>
<codeline lineno="512"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ip6_addr_t<sp/>prefix_addr;</highlight></codeline>
<codeline lineno="513"><highlight class="normal"></highlight></codeline>
<codeline lineno="514"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Get<sp/>a<sp/>memory-aligned<sp/>copy<sp/>of<sp/>the<sp/>prefix.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="515"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ip6_addr_set(&amp;prefix_addr,<sp/>&amp;(prefix_opt-&gt;prefix));</highlight></codeline>
<codeline lineno="516"><highlight class="normal"></highlight></codeline>
<codeline lineno="517"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>find<sp/>cache<sp/>entry<sp/>for<sp/>this<sp/>prefix.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="518"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>prefix<sp/>=<sp/>nd6_get_onlink_prefix(&amp;prefix_addr,<sp/>inp);</highlight></codeline>
<codeline lineno="519"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(prefix<sp/>&lt;<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="520"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Create<sp/>a<sp/>new<sp/>cache<sp/>entry.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="521"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>prefix<sp/>=<sp/>nd6_new_onlink_prefix(&amp;prefix_addr,<sp/>inp);</highlight></codeline>
<codeline lineno="522"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="523"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(prefix<sp/>&gt;=<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="524"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>prefix_list[prefix].invalidation_timer<sp/>=<sp/><ref refid="def_8c_1a14f94347a5b9b9e3602705b75b7ae524" kindref="member">lwip_htonl</ref>(prefix_opt-&gt;valid_lifetime);</highlight></codeline>
<codeline lineno="525"><highlight class="normal"></highlight></codeline>
<codeline lineno="526"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_IPV6_AUTOCONFIG</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="527"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(prefix_opt-&gt;flags<sp/>&amp;<sp/><ref refid="prot_2nd6_8h_1acc8f3704e72b27a166b120eec5a2665b" kindref="member">ND6_PREFIX_FLAG_AUTONOMOUS</ref>)<sp/>{</highlight></codeline>
<codeline lineno="528"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Mark<sp/>prefix<sp/>as<sp/>autonomous,<sp/>so<sp/>that<sp/>address<sp/>autoconfiguration<sp/>can<sp/>take<sp/>place.</highlight></codeline>
<codeline lineno="529"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*<sp/>Only<sp/>OR<sp/>flag,<sp/>so<sp/>that<sp/>we<sp/>don&apos;t<sp/>over-write<sp/>other<sp/>flags<sp/>(such<sp/>as<sp/>ADDRESS_DUPLICATE)*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="530"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>prefix_list[prefix].flags<sp/>|=<sp/>ND6_PREFIX_AUTOCONFIG_AUTONOMOUS;</highlight></codeline>
<codeline lineno="531"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="532"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_IPV6_AUTOCONFIG<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="533"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="534"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="535"><highlight class="normal"></highlight></codeline>
<codeline lineno="536"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="537"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="538"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="prot_2nd6_8h_1aff2e03766ee1fa15263c4aeda5097d28" kindref="member">ND6_OPTION_TYPE_ROUTE_INFO</ref>:</highlight></codeline>
<codeline lineno="539"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>@todo<sp/>implement<sp/>preferred<sp/>routes.</highlight></codeline>
<codeline lineno="540"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>struct<sp/>route_option<sp/>*<sp/>route_opt;</highlight></codeline>
<codeline lineno="541"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>route_opt<sp/>=<sp/>(struct<sp/>route_option<sp/>*)buffer;*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="542"><highlight class="normal"></highlight></codeline>
<codeline lineno="543"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="544"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_ND6_RDNSS_MAX_DNS_SERVERS</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="545"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="prot_2nd6_8h_1a3188b9704a8ca598f54b87c3db73272e" kindref="member">ND6_OPTION_TYPE_RDNSS</ref>:</highlight></codeline>
<codeline lineno="546"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="547"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>num,<sp/>n;</highlight></codeline>
<codeline lineno="548"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structrdnss__option" kindref="compound">rdnss_option</ref><sp/>*<sp/>rdnss_opt;</highlight></codeline>
<codeline lineno="549"><highlight class="normal"></highlight></codeline>
<codeline lineno="550"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>rdnss_opt<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structrdnss__option" kindref="compound">rdnss_option</ref><sp/>*)<ref refid="shell_8c_1aff2566f4c366b48d73479bef43ee4d2e" kindref="member">buffer</ref>;</highlight></codeline>
<codeline lineno="551"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>num<sp/>=<sp/>(rdnss_opt-&gt;length<sp/>-<sp/>1)<sp/>/<sp/>2;</highlight></codeline>
<codeline lineno="552"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(n<sp/>=<sp/>0;<sp/>(rdnss_server_idx<sp/>&lt;<sp/><ref refid="lwipopts_8h_1a9f9881c887a8aceb9765820c2dbdf292" kindref="member">DNS_MAX_SERVERS</ref>)<sp/>&amp;&amp;<sp/>(n<sp/>&lt;<sp/>num);<sp/>n++)<sp/>{</highlight></codeline>
<codeline lineno="553"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="ip__addr_8h_1a88b43639738c4de2d3cd22e3a1fd7696" kindref="member">ip_addr_t</ref><sp/>rdnss_address;</highlight></codeline>
<codeline lineno="554"><highlight class="normal"></highlight></codeline>
<codeline lineno="555"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Get<sp/>a<sp/>memory-aligned<sp/>copy<sp/>of<sp/>the<sp/>prefix.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="556"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="ip__addr_8h_1abe6f7908ce8a91dc587e2ebc2172e651" kindref="member">ip_addr_copy_from_ip6</ref>(rdnss_address,<sp/>rdnss_opt-&gt;rdnss_address[n]);</highlight></codeline>
<codeline lineno="557"><highlight class="normal"></highlight></codeline>
<codeline lineno="558"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="def_8h_1ae4027a6ad07f13aa12eab285a1b46019" kindref="member">htonl</ref>(rdnss_opt-&gt;lifetime)<sp/>&gt;<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="559"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>TODO<sp/>implement<sp/>Lifetime<sp/>&gt;<sp/>0<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="560"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>dns_setserver(rdnss_server_idx++,<sp/>&amp;rdnss_address);</highlight></codeline>
<codeline lineno="561"><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="562"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>TODO<sp/>implement<sp/>DNS<sp/>removal<sp/>in<sp/>dns.c<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="563"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>s;</highlight></codeline>
<codeline lineno="564"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(s<sp/>=<sp/>0;<sp/>s<sp/>&lt;<sp/><ref refid="lwipopts_8h_1a9f9881c887a8aceb9765820c2dbdf292" kindref="member">DNS_MAX_SERVERS</ref>;<sp/>s++)<sp/>{</highlight></codeline>
<codeline lineno="565"><highlight class="normal"><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="ip__addr_8h_1a88b43639738c4de2d3cd22e3a1fd7696" kindref="member">ip_addr_t</ref><sp/>*addr<sp/>=<sp/>dns_getserver(s);</highlight></codeline>
<codeline lineno="566"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(<ref refid="ip__addr_8h_1a008c9c92d770cc030ea054e6b259835a" kindref="member">ip_addr_cmp</ref>(addr,<sp/>&amp;rdnss_address))<sp/>{</highlight></codeline>
<codeline lineno="567"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>dns_setserver(s,<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>);</highlight></codeline>
<codeline lineno="568"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="569"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="570"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="571"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="572"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="573"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="574"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_ND6_RDNSS_MAX_DNS_SERVERS<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="575"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">default</highlight><highlight class="normal">:</highlight></codeline>
<codeline lineno="576"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Unrecognized<sp/>option,<sp/>abort.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="577"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1a5c508f5734163d7ce6ac7c1227500867" kindref="member">ND6_STATS_INC</ref>(nd6.proterr);</highlight></codeline>
<codeline lineno="578"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="579"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="580"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>option<sp/>length<sp/>is<sp/>checked<sp/>earlier<sp/>to<sp/>be<sp/>non-zero<sp/>to<sp/>make<sp/>sure<sp/>loop<sp/>ends<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="581"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>offset<sp/>+=<sp/>8<sp/>*<sp/>((<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)<ref refid="shell_8c_1aff2566f4c366b48d73479bef43ee4d2e" kindref="member">buffer</ref>[1]);</highlight></codeline>
<codeline lineno="582"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="583"><highlight class="normal"></highlight></codeline>
<codeline lineno="584"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;<sp/></highlight><highlight class="comment">/*<sp/>ICMP6_TYPE_RA<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="585"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="586"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="prot_2icmp6_8h_1a6e10428d8f6102013b30013065716858a0f6702d62de5f873e0afe7431d878207" kindref="member">ICMP6_TYPE_RD</ref>:<sp/></highlight><highlight class="comment">/*<sp/>Redirect<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="587"><highlight class="normal"><sp/><sp/>{</highlight></codeline>
<codeline lineno="588"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structredirect__header" kindref="compound">redirect_header</ref><sp/>*redir_hdr;</highlight></codeline>
<codeline lineno="589"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structlladdr__option" kindref="compound">lladdr_option</ref><sp/>*lladdr_opt;</highlight></codeline>
<codeline lineno="590"><highlight class="normal"><sp/><sp/><sp/><sp/>ip6_addr_t<sp/>tmp;</highlight></codeline>
<codeline lineno="591"><highlight class="normal"></highlight></codeline>
<codeline lineno="592"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Check<sp/>that<sp/>Redir<sp/>header<sp/>fits<sp/>in<sp/>packet.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="593"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(p-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref><sp/>&lt;<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structredirect__header" kindref="compound">redirect_header</ref>))<sp/>{</highlight></codeline>
<codeline lineno="594"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>@todo<sp/>debug<sp/>message<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="595"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(p);</highlight></codeline>
<codeline lineno="596"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1a5c508f5734163d7ce6ac7c1227500867" kindref="member">ND6_STATS_INC</ref>(nd6.lenerr);</highlight></codeline>
<codeline lineno="597"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1a5c508f5734163d7ce6ac7c1227500867" kindref="member">ND6_STATS_INC</ref>(nd6.drop);</highlight></codeline>
<codeline lineno="598"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="599"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="600"><highlight class="normal"></highlight></codeline>
<codeline lineno="601"><highlight class="normal"><sp/><sp/><sp/><sp/>redir_hdr<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structredirect__header" kindref="compound">redirect_header</ref><sp/>*)p-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref>;</highlight></codeline>
<codeline lineno="602"><highlight class="normal"></highlight></codeline>
<codeline lineno="603"><highlight class="normal"><sp/><sp/><sp/><sp/>if<sp/>(p-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref><sp/>&gt;=<sp/>(</highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structredirect__header" kindref="compound">redirect_header</ref>)<sp/>+<sp/>2))<sp/>{</highlight></codeline>
<codeline lineno="604"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>lladdr_opt<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structlladdr__option" kindref="compound">lladdr_option</ref><sp/>*)((<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref>*)p-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref><sp/>+<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structredirect__header" kindref="compound">redirect_header</ref>));</highlight></codeline>
<codeline lineno="605"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(p-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref><sp/>&lt;<sp/>(</highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structredirect__header" kindref="compound">redirect_header</ref>)<sp/>+<sp/>(lladdr_opt-&gt;length<sp/>&lt;&lt;<sp/>3)))<sp/>{</highlight></codeline>
<codeline lineno="606"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>lladdr_opt<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="607"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="608"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="609"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>lladdr_opt<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="610"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="611"><highlight class="normal"></highlight></codeline>
<codeline lineno="612"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Copy<sp/>original<sp/>destination<sp/>address<sp/>to<sp/>current<sp/>source<sp/>address,<sp/>to<sp/>have<sp/>an<sp/>aligned<sp/>copy.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="613"><highlight class="normal"><sp/><sp/><sp/><sp/>ip6_addr_set(&amp;tmp,<sp/>&amp;(redir_hdr-&gt;destination_address));</highlight></codeline>
<codeline lineno="614"><highlight class="normal"></highlight></codeline>
<codeline lineno="615"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Find<sp/>dest<sp/>address<sp/>in<sp/>cache<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="616"><highlight class="normal"><sp/><sp/><sp/><sp/>i<sp/>=<sp/>nd6_find_destination_cache_entry(&amp;tmp);</highlight></codeline>
<codeline lineno="617"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(i<sp/>&lt;<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="618"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Destination<sp/>not<sp/>in<sp/>cache,<sp/>drop<sp/>packet.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="619"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(p);</highlight></codeline>
<codeline lineno="620"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="621"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="622"><highlight class="normal"></highlight></codeline>
<codeline lineno="623"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Set<sp/>the<sp/>new<sp/>target<sp/>address.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="624"><highlight class="normal"><sp/><sp/><sp/><sp/>ip6_addr_set(&amp;(destination_cache[i].next_hop_addr),<sp/>&amp;(redir_hdr-&gt;target_address));</highlight></codeline>
<codeline lineno="625"><highlight class="normal"></highlight></codeline>
<codeline lineno="626"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>If<sp/>Link-layer<sp/>address<sp/>of<sp/>other<sp/>router<sp/>is<sp/>given,<sp/>try<sp/>to<sp/>add<sp/>to<sp/>neighbor<sp/>cache.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="627"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(lladdr_opt<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="628"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(lladdr_opt-&gt;type<sp/>==<sp/><ref refid="prot_2nd6_8h_1a787edcc6357686798581dd714d68c8c1" kindref="member">ND6_OPTION_TYPE_TARGET_LLADDR</ref>)<sp/>{</highlight></codeline>
<codeline lineno="629"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Copy<sp/>target<sp/>address<sp/>to<sp/>current<sp/>source<sp/>address,<sp/>to<sp/>have<sp/>an<sp/>aligned<sp/>copy.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="630"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ip6_addr_set(&amp;tmp,<sp/>&amp;(redir_hdr-&gt;target_address));</highlight></codeline>
<codeline lineno="631"><highlight class="normal"></highlight></codeline>
<codeline lineno="632"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>i<sp/>=<sp/>nd6_find_neighbor_cache_entry(&amp;tmp);</highlight></codeline>
<codeline lineno="633"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(i<sp/>&lt;<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="634"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>i<sp/>=<sp/>nd6_new_neighbor_cache_entry();</highlight></codeline>
<codeline lineno="635"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(i<sp/>&gt;=<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="636"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>neighbor_cache[i].netif<sp/>=<sp/>inp;</highlight></codeline>
<codeline lineno="637"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="lwipopts_8h_1aa1dd57a66b6de8c0593e9e3e8d1411f6" kindref="member">MEMCPY</ref>(neighbor_cache[i].lladdr,<sp/>lladdr_opt-&gt;addr,<sp/>inp-&gt;<ref refid="structnetif_1afe1181561cb16241f3cb5ed01e567d42" kindref="member">hwaddr_len</ref>);</highlight></codeline>
<codeline lineno="638"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ip6_addr_set(&amp;(neighbor_cache[i].next_hop_address),<sp/>&amp;tmp);</highlight></codeline>
<codeline lineno="639"><highlight class="normal"></highlight></codeline>
<codeline lineno="640"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Receiving<sp/>a<sp/>message<sp/>does<sp/>not<sp/>prove<sp/>reachability:<sp/>only<sp/>in<sp/>one<sp/>direction.</highlight></codeline>
<codeline lineno="641"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*<sp/>Delay<sp/>probe<sp/>in<sp/>case<sp/>we<sp/>get<sp/>confirmation<sp/>of<sp/>reachability<sp/>from<sp/>upper<sp/>layer<sp/>(TCP).<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="642"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>neighbor_cache[i].state<sp/>=<sp/>ND6_DELAY;</highlight></codeline>
<codeline lineno="643"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>neighbor_cache[i].counter.delay_time<sp/>=<sp/><ref refid="lwipopts_8h_1a315bd6d4a9d185766dfc3253cd9d7715" kindref="member">LWIP_ND6_DELAY_FIRST_PROBE_TIME</ref><sp/>/<sp/>ND6_TMR_INTERVAL;</highlight></codeline>
<codeline lineno="644"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="645"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="646"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(i<sp/>&gt;=<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="647"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(neighbor_cache[i].state<sp/>==<sp/>ND6_INCOMPLETE)<sp/>{</highlight></codeline>
<codeline lineno="648"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="lwipopts_8h_1aa1dd57a66b6de8c0593e9e3e8d1411f6" kindref="member">MEMCPY</ref>(neighbor_cache[i].lladdr,<sp/>lladdr_opt-&gt;addr,<sp/>inp-&gt;<ref refid="structnetif_1afe1181561cb16241f3cb5ed01e567d42" kindref="member">hwaddr_len</ref>);</highlight></codeline>
<codeline lineno="649"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Receiving<sp/>a<sp/>message<sp/>does<sp/>not<sp/>prove<sp/>reachability:<sp/>only<sp/>in<sp/>one<sp/>direction.</highlight></codeline>
<codeline lineno="650"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*<sp/>Delay<sp/>probe<sp/>in<sp/>case<sp/>we<sp/>get<sp/>confirmation<sp/>of<sp/>reachability<sp/>from<sp/>upper<sp/>layer<sp/>(TCP).<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="651"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>neighbor_cache[i].state<sp/>=<sp/>ND6_DELAY;</highlight></codeline>
<codeline lineno="652"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>neighbor_cache[i].counter.delay_time<sp/>=<sp/><ref refid="lwipopts_8h_1a315bd6d4a9d185766dfc3253cd9d7715" kindref="member">LWIP_ND6_DELAY_FIRST_PROBE_TIME</ref><sp/>/<sp/>ND6_TMR_INTERVAL;</highlight></codeline>
<codeline lineno="653"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="654"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="655"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="656"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="657"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;<sp/></highlight><highlight class="comment">/*<sp/>ICMP6_TYPE_RD<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="658"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="659"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="prot_2icmp6_8h_1a6e10428d8f6102013b30013065716858a1d52ef5024a5822bd622bcb0b9da323d" kindref="member">ICMP6_TYPE_PTB</ref>:<sp/></highlight><highlight class="comment">/*<sp/>Packet<sp/>too<sp/>big<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="660"><highlight class="normal"><sp/><sp/>{</highlight></codeline>
<codeline lineno="661"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structicmp6__hdr" kindref="compound">icmp6_hdr</ref><sp/>*icmp6hdr;<sp/></highlight><highlight class="comment">/*<sp/>Packet<sp/>too<sp/>big<sp/>message<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="662"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structip6__hdr" kindref="compound">ip6_hdr</ref><sp/>*ip6hdr;<sp/></highlight><highlight class="comment">/*<sp/>IPv6<sp/>header<sp/>of<sp/>the<sp/>packet<sp/>which<sp/>caused<sp/>the<sp/>error<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="663"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__compiler__abstraction_1ga4c14294869aceba3ef9d4c0c302d0f33" kindref="member">u32_t</ref><sp/>pmtu;</highlight></codeline>
<codeline lineno="664"><highlight class="normal"><sp/><sp/><sp/><sp/>ip6_addr_t<sp/>tmp;</highlight></codeline>
<codeline lineno="665"><highlight class="normal"></highlight></codeline>
<codeline lineno="666"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Check<sp/>that<sp/>ICMPv6<sp/>header<sp/>+<sp/>IPv6<sp/>header<sp/>fit<sp/>in<sp/>payload<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="667"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(p-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref><sp/>&lt;<sp/>(</highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structicmp6__hdr" kindref="compound">icmp6_hdr</ref>)<sp/>+<sp/><ref refid="prot_2ip6_8h_1afb4c1dc527be76d8f27591dfb726c023" kindref="member">IP6_HLEN</ref>))<sp/>{</highlight></codeline>
<codeline lineno="668"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>drop<sp/>short<sp/>packets<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="669"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(p);</highlight></codeline>
<codeline lineno="670"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1a5c508f5734163d7ce6ac7c1227500867" kindref="member">ND6_STATS_INC</ref>(nd6.lenerr);</highlight></codeline>
<codeline lineno="671"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1a5c508f5734163d7ce6ac7c1227500867" kindref="member">ND6_STATS_INC</ref>(nd6.drop);</highlight></codeline>
<codeline lineno="672"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="673"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="674"><highlight class="normal"></highlight></codeline>
<codeline lineno="675"><highlight class="normal"><sp/><sp/><sp/><sp/>icmp6hdr<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structicmp6__hdr" kindref="compound">icmp6_hdr</ref><sp/>*)p-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref>;</highlight></codeline>
<codeline lineno="676"><highlight class="normal"><sp/><sp/><sp/><sp/>ip6hdr<sp/>=<sp/>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structip6__hdr" kindref="compound">ip6_hdr</ref><sp/>*)((<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref>*)p-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref><sp/>+<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structicmp6__hdr" kindref="compound">icmp6_hdr</ref>));</highlight></codeline>
<codeline lineno="677"><highlight class="normal"></highlight></codeline>
<codeline lineno="678"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Copy<sp/>original<sp/>destination<sp/>address<sp/>to<sp/>current<sp/>source<sp/>address,<sp/>to<sp/>have<sp/>an<sp/>aligned<sp/>copy.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="679"><highlight class="normal"><sp/><sp/><sp/><sp/>ip6_addr_set(&amp;tmp,<sp/>&amp;(ip6hdr-&gt;dest));</highlight></codeline>
<codeline lineno="680"><highlight class="normal"></highlight></codeline>
<codeline lineno="681"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Look<sp/>for<sp/>entry<sp/>in<sp/>destination<sp/>cache.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="682"><highlight class="normal"><sp/><sp/><sp/><sp/>i<sp/>=<sp/>nd6_find_destination_cache_entry(&amp;tmp);</highlight></codeline>
<codeline lineno="683"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(i<sp/>&lt;<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="684"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Destination<sp/>not<sp/>in<sp/>cache,<sp/>drop<sp/>packet.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="685"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(p);</highlight></codeline>
<codeline lineno="686"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="687"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="688"><highlight class="normal"></highlight></codeline>
<codeline lineno="689"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Change<sp/>the<sp/>Path<sp/>MTU.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="690"><highlight class="normal"><sp/><sp/><sp/><sp/>pmtu<sp/>=<sp/><ref refid="def_8c_1a14f94347a5b9b9e3602705b75b7ae524" kindref="member">lwip_htonl</ref>(icmp6hdr-&gt;data);</highlight></codeline>
<codeline lineno="691"><highlight class="normal"><sp/><sp/><sp/><sp/>destination_cache[i].pmtu<sp/>=<sp/>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)<ref refid="def_8h_1a748f5df614a3fc989e8900fd229d6e4e" kindref="member">LWIP_MIN</ref>(pmtu,<sp/>0xFFFF);</highlight></codeline>
<codeline lineno="692"><highlight class="normal"></highlight></codeline>
<codeline lineno="693"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;<sp/></highlight><highlight class="comment">/*<sp/>ICMP6_TYPE_PTB<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="694"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="695"><highlight class="normal"></highlight></codeline>
<codeline lineno="696"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">default</highlight><highlight class="normal">:</highlight></codeline>
<codeline lineno="697"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="stats_8h_1a5c508f5734163d7ce6ac7c1227500867" kindref="member">ND6_STATS_INC</ref>(nd6.proterr);</highlight></codeline>
<codeline lineno="698"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="stats_8h_1a5c508f5734163d7ce6ac7c1227500867" kindref="member">ND6_STATS_INC</ref>(nd6.drop);</highlight></codeline>
<codeline lineno="699"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;<sp/></highlight><highlight class="comment">/*<sp/>default<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="700"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="701"><highlight class="normal"></highlight></codeline>
<codeline lineno="702"><highlight class="normal"><sp/><sp/><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(p);</highlight></codeline>
<codeline lineno="703"><highlight class="normal">}</highlight></codeline>
<codeline lineno="704"><highlight class="normal"></highlight></codeline>
<codeline lineno="705"><highlight class="normal"></highlight></codeline>
<codeline lineno="715"><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="716"><highlight class="normal">nd6_tmr(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">)</highlight></codeline>
<codeline lineno="717"><highlight class="normal">{</highlight></codeline>
<codeline lineno="718"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga9cd1d7891fe315de1201e2c6e45f4f57" kindref="member">s8_t</ref><sp/>i;</highlight></codeline>
<codeline lineno="719"><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="720"><highlight class="normal"></highlight></codeline>
<codeline lineno="721"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Process<sp/>neighbor<sp/>entries.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="722"><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_1ab2fe15bdb4e0a41f295eb5577b11ad16" kindref="member">LWIP_ND6_NUM_NEIGHBORS</ref>;<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="723"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">switch</highlight><highlight class="normal"><sp/>(neighbor_cache[i].<ref refid="structnetif_1a809cc57c0dff09c5c9ae45b02c2002f3" kindref="member">state</ref>)<sp/>{</highlight></codeline>
<codeline lineno="724"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/>ND6_INCOMPLETE:</highlight></codeline>
<codeline lineno="725"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((neighbor_cache[i].counter.probes_sent<sp/>&gt;=<sp/><ref refid="lwipopts_8h_1a980909018aed54adc10dd68be3572b30" kindref="member">LWIP_ND6_MAX_MULTICAST_SOLICIT</ref>)<sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="726"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(!neighbor_cache[i].isrouter))<sp/>{</highlight></codeline>
<codeline lineno="727"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Retries<sp/>exceeded.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="728"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>nd6_free_neighbor_cache_entry(i);</highlight></codeline>
<codeline lineno="729"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="730"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Send<sp/>a<sp/>NS<sp/>for<sp/>this<sp/>entry.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="731"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>neighbor_cache[i].counter.probes_sent++;</highlight></codeline>
<codeline lineno="732"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>nd6_send_neighbor_cache_probe(&amp;neighbor_cache[i],<sp/>ND6_SEND_FLAG_MULTICAST_DEST);</highlight></codeline>
<codeline lineno="733"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="734"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="735"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/>ND6_REACHABLE:</highlight></codeline>
<codeline lineno="736"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Send<sp/>queued<sp/>packets,<sp/>if<sp/>any<sp/>are<sp/>left.<sp/>Should<sp/>have<sp/>been<sp/>sent<sp/>already.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="737"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(neighbor_cache[i].q<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="738"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>nd6_send_q(i);</highlight></codeline>
<codeline lineno="739"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="740"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(neighbor_cache[i].counter.reachable_time<sp/>&lt;=<sp/>ND6_TMR_INTERVAL)<sp/>{</highlight></codeline>
<codeline lineno="741"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Change<sp/>to<sp/>stale<sp/>state.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="742"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>neighbor_cache[i].state<sp/>=<sp/>ND6_STALE;</highlight></codeline>
<codeline lineno="743"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>neighbor_cache[i].counter.stale_time<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="744"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="745"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>neighbor_cache[i].counter.reachable_time<sp/>-=<sp/>ND6_TMR_INTERVAL;</highlight></codeline>
<codeline lineno="746"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="747"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="748"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/>ND6_STALE:</highlight></codeline>
<codeline lineno="749"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>neighbor_cache[i].counter.stale_time++;</highlight></codeline>
<codeline lineno="750"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="751"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/>ND6_DELAY:</highlight></codeline>
<codeline lineno="752"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(neighbor_cache[i].counter.delay_time<sp/>&lt;=<sp/>1)<sp/>{</highlight></codeline>
<codeline lineno="753"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Change<sp/>to<sp/>PROBE<sp/>state.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="754"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>neighbor_cache[i].state<sp/>=<sp/>ND6_PROBE;</highlight></codeline>
<codeline lineno="755"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>neighbor_cache[i].counter.probes_sent<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="756"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="757"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>neighbor_cache[i].counter.delay_time--;</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/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="760"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/>ND6_PROBE:</highlight></codeline>
<codeline lineno="761"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((neighbor_cache[i].counter.probes_sent<sp/>&gt;=<sp/><ref refid="lwipopts_8h_1a980909018aed54adc10dd68be3572b30" kindref="member">LWIP_ND6_MAX_MULTICAST_SOLICIT</ref>)<sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="762"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(!neighbor_cache[i].isrouter))<sp/>{</highlight></codeline>
<codeline lineno="763"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Retries<sp/>exceeded.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="764"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>nd6_free_neighbor_cache_entry(i);</highlight></codeline>
<codeline lineno="765"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="766"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Send<sp/>a<sp/>NS<sp/>for<sp/>this<sp/>entry.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="767"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>neighbor_cache[i].counter.probes_sent++;</highlight></codeline>
<codeline lineno="768"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>nd6_send_neighbor_cache_probe(&amp;neighbor_cache[i],<sp/>0);</highlight></codeline>
<codeline lineno="769"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="770"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="771"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/>ND6_NO_ENTRY:</highlight></codeline>
<codeline lineno="772"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">default</highlight><highlight class="normal">:</highlight></codeline>
<codeline lineno="773"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Do<sp/>nothing.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="774"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="775"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="776"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="777"><highlight class="normal"></highlight></codeline>
<codeline lineno="778"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Process<sp/>destination<sp/>entries.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="779"><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_1acad118b1ae886e80137a1d4f0fb19672" kindref="member">LWIP_ND6_NUM_DESTINATIONS</ref>;<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="780"><highlight class="normal"><sp/><sp/><sp/><sp/>destination_cache[i].age++;</highlight></codeline>
<codeline lineno="781"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="782"><highlight class="normal"></highlight></codeline>
<codeline lineno="783"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Process<sp/>router<sp/>entries.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="784"><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_1a75e81a96148f266c8fad8c0bcab2f36a" kindref="member">LWIP_ND6_NUM_ROUTERS</ref>;<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="785"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(default_router_list[i].neighbor_entry<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="786"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Active<sp/>entry.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="787"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(default_router_list[i].invalidation_timer<sp/>&gt;<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="788"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>default_router_list[i].invalidation_timer<sp/>-=<sp/>ND6_TMR_INTERVAL<sp/>/<sp/>1000;</highlight></codeline>
<codeline lineno="789"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="790"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(default_router_list[i].invalidation_timer<sp/>&lt;<sp/>ND6_TMR_INTERVAL<sp/>/<sp/>1000)<sp/>{</highlight></codeline>
<codeline lineno="791"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Less<sp/>than<sp/>1<sp/>second<sp/>remaining.<sp/>Clear<sp/>this<sp/>entry.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="792"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>default_router_list[i].neighbor_entry-&gt;isrouter<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="793"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>default_router_list[i].neighbor_entry<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="794"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>default_router_list[i].invalidation_timer<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="795"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>default_router_list[i].flags<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="796"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="797"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="798"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="799"><highlight class="normal"></highlight></codeline>
<codeline lineno="800"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Process<sp/>prefix<sp/>entries.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="801"><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_1ad9cc576b5951f1b5e1c2b0d0bb831d9a" kindref="member">LWIP_ND6_NUM_PREFIXES</ref>;<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="802"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(prefix_list[i].<ref refid="structnetif" kindref="compound">netif</ref><sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="803"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(prefix_list[i].invalidation_timer<sp/>&lt;<sp/>ND6_TMR_INTERVAL<sp/>/<sp/>1000)<sp/>{</highlight></codeline>
<codeline lineno="804"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Entry<sp/>timed<sp/>out,<sp/>remove<sp/>it<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="805"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>prefix_list[i].invalidation_timer<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="806"><highlight class="normal"></highlight></codeline>
<codeline lineno="807"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_IPV6_AUTOCONFIG</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="808"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>If<sp/>any<sp/>addresses<sp/>were<sp/>configured<sp/>with<sp/>this<sp/>prefix,<sp/>remove<sp/>them<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="809"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(prefix_list[i].<ref refid="structnetif_1a1c171db6097bbb6f09f63549a66e00ea" kindref="member">flags</ref><sp/>&amp;<sp/>ND6_PREFIX_AUTOCONFIG_ADDRESS_GENERATED)<sp/>{</highlight></codeline>
<codeline lineno="810"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__compiler__abstraction_1ga9cd1d7891fe315de1201e2c6e45f4f57" kindref="member">s8_t</ref><sp/>j;</highlight></codeline>
<codeline lineno="811"><highlight class="normal"></highlight></codeline>
<codeline lineno="812"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(j<sp/>=<sp/>1;<sp/>j<sp/>&lt;<sp/><ref refid="lwipopts_8h_1a16c1b672604bfb0a66a6aeeb854589d3" kindref="member">LWIP_IPV6_NUM_ADDRESSES</ref>;<sp/>j++)<sp/>{</highlight></codeline>
<codeline lineno="813"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((netif_ip6_addr_state(prefix_list[i].<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>j)<sp/>!=<sp/>IP6_ADDR_INVALID)<sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="814"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ip6_addr_netcmp(&amp;prefix_list[i].prefix,<sp/>netif_ip6_addr(prefix_list[i].<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>j)))<sp/>{</highlight></codeline>
<codeline lineno="815"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>netif_ip6_addr_set_state(prefix_list[i].<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>j,<sp/>IP6_ADDR_INVALID);</highlight></codeline>
<codeline lineno="816"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>prefix_list[i].flags<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="817"><highlight class="normal"></highlight></codeline>
<codeline lineno="818"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Exit<sp/>loop.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="819"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="820"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="821"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="822"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="823"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_IPV6_AUTOCONFIG<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="824"><highlight class="normal"></highlight></codeline>
<codeline lineno="825"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>prefix_list[i].netif<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="826"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>prefix_list[i].flags<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="827"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="828"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>prefix_list[i].invalidation_timer<sp/>-=<sp/>ND6_TMR_INTERVAL<sp/>/<sp/>1000;</highlight></codeline>
<codeline lineno="829"><highlight class="normal"></highlight></codeline>
<codeline lineno="830"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_IPV6_AUTOCONFIG</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="831"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Initiate<sp/>address<sp/>autoconfiguration<sp/>for<sp/>this<sp/>prefix,<sp/>if<sp/>conditions<sp/>are<sp/>met.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="832"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(prefix_list[i].<ref refid="structnetif" kindref="compound">netif</ref>-&gt;ip6_autoconfig_enabled<sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="833"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(prefix_list[i].flags<sp/>&amp;<sp/>ND6_PREFIX_AUTOCONFIG_AUTONOMOUS)<sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="834"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>!(prefix_list[i].flags<sp/>&amp;<sp/>ND6_PREFIX_AUTOCONFIG_ADDRESS_GENERATED))<sp/>{</highlight></codeline>
<codeline lineno="835"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__compiler__abstraction_1ga9cd1d7891fe315de1201e2c6e45f4f57" kindref="member">s8_t</ref><sp/>j;</highlight></codeline>
<codeline lineno="836"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Try<sp/>to<sp/>get<sp/>an<sp/>address<sp/>on<sp/>this<sp/>netif<sp/>that<sp/>is<sp/>invalid.</highlight></codeline>
<codeline lineno="837"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*<sp/>Skip<sp/>0<sp/>index<sp/>(link-local<sp/>address)<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="838"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(j<sp/>=<sp/>1;<sp/>j<sp/>&lt;<sp/><ref refid="lwipopts_8h_1a16c1b672604bfb0a66a6aeeb854589d3" kindref="member">LWIP_IPV6_NUM_ADDRESSES</ref>;<sp/>j++)<sp/>{</highlight></codeline>
<codeline lineno="839"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(netif_ip6_addr_state(prefix_list[i].<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>j)<sp/>==<sp/>IP6_ADDR_INVALID)<sp/>{</highlight></codeline>
<codeline lineno="840"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Generate<sp/>an<sp/>address<sp/>using<sp/>this<sp/>prefix<sp/>and<sp/>interface<sp/>ID<sp/>from<sp/>link-local<sp/>address.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="841"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>netif_ip6_addr_set_parts(prefix_list[i].<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>j,</highlight></codeline>
<codeline lineno="842"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>prefix_list[i].prefix.addr[0],<sp/>prefix_list[i].prefix.addr[1],</highlight></codeline>
<codeline lineno="843"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>netif_ip6_addr(prefix_list[i].<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>0)-&gt;addr[2],<sp/>netif_ip6_addr(prefix_list[i].<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>0)-&gt;addr[3]);</highlight></codeline>
<codeline lineno="844"><highlight class="normal"></highlight></codeline>
<codeline lineno="845"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Mark<sp/>it<sp/>as<sp/>tentative<sp/>(DAD<sp/>will<sp/>be<sp/>performed<sp/>if<sp/>configured).<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="846"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>netif_ip6_addr_set_state(prefix_list[i].<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>j,<sp/>IP6_ADDR_TENTATIVE);</highlight></codeline>
<codeline lineno="847"><highlight class="normal"></highlight></codeline>
<codeline lineno="848"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Mark<sp/>this<sp/>prefix<sp/>with<sp/>ADDRESS_GENERATED,<sp/>so<sp/>that<sp/>we<sp/>don&apos;t<sp/>try<sp/>again.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="849"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>prefix_list[i].flags<sp/>|=<sp/>ND6_PREFIX_AUTOCONFIG_ADDRESS_GENERATED;</highlight></codeline>
<codeline lineno="850"><highlight class="normal"></highlight></codeline>
<codeline lineno="851"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Exit<sp/>loop.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="852"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="853"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="854"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="855"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="856"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_IPV6_AUTOCONFIG<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="857"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="858"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="859"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="860"><highlight class="normal"></highlight></codeline>
<codeline lineno="861"><highlight class="normal"></highlight></codeline>
<codeline lineno="862"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Process<sp/>our<sp/>own<sp/>addresses,<sp/>if<sp/>DAD<sp/>configured.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="863"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(<ref refid="structnetif" kindref="compound">netif</ref><sp/>=<sp/><ref refid="netif_8h_1a1c8141eaa98f6dc6dfddbb23a706656c" kindref="member">netif_list</ref>;<sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;<sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>=<sp/><ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1ae77736b64df442242795220d76be6b86" kindref="member">next</ref>)<sp/>{</highlight></codeline>
<codeline lineno="864"><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_1a16c1b672604bfb0a66a6aeeb854589d3" kindref="member">LWIP_IPV6_NUM_ADDRESSES</ref>;<sp/>++i)<sp/>{</highlight></codeline>
<codeline lineno="865"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>addr_state<sp/>=<sp/>netif_ip6_addr_state(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>i);</highlight></codeline>
<codeline lineno="866"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ip6_addr_istentative(addr_state))<sp/>{</highlight></codeline>
<codeline lineno="867"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((addr_state<sp/>&amp;<sp/>IP6_ADDR_TENTATIVE_COUNT_MASK)<sp/>&gt;=<sp/><ref refid="lwipopts_8h_1ad8489522d34f37e42b4001bab3781bcb" kindref="member">LWIP_IPV6_DUP_DETECT_ATTEMPTS</ref>)<sp/>{</highlight></codeline>
<codeline lineno="868"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>No<sp/>NA<sp/>received<sp/>in<sp/>response.<sp/>Mark<sp/>address<sp/>as<sp/>valid.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="869"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>netif_ip6_addr_set_state(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>i,<sp/>IP6_ADDR_PREFERRED);</highlight></codeline>
<codeline lineno="870"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>@todo<sp/>implement<sp/>preferred<sp/>and<sp/>valid<sp/>lifetimes.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="871"><highlight class="normal"><sp/><sp/><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/>(<ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1a1c171db6097bbb6f09f63549a66e00ea" kindref="member">flags</ref><sp/>&amp;<sp/><ref refid="group__netif__flags_1gab47d7d130693dc155f480a5bf447725e" kindref="member">NETIF_FLAG_UP</ref>)<sp/>{</highlight></codeline>
<codeline lineno="872"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Send<sp/>a<sp/>NS<sp/>for<sp/>this<sp/>address.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="873"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>nd6_send_ns(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>netif_ip6_addr(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>i),<sp/>ND6_SEND_FLAG_MULTICAST_DEST);</highlight></codeline>
<codeline lineno="874"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>tentative:<sp/>set<sp/>next<sp/>state<sp/>by<sp/>increasing<sp/>by<sp/>one<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="875"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>netif_ip6_addr_set_state(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>i,<sp/>addr_state<sp/>+<sp/>1);</highlight></codeline>
<codeline lineno="876"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>@todo<sp/>send<sp/>max<sp/>1<sp/>NS<sp/>per<sp/>tmr<sp/>call?<sp/>enable<sp/>return*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="877"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*return;*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="878"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="879"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="880"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="881"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="882"><highlight class="normal"></highlight></codeline>
<codeline lineno="883"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_IPV6_SEND_ROUTER_SOLICIT</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="884"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Send<sp/>router<sp/>solicitation<sp/>messages,<sp/>if<sp/>necessary.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="885"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(<ref refid="structnetif" kindref="compound">netif</ref><sp/>=<sp/><ref refid="netif_8h_1a1c8141eaa98f6dc6dfddbb23a706656c" kindref="member">netif_list</ref>;<sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;<sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>=<sp/><ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1ae77736b64df442242795220d76be6b86" kindref="member">next</ref>)<sp/>{</highlight></codeline>
<codeline lineno="886"><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;rs_count<sp/>&gt;<sp/>0)<sp/>&amp;&amp;<sp/>(<ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1a1c171db6097bbb6f09f63549a66e00ea" kindref="member">flags</ref><sp/>&amp;<sp/><ref refid="group__netif__flags_1gab47d7d130693dc155f480a5bf447725e" kindref="member">NETIF_FLAG_UP</ref>)<sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="887"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(!ip6_addr_isinvalid(netif_ip6_addr_state(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>0))))<sp/>{</highlight></codeline>
<codeline lineno="888"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(nd6_send_rs(<ref refid="structnetif" kindref="compound">netif</ref>)<sp/>==<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" kindref="member">ERR_OK</ref>)<sp/>{</highlight></codeline>
<codeline lineno="889"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structnetif" kindref="compound">netif</ref>-&gt;rs_count--;</highlight></codeline>
<codeline lineno="890"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="891"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="892"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="893"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_IPV6_SEND_ROUTER_SOLICIT<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="894"><highlight class="normal"></highlight></codeline>
<codeline lineno="895"><highlight class="normal">}</highlight></codeline>
<codeline lineno="896"><highlight class="normal"></highlight></codeline>
<codeline lineno="902"><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="903"><highlight class="normal">nd6_send_neighbor_cache_probe(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>nd6_neighbor_cache_entry<sp/>*entry,<sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/><ref refid="structnetif_1a1c171db6097bbb6f09f63549a66e00ea" kindref="member">flags</ref>)</highlight></codeline>
<codeline lineno="904"><highlight class="normal">{</highlight></codeline>
<codeline lineno="905"><highlight class="normal"><sp/><sp/>nd6_send_ns(entry-&gt;netif,<sp/>&amp;entry-&gt;next_hop_address,<sp/><ref refid="structnetif_1a1c171db6097bbb6f09f63549a66e00ea" kindref="member">flags</ref>);</highlight></codeline>
<codeline lineno="906"><highlight class="normal">}</highlight></codeline>
<codeline lineno="907"><highlight class="normal"></highlight></codeline>
<codeline lineno="915"><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="916"><highlight class="normal">nd6_send_ns(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>ip6_addr_t<sp/>*target_addr,<sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/><ref refid="structnetif_1a1c171db6097bbb6f09f63549a66e00ea" kindref="member">flags</ref>)</highlight></codeline>
<codeline lineno="917"><highlight class="normal">{</highlight></codeline>
<codeline lineno="918"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structns__header" kindref="compound">ns_header</ref><sp/>*ns_hdr;</highlight></codeline>
<codeline lineno="919"><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="920"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>ip6_addr_t<sp/>*src_addr;</highlight></codeline>
<codeline lineno="921"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>lladdr_opt_len;</highlight></codeline>
<codeline lineno="922"><highlight class="normal"></highlight></codeline>
<codeline lineno="923"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ip6_addr_isvalid(netif_ip6_addr_state(<ref refid="structnetif" kindref="compound">netif</ref>,0)))<sp/>{</highlight></codeline>
<codeline lineno="924"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Use<sp/>link-local<sp/>address<sp/>as<sp/>source<sp/>address.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="925"><highlight class="normal"><sp/><sp/><sp/><sp/>src_addr<sp/>=<sp/>netif_ip6_addr(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>0);</highlight></codeline>
<codeline lineno="926"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>calculate<sp/>option<sp/>length<sp/>(in<sp/>8-byte-blocks)<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="927"><highlight class="normal"><sp/><sp/><sp/><sp/>lladdr_opt_len<sp/>=<sp/>((<ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1afe1181561cb16241f3cb5ed01e567d42" kindref="member">hwaddr_len</ref><sp/>+<sp/>2)<sp/>+<sp/>7)<sp/>&gt;&gt;<sp/>3;</highlight></codeline>
<codeline lineno="928"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="929"><highlight class="normal"><sp/><sp/><sp/><sp/>src_addr<sp/>=<sp/>IP6_ADDR_ANY6;</highlight></codeline>
<codeline lineno="930"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Option<sp/>&quot;MUST<sp/>NOT<sp/>be<sp/>included<sp/>when<sp/>the<sp/>source<sp/>IP<sp/>address<sp/>is<sp/>the<sp/>unspecified<sp/>address.&quot;<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="931"><highlight class="normal"><sp/><sp/><sp/><sp/>lladdr_opt_len<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="932"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="933"><highlight class="normal"></highlight></codeline>
<codeline lineno="934"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Allocate<sp/>a<sp/>packet.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="935"><highlight class="normal"><sp/><sp/>p<sp/>=<sp/><ref refid="group__pbuf_1gacfcb0a2af918658ba0afe36499c65f47" kindref="member">pbuf_alloc</ref>(<ref refid="group__pbuf_1ggaee1baa59bb2f85ba575b5a8619ac1ebfafcc1e506061ba69dfa142eb6b3da5f13" kindref="member">PBUF_IP</ref>,<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structns__header" kindref="compound">ns_header</ref>)<sp/>+<sp/>(lladdr_opt_len<sp/>&lt;&lt;<sp/>3),<sp/><ref refid="group__pbuf_1ggab7e0e32fcc292c0d7107721766ed92fbac5e9f28455bca98944a030d4b84ecfab" kindref="member">PBUF_RAM</ref>);</highlight></codeline>
<codeline lineno="936"><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="937"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="stats_8h_1a5c508f5734163d7ce6ac7c1227500867" kindref="member">ND6_STATS_INC</ref>(nd6.memerr);</highlight></codeline>
<codeline lineno="938"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="939"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="940"><highlight class="normal"></highlight></codeline>
<codeline lineno="941"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Set<sp/>fields.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="942"><highlight class="normal"><sp/><sp/>ns_hdr<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structns__header" kindref="compound">ns_header</ref><sp/>*)p-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref>;</highlight></codeline>
<codeline lineno="943"><highlight class="normal"></highlight></codeline>
<codeline lineno="944"><highlight class="normal"><sp/><sp/>ns_hdr-&gt;type<sp/>=<sp/><ref refid="prot_2icmp6_8h_1a6e10428d8f6102013b30013065716858a0d8d8717c6c34053d1101932c23929fe" kindref="member">ICMP6_TYPE_NS</ref>;</highlight></codeline>
<codeline lineno="945"><highlight class="normal"><sp/><sp/>ns_hdr-&gt;code<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="946"><highlight class="normal"><sp/><sp/>ns_hdr-&gt;chksum<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="947"><highlight class="normal"><sp/><sp/>ns_hdr-&gt;reserved<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="948"><highlight class="normal"><sp/><sp/>ip6_addr_set(&amp;(ns_hdr-&gt;target_address),<sp/>target_addr);</highlight></codeline>
<codeline lineno="949"><highlight class="normal"></highlight></codeline>
<codeline lineno="950"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(lladdr_opt_len<sp/>!=<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="951"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structlladdr__option" kindref="compound">lladdr_option</ref><sp/>*lladdr_opt<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structlladdr__option" kindref="compound">lladdr_option</ref><sp/>*)((<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref>*)p-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref><sp/>+<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structns__header" kindref="compound">ns_header</ref>));</highlight></codeline>
<codeline lineno="952"><highlight class="normal"><sp/><sp/><sp/><sp/>lladdr_opt-&gt;type<sp/>=<sp/><ref refid="prot_2nd6_8h_1a68ce8550a20cd30093d6e79e1ca51842" kindref="member">ND6_OPTION_TYPE_SOURCE_LLADDR</ref>;</highlight></codeline>
<codeline lineno="953"><highlight class="normal"><sp/><sp/><sp/><sp/>lladdr_opt-&gt;length<sp/>=<sp/>(<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref>)lladdr_opt_len;</highlight></codeline>
<codeline lineno="954"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="lwipopts_8h_1a8c6e3c1e4f74acb16376188dbf8909ec" kindref="member">SMEMCPY</ref>(lladdr_opt-&gt;addr,<sp/><ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1aee967965d999fc1a4c40a66709304e69" kindref="member">hwaddr</ref>,<sp/><ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1afe1181561cb16241f3cb5ed01e567d42" kindref="member">hwaddr_len</ref>);</highlight></codeline>
<codeline lineno="955"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="956"><highlight class="normal"></highlight></codeline>
<codeline lineno="957"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Generate<sp/>the<sp/>solicited<sp/>node<sp/>address<sp/>for<sp/>the<sp/>target<sp/>address.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="958"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(flags<sp/>&amp;<sp/>ND6_SEND_FLAG_MULTICAST_DEST)<sp/>{</highlight></codeline>
<codeline lineno="959"><highlight class="normal"><sp/><sp/><sp/><sp/>ip6_addr_set_solicitednode(&amp;multicast_address,<sp/>target_addr-&gt;addr[3]);</highlight></codeline>
<codeline lineno="960"><highlight class="normal"><sp/><sp/><sp/><sp/>target_addr<sp/>=<sp/>&amp;multicast_address;</highlight></codeline>
<codeline lineno="961"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="962"><highlight class="normal"></highlight></codeline>
<codeline lineno="963"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>CHECKSUM_GEN_ICMP6</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="964"><highlight class="normal"><sp/><sp/><ref refid="netif_8h_1ad968df1b35c2fae368e087966e3bc677" kindref="member">IF__NETIF_CHECKSUM_ENABLED</ref>(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>NETIF_CHECKSUM_GEN_ICMP6)<sp/>{</highlight></codeline>
<codeline lineno="965"><highlight class="normal"><sp/><sp/><sp/><sp/>ns_hdr-&gt;chksum<sp/>=<sp/>ip6_chksum_pseudo(p,<sp/><ref refid="prot_2ip6_8h_1ab277ee09b6e7200fc1cfe28482b886a6" kindref="member">IP6_NEXTH_ICMP6</ref>,<sp/>p-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref>,<sp/>src_addr,</highlight></codeline>
<codeline lineno="966"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>target_addr);</highlight></codeline>
<codeline lineno="967"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="968"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>CHECKSUM_GEN_ICMP6<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="969"><highlight class="normal"></highlight></codeline>
<codeline lineno="970"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Send<sp/>the<sp/>packet<sp/>out.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="971"><highlight class="normal"><sp/><sp/><ref refid="stats_8h_1a5c508f5734163d7ce6ac7c1227500867" kindref="member">ND6_STATS_INC</ref>(nd6.xmit);</highlight></codeline>
<codeline lineno="972"><highlight class="normal"><sp/><sp/>ip6_output_if(p,<sp/>(src_addr<sp/>==<sp/>IP6_ADDR_ANY6)<sp/>?<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref><sp/>:<sp/>src_addr,<sp/>target_addr,</highlight></codeline>
<codeline lineno="973"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="lwipopts_8h_1a82193577b4045e1ac1533c4341a2bd79" kindref="member">LWIP_ICMP6_HL</ref>,<sp/>0,<sp/><ref refid="prot_2ip6_8h_1ab277ee09b6e7200fc1cfe28482b886a6" kindref="member">IP6_NEXTH_ICMP6</ref>,<sp/><ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="974"><highlight class="normal"><sp/><sp/><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(p);</highlight></codeline>
<codeline lineno="975"><highlight class="normal">}</highlight></codeline>
<codeline lineno="976"><highlight class="normal"></highlight></codeline>
<codeline lineno="984"><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="985"><highlight class="normal">nd6_send_na(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>ip6_addr_t<sp/>*target_addr,<sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>flags)</highlight></codeline>
<codeline lineno="986"><highlight class="normal">{</highlight></codeline>
<codeline lineno="987"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structna__header" kindref="compound">na_header</ref><sp/>*na_hdr;</highlight></codeline>
<codeline lineno="988"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structlladdr__option" kindref="compound">lladdr_option</ref><sp/>*lladdr_opt;</highlight></codeline>
<codeline lineno="989"><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="990"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>ip6_addr_t<sp/>*src_addr;</highlight></codeline>
<codeline lineno="991"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>ip6_addr_t<sp/>*dest_addr;</highlight></codeline>
<codeline lineno="992"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>lladdr_opt_len;</highlight></codeline>
<codeline lineno="993"><highlight class="normal"></highlight></codeline>
<codeline lineno="994"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Use<sp/>link-local<sp/>address<sp/>as<sp/>source<sp/>address.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="995"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>src_addr<sp/>=<sp/>netif_ip6_addr(netif,<sp/>0);<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="996"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Use<sp/>target<sp/>address<sp/>as<sp/>source<sp/>address.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="997"><highlight class="normal"><sp/><sp/>src_addr<sp/>=<sp/>target_addr;</highlight></codeline>
<codeline lineno="998"><highlight class="normal"></highlight></codeline>
<codeline lineno="999"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Allocate<sp/>a<sp/>packet.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1000"><highlight class="normal"><sp/><sp/>lladdr_opt_len<sp/>=<sp/>((<ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1afe1181561cb16241f3cb5ed01e567d42" kindref="member">hwaddr_len</ref><sp/>+<sp/>2)<sp/>&gt;&gt;<sp/>3)<sp/>+<sp/>(((<ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1afe1181561cb16241f3cb5ed01e567d42" kindref="member">hwaddr_len</ref><sp/>+<sp/>2)<sp/>&amp;<sp/>0x07)<sp/>?<sp/>1<sp/>:<sp/>0);</highlight></codeline>
<codeline lineno="1001"><highlight class="normal"><sp/><sp/>p<sp/>=<sp/><ref refid="group__pbuf_1gacfcb0a2af918658ba0afe36499c65f47" kindref="member">pbuf_alloc</ref>(<ref refid="group__pbuf_1ggaee1baa59bb2f85ba575b5a8619ac1ebfafcc1e506061ba69dfa142eb6b3da5f13" kindref="member">PBUF_IP</ref>,<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structna__header" kindref="compound">na_header</ref>)<sp/>+<sp/>(lladdr_opt_len<sp/>&lt;&lt;<sp/>3),<sp/><ref refid="group__pbuf_1ggab7e0e32fcc292c0d7107721766ed92fbac5e9f28455bca98944a030d4b84ecfab" kindref="member">PBUF_RAM</ref>);</highlight></codeline>
<codeline lineno="1002"><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="1003"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="stats_8h_1a5c508f5734163d7ce6ac7c1227500867" kindref="member">ND6_STATS_INC</ref>(nd6.memerr);</highlight></codeline>
<codeline lineno="1004"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="1005"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1006"><highlight class="normal"></highlight></codeline>
<codeline lineno="1007"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Set<sp/>fields.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1008"><highlight class="normal"><sp/><sp/>na_hdr<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structna__header" kindref="compound">na_header</ref><sp/>*)p-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref>;</highlight></codeline>
<codeline lineno="1009"><highlight class="normal"><sp/><sp/>lladdr_opt<sp/>=<sp/>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structlladdr__option" kindref="compound">lladdr_option</ref><sp/>*)((<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref>*)p-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref><sp/>+<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structna__header" kindref="compound">na_header</ref>));</highlight></codeline>
<codeline lineno="1010"><highlight class="normal"></highlight></codeline>
<codeline lineno="1011"><highlight class="normal"><sp/><sp/>na_hdr-&gt;type<sp/>=<sp/><ref refid="prot_2icmp6_8h_1a6e10428d8f6102013b30013065716858a1f99d333f425c28d3840e029cc9c46f3" kindref="member">ICMP6_TYPE_NA</ref>;</highlight></codeline>
<codeline lineno="1012"><highlight class="normal"><sp/><sp/>na_hdr-&gt;code<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1013"><highlight class="normal"><sp/><sp/>na_hdr-&gt;chksum<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1014"><highlight class="normal"><sp/><sp/>na_hdr-&gt;flags<sp/>=<sp/>flags<sp/>&amp;<sp/>0xf0;</highlight></codeline>
<codeline lineno="1015"><highlight class="normal"><sp/><sp/>na_hdr-&gt;reserved[0]<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1016"><highlight class="normal"><sp/><sp/>na_hdr-&gt;reserved[1]<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1017"><highlight class="normal"><sp/><sp/>na_hdr-&gt;reserved[2]<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1018"><highlight class="normal"><sp/><sp/>ip6_addr_set(&amp;(na_hdr-&gt;target_address),<sp/>target_addr);</highlight></codeline>
<codeline lineno="1019"><highlight class="normal"></highlight></codeline>
<codeline lineno="1020"><highlight class="normal"><sp/><sp/>lladdr_opt-&gt;type<sp/>=<sp/><ref refid="prot_2nd6_8h_1a787edcc6357686798581dd714d68c8c1" kindref="member">ND6_OPTION_TYPE_TARGET_LLADDR</ref>;</highlight></codeline>
<codeline lineno="1021"><highlight class="normal"><sp/><sp/>lladdr_opt-&gt;length<sp/>=<sp/>(<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref>)lladdr_opt_len;</highlight></codeline>
<codeline lineno="1022"><highlight class="normal"><sp/><sp/><ref refid="lwipopts_8h_1a8c6e3c1e4f74acb16376188dbf8909ec" kindref="member">SMEMCPY</ref>(lladdr_opt-&gt;addr,<sp/><ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1aee967965d999fc1a4c40a66709304e69" kindref="member">hwaddr</ref>,<sp/><ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1afe1181561cb16241f3cb5ed01e567d42" kindref="member">hwaddr_len</ref>);</highlight></codeline>
<codeline lineno="1023"><highlight class="normal"></highlight></codeline>
<codeline lineno="1024"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Generate<sp/>the<sp/>solicited<sp/>node<sp/>address<sp/>for<sp/>the<sp/>target<sp/>address.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1025"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(flags<sp/>&amp;<sp/>ND6_SEND_FLAG_MULTICAST_DEST)<sp/>{</highlight></codeline>
<codeline lineno="1026"><highlight class="normal"><sp/><sp/><sp/><sp/>ip6_addr_set_solicitednode(&amp;multicast_address,<sp/>target_addr-&gt;addr[3]);</highlight></codeline>
<codeline lineno="1027"><highlight class="normal"><sp/><sp/><sp/><sp/>dest_addr<sp/>=<sp/>&amp;multicast_address;</highlight></codeline>
<codeline lineno="1028"><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/>(flags<sp/>&amp;<sp/>ND6_SEND_FLAG_ALLNODES_DEST)<sp/>{</highlight></codeline>
<codeline lineno="1029"><highlight class="normal"><sp/><sp/><sp/><sp/>ip6_addr_set_allnodes_linklocal(&amp;multicast_address);</highlight></codeline>
<codeline lineno="1030"><highlight class="normal"><sp/><sp/><sp/><sp/>dest_addr<sp/>=<sp/>&amp;multicast_address;</highlight></codeline>
<codeline lineno="1031"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="1032"><highlight class="normal"><sp/><sp/><sp/><sp/>dest_addr<sp/>=<sp/>ip6_current_src_addr();</highlight></codeline>
<codeline lineno="1033"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1034"><highlight class="normal"></highlight></codeline>
<codeline lineno="1035"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>CHECKSUM_GEN_ICMP6</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1036"><highlight class="normal"><sp/><sp/><ref refid="netif_8h_1ad968df1b35c2fae368e087966e3bc677" kindref="member">IF__NETIF_CHECKSUM_ENABLED</ref>(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>NETIF_CHECKSUM_GEN_ICMP6)<sp/>{</highlight></codeline>
<codeline lineno="1037"><highlight class="normal"><sp/><sp/><sp/><sp/>na_hdr-&gt;chksum<sp/>=<sp/>ip6_chksum_pseudo(p,<sp/><ref refid="prot_2ip6_8h_1ab277ee09b6e7200fc1cfe28482b886a6" kindref="member">IP6_NEXTH_ICMP6</ref>,<sp/>p-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref>,<sp/>src_addr,</highlight></codeline>
<codeline lineno="1038"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>dest_addr);</highlight></codeline>
<codeline lineno="1039"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1040"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>CHECKSUM_GEN_ICMP6<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1041"><highlight class="normal"></highlight></codeline>
<codeline lineno="1042"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Send<sp/>the<sp/>packet<sp/>out.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1043"><highlight class="normal"><sp/><sp/><ref refid="stats_8h_1a5c508f5734163d7ce6ac7c1227500867" kindref="member">ND6_STATS_INC</ref>(nd6.xmit);</highlight></codeline>
<codeline lineno="1044"><highlight class="normal"><sp/><sp/>ip6_output_if(p,<sp/>src_addr,<sp/>dest_addr,</highlight></codeline>
<codeline lineno="1045"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="lwipopts_8h_1a82193577b4045e1ac1533c4341a2bd79" kindref="member">LWIP_ICMP6_HL</ref>,<sp/>0,<sp/><ref refid="prot_2ip6_8h_1ab277ee09b6e7200fc1cfe28482b886a6" kindref="member">IP6_NEXTH_ICMP6</ref>,<sp/><ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="1046"><highlight class="normal"><sp/><sp/><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(p);</highlight></codeline>
<codeline lineno="1047"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1048"><highlight class="normal"></highlight></codeline>
<codeline lineno="1049"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_IPV6_SEND_ROUTER_SOLICIT</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1050"><highlight class="normal"></highlight></codeline>
<codeline lineno="1055"><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="1056"><highlight class="normal">nd6_send_rs(</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="1057"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1058"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structrs__header" kindref="compound">rs_header</ref><sp/>*rs_hdr;</highlight></codeline>
<codeline lineno="1059"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structlladdr__option" kindref="compound">lladdr_option</ref><sp/>*lladdr_opt;</highlight></codeline>
<codeline lineno="1060"><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="1061"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>ip6_addr_t<sp/>*src_addr;</highlight></codeline>
<codeline lineno="1062"><highlight class="normal"><sp/><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref><sp/>err;</highlight></codeline>
<codeline lineno="1063"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>lladdr_opt_len<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1064"><highlight class="normal"></highlight></codeline>
<codeline lineno="1065"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Link-local<sp/>source<sp/>address,<sp/>or<sp/>unspecified<sp/>address?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1066"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ip6_addr_isvalid(netif_ip6_addr_state(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>0)))<sp/>{</highlight></codeline>
<codeline lineno="1067"><highlight class="normal"><sp/><sp/><sp/><sp/>src_addr<sp/>=<sp/>netif_ip6_addr(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>0);</highlight></codeline>
<codeline lineno="1068"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="1069"><highlight class="normal"><sp/><sp/><sp/><sp/>src_addr<sp/>=<sp/>IP6_ADDR_ANY6;</highlight></codeline>
<codeline lineno="1070"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1071"><highlight class="normal"></highlight></codeline>
<codeline lineno="1072"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Generate<sp/>the<sp/>all<sp/>routers<sp/>target<sp/>address.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1073"><highlight class="normal"><sp/><sp/>ip6_addr_set_allrouters_linklocal(&amp;multicast_address);</highlight></codeline>
<codeline lineno="1074"><highlight class="normal"></highlight></codeline>
<codeline lineno="1075"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Allocate<sp/>a<sp/>packet.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1076"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(src_addr<sp/>!=<sp/>IP6_ADDR_ANY6)<sp/>{</highlight></codeline>
<codeline lineno="1077"><highlight class="normal"><sp/><sp/><sp/><sp/>lladdr_opt_len<sp/>=<sp/>((<ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1afe1181561cb16241f3cb5ed01e567d42" kindref="member">hwaddr_len</ref><sp/>+<sp/>2)<sp/>&gt;&gt;<sp/>3)<sp/>+<sp/>(((<ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1afe1181561cb16241f3cb5ed01e567d42" kindref="member">hwaddr_len</ref><sp/>+<sp/>2)<sp/>&amp;<sp/>0x07)<sp/>?<sp/>1<sp/>:<sp/>0);</highlight></codeline>
<codeline lineno="1078"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1079"><highlight class="normal"><sp/><sp/>p<sp/>=<sp/><ref refid="group__pbuf_1gacfcb0a2af918658ba0afe36499c65f47" kindref="member">pbuf_alloc</ref>(<ref refid="group__pbuf_1ggaee1baa59bb2f85ba575b5a8619ac1ebfafcc1e506061ba69dfa142eb6b3da5f13" kindref="member">PBUF_IP</ref>,<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structrs__header" kindref="compound">rs_header</ref>)<sp/>+<sp/>(lladdr_opt_len<sp/>&lt;&lt;<sp/>3),<sp/><ref refid="group__pbuf_1ggab7e0e32fcc292c0d7107721766ed92fbac5e9f28455bca98944a030d4b84ecfab" kindref="member">PBUF_RAM</ref>);</highlight></codeline>
<codeline lineno="1080"><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="1081"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="stats_8h_1a5c508f5734163d7ce6ac7c1227500867" kindref="member">ND6_STATS_INC</ref>(nd6.memerr);</highlight></codeline>
<codeline lineno="1082"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadca05c91366f1b5203a5db9a241b415cd63" kindref="member">ERR_BUF</ref>;</highlight></codeline>
<codeline lineno="1083"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1084"><highlight class="normal"></highlight></codeline>
<codeline lineno="1085"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Set<sp/>fields.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1086"><highlight class="normal"><sp/><sp/>rs_hdr<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structrs__header" kindref="compound">rs_header</ref><sp/>*)p-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref>;</highlight></codeline>
<codeline lineno="1087"><highlight class="normal"></highlight></codeline>
<codeline lineno="1088"><highlight class="normal"><sp/><sp/>rs_hdr-&gt;type<sp/>=<sp/><ref refid="prot_2icmp6_8h_1a6e10428d8f6102013b30013065716858a670d95494c9282f646ac442d81d9a780" kindref="member">ICMP6_TYPE_RS</ref>;</highlight></codeline>
<codeline lineno="1089"><highlight class="normal"><sp/><sp/>rs_hdr-&gt;code<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1090"><highlight class="normal"><sp/><sp/>rs_hdr-&gt;chksum<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1091"><highlight class="normal"><sp/><sp/>rs_hdr-&gt;reserved<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1092"><highlight class="normal"></highlight></codeline>
<codeline lineno="1093"><highlight class="normal"><sp/><sp/>if<sp/>(src_addr<sp/>!=<sp/>IP6_ADDR_ANY6)<sp/>{</highlight></codeline>
<codeline lineno="1094"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Include<sp/>our<sp/>hw<sp/>address.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1095"><highlight class="normal"><sp/><sp/><sp/><sp/>lladdr_opt<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structlladdr__option" kindref="compound">lladdr_option</ref><sp/>*)((<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref>*)p-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref><sp/>+<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structrs__header" kindref="compound">rs_header</ref>));</highlight></codeline>
<codeline lineno="1096"><highlight class="normal"><sp/><sp/><sp/><sp/>lladdr_opt-&gt;type<sp/>=<sp/><ref refid="prot_2nd6_8h_1a68ce8550a20cd30093d6e79e1ca51842" kindref="member">ND6_OPTION_TYPE_SOURCE_LLADDR</ref>;</highlight></codeline>
<codeline lineno="1097"><highlight class="normal"><sp/><sp/><sp/><sp/>lladdr_opt-&gt;length<sp/>=<sp/>(<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref>)lladdr_opt_len;</highlight></codeline>
<codeline lineno="1098"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="lwipopts_8h_1a8c6e3c1e4f74acb16376188dbf8909ec" kindref="member">SMEMCPY</ref>(lladdr_opt-&gt;addr,<sp/><ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1aee967965d999fc1a4c40a66709304e69" kindref="member">hwaddr</ref>,<sp/><ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1afe1181561cb16241f3cb5ed01e567d42" kindref="member">hwaddr_len</ref>);</highlight></codeline>
<codeline lineno="1099"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1100"><highlight class="normal"></highlight></codeline>
<codeline lineno="1101"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>CHECKSUM_GEN_ICMP6</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1102"><highlight class="normal"><sp/><sp/><ref refid="netif_8h_1ad968df1b35c2fae368e087966e3bc677" kindref="member">IF__NETIF_CHECKSUM_ENABLED</ref>(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>NETIF_CHECKSUM_GEN_ICMP6)<sp/>{</highlight></codeline>
<codeline lineno="1103"><highlight class="normal"><sp/><sp/><sp/><sp/>rs_hdr-&gt;chksum<sp/>=<sp/>ip6_chksum_pseudo(p,<sp/><ref refid="prot_2ip6_8h_1ab277ee09b6e7200fc1cfe28482b886a6" kindref="member">IP6_NEXTH_ICMP6</ref>,<sp/>p-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref>,<sp/>src_addr,</highlight></codeline>
<codeline lineno="1104"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>&amp;multicast_address);</highlight></codeline>
<codeline lineno="1105"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1106"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>CHECKSUM_GEN_ICMP6<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1107"><highlight class="normal"></highlight></codeline>
<codeline lineno="1108"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Send<sp/>the<sp/>packet<sp/>out.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1109"><highlight class="normal"><sp/><sp/><ref refid="stats_8h_1a5c508f5734163d7ce6ac7c1227500867" kindref="member">ND6_STATS_INC</ref>(nd6.xmit);</highlight></codeline>
<codeline lineno="1110"><highlight class="normal"></highlight></codeline>
<codeline lineno="1111"><highlight class="normal"><sp/><sp/>err<sp/>=<sp/>ip6_output_if(p,<sp/>(src_addr<sp/>==<sp/>IP6_ADDR_ANY6)<sp/>?<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref><sp/>:<sp/>src_addr,<sp/>&amp;multicast_address,</highlight></codeline>
<codeline lineno="1112"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="lwipopts_8h_1a82193577b4045e1ac1533c4341a2bd79" kindref="member">LWIP_ICMP6_HL</ref>,<sp/>0,<sp/><ref refid="prot_2ip6_8h_1ab277ee09b6e7200fc1cfe28482b886a6" kindref="member">IP6_NEXTH_ICMP6</ref>,<sp/><ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="1113"><highlight class="normal"><sp/><sp/><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(p);</highlight></codeline>
<codeline lineno="1114"><highlight class="normal"></highlight></codeline>
<codeline lineno="1115"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>err;</highlight></codeline>
<codeline lineno="1116"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1117"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_IPV6_SEND_ROUTER_SOLICIT<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1118"><highlight class="normal"></highlight></codeline>
<codeline lineno="1126"><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__compiler__abstraction_1ga9cd1d7891fe315de1201e2c6e45f4f57" kindref="member">s8_t</ref></highlight></codeline>
<codeline lineno="1127"><highlight class="normal">nd6_find_neighbor_cache_entry(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>ip6_addr_t<sp/>*ip6addr)</highlight></codeline>
<codeline lineno="1128"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1129"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga9cd1d7891fe315de1201e2c6e45f4f57" kindref="member">s8_t</ref><sp/>i;</highlight></codeline>
<codeline lineno="1130"><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_1ab2fe15bdb4e0a41f295eb5577b11ad16" kindref="member">LWIP_ND6_NUM_NEIGHBORS</ref>;<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="1131"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ip6_addr_cmp(ip6addr,<sp/>&amp;(neighbor_cache[i].next_hop_address)))<sp/>{</highlight></codeline>
<codeline lineno="1132"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>i;</highlight></codeline>
<codeline lineno="1133"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1134"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1135"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>-1;</highlight></codeline>
<codeline lineno="1136"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1137"><highlight class="normal"></highlight></codeline>
<codeline lineno="1147"><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__compiler__abstraction_1ga9cd1d7891fe315de1201e2c6e45f4f57" kindref="member">s8_t</ref></highlight></codeline>
<codeline lineno="1148"><highlight class="normal">nd6_new_neighbor_cache_entry(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">)</highlight></codeline>
<codeline lineno="1149"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1150"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga9cd1d7891fe315de1201e2c6e45f4f57" kindref="member">s8_t</ref><sp/>i;</highlight></codeline>
<codeline lineno="1151"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga9cd1d7891fe315de1201e2c6e45f4f57" kindref="member">s8_t</ref><sp/>j;</highlight></codeline>
<codeline lineno="1152"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga4c14294869aceba3ef9d4c0c302d0f33" kindref="member">u32_t</ref><sp/>time;</highlight></codeline>
<codeline lineno="1153"><highlight class="normal"></highlight></codeline>
<codeline lineno="1154"><highlight class="normal"></highlight></codeline>
<codeline lineno="1155"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>First,<sp/>try<sp/>to<sp/>find<sp/>an<sp/>empty<sp/>entry.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1156"><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_1ab2fe15bdb4e0a41f295eb5577b11ad16" kindref="member">LWIP_ND6_NUM_NEIGHBORS</ref>;<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="1157"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(neighbor_cache[i].state<sp/>==<sp/>ND6_NO_ENTRY)<sp/>{</highlight></codeline>
<codeline lineno="1158"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>i;</highlight></codeline>
<codeline lineno="1159"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1160"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1161"><highlight class="normal"></highlight></codeline>
<codeline lineno="1162"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>We<sp/>need<sp/>to<sp/>recycle<sp/>an<sp/>entry.<sp/>in<sp/>general,<sp/>do<sp/>not<sp/>recycle<sp/>if<sp/>it<sp/>is<sp/>a<sp/>router.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1163"><highlight class="normal"></highlight></codeline>
<codeline lineno="1164"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Next,<sp/>try<sp/>to<sp/>find<sp/>a<sp/>Stale<sp/>entry.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1165"><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_1ab2fe15bdb4e0a41f295eb5577b11ad16" kindref="member">LWIP_ND6_NUM_NEIGHBORS</ref>;<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="1166"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((neighbor_cache[i].state<sp/>==<sp/>ND6_STALE)<sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="1167"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(!neighbor_cache[i].isrouter))<sp/>{</highlight></codeline>
<codeline lineno="1168"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>nd6_free_neighbor_cache_entry(i);</highlight></codeline>
<codeline lineno="1169"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>i;</highlight></codeline>
<codeline lineno="1170"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1171"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1172"><highlight class="normal"></highlight></codeline>
<codeline lineno="1173"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Next,<sp/>try<sp/>to<sp/>find<sp/>a<sp/>Probe<sp/>entry.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1174"><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_1ab2fe15bdb4e0a41f295eb5577b11ad16" kindref="member">LWIP_ND6_NUM_NEIGHBORS</ref>;<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="1175"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((neighbor_cache[i].state<sp/>==<sp/>ND6_PROBE)<sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="1176"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(!neighbor_cache[i].isrouter))<sp/>{</highlight></codeline>
<codeline lineno="1177"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>nd6_free_neighbor_cache_entry(i);</highlight></codeline>
<codeline lineno="1178"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>i;</highlight></codeline>
<codeline lineno="1179"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1180"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1181"><highlight class="normal"></highlight></codeline>
<codeline lineno="1182"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Next,<sp/>try<sp/>to<sp/>find<sp/>a<sp/>Delayed<sp/>entry.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1183"><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_1ab2fe15bdb4e0a41f295eb5577b11ad16" kindref="member">LWIP_ND6_NUM_NEIGHBORS</ref>;<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="1184"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((neighbor_cache[i].state<sp/>==<sp/>ND6_DELAY)<sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="1185"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(!neighbor_cache[i].isrouter))<sp/>{</highlight></codeline>
<codeline lineno="1186"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>nd6_free_neighbor_cache_entry(i);</highlight></codeline>
<codeline lineno="1187"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>i;</highlight></codeline>
<codeline lineno="1188"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1189"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1190"><highlight class="normal"></highlight></codeline>
<codeline lineno="1191"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Next,<sp/>try<sp/>to<sp/>find<sp/>the<sp/>oldest<sp/>reachable<sp/>entry.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1192"><highlight class="normal"><sp/><sp/>time<sp/>=<sp/>0xfffffffful;</highlight></codeline>
<codeline lineno="1193"><highlight class="normal"><sp/><sp/>j<sp/>=<sp/>-1;</highlight></codeline>
<codeline lineno="1194"><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_1ab2fe15bdb4e0a41f295eb5577b11ad16" kindref="member">LWIP_ND6_NUM_NEIGHBORS</ref>;<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="1195"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((neighbor_cache[i].state<sp/>==<sp/>ND6_REACHABLE)<sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="1196"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(!neighbor_cache[i].isrouter))<sp/>{</highlight></codeline>
<codeline lineno="1197"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(neighbor_cache[i].counter.reachable_time<sp/>&lt;<sp/>time)<sp/>{</highlight></codeline>
<codeline lineno="1198"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>j<sp/>=<sp/>i;</highlight></codeline>
<codeline lineno="1199"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>time<sp/>=<sp/>neighbor_cache[i].counter.reachable_time;</highlight></codeline>
<codeline lineno="1200"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1201"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1202"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1203"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(j<sp/>&gt;=<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="1204"><highlight class="normal"><sp/><sp/><sp/><sp/>nd6_free_neighbor_cache_entry(j);</highlight></codeline>
<codeline lineno="1205"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>j;</highlight></codeline>
<codeline lineno="1206"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1207"><highlight class="normal"></highlight></codeline>
<codeline lineno="1208"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Next,<sp/>find<sp/>oldest<sp/>incomplete<sp/>entry<sp/>without<sp/>queued<sp/>packets.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1209"><highlight class="normal"><sp/><sp/>time<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1210"><highlight class="normal"><sp/><sp/>j<sp/>=<sp/>-1;</highlight></codeline>
<codeline lineno="1211"><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_1ab2fe15bdb4e0a41f295eb5577b11ad16" kindref="member">LWIP_ND6_NUM_NEIGHBORS</ref>;<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="1212"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(</highlight></codeline>
<codeline lineno="1213"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(neighbor_cache[i].q<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="1214"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(neighbor_cache[i].state<sp/>==<sp/>ND6_INCOMPLETE)<sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="1215"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(!neighbor_cache[i].isrouter))<sp/>{</highlight></codeline>
<codeline lineno="1216"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(neighbor_cache[i].counter.probes_sent<sp/>&gt;=<sp/>time)<sp/>{</highlight></codeline>
<codeline lineno="1217"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>j<sp/>=<sp/>i;</highlight></codeline>
<codeline lineno="1218"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>time<sp/>=<sp/>neighbor_cache[i].counter.probes_sent;</highlight></codeline>
<codeline lineno="1219"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1220"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1221"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1222"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(j<sp/>&gt;=<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="1223"><highlight class="normal"><sp/><sp/><sp/><sp/>nd6_free_neighbor_cache_entry(j);</highlight></codeline>
<codeline lineno="1224"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>j;</highlight></codeline>
<codeline lineno="1225"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1226"><highlight class="normal"></highlight></codeline>
<codeline lineno="1227"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Next,<sp/>find<sp/>oldest<sp/>incomplete<sp/>entry<sp/>with<sp/>queued<sp/>packets.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1228"><highlight class="normal"><sp/><sp/>time<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1229"><highlight class="normal"><sp/><sp/>j<sp/>=<sp/>-1;</highlight></codeline>
<codeline lineno="1230"><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_1ab2fe15bdb4e0a41f295eb5577b11ad16" kindref="member">LWIP_ND6_NUM_NEIGHBORS</ref>;<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="1231"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((neighbor_cache[i].state<sp/>==<sp/>ND6_INCOMPLETE)<sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="1232"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(!neighbor_cache[i].isrouter))<sp/>{</highlight></codeline>
<codeline lineno="1233"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(neighbor_cache[i].counter.probes_sent<sp/>&gt;=<sp/>time)<sp/>{</highlight></codeline>
<codeline lineno="1234"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>j<sp/>=<sp/>i;</highlight></codeline>
<codeline lineno="1235"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>time<sp/>=<sp/>neighbor_cache[i].counter.probes_sent;</highlight></codeline>
<codeline lineno="1236"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1237"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1238"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1239"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(j<sp/>&gt;=<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="1240"><highlight class="normal"><sp/><sp/><sp/><sp/>nd6_free_neighbor_cache_entry(j);</highlight></codeline>
<codeline lineno="1241"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>j;</highlight></codeline>
<codeline lineno="1242"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1243"><highlight class="normal"></highlight></codeline>
<codeline lineno="1244"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>No<sp/>more<sp/>entries<sp/>to<sp/>try.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1245"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>-1;</highlight></codeline>
<codeline lineno="1246"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1247"><highlight class="normal"></highlight></codeline>
<codeline lineno="1254"><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1255"><highlight class="normal">nd6_free_neighbor_cache_entry(<ref refid="group__compiler__abstraction_1ga9cd1d7891fe315de1201e2c6e45f4f57" kindref="member">s8_t</ref><sp/>i)</highlight></codeline>
<codeline lineno="1256"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1257"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((i<sp/>&lt;<sp/>0)<sp/>||<sp/>(i<sp/>&gt;=<sp/><ref refid="lwipopts_8h_1ab2fe15bdb4e0a41f295eb5577b11ad16" kindref="member">LWIP_ND6_NUM_NEIGHBORS</ref>))<sp/>{</highlight></codeline>
<codeline lineno="1258"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="1259"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1260"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(neighbor_cache[i].isrouter)<sp/>{</highlight></codeline>
<codeline lineno="1261"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>isrouter<sp/>needs<sp/>to<sp/>be<sp/>cleared<sp/>before<sp/>deleting<sp/>a<sp/>neighbor<sp/>cache<sp/>entry<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1262"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="1263"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1264"><highlight class="normal"></highlight></codeline>
<codeline lineno="1265"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Free<sp/>any<sp/>queued<sp/>packets.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1266"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(neighbor_cache[i].q<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1267"><highlight class="normal"><sp/><sp/><sp/><sp/>nd6_free_q(neighbor_cache[i].q);</highlight></codeline>
<codeline lineno="1268"><highlight class="normal"><sp/><sp/><sp/><sp/>neighbor_cache[i].q<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="1269"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1270"><highlight class="normal"></highlight></codeline>
<codeline lineno="1271"><highlight class="normal"><sp/><sp/>neighbor_cache[i].state<sp/>=<sp/>ND6_NO_ENTRY;</highlight></codeline>
<codeline lineno="1272"><highlight class="normal"><sp/><sp/>neighbor_cache[i].isrouter<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1273"><highlight class="normal"><sp/><sp/>neighbor_cache[i].netif<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="1274"><highlight class="normal"><sp/><sp/>neighbor_cache[i].counter.reachable_time<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1275"><highlight class="normal"><sp/><sp/>ip6_addr_set_zero(&amp;(neighbor_cache[i].next_hop_address));</highlight></codeline>
<codeline lineno="1276"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1277"><highlight class="normal"></highlight></codeline>
<codeline lineno="1285"><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__compiler__abstraction_1ga9cd1d7891fe315de1201e2c6e45f4f57" kindref="member">s8_t</ref></highlight></codeline>
<codeline lineno="1286"><highlight class="normal">nd6_find_destination_cache_entry(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>ip6_addr_t<sp/>*ip6addr)</highlight></codeline>
<codeline lineno="1287"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1288"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga9cd1d7891fe315de1201e2c6e45f4f57" kindref="member">s8_t</ref><sp/>i;</highlight></codeline>
<codeline lineno="1289"><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_1acad118b1ae886e80137a1d4f0fb19672" kindref="member">LWIP_ND6_NUM_DESTINATIONS</ref>;<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="1290"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ip6_addr_cmp(ip6addr,<sp/>&amp;(destination_cache[i].destination_addr)))<sp/>{</highlight></codeline>
<codeline lineno="1291"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>i;</highlight></codeline>
<codeline lineno="1292"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1293"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1294"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>-1;</highlight></codeline>
<codeline lineno="1295"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1296"><highlight class="normal"></highlight></codeline>
<codeline lineno="1304"><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__compiler__abstraction_1ga9cd1d7891fe315de1201e2c6e45f4f57" kindref="member">s8_t</ref></highlight></codeline>
<codeline lineno="1305"><highlight class="normal">nd6_new_destination_cache_entry(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">)</highlight></codeline>
<codeline lineno="1306"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1307"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga9cd1d7891fe315de1201e2c6e45f4f57" kindref="member">s8_t</ref><sp/>i,<sp/>j;</highlight></codeline>
<codeline lineno="1308"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga4c14294869aceba3ef9d4c0c302d0f33" kindref="member">u32_t</ref><sp/>age;</highlight></codeline>
<codeline lineno="1309"><highlight class="normal"></highlight></codeline>
<codeline lineno="1310"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Find<sp/>an<sp/>empty<sp/>entry.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1311"><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_1acad118b1ae886e80137a1d4f0fb19672" kindref="member">LWIP_ND6_NUM_DESTINATIONS</ref>;<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="1312"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ip6_addr_isany(&amp;(destination_cache[i].destination_addr)))<sp/>{</highlight></codeline>
<codeline lineno="1313"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>i;</highlight></codeline>
<codeline lineno="1314"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1315"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1316"><highlight class="normal"></highlight></codeline>
<codeline lineno="1317"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Find<sp/>oldest<sp/>entry.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1318"><highlight class="normal"><sp/><sp/>age<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1319"><highlight class="normal"><sp/><sp/>j<sp/>=<sp/><ref refid="lwipopts_8h_1acad118b1ae886e80137a1d4f0fb19672" kindref="member">LWIP_ND6_NUM_DESTINATIONS</ref><sp/>-<sp/>1;</highlight></codeline>
<codeline lineno="1320"><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_1acad118b1ae886e80137a1d4f0fb19672" kindref="member">LWIP_ND6_NUM_DESTINATIONS</ref>;<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="1321"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(destination_cache[i].age<sp/>&gt;<sp/>age)<sp/>{</highlight></codeline>
<codeline lineno="1322"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>j<sp/>=<sp/>i;</highlight></codeline>
<codeline lineno="1323"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1324"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1325"><highlight class="normal"></highlight></codeline>
<codeline lineno="1326"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>j;</highlight></codeline>
<codeline lineno="1327"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1328"><highlight class="normal"></highlight></codeline>
<codeline lineno="1335"><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1336"><highlight class="normal">nd6_clear_destination_cache(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">)</highlight></codeline>
<codeline lineno="1337"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1338"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>i;</highlight></codeline>
<codeline lineno="1339"><highlight class="normal"></highlight></codeline>
<codeline lineno="1340"><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_1acad118b1ae886e80137a1d4f0fb19672" kindref="member">LWIP_ND6_NUM_DESTINATIONS</ref>;<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="1341"><highlight class="normal"><sp/><sp/><sp/><sp/>ip6_addr_set_any(&amp;destination_cache[i].destination_addr);</highlight></codeline>
<codeline lineno="1342"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1343"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1344"><highlight class="normal"></highlight></codeline>
<codeline lineno="1351"><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__compiler__abstraction_1ga9cd1d7891fe315de1201e2c6e45f4f57" kindref="member">s8_t</ref></highlight></codeline>
<codeline lineno="1352"><highlight class="normal">nd6_is_prefix_in_netif(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>ip6_addr_t<sp/>*ip6addr,<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="1353"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1354"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga9cd1d7891fe315de1201e2c6e45f4f57" kindref="member">s8_t</ref><sp/>i;</highlight></codeline>
<codeline lineno="1355"><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_1ad9cc576b5951f1b5e1c2b0d0bb831d9a" kindref="member">LWIP_ND6_NUM_PREFIXES</ref>;<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="1356"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((prefix_list[i].<ref refid="structnetif" kindref="compound">netif</ref><sp/>==<sp/><ref refid="structnetif" kindref="compound">netif</ref>)<sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="1357"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(prefix_list[i].invalidation_timer<sp/>&gt;<sp/>0)<sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="1358"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ip6_addr_netcmp(ip6addr,<sp/>&amp;(prefix_list[i].prefix)))<sp/>{</highlight></codeline>
<codeline lineno="1359"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>1;</highlight></codeline>
<codeline lineno="1360"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1361"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1362"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Check<sp/>to<sp/>see<sp/>if<sp/>address<sp/>prefix<sp/>matches<sp/>a<sp/>(manually?)<sp/>configured<sp/>address.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1363"><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_1a16c1b672604bfb0a66a6aeeb854589d3" kindref="member">LWIP_IPV6_NUM_ADDRESSES</ref>;<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="1364"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ip6_addr_isvalid(netif_ip6_addr_state(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>i))<sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="1365"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ip6_addr_netcmp(ip6addr,<sp/>netif_ip6_addr(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>i)))<sp/>{</highlight></codeline>
<codeline lineno="1366"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>1;</highlight></codeline>
<codeline lineno="1367"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1368"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1369"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0;</highlight></codeline>
<codeline lineno="1370"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1371"><highlight class="normal"></highlight></codeline>
<codeline lineno="1380"><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__compiler__abstraction_1ga9cd1d7891fe315de1201e2c6e45f4f57" kindref="member">s8_t</ref></highlight></codeline>
<codeline lineno="1381"><highlight class="normal">nd6_select_router(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>ip6_addr_t<sp/>*ip6addr,<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="1382"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1383"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga9cd1d7891fe315de1201e2c6e45f4f57" kindref="member">s8_t</ref><sp/>i;</highlight></codeline>
<codeline lineno="1384"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>last_router<sp/>is<sp/>used<sp/>for<sp/>round-robin<sp/>router<sp/>selection<sp/>(as<sp/>recommended</highlight></codeline>
<codeline lineno="1385"><highlight class="comment"><sp/><sp/><sp/>*<sp/>in<sp/>RFC).<sp/>This<sp/>is<sp/>more<sp/>robust<sp/>in<sp/>case<sp/>one<sp/>router<sp/>is<sp/>not<sp/>reachable,</highlight></codeline>
<codeline lineno="1386"><highlight class="comment"><sp/><sp/><sp/>*<sp/>we<sp/>are<sp/>not<sp/>stuck<sp/>trying<sp/>to<sp/>resolve<sp/>it.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1387"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__compiler__abstraction_1ga9cd1d7891fe315de1201e2c6e45f4f57" kindref="member">s8_t</ref><sp/>last_router;</highlight></codeline>
<codeline lineno="1388"><highlight class="normal"><sp/><sp/>(void)ip6addr;<sp/></highlight><highlight class="comment">/*<sp/>@todo<sp/>match<sp/>preferred<sp/>routes!!<sp/>(must<sp/>implement<sp/>ND6_OPTION_TYPE_ROUTE_INFO)<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1389"><highlight class="normal"></highlight></codeline>
<codeline lineno="1390"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>@todo:<sp/>implement<sp/>default<sp/>router<sp/>preference<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1391"><highlight class="normal"></highlight></codeline>
<codeline lineno="1392"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Look<sp/>for<sp/>reachable<sp/>routers.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1393"><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_1a75e81a96148f266c8fad8c0bcab2f36a" kindref="member">LWIP_ND6_NUM_ROUTERS</ref>;<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="1394"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(++last_router<sp/>&gt;=<sp/><ref refid="lwipopts_8h_1a75e81a96148f266c8fad8c0bcab2f36a" kindref="member">LWIP_ND6_NUM_ROUTERS</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1395"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>last_router<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1396"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1397"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((default_router_list[i].neighbor_entry<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="1398"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(<ref refid="structnetif" kindref="compound">netif</ref><sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref><sp/>?<sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>==<sp/>default_router_list[i].neighbor_entry-&gt;netif<sp/>:<sp/>1)<sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="1399"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(default_router_list[i].invalidation_timer<sp/>&gt;<sp/>0)<sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="1400"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(default_router_list[i].neighbor_entry-&gt;state<sp/>==<sp/>ND6_REACHABLE))<sp/>{</highlight></codeline>
<codeline lineno="1401"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>i;</highlight></codeline>
<codeline lineno="1402"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1403"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1404"><highlight class="normal"></highlight></codeline>
<codeline lineno="1405"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Look<sp/>for<sp/>router<sp/>in<sp/>other<sp/>reachability<sp/>states,<sp/>but<sp/>still<sp/>valid<sp/>according<sp/>to<sp/>timer.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1406"><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_1a75e81a96148f266c8fad8c0bcab2f36a" kindref="member">LWIP_ND6_NUM_ROUTERS</ref>;<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="1407"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(++last_router<sp/>&gt;=<sp/><ref refid="lwipopts_8h_1a75e81a96148f266c8fad8c0bcab2f36a" kindref="member">LWIP_ND6_NUM_ROUTERS</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1408"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>last_router<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1409"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1410"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((default_router_list[i].neighbor_entry<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="1411"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(<ref refid="structnetif" kindref="compound">netif</ref><sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref><sp/>?<sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>==<sp/>default_router_list[i].neighbor_entry-&gt;netif<sp/>:<sp/>1)<sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="1412"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(default_router_list[i].invalidation_timer<sp/>&gt;<sp/>0))<sp/>{</highlight></codeline>
<codeline lineno="1413"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>i;</highlight></codeline>
<codeline lineno="1414"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1415"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1416"><highlight class="normal"></highlight></codeline>
<codeline lineno="1417"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Look<sp/>for<sp/>any<sp/>router<sp/>for<sp/>which<sp/>we<sp/>have<sp/>any<sp/>information<sp/>at<sp/>all.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1418"><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_1a75e81a96148f266c8fad8c0bcab2f36a" kindref="member">LWIP_ND6_NUM_ROUTERS</ref>;<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="1419"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(++last_router<sp/>&gt;=<sp/><ref refid="lwipopts_8h_1a75e81a96148f266c8fad8c0bcab2f36a" kindref="member">LWIP_ND6_NUM_ROUTERS</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1420"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>last_router<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1421"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1422"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(default_router_list[i].neighbor_entry<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref><sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="1423"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(<ref refid="structnetif" kindref="compound">netif</ref><sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref><sp/>?<sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>==<sp/>default_router_list[i].neighbor_entry-&gt;netif<sp/>:<sp/>1))<sp/>{</highlight></codeline>
<codeline lineno="1424"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>i;</highlight></codeline>
<codeline lineno="1425"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1426"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1427"><highlight class="normal"></highlight></codeline>
<codeline lineno="1428"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>no<sp/>suitable<sp/>router<sp/>found.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1429"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>-1;</highlight></codeline>
<codeline lineno="1430"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1431"><highlight class="normal"></highlight></codeline>
<codeline lineno="1441"><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structnetif" kindref="compound">netif</ref><sp/>*</highlight></codeline>
<codeline lineno="1442"><highlight class="normal">nd6_find_route(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>ip6_addr_t<sp/>*ip6addr)</highlight></codeline>
<codeline lineno="1443"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1444"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga9cd1d7891fe315de1201e2c6e45f4f57" kindref="member">s8_t</ref><sp/>i;</highlight></codeline>
<codeline lineno="1445"><highlight class="normal"></highlight></codeline>
<codeline lineno="1446"><highlight class="normal"><sp/><sp/>i<sp/>=<sp/>nd6_select_router(ip6addr,<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>);</highlight></codeline>
<codeline lineno="1447"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(i<sp/>&gt;=<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="1448"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(default_router_list[i].neighbor_entry<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1449"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>default_router_list[i].neighbor_entry-&gt;netif;<sp/></highlight><highlight class="comment">/*<sp/>may<sp/>be<sp/>NULL<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1450"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1451"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1452"><highlight class="normal"></highlight></codeline>
<codeline lineno="1453"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="1454"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1455"><highlight class="normal"></highlight></codeline>
<codeline lineno="1463"><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__compiler__abstraction_1ga9cd1d7891fe315de1201e2c6e45f4f57" kindref="member">s8_t</ref></highlight></codeline>
<codeline lineno="1464"><highlight class="normal">nd6_get_router(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>ip6_addr_t<sp/>*router_addr,<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="1465"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1466"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga9cd1d7891fe315de1201e2c6e45f4f57" kindref="member">s8_t</ref><sp/>i;</highlight></codeline>
<codeline lineno="1467"><highlight class="normal"></highlight></codeline>
<codeline lineno="1468"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Look<sp/>for<sp/>router.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1469"><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_1a75e81a96148f266c8fad8c0bcab2f36a" kindref="member">LWIP_ND6_NUM_ROUTERS</ref>;<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="1470"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((default_router_list[i].neighbor_entry<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="1471"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>((<ref refid="structnetif" kindref="compound">netif</ref><sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>?<sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>==<sp/>default_router_list[i].neighbor_entry-&gt;netif<sp/>:<sp/>1)<sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="1472"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ip6_addr_cmp(router_addr,<sp/>&amp;(default_router_list[i].neighbor_entry-&gt;next_hop_address)))<sp/>{</highlight></codeline>
<codeline lineno="1473"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>i;</highlight></codeline>
<codeline lineno="1474"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1475"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1476"><highlight class="normal"></highlight></codeline>
<codeline lineno="1477"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>router<sp/>not<sp/>found.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1478"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>-1;</highlight></codeline>
<codeline lineno="1479"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1480"><highlight class="normal"></highlight></codeline>
<codeline lineno="1488"><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__compiler__abstraction_1ga9cd1d7891fe315de1201e2c6e45f4f57" kindref="member">s8_t</ref></highlight></codeline>
<codeline lineno="1489"><highlight class="normal">nd6_new_router(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>ip6_addr_t<sp/>*router_addr,<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="1490"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1491"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga9cd1d7891fe315de1201e2c6e45f4f57" kindref="member">s8_t</ref><sp/>router_index;</highlight></codeline>
<codeline lineno="1492"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga9cd1d7891fe315de1201e2c6e45f4f57" kindref="member">s8_t</ref><sp/>free_router_index;</highlight></codeline>
<codeline lineno="1493"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga9cd1d7891fe315de1201e2c6e45f4f57" kindref="member">s8_t</ref><sp/>neighbor_index;</highlight></codeline>
<codeline lineno="1494"><highlight class="normal"></highlight></codeline>
<codeline lineno="1495"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Do<sp/>we<sp/>have<sp/>a<sp/>neighbor<sp/>entry<sp/>for<sp/>this<sp/>router?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1496"><highlight class="normal"><sp/><sp/>neighbor_index<sp/>=<sp/>nd6_find_neighbor_cache_entry(router_addr);</highlight></codeline>
<codeline lineno="1497"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(neighbor_index<sp/>&lt;<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="1498"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Create<sp/>a<sp/>neighbor<sp/>entry<sp/>for<sp/>this<sp/>router.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1499"><highlight class="normal"><sp/><sp/><sp/><sp/>neighbor_index<sp/>=<sp/>nd6_new_neighbor_cache_entry();</highlight></codeline>
<codeline lineno="1500"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(neighbor_index<sp/>&lt;<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="1501"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Could<sp/>not<sp/>create<sp/>neighbor<sp/>entry<sp/>for<sp/>this<sp/>router.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1502"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>-1;</highlight></codeline>
<codeline lineno="1503"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1504"><highlight class="normal"><sp/><sp/><sp/><sp/>ip6_addr_set(&amp;(neighbor_cache[neighbor_index].next_hop_address),<sp/>router_addr);</highlight></codeline>
<codeline lineno="1505"><highlight class="normal"><sp/><sp/><sp/><sp/>neighbor_cache[neighbor_index].netif<sp/>=<sp/><ref refid="structnetif" kindref="compound">netif</ref>;</highlight></codeline>
<codeline lineno="1506"><highlight class="normal"><sp/><sp/><sp/><sp/>neighbor_cache[neighbor_index].q<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="1507"><highlight class="normal"><sp/><sp/><sp/><sp/>neighbor_cache[neighbor_index].state<sp/>=<sp/>ND6_INCOMPLETE;</highlight></codeline>
<codeline lineno="1508"><highlight class="normal"><sp/><sp/><sp/><sp/>neighbor_cache[neighbor_index].counter.probes_sent<sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="1509"><highlight class="normal"><sp/><sp/><sp/><sp/>nd6_send_neighbor_cache_probe(&amp;neighbor_cache[neighbor_index],<sp/>ND6_SEND_FLAG_MULTICAST_DEST);</highlight></codeline>
<codeline lineno="1510"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1511"><highlight class="normal"></highlight></codeline>
<codeline lineno="1512"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Mark<sp/>neighbor<sp/>as<sp/>router.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1513"><highlight class="normal"><sp/><sp/>neighbor_cache[neighbor_index].isrouter<sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="1514"><highlight class="normal"></highlight></codeline>
<codeline lineno="1515"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Look<sp/>for<sp/>empty<sp/>entry.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1516"><highlight class="normal"><sp/><sp/>free_router_index<sp/>=<sp/><ref refid="lwipopts_8h_1a75e81a96148f266c8fad8c0bcab2f36a" kindref="member">LWIP_ND6_NUM_ROUTERS</ref>;</highlight></codeline>
<codeline lineno="1517"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(router_index<sp/>=<sp/><ref refid="lwipopts_8h_1a75e81a96148f266c8fad8c0bcab2f36a" kindref="member">LWIP_ND6_NUM_ROUTERS</ref><sp/>-<sp/>1;<sp/>router_index<sp/>&gt;=<sp/>0;<sp/>router_index--)<sp/>{</highlight></codeline>
<codeline lineno="1518"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>check<sp/>if<sp/>router<sp/>already<sp/>exists<sp/>(this<sp/>is<sp/>a<sp/>special<sp/>case<sp/>for<sp/>2<sp/>netifs<sp/>on<sp/>the<sp/>same<sp/>subnet</highlight></codeline>
<codeline lineno="1519"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>-<sp/>e.g.<sp/>wifi<sp/>and<sp/>cable)<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1520"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(default_router_list[router_index].neighbor_entry<sp/>==<sp/>&amp;(neighbor_cache[neighbor_index])){<sp/></highlight></codeline>
<codeline lineno="1521"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>router_index;<sp/></highlight></codeline>
<codeline lineno="1522"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight></codeline>
<codeline lineno="1523"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(default_router_list[router_index].neighbor_entry<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1524"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>remember<sp/>lowest<sp/>free<sp/>index<sp/>to<sp/>create<sp/>a<sp/>new<sp/>entry<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1525"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>free_router_index<sp/>=<sp/>router_index;</highlight></codeline>
<codeline lineno="1526"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1527"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1528"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(free_router_index<sp/>&lt;<sp/><ref refid="lwipopts_8h_1a75e81a96148f266c8fad8c0bcab2f36a" kindref="member">LWIP_ND6_NUM_ROUTERS</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1529"><highlight class="normal"><sp/><sp/><sp/><sp/>default_router_list[free_router_index].neighbor_entry<sp/>=<sp/>&amp;(neighbor_cache[neighbor_index]);</highlight></codeline>
<codeline lineno="1530"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>free_router_index;</highlight></codeline>
<codeline lineno="1531"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1532"><highlight class="normal"></highlight></codeline>
<codeline lineno="1533"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Could<sp/>not<sp/>create<sp/>a<sp/>router<sp/>entry.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1534"><highlight class="normal"></highlight></codeline>
<codeline lineno="1535"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Mark<sp/>neighbor<sp/>entry<sp/>as<sp/>not-router.<sp/>Entry<sp/>might<sp/>be<sp/>useful<sp/>as<sp/>neighbor<sp/>still.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1536"><highlight class="normal"><sp/><sp/>neighbor_cache[neighbor_index].isrouter<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1537"><highlight class="normal"></highlight></codeline>
<codeline lineno="1538"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>router<sp/>not<sp/>found.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1539"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>-1;</highlight></codeline>
<codeline lineno="1540"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1541"><highlight class="normal"></highlight></codeline>
<codeline lineno="1549"><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__compiler__abstraction_1ga9cd1d7891fe315de1201e2c6e45f4f57" kindref="member">s8_t</ref></highlight></codeline>
<codeline lineno="1550"><highlight class="normal">nd6_get_onlink_prefix(ip6_addr_t<sp/>*prefix,<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="1551"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1552"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga9cd1d7891fe315de1201e2c6e45f4f57" kindref="member">s8_t</ref><sp/>i;</highlight></codeline>
<codeline lineno="1553"><highlight class="normal"></highlight></codeline>
<codeline lineno="1554"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Look<sp/>for<sp/>prefix<sp/>in<sp/>list.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1555"><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_1ad9cc576b5951f1b5e1c2b0d0bb831d9a" kindref="member">LWIP_ND6_NUM_PREFIXES</ref>;<sp/>++i)<sp/>{</highlight></codeline>
<codeline lineno="1556"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((ip6_addr_netcmp(&amp;(prefix_list[i].prefix),<sp/>prefix))<sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="1557"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(prefix_list[i].<ref refid="structnetif" kindref="compound">netif</ref><sp/>==<sp/><ref refid="structnetif" kindref="compound">netif</ref>))<sp/>{</highlight></codeline>
<codeline lineno="1558"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>i;</highlight></codeline>
<codeline lineno="1559"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1560"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1561"><highlight class="normal"></highlight></codeline>
<codeline lineno="1562"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Entry<sp/>not<sp/>available.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1563"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>-1;</highlight></codeline>
<codeline lineno="1564"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1565"><highlight class="normal"></highlight></codeline>
<codeline lineno="1573"><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__compiler__abstraction_1ga9cd1d7891fe315de1201e2c6e45f4f57" kindref="member">s8_t</ref></highlight></codeline>
<codeline lineno="1574"><highlight class="normal">nd6_new_onlink_prefix(ip6_addr_t<sp/>*prefix,<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="1575"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1576"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga9cd1d7891fe315de1201e2c6e45f4f57" kindref="member">s8_t</ref><sp/>i;</highlight></codeline>
<codeline lineno="1577"><highlight class="normal"></highlight></codeline>
<codeline lineno="1578"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Create<sp/>new<sp/>entry.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1579"><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_1ad9cc576b5951f1b5e1c2b0d0bb831d9a" kindref="member">LWIP_ND6_NUM_PREFIXES</ref>;<sp/>++i)<sp/>{</highlight></codeline>
<codeline lineno="1580"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((prefix_list[i].<ref refid="structnetif" kindref="compound">netif</ref><sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>||</highlight></codeline>
<codeline lineno="1581"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(prefix_list[i].invalidation_timer<sp/>==<sp/>0))<sp/>{</highlight></codeline>
<codeline lineno="1582"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Found<sp/>empty<sp/>prefix<sp/>entry.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1583"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>prefix_list[i].netif<sp/>=<sp/><ref refid="structnetif" kindref="compound">netif</ref>;</highlight></codeline>
<codeline lineno="1584"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>ip6_addr_set(&amp;(prefix_list[i].prefix),<sp/>prefix);</highlight></codeline>
<codeline lineno="1585"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_IPV6_AUTOCONFIG</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1586"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>prefix_list[i].flags<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1587"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_IPV6_AUTOCONFIG<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1588"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>i;</highlight></codeline>
<codeline lineno="1589"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1590"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1591"><highlight class="normal"></highlight></codeline>
<codeline lineno="1592"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Entry<sp/>not<sp/>available.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1593"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>-1;</highlight></codeline>
<codeline lineno="1594"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1595"><highlight class="normal"></highlight></codeline>
<codeline lineno="1608"><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__compiler__abstraction_1ga9cd1d7891fe315de1201e2c6e45f4f57" kindref="member">s8_t</ref></highlight></codeline>
<codeline lineno="1609"><highlight class="normal">nd6_get_next_hop_entry(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>ip6_addr_t<sp/>*ip6addr,<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="1610"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1611"><highlight class="normal"></highlight><highlight class="preprocessor">#ifdef<sp/>LWIP_HOOK_ND6_GET_GW</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1612"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>ip6_addr_t<sp/>*next_hop_addr;</highlight></codeline>
<codeline lineno="1613"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_HOOK_ND6_GET_GW<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1614"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga9cd1d7891fe315de1201e2c6e45f4f57" kindref="member">s8_t</ref><sp/>i;</highlight></codeline>
<codeline lineno="1615"><highlight class="normal"></highlight></codeline>
<codeline lineno="1616"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_NETIF_HWADDRHINT</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1617"><highlight class="normal"><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="1618"><highlight class="normal"><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="1619"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>addr_hint<sp/>=<sp/>*(<ref refid="structnetif" kindref="compound">netif</ref>-&gt;addr_hint);</highlight></codeline>
<codeline lineno="1620"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(addr_hint<sp/>&lt;<sp/><ref refid="lwipopts_8h_1acad118b1ae886e80137a1d4f0fb19672" kindref="member">LWIP_ND6_NUM_DESTINATIONS</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1621"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>nd6_cached_destination_index<sp/>=<sp/>addr_hint;</highlight></codeline>
<codeline lineno="1622"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1623"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1624"><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="1625"><highlight class="normal"></highlight></codeline>
<codeline lineno="1626"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Look<sp/>for<sp/>ip6addr<sp/>in<sp/>destination<sp/>cache.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1627"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ip6_addr_cmp(ip6addr,<sp/>&amp;(destination_cache[nd6_cached_destination_index].destination_addr)))<sp/>{</highlight></codeline>
<codeline lineno="1628"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>the<sp/>cached<sp/>entry<sp/>index<sp/>is<sp/>the<sp/>right<sp/>one!<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1629"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>do<sp/>nothing.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1630"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="stats_8h_1a5c508f5734163d7ce6ac7c1227500867" kindref="member">ND6_STATS_INC</ref>(nd6.cachehit);</highlight></codeline>
<codeline lineno="1631"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="1632"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Search<sp/>destination<sp/>cache.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1633"><highlight class="normal"><sp/><sp/><sp/><sp/>i<sp/>=<sp/>nd6_find_destination_cache_entry(ip6addr);</highlight></codeline>
<codeline lineno="1634"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(i<sp/>&gt;=<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="1635"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>found<sp/>destination<sp/>entry.<sp/>make<sp/>it<sp/>our<sp/>new<sp/>cached<sp/>index.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1636"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>nd6_cached_destination_index<sp/>=<sp/>i;</highlight></codeline>
<codeline lineno="1637"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="1638"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Not<sp/>found.<sp/>Create<sp/>a<sp/>new<sp/>destination<sp/>entry.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1639"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>i<sp/>=<sp/>nd6_new_destination_cache_entry();</highlight></codeline>
<codeline lineno="1640"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(i<sp/>&gt;=<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="1641"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>got<sp/>new<sp/>destination<sp/>entry.<sp/>make<sp/>it<sp/>our<sp/>new<sp/>cached<sp/>index.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1642"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>nd6_cached_destination_index<sp/>=<sp/>i;</highlight></codeline>
<codeline lineno="1643"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="1644"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Could<sp/>not<sp/>create<sp/>a<sp/>destination<sp/>cache<sp/>entry.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1645"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaaaeafdbf3aecc46864daa3cd829c7e05" kindref="member">ERR_MEM</ref>;</highlight></codeline>
<codeline lineno="1646"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1647"><highlight class="normal"></highlight></codeline>
<codeline lineno="1648"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Copy<sp/>dest<sp/>address<sp/>to<sp/>destination<sp/>cache.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1649"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>ip6_addr_set(&amp;(destination_cache[nd6_cached_destination_index].destination_addr),<sp/>ip6addr);</highlight></codeline>
<codeline lineno="1650"><highlight class="normal"></highlight></codeline>
<codeline lineno="1651"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Now<sp/>find<sp/>the<sp/>next<sp/>hop.<sp/>is<sp/>it<sp/>a<sp/>neighbor?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1652"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ip6_addr_islinklocal(ip6addr)<sp/>||</highlight></codeline>
<codeline lineno="1653"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>nd6_is_prefix_in_netif(ip6addr,<sp/><ref refid="structnetif" kindref="compound">netif</ref>))<sp/>{</highlight></codeline>
<codeline lineno="1654"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Destination<sp/>in<sp/>local<sp/>link.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1655"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>destination_cache[nd6_cached_destination_index].pmtu<sp/>=<sp/><ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1aca7d56b4e0f822b0ced2885f222b8d48" kindref="member">mtu</ref>;</highlight></codeline>
<codeline lineno="1656"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ip6_addr_copy(destination_cache[nd6_cached_destination_index].next_hop_addr,<sp/>destination_cache[nd6_cached_destination_index].destination_addr);</highlight></codeline>
<codeline lineno="1657"><highlight class="normal"></highlight><highlight class="preprocessor">#ifdef<sp/>LWIP_HOOK_ND6_GET_GW</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1658"><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/>((next_hop_addr<sp/>=<sp/>LWIP_HOOK_ND6_GET_GW(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>ip6addr))<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1659"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Next<sp/>hop<sp/>for<sp/>destination<sp/>provided<sp/>by<sp/>hook<sp/>function.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1660"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>destination_cache[nd6_cached_destination_index].pmtu<sp/>=<sp/><ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1aca7d56b4e0f822b0ced2885f222b8d48" kindref="member">mtu</ref>;</highlight></codeline>
<codeline lineno="1661"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ip6_addr_set(&amp;destination_cache[nd6_cached_destination_index].next_hop_addr,<sp/>next_hop_addr);</highlight></codeline>
<codeline lineno="1662"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_HOOK_ND6_GET_GW<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1663"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="1664"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>We<sp/>need<sp/>to<sp/>select<sp/>a<sp/>router.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1665"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>i<sp/>=<sp/>nd6_select_router(ip6addr,<sp/><ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="1666"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(i<sp/>&lt;<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="1667"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>No<sp/>router<sp/>found.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1668"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ip6_addr_set_any(&amp;(destination_cache[nd6_cached_destination_index].destination_addr));</highlight></codeline>
<codeline lineno="1669"><highlight class="normal"><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="1670"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1671"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>destination_cache[nd6_cached_destination_index].pmtu<sp/>=<sp/><ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1aca7d56b4e0f822b0ced2885f222b8d48" kindref="member">mtu</ref>;<sp/></highlight><highlight class="comment">/*<sp/>Start<sp/>with<sp/>netif<sp/>mtu,<sp/>correct<sp/>through<sp/>ICMPv6<sp/>if<sp/>necessary<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1672"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ip6_addr_copy(destination_cache[nd6_cached_destination_index].next_hop_addr,<sp/>default_router_list[i].neighbor_entry-&gt;next_hop_address);</highlight></codeline>
<codeline lineno="1673"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1674"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1675"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1676"><highlight class="normal"></highlight></codeline>
<codeline lineno="1677"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_NETIF_HWADDRHINT</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1678"><highlight class="normal"><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="1679"><highlight class="normal"><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="1680"><highlight class="normal"><sp/><sp/><sp/><sp/>*(<ref refid="structnetif" kindref="compound">netif</ref>-&gt;addr_hint)<sp/>=<sp/>nd6_cached_destination_index;</highlight></codeline>
<codeline lineno="1681"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1682"><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="1683"><highlight class="normal"></highlight></codeline>
<codeline lineno="1684"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Look<sp/>in<sp/>neighbor<sp/>cache<sp/>for<sp/>the<sp/>next-hop<sp/>address.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1685"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ip6_addr_cmp(&amp;(destination_cache[nd6_cached_destination_index].next_hop_addr),</highlight></codeline>
<codeline lineno="1686"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>&amp;(neighbor_cache[nd6_cached_neighbor_index].next_hop_address)))<sp/>{</highlight></codeline>
<codeline lineno="1687"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Cache<sp/>hit.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1688"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Do<sp/>nothing.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1689"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="stats_8h_1a5c508f5734163d7ce6ac7c1227500867" kindref="member">ND6_STATS_INC</ref>(nd6.cachehit);</highlight></codeline>
<codeline lineno="1690"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="1691"><highlight class="normal"><sp/><sp/><sp/><sp/>i<sp/>=<sp/>nd6_find_neighbor_cache_entry(&amp;(destination_cache[nd6_cached_destination_index].next_hop_addr));</highlight></codeline>
<codeline lineno="1692"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(i<sp/>&gt;=<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="1693"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Found<sp/>a<sp/>matching<sp/>record,<sp/>make<sp/>it<sp/>new<sp/>cached<sp/>entry.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1694"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>nd6_cached_neighbor_index<sp/>=<sp/>i;</highlight></codeline>
<codeline lineno="1695"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="1696"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Neighbor<sp/>not<sp/>in<sp/>cache.<sp/>Make<sp/>a<sp/>new<sp/>entry.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1697"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>i<sp/>=<sp/>nd6_new_neighbor_cache_entry();</highlight></codeline>
<codeline lineno="1698"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(i<sp/>&gt;=<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="1699"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>got<sp/>new<sp/>neighbor<sp/>entry.<sp/>make<sp/>it<sp/>our<sp/>new<sp/>cached<sp/>index.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1700"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>nd6_cached_neighbor_index<sp/>=<sp/>i;</highlight></codeline>
<codeline lineno="1701"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="1702"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Could<sp/>not<sp/>create<sp/>a<sp/>neighbor<sp/>cache<sp/>entry.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1703"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaaaeafdbf3aecc46864daa3cd829c7e05" kindref="member">ERR_MEM</ref>;</highlight></codeline>
<codeline lineno="1704"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1705"><highlight class="normal"></highlight></codeline>
<codeline lineno="1706"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Initialize<sp/>fields.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1707"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>ip6_addr_copy(neighbor_cache[i].next_hop_address,</highlight></codeline>
<codeline lineno="1708"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>destination_cache[nd6_cached_destination_index].next_hop_addr);</highlight></codeline>
<codeline lineno="1709"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>neighbor_cache[i].isrouter<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1710"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>neighbor_cache[i].netif<sp/>=<sp/><ref refid="structnetif" kindref="compound">netif</ref>;</highlight></codeline>
<codeline lineno="1711"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>neighbor_cache[i].<ref refid="structnetif_1a809cc57c0dff09c5c9ae45b02c2002f3" kindref="member">state</ref><sp/>=<sp/>ND6_INCOMPLETE;</highlight></codeline>
<codeline lineno="1712"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>neighbor_cache[i].counter.probes_sent<sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="1713"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>nd6_send_neighbor_cache_probe(&amp;neighbor_cache[i],<sp/>ND6_SEND_FLAG_MULTICAST_DEST);</highlight></codeline>
<codeline lineno="1714"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1715"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1716"><highlight class="normal"></highlight></codeline>
<codeline lineno="1717"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Reset<sp/>this<sp/>destination&apos;s<sp/>age.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1718"><highlight class="normal"><sp/><sp/>destination_cache[nd6_cached_destination_index].age<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1719"><highlight class="normal"></highlight></codeline>
<codeline lineno="1720"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>nd6_cached_neighbor_index;</highlight></codeline>
<codeline lineno="1721"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1722"><highlight class="normal"></highlight></codeline>
<codeline lineno="1730"><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="1731"><highlight class="normal">nd6_queue_packet(<ref refid="group__compiler__abstraction_1ga9cd1d7891fe315de1201e2c6e45f4f57" kindref="member">s8_t</ref><sp/>neighbor_index,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*q)</highlight></codeline>
<codeline lineno="1732"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1733"><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="1734"><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="1735"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>copy_needed<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1736"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_ND6_QUEUEING</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1737"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">nd6_q_entry<sp/>*new_entry,<sp/>*r;</highlight></codeline>
<codeline lineno="1738"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_ND6_QUEUEING<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1739"><highlight class="normal"></highlight></codeline>
<codeline lineno="1740"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((neighbor_index<sp/>&lt;<sp/>0)<sp/>||<sp/>(neighbor_index<sp/>&gt;=<sp/><ref refid="lwipopts_8h_1ab2fe15bdb4e0a41f295eb5577b11ad16" kindref="member">LWIP_ND6_NUM_NEIGHBORS</ref>))<sp/>{</highlight></codeline>
<codeline lineno="1741"><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="1742"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1743"><highlight class="normal"></highlight></codeline>
<codeline lineno="1744"><highlight class="normal"><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="1745"><highlight class="comment"><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="1746"><highlight class="comment"><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="1747"><highlight class="normal"><sp/><sp/>p<sp/>=<sp/>q;</highlight></codeline>
<codeline lineno="1748"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(p)<sp/>{</highlight></codeline>
<codeline lineno="1749"><highlight class="normal"><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="1750"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>copy_needed<sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="1751"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="1752"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1753"><highlight class="normal"><sp/><sp/><sp/><sp/>p<sp/>=<sp/>p-&gt;<ref refid="structpbuf_1a5e5763c94fd18d78937b0b58ce7df341" kindref="member">next</ref>;</highlight></codeline>
<codeline lineno="1754"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1755"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(copy_needed)<sp/>{</highlight></codeline>
<codeline lineno="1756"><highlight class="normal"><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="1757"><highlight class="normal"><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/>q-&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="1758"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>((p<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>&amp;&amp;<sp/>(neighbor_cache[neighbor_index].q<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>))<sp/>{</highlight></codeline>
<codeline lineno="1759"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Free<sp/>oldest<sp/>packet<sp/>(as<sp/>per<sp/>RFC<sp/>recommendation)<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1760"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_ND6_QUEUEING</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1761"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>r<sp/>=<sp/>neighbor_cache[neighbor_index].q;</highlight></codeline>
<codeline lineno="1762"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>neighbor_cache[neighbor_index].q<sp/>=<sp/>r-&gt;next;</highlight></codeline>
<codeline lineno="1763"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>r-&gt;next<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="1764"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>nd6_free_q(r);</highlight></codeline>
<codeline lineno="1765"><highlight class="normal"></highlight><highlight class="preprocessor">#else<sp/></highlight><highlight class="comment">/*<sp/>LWIP_ND6_QUEUEING<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1766"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(neighbor_cache[neighbor_index].q);</highlight></codeline>
<codeline lineno="1767"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>neighbor_cache[neighbor_index].q<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="1768"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_ND6_QUEUEING<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1769"><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/>q-&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="1770"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1771"><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="1772"><highlight class="normal"><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="1773"><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="1774"><highlight class="normal"><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="1775"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1776"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1777"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="1778"><highlight class="normal"><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="1779"><highlight class="normal"><sp/><sp/><sp/><sp/>p<sp/>=<sp/>q;</highlight></codeline>
<codeline lineno="1780"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1ga77f6bbd69e45e542014d9c547c7da74e" kindref="member">pbuf_ref</ref>(p);</highlight></codeline>
<codeline lineno="1781"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1782"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>packet<sp/>was<sp/>copied/ref&apos;d?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1783"><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="1784"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>queue<sp/>packet<sp/>...<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1785"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_ND6_QUEUEING</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1786"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>allocate<sp/>a<sp/>new<sp/>nd6<sp/>queue<sp/>entry<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1787"><highlight class="normal"><sp/><sp/><sp/><sp/>new_entry<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">nd6_q_entry<sp/>*)<ref refid="memp_8h_1a2b00593d086313c267b54a976bf67aa5" kindref="member">memp_malloc</ref>(MEMP_ND6_QUEUE);</highlight></codeline>
<codeline lineno="1788"><highlight class="normal"><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/>&amp;&amp;<sp/>(neighbor_cache[neighbor_index].q<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>))<sp/>{</highlight></codeline>
<codeline lineno="1789"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Free<sp/>oldest<sp/>packet<sp/>(as<sp/>per<sp/>RFC<sp/>recommendation)<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1790"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>r<sp/>=<sp/>neighbor_cache[neighbor_index].q;</highlight></codeline>
<codeline lineno="1791"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>neighbor_cache[neighbor_index].q<sp/>=<sp/>r-&gt;next;</highlight></codeline>
<codeline lineno="1792"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>r-&gt;next<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="1793"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>nd6_free_q(r);</highlight></codeline>
<codeline lineno="1794"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>new_entry<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">nd6_q_entry<sp/>*)<ref refid="memp_8h_1a2b00593d086313c267b54a976bf67aa5" kindref="member">memp_malloc</ref>(MEMP_ND6_QUEUE);</highlight></codeline>
<codeline lineno="1795"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1796"><highlight class="normal"><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="1797"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>new_entry-&gt;next<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="1798"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>new_entry-&gt;p<sp/>=<sp/>p;</highlight></codeline>
<codeline lineno="1799"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(neighbor_cache[neighbor_index].q<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1800"><highlight class="normal"><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="1801"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>r<sp/>=<sp/>neighbor_cache[neighbor_index].q;</highlight></codeline>
<codeline lineno="1802"><highlight class="normal"><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="1803"><highlight class="normal"><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="1804"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1805"><highlight class="normal"><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="1806"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="1807"><highlight class="normal"><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="1808"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>neighbor_cache[neighbor_index].q<sp/>=<sp/>new_entry;</highlight></codeline>
<codeline lineno="1809"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1810"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;ipv6:<sp/>queued<sp/>packet<sp/>%p<sp/>on<sp/>neighbor<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/>*)p,<sp/>(<ref refid="group__compiler__abstraction_1gacf46f4df0ebab84edebcb69967fdf86b" kindref="member">s16_t</ref>)neighbor_index));</highlight></codeline>
<codeline lineno="1811"><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="1812"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="1813"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>the<sp/>pool<sp/>MEMP_ND6_QUEUE<sp/>is<sp/>empty<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1814"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(p);</highlight></codeline>
<codeline lineno="1815"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;ipv6:<sp/>could<sp/>not<sp/>queue<sp/>a<sp/>copy<sp/>of<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/>*)p));</highlight></codeline>
<codeline lineno="1816"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>{<sp/>result<sp/>==<sp/>ERR_MEM<sp/>}<sp/>through<sp/>initialization<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1817"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1818"><highlight class="normal"></highlight><highlight class="preprocessor">#else<sp/></highlight><highlight class="comment">/*<sp/>LWIP_ND6_QUEUEING<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1819"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Queue<sp/>a<sp/>single<sp/>packet.<sp/>If<sp/>an<sp/>older<sp/>packet<sp/>is<sp/>already<sp/>queued,<sp/>free<sp/>it<sp/>as<sp/>per<sp/>RFC.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1820"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(neighbor_cache[neighbor_index].q<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1821"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(neighbor_cache[neighbor_index].q);</highlight></codeline>
<codeline lineno="1822"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1823"><highlight class="normal"><sp/><sp/><sp/><sp/>neighbor_cache[neighbor_index].q<sp/>=<sp/>p;</highlight></codeline>
<codeline lineno="1824"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;ipv6:<sp/>queued<sp/>packet<sp/>%p<sp/>on<sp/>neighbor<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/>*)p,<sp/>(<ref refid="group__compiler__abstraction_1gacf46f4df0ebab84edebcb69967fdf86b" kindref="member">s16_t</ref>)neighbor_index));</highlight></codeline>
<codeline lineno="1825"><highlight class="normal"><sp/><sp/><sp/><sp/>result<sp/>=<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" kindref="member">ERR_OK</ref>;</highlight></codeline>
<codeline lineno="1826"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_ND6_QUEUEING<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1827"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="1828"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;ipv6:<sp/>could<sp/>not<sp/>queue<sp/>a<sp/>copy<sp/>of<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="1829"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>{<sp/>result<sp/>==<sp/>ERR_MEM<sp/>}<sp/>through<sp/>initialization<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1830"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1831"><highlight class="normal"></highlight></codeline>
<codeline lineno="1832"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>result;</highlight></codeline>
<codeline lineno="1833"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1834"><highlight class="normal"></highlight></codeline>
<codeline lineno="1835"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_ND6_QUEUEING</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1836"><highlight class="normal"></highlight></codeline>
<codeline lineno="1841"><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1842"><highlight class="normal">nd6_free_q(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>nd6_q_entry<sp/>*q)</highlight></codeline>
<codeline lineno="1843"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1844"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">nd6_q_entry<sp/>*r;</highlight></codeline>
<codeline lineno="1845"><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="1846"><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="1847"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(q)<sp/>{</highlight></codeline>
<codeline lineno="1848"><highlight class="normal"><sp/><sp/><sp/><sp/>r<sp/>=<sp/>q;</highlight></codeline>
<codeline lineno="1849"><highlight class="normal"><sp/><sp/><sp/><sp/>q<sp/>=<sp/>q-&gt;next;</highlight></codeline>
<codeline lineno="1850"><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="1851"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(r-&gt;p);</highlight></codeline>
<codeline lineno="1852"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="memp_8h_1aecd94926b7c2a0e23ae195f4ae97581f" kindref="member">memp_free</ref>(MEMP_ND6_QUEUE,<sp/>r);</highlight></codeline>
<codeline lineno="1853"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1854"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1855"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_ND6_QUEUEING<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1856"><highlight class="normal"></highlight></codeline>
<codeline lineno="1862"><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1863"><highlight class="normal">nd6_send_q(<ref refid="group__compiler__abstraction_1ga9cd1d7891fe315de1201e2c6e45f4f57" kindref="member">s8_t</ref><sp/>i)</highlight></codeline>
<codeline lineno="1864"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1865"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structip6__hdr" kindref="compound">ip6_hdr</ref><sp/>*ip6hdr;</highlight></codeline>
<codeline lineno="1866"><highlight class="normal"><sp/><sp/>ip6_addr_t<sp/>dest;</highlight></codeline>
<codeline lineno="1867"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_ND6_QUEUEING</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1868"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">nd6_q_entry<sp/>*q;</highlight></codeline>
<codeline lineno="1869"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_ND6_QUEUEING<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1870"><highlight class="normal"></highlight></codeline>
<codeline lineno="1871"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((i<sp/>&lt;<sp/>0)<sp/>||<sp/>(i<sp/>&gt;=<sp/><ref refid="lwipopts_8h_1ab2fe15bdb4e0a41f295eb5577b11ad16" kindref="member">LWIP_ND6_NUM_NEIGHBORS</ref>))<sp/>{</highlight></codeline>
<codeline lineno="1872"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="1873"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1874"><highlight class="normal"></highlight></codeline>
<codeline lineno="1875"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_ND6_QUEUEING</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1876"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(neighbor_cache[i].q<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1877"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>remember<sp/>first<sp/>in<sp/>queue<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1878"><highlight class="normal"><sp/><sp/><sp/><sp/>q<sp/>=<sp/>neighbor_cache[i].q;</highlight></codeline>
<codeline lineno="1879"><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="1880"><highlight class="normal"><sp/><sp/><sp/><sp/>neighbor_cache[i].q<sp/>=<sp/>q-&gt;next;</highlight></codeline>
<codeline lineno="1881"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Get<sp/>ipv6<sp/>header.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1882"><highlight class="normal"><sp/><sp/><sp/><sp/>ip6hdr<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structip6__hdr" kindref="compound">ip6_hdr</ref><sp/>*)(q-&gt;p-&gt;payload);</highlight></codeline>
<codeline lineno="1883"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Create<sp/>an<sp/>aligned<sp/>copy.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1884"><highlight class="normal"><sp/><sp/><sp/><sp/>ip6_addr_set(&amp;dest,<sp/>&amp;(ip6hdr-&gt;dest));</highlight></codeline>
<codeline lineno="1885"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>send<sp/>the<sp/>queued<sp/>IPv6<sp/>packet<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1886"><highlight class="normal"><sp/><sp/><sp/><sp/>(neighbor_cache[i].netif)-&gt;output_ip6(neighbor_cache[i].<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>q-&gt;p,<sp/>&amp;dest);</highlight></codeline>
<codeline lineno="1887"><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="1888"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(q-&gt;p);</highlight></codeline>
<codeline lineno="1889"><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="1890"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="memp_8h_1aecd94926b7c2a0e23ae195f4ae97581f" kindref="member">memp_free</ref>(MEMP_ND6_QUEUE,<sp/>q);</highlight></codeline>
<codeline lineno="1891"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1892"><highlight class="normal"></highlight><highlight class="preprocessor">#else<sp/></highlight><highlight class="comment">/*<sp/>LWIP_ND6_QUEUEING<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1893"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(neighbor_cache[i].q<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1894"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Get<sp/>ipv6<sp/>header.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1895"><highlight class="normal"><sp/><sp/><sp/><sp/>ip6hdr<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structip6__hdr" kindref="compound">ip6_hdr</ref><sp/>*)(neighbor_cache[i].q-&gt;payload);</highlight></codeline>
<codeline lineno="1896"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Create<sp/>an<sp/>aligned<sp/>copy.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1897"><highlight class="normal"><sp/><sp/><sp/><sp/>ip6_addr_set(&amp;dest,<sp/>&amp;(ip6hdr-&gt;dest));</highlight></codeline>
<codeline lineno="1898"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>send<sp/>the<sp/>queued<sp/>IPv6<sp/>packet<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1899"><highlight class="normal"><sp/><sp/><sp/><sp/>(neighbor_cache[i].netif)-&gt;output_ip6(neighbor_cache[i].<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>neighbor_cache[i].q,<sp/>&amp;dest);</highlight></codeline>
<codeline lineno="1900"><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="1901"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(neighbor_cache[i].q);</highlight></codeline>
<codeline lineno="1902"><highlight class="normal"><sp/><sp/><sp/><sp/>neighbor_cache[i].q<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="1903"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1904"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_ND6_QUEUEING<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1905"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1906"><highlight class="normal"></highlight></codeline>
<codeline lineno="1929"><highlight class="normal"><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="1930"><highlight class="normal">nd6_get_next_hop_addr_or_queue(</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/>ip6_addr_t<sp/>*ip6addr,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>**hwaddrp)</highlight></codeline>
<codeline lineno="1931"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1932"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga9cd1d7891fe315de1201e2c6e45f4f57" kindref="member">s8_t</ref><sp/>i;</highlight></codeline>
<codeline lineno="1933"><highlight class="normal"></highlight></codeline>
<codeline lineno="1934"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Get<sp/>next<sp/>hop<sp/>record.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1935"><highlight class="normal"><sp/><sp/>i<sp/>=<sp/>nd6_get_next_hop_entry(ip6addr,<sp/><ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="1936"><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="1937"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>failed<sp/>to<sp/>get<sp/>a<sp/>next<sp/>hop<sp/>neighbor<sp/>record.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1938"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>i;</highlight></codeline>
<codeline lineno="1939"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1940"><highlight class="normal"></highlight></codeline>
<codeline lineno="1941"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Now<sp/>that<sp/>we<sp/>have<sp/>a<sp/>destination<sp/>record,<sp/>send<sp/>or<sp/>queue<sp/>the<sp/>packet.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1942"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(neighbor_cache[i].state<sp/>==<sp/>ND6_STALE)<sp/>{</highlight></codeline>
<codeline lineno="1943"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Switch<sp/>to<sp/>delay<sp/>state.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1944"><highlight class="normal"><sp/><sp/><sp/><sp/>neighbor_cache[i].state<sp/>=<sp/>ND6_DELAY;</highlight></codeline>
<codeline lineno="1945"><highlight class="normal"><sp/><sp/><sp/><sp/>neighbor_cache[i].counter.delay_time<sp/>=<sp/><ref refid="lwipopts_8h_1a315bd6d4a9d185766dfc3253cd9d7715" kindref="member">LWIP_ND6_DELAY_FIRST_PROBE_TIME</ref><sp/>/<sp/>ND6_TMR_INTERVAL;</highlight></codeline>
<codeline lineno="1946"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1947"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>@todo<sp/>should<sp/>we<sp/>send<sp/>or<sp/>queue<sp/>if<sp/>PROBE?<sp/>send<sp/>for<sp/>now,<sp/>to<sp/>let<sp/>unicast<sp/>NS<sp/>pass.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1948"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((neighbor_cache[i].state<sp/>==<sp/>ND6_REACHABLE)<sp/>||</highlight></codeline>
<codeline lineno="1949"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>(neighbor_cache[i].state<sp/>==<sp/>ND6_DELAY)<sp/>||</highlight></codeline>
<codeline lineno="1950"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>(neighbor_cache[i].state<sp/>==<sp/>ND6_PROBE))<sp/>{</highlight></codeline>
<codeline lineno="1951"><highlight class="normal"></highlight></codeline>
<codeline lineno="1952"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Tell<sp/>the<sp/>caller<sp/>to<sp/>send<sp/>out<sp/>the<sp/>packet<sp/>now.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1953"><highlight class="normal"><sp/><sp/><sp/><sp/>*hwaddrp<sp/>=<sp/>neighbor_cache[i].lladdr;</highlight></codeline>
<codeline lineno="1954"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" kindref="member">ERR_OK</ref>;</highlight></codeline>
<codeline lineno="1955"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1956"><highlight class="normal"></highlight></codeline>
<codeline lineno="1957"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>We<sp/>should<sp/>queue<sp/>packet<sp/>on<sp/>this<sp/>interface.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1958"><highlight class="normal"><sp/><sp/>*hwaddrp<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="1959"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>nd6_queue_packet(i,<sp/>q);</highlight></codeline>
<codeline lineno="1960"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1961"><highlight class="normal"></highlight></codeline>
<codeline lineno="1962"><highlight class="normal"></highlight></codeline>
<codeline lineno="1970"><highlight class="normal"><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref></highlight></codeline>
<codeline lineno="1971"><highlight class="normal">nd6_get_destination_mtu(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>ip6_addr_t<sp/>*ip6addr,<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="1972"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1973"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga9cd1d7891fe315de1201e2c6e45f4f57" kindref="member">s8_t</ref><sp/>i;</highlight></codeline>
<codeline lineno="1974"><highlight class="normal"></highlight></codeline>
<codeline lineno="1975"><highlight class="normal"><sp/><sp/>i<sp/>=<sp/>nd6_find_destination_cache_entry(ip6addr);</highlight></codeline>
<codeline lineno="1976"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(i<sp/>&gt;=<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="1977"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(destination_cache[i].pmtu<sp/>&gt;<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="1978"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>destination_cache[i].pmtu;</highlight></codeline>
<codeline lineno="1979"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1980"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1981"><highlight class="normal"></highlight></codeline>
<codeline lineno="1982"><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="1983"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1aca7d56b4e0f822b0ced2885f222b8d48" kindref="member">mtu</ref>;</highlight></codeline>
<codeline lineno="1984"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1985"><highlight class="normal"></highlight></codeline>
<codeline lineno="1986"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>1280;<sp/></highlight><highlight class="comment">/*<sp/>Minimum<sp/>MTU<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1987"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1988"><highlight class="normal"></highlight></codeline>
<codeline lineno="1989"><highlight class="normal"></highlight></codeline>
<codeline lineno="1990"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_ND6_TCP_REACHABILITY_HINTS</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1991"><highlight class="normal"></highlight></codeline>
<codeline lineno="2000"><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="2001"><highlight class="normal">nd6_reachability_hint(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>ip6_addr_t<sp/>*ip6addr)</highlight></codeline>
<codeline lineno="2002"><highlight class="normal">{</highlight></codeline>
<codeline lineno="2003"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga9cd1d7891fe315de1201e2c6e45f4f57" kindref="member">s8_t</ref><sp/>i;</highlight></codeline>
<codeline lineno="2004"><highlight class="normal"></highlight></codeline>
<codeline lineno="2005"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Find<sp/>destination<sp/>in<sp/>cache.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="2006"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ip6_addr_cmp(ip6addr,<sp/>&amp;(destination_cache[nd6_cached_destination_index].destination_addr)))<sp/>{</highlight></codeline>
<codeline lineno="2007"><highlight class="normal"><sp/><sp/><sp/><sp/>i<sp/>=<sp/>nd6_cached_destination_index;</highlight></codeline>
<codeline lineno="2008"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="stats_8h_1a5c508f5734163d7ce6ac7c1227500867" kindref="member">ND6_STATS_INC</ref>(nd6.cachehit);</highlight></codeline>
<codeline lineno="2009"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="2010"><highlight class="normal"><sp/><sp/><sp/><sp/>i<sp/>=<sp/>nd6_find_destination_cache_entry(ip6addr);</highlight></codeline>
<codeline lineno="2011"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="2012"><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="2013"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="2014"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="2015"><highlight class="normal"></highlight></codeline>
<codeline lineno="2016"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Find<sp/>next<sp/>hop<sp/>neighbor<sp/>in<sp/>cache.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="2017"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ip6_addr_cmp(&amp;(destination_cache[i].next_hop_addr),<sp/>&amp;(neighbor_cache[nd6_cached_neighbor_index].next_hop_address)))<sp/>{</highlight></codeline>
<codeline lineno="2018"><highlight class="normal"><sp/><sp/><sp/><sp/>i<sp/>=<sp/>nd6_cached_neighbor_index;</highlight></codeline>
<codeline lineno="2019"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="stats_8h_1a5c508f5734163d7ce6ac7c1227500867" kindref="member">ND6_STATS_INC</ref>(nd6.cachehit);</highlight></codeline>
<codeline lineno="2020"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="2021"><highlight class="normal"><sp/><sp/><sp/><sp/>i<sp/>=<sp/>nd6_find_neighbor_cache_entry(&amp;(destination_cache[i].next_hop_addr));</highlight></codeline>
<codeline lineno="2022"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="2023"><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="2024"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="2025"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="2026"><highlight class="normal"></highlight></codeline>
<codeline lineno="2027"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>For<sp/>safety:<sp/>don&apos;t<sp/>set<sp/>as<sp/>reachable<sp/>if<sp/>we<sp/>don&apos;t<sp/>have<sp/>a<sp/>LL<sp/>address<sp/>yet.<sp/>Misuse<sp/>protection.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="2028"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(neighbor_cache[i].state<sp/>==<sp/>ND6_INCOMPLETE<sp/>||<sp/>neighbor_cache[i].state<sp/>==<sp/>ND6_NO_ENTRY)<sp/>{</highlight></codeline>
<codeline lineno="2029"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="2030"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="2031"><highlight class="normal"></highlight></codeline>
<codeline lineno="2032"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Set<sp/>reachability<sp/>state.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="2033"><highlight class="normal"><sp/><sp/>neighbor_cache[i].state<sp/>=<sp/>ND6_REACHABLE;</highlight></codeline>
<codeline lineno="2034"><highlight class="normal"><sp/><sp/>neighbor_cache[i].counter.reachable_time<sp/>=<sp/>reachable_time;</highlight></codeline>
<codeline lineno="2035"><highlight class="normal">}</highlight></codeline>
<codeline lineno="2036"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_ND6_TCP_REACHABILITY_HINTS<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="2037"><highlight class="normal"></highlight></codeline>
<codeline lineno="2043"><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="2044"><highlight class="normal">nd6_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="2045"><highlight class="normal">{</highlight></codeline>
<codeline lineno="2046"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>i;</highlight></codeline>
<codeline lineno="2047"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga9cd1d7891fe315de1201e2c6e45f4f57" kindref="member">s8_t</ref><sp/>router_index;</highlight></codeline>
<codeline lineno="2048"><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_1ad9cc576b5951f1b5e1c2b0d0bb831d9a" kindref="member">LWIP_ND6_NUM_PREFIXES</ref>;<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="2049"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(prefix_list[i].<ref refid="structnetif" kindref="compound">netif</ref><sp/>==<sp/><ref refid="structnetif" kindref="compound">netif</ref>)<sp/>{</highlight></codeline>
<codeline lineno="2050"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>prefix_list[i].netif<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="2051"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>prefix_list[i].flags<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="2052"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="2053"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="2054"><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_1ab2fe15bdb4e0a41f295eb5577b11ad16" kindref="member">LWIP_ND6_NUM_NEIGHBORS</ref>;<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="2055"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(neighbor_cache[i].<ref refid="structnetif" kindref="compound">netif</ref><sp/>==<sp/><ref refid="structnetif" kindref="compound">netif</ref>)<sp/>{</highlight></codeline>
<codeline lineno="2056"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(router_index<sp/>=<sp/>0;<sp/>router_index<sp/>&lt;<sp/><ref refid="lwipopts_8h_1a75e81a96148f266c8fad8c0bcab2f36a" kindref="member">LWIP_ND6_NUM_ROUTERS</ref>;<sp/>router_index++)<sp/>{</highlight></codeline>
<codeline lineno="2057"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(default_router_list[router_index].neighbor_entry<sp/>==<sp/>&amp;neighbor_cache[i])<sp/>{</highlight></codeline>
<codeline lineno="2058"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>default_router_list[router_index].neighbor_entry<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="2059"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>default_router_list[router_index].flags<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="2060"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="2061"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="2062"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>neighbor_cache[i].isrouter<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="2063"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>nd6_free_neighbor_cache_entry(i);</highlight></codeline>
<codeline lineno="2064"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="2065"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="2066"><highlight class="normal">}</highlight></codeline>
<codeline lineno="2067"><highlight class="normal"></highlight></codeline>
<codeline lineno="2068"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_IPV6_MLD</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="2069"><highlight class="normal"></highlight></codeline>
<codeline lineno="2077"><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="2078"><highlight class="normal">nd6_adjust_mld_membership(</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/><ref refid="group__compiler__abstraction_1ga9cd1d7891fe315de1201e2c6e45f4f57" kindref="member">s8_t</ref><sp/>addr_idx,<sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>new_state)</highlight></codeline>
<codeline lineno="2079"><highlight class="normal">{</highlight></codeline>
<codeline lineno="2080"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>old_state,<sp/>old_member,<sp/>new_member;</highlight></codeline>
<codeline lineno="2081"><highlight class="normal"></highlight></codeline>
<codeline lineno="2082"><highlight class="normal"><sp/><sp/>old_state<sp/>=<sp/>netif_ip6_addr_state(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>addr_idx);</highlight></codeline>
<codeline lineno="2083"><highlight class="normal"></highlight></codeline>
<codeline lineno="2084"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Determine<sp/>whether<sp/>we<sp/>were,<sp/>and<sp/>should<sp/>be,<sp/>a<sp/>member<sp/>of<sp/>the<sp/>solicited-node</highlight></codeline>
<codeline lineno="2085"><highlight class="comment"><sp/><sp/><sp/>*<sp/>multicast<sp/>group<sp/>for<sp/>this<sp/>address.<sp/>For<sp/>tentative<sp/>addresses,<sp/>the<sp/>group<sp/>is</highlight></codeline>
<codeline lineno="2086"><highlight class="comment"><sp/><sp/><sp/>*<sp/>not<sp/>joined<sp/>until<sp/>the<sp/>address<sp/>enters<sp/>the<sp/>TENTATIVE_1<sp/>(or<sp/>VALID)<sp/>state.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="2087"><highlight class="normal"><sp/><sp/>old_member<sp/>=<sp/>(old_state<sp/>!=<sp/>IP6_ADDR_INVALID<sp/>&amp;&amp;<sp/>old_state<sp/>!=<sp/>IP6_ADDR_TENTATIVE);</highlight></codeline>
<codeline lineno="2088"><highlight class="normal"><sp/><sp/>new_member<sp/>=<sp/>(new_state<sp/>!=<sp/>IP6_ADDR_INVALID<sp/>&amp;&amp;<sp/>new_state<sp/>!=<sp/>IP6_ADDR_TENTATIVE);</highlight></codeline>
<codeline lineno="2089"><highlight class="normal"></highlight></codeline>
<codeline lineno="2090"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(old_member<sp/>!=<sp/>new_member)<sp/>{</highlight></codeline>
<codeline lineno="2091"><highlight class="normal"><sp/><sp/><sp/><sp/>ip6_addr_set_solicitednode(&amp;multicast_address,<sp/>netif_ip6_addr(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>addr_idx)-&gt;addr[3]);</highlight></codeline>
<codeline lineno="2092"><highlight class="normal"></highlight></codeline>
<codeline lineno="2093"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(new_member)<sp/>{</highlight></codeline>
<codeline lineno="2094"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>mld6_joingroup_netif(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>&amp;multicast_address);</highlight></codeline>
<codeline lineno="2095"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="2096"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>mld6_leavegroup_netif(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>&amp;multicast_address);</highlight></codeline>
<codeline lineno="2097"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="2098"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="2099"><highlight class="normal">}</highlight></codeline>
<codeline lineno="2100"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_IPV6_MLD<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="2101"><highlight class="normal"></highlight></codeline>
<codeline lineno="2102"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_IPV6<sp/>*/</highlight><highlight class="preprocessor"></highlight></codeline>
    </programlisting>
    <location file="C:/Dev/git/UbixOS/sys/net/core/ipv6/nd6.c"/>
  </compounddef>
</doxygen>
