HTTPClient using static IP

Dependencies:   mbed

Committer:
mr_q
Date:
Mon May 30 11:53:37 2011 +0000
Revision:
0:d8f2f7d5f31b
v0.01 Draft

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mr_q 0:d8f2f7d5f31b 1 /**
mr_q 0:d8f2f7d5f31b 2 * @file
mr_q 0:d8f2f7d5f31b 3 * AutoIP Automatic LinkLocal IP Configuration
mr_q 0:d8f2f7d5f31b 4 *
mr_q 0:d8f2f7d5f31b 5 */
mr_q 0:d8f2f7d5f31b 6
mr_q 0:d8f2f7d5f31b 7 /*
mr_q 0:d8f2f7d5f31b 8 *
mr_q 0:d8f2f7d5f31b 9 * Copyright (c) 2007 Dominik Spies <kontakt@dspies.de>
mr_q 0:d8f2f7d5f31b 10 * All rights reserved.
mr_q 0:d8f2f7d5f31b 11 *
mr_q 0:d8f2f7d5f31b 12 * Redistribution and use in source and binary forms, with or without modification,
mr_q 0:d8f2f7d5f31b 13 * are permitted provided that the following conditions are met:
mr_q 0:d8f2f7d5f31b 14 *
mr_q 0:d8f2f7d5f31b 15 * 1. Redistributions of source code must retain the above copyright notice,
mr_q 0:d8f2f7d5f31b 16 * this list of conditions and the following disclaimer.
mr_q 0:d8f2f7d5f31b 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
mr_q 0:d8f2f7d5f31b 18 * this list of conditions and the following disclaimer in the documentation
mr_q 0:d8f2f7d5f31b 19 * and/or other materials provided with the distribution.
mr_q 0:d8f2f7d5f31b 20 * 3. The name of the author may not be used to endorse or promote products
mr_q 0:d8f2f7d5f31b 21 * derived from this software without specific prior written permission.
mr_q 0:d8f2f7d5f31b 22 *
mr_q 0:d8f2f7d5f31b 23 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
mr_q 0:d8f2f7d5f31b 24 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
mr_q 0:d8f2f7d5f31b 25 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
mr_q 0:d8f2f7d5f31b 26 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
mr_q 0:d8f2f7d5f31b 27 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
mr_q 0:d8f2f7d5f31b 28 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
mr_q 0:d8f2f7d5f31b 29 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
mr_q 0:d8f2f7d5f31b 30 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
mr_q 0:d8f2f7d5f31b 31 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
mr_q 0:d8f2f7d5f31b 32 * OF SUCH DAMAGE.
mr_q 0:d8f2f7d5f31b 33 *
mr_q 0:d8f2f7d5f31b 34 * Author: Dominik Spies <kontakt@dspies.de>
mr_q 0:d8f2f7d5f31b 35 *
mr_q 0:d8f2f7d5f31b 36 * This is a AutoIP implementation for the lwIP TCP/IP stack. It aims to conform
mr_q 0:d8f2f7d5f31b 37 * with RFC 3927.
mr_q 0:d8f2f7d5f31b 38 *
mr_q 0:d8f2f7d5f31b 39 *
mr_q 0:d8f2f7d5f31b 40 * Please coordinate changes and requests with Dominik Spies
mr_q 0:d8f2f7d5f31b 41 * <kontakt@dspies.de>
mr_q 0:d8f2f7d5f31b 42 */
mr_q 0:d8f2f7d5f31b 43
mr_q 0:d8f2f7d5f31b 44 /*******************************************************************************
mr_q 0:d8f2f7d5f31b 45 * USAGE:
mr_q 0:d8f2f7d5f31b 46 *
mr_q 0:d8f2f7d5f31b 47 * define LWIP_AUTOIP 1 in your lwipopts.h
mr_q 0:d8f2f7d5f31b 48 *
mr_q 0:d8f2f7d5f31b 49 * If you don't use tcpip.c (so, don't call, you don't call tcpip_init):
mr_q 0:d8f2f7d5f31b 50 * - First, call autoip_init().
mr_q 0:d8f2f7d5f31b 51 * - call autoip_tmr() all AUTOIP_TMR_INTERVAL msces,
mr_q 0:d8f2f7d5f31b 52 * that should be defined in autoip.h.
mr_q 0:d8f2f7d5f31b 53 * I recommend a value of 100. The value must divide 1000 with a remainder almost 0.
mr_q 0:d8f2f7d5f31b 54 * Possible values are 1000, 500, 333, 250, 200, 166, 142, 125, 111, 100 ....
mr_q 0:d8f2f7d5f31b 55 *
mr_q 0:d8f2f7d5f31b 56 * Without DHCP:
mr_q 0:d8f2f7d5f31b 57 * - Call autoip_start() after netif_add().
mr_q 0:d8f2f7d5f31b 58 *
mr_q 0:d8f2f7d5f31b 59 * With DHCP:
mr_q 0:d8f2f7d5f31b 60 * - define LWIP_DHCP_AUTOIP_COOP 1 in your lwipopts.h.
mr_q 0:d8f2f7d5f31b 61 * - Configure your DHCP Client.
mr_q 0:d8f2f7d5f31b 62 *
mr_q 0:d8f2f7d5f31b 63 */
mr_q 0:d8f2f7d5f31b 64
mr_q 0:d8f2f7d5f31b 65 #include "lwip/opt.h"
mr_q 0:d8f2f7d5f31b 66
mr_q 0:d8f2f7d5f31b 67 #if LWIP_AUTOIP /* don't build if not configured for use in lwipopts.h */
mr_q 0:d8f2f7d5f31b 68
mr_q 0:d8f2f7d5f31b 69 #include "lwip/mem.h"
mr_q 0:d8f2f7d5f31b 70 #include "lwip/udp.h"
mr_q 0:d8f2f7d5f31b 71 #include "lwip/ip_addr.h"
mr_q 0:d8f2f7d5f31b 72 #include "lwip/netif.h"
mr_q 0:d8f2f7d5f31b 73 #include "lwip/autoip.h"
mr_q 0:d8f2f7d5f31b 74 #include "netif/etharp.h"
mr_q 0:d8f2f7d5f31b 75
mr_q 0:d8f2f7d5f31b 76 #include <stdlib.h>
mr_q 0:d8f2f7d5f31b 77 #include <string.h>
mr_q 0:d8f2f7d5f31b 78
mr_q 0:d8f2f7d5f31b 79 /* 169.254.0.0 */
mr_q 0:d8f2f7d5f31b 80 #define AUTOIP_NET 0xA9FE0000
mr_q 0:d8f2f7d5f31b 81 /* 169.254.1.0 */
mr_q 0:d8f2f7d5f31b 82 #define AUTOIP_RANGE_START (AUTOIP_NET | 0x0100)
mr_q 0:d8f2f7d5f31b 83 /* 169.254.254.255 */
mr_q 0:d8f2f7d5f31b 84 #define AUTOIP_RANGE_END (AUTOIP_NET | 0xFEFF)
mr_q 0:d8f2f7d5f31b 85
mr_q 0:d8f2f7d5f31b 86
mr_q 0:d8f2f7d5f31b 87 /** Pseudo random macro based on netif informations.
mr_q 0:d8f2f7d5f31b 88 * You could use "rand()" from the C Library if you define LWIP_AUTOIP_RAND in lwipopts.h */
mr_q 0:d8f2f7d5f31b 89 #ifndef LWIP_AUTOIP_RAND
mr_q 0:d8f2f7d5f31b 90 #define LWIP_AUTOIP_RAND(netif) ( (((u32_t)((netif->hwaddr[5]) & 0xff) << 24) | \
mr_q 0:d8f2f7d5f31b 91 ((u32_t)((netif->hwaddr[3]) & 0xff) << 16) | \
mr_q 0:d8f2f7d5f31b 92 ((u32_t)((netif->hwaddr[2]) & 0xff) << 8) | \
mr_q 0:d8f2f7d5f31b 93 ((u32_t)((netif->hwaddr[4]) & 0xff))) + \
mr_q 0:d8f2f7d5f31b 94 (netif->autoip?netif->autoip->tried_llipaddr:0))
mr_q 0:d8f2f7d5f31b 95 #endif /* LWIP_AUTOIP_RAND */
mr_q 0:d8f2f7d5f31b 96
mr_q 0:d8f2f7d5f31b 97 /**
mr_q 0:d8f2f7d5f31b 98 * Macro that generates the initial IP address to be tried by AUTOIP.
mr_q 0:d8f2f7d5f31b 99 * If you want to override this, define it to something else in lwipopts.h.
mr_q 0:d8f2f7d5f31b 100 */
mr_q 0:d8f2f7d5f31b 101 #ifndef LWIP_AUTOIP_CREATE_SEED_ADDR
mr_q 0:d8f2f7d5f31b 102 #define LWIP_AUTOIP_CREATE_SEED_ADDR(netif) \
mr_q 0:d8f2f7d5f31b 103 htonl(AUTOIP_RANGE_START + ((u32_t)(((u8_t)(netif->hwaddr[4])) | \
mr_q 0:d8f2f7d5f31b 104 ((u32_t)((u8_t)(netif->hwaddr[5]))) << 8)))
mr_q 0:d8f2f7d5f31b 105 #endif /* LWIP_AUTOIP_CREATE_SEED_ADDR */
mr_q 0:d8f2f7d5f31b 106
mr_q 0:d8f2f7d5f31b 107 /* static functions */
mr_q 0:d8f2f7d5f31b 108 static void autoip_handle_arp_conflict(struct netif *netif);
mr_q 0:d8f2f7d5f31b 109
mr_q 0:d8f2f7d5f31b 110 /* creates a pseudo random LL IP-Address for a network interface */
mr_q 0:d8f2f7d5f31b 111 static void autoip_create_addr(struct netif *netif, ip_addr_t *ipaddr);
mr_q 0:d8f2f7d5f31b 112
mr_q 0:d8f2f7d5f31b 113 /* sends an ARP probe */
mr_q 0:d8f2f7d5f31b 114 static err_t autoip_arp_probe(struct netif *netif);
mr_q 0:d8f2f7d5f31b 115
mr_q 0:d8f2f7d5f31b 116 /* sends an ARP announce */
mr_q 0:d8f2f7d5f31b 117 static err_t autoip_arp_announce(struct netif *netif);
mr_q 0:d8f2f7d5f31b 118
mr_q 0:d8f2f7d5f31b 119 /* configure interface for use with current LL IP-Address */
mr_q 0:d8f2f7d5f31b 120 static err_t autoip_bind(struct netif *netif);
mr_q 0:d8f2f7d5f31b 121
mr_q 0:d8f2f7d5f31b 122 /* start sending probes for llipaddr */
mr_q 0:d8f2f7d5f31b 123 static void autoip_start_probing(struct netif *netif);
mr_q 0:d8f2f7d5f31b 124
mr_q 0:d8f2f7d5f31b 125 /**
mr_q 0:d8f2f7d5f31b 126 * Initialize this module
mr_q 0:d8f2f7d5f31b 127 */
mr_q 0:d8f2f7d5f31b 128 void
mr_q 0:d8f2f7d5f31b 129 autoip_init(void)
mr_q 0:d8f2f7d5f31b 130 {
mr_q 0:d8f2f7d5f31b 131 LWIP_DEBUGF(AUTOIP_DEBUG | LWIP_DBG_TRACE, ("autoip_init()\n"));
mr_q 0:d8f2f7d5f31b 132 }
mr_q 0:d8f2f7d5f31b 133
mr_q 0:d8f2f7d5f31b 134 /** Set a statically allocated struct autoip to work with.
mr_q 0:d8f2f7d5f31b 135 * Using this prevents autoip_start to allocate it using mem_malloc.
mr_q 0:d8f2f7d5f31b 136 *
mr_q 0:d8f2f7d5f31b 137 * @param netif the netif for which to set the struct autoip
mr_q 0:d8f2f7d5f31b 138 * @param dhcp (uninitialised) dhcp struct allocated by the application
mr_q 0:d8f2f7d5f31b 139 */
mr_q 0:d8f2f7d5f31b 140 void
mr_q 0:d8f2f7d5f31b 141 autoip_set_struct(struct netif *netif, struct autoip *autoip)
mr_q 0:d8f2f7d5f31b 142 {
mr_q 0:d8f2f7d5f31b 143 LWIP_ASSERT("netif != NULL", netif != NULL);
mr_q 0:d8f2f7d5f31b 144 LWIP_ASSERT("autoip != NULL", autoip != NULL);
mr_q 0:d8f2f7d5f31b 145 LWIP_ASSERT("netif already has a struct autoip set", netif->autoip == NULL);
mr_q 0:d8f2f7d5f31b 146
mr_q 0:d8f2f7d5f31b 147 /* clear data structure */
mr_q 0:d8f2f7d5f31b 148 memset(autoip, 0, sizeof(struct autoip));
mr_q 0:d8f2f7d5f31b 149 /* autoip->state = AUTOIP_STATE_OFF; */
mr_q 0:d8f2f7d5f31b 150 netif->autoip = autoip;
mr_q 0:d8f2f7d5f31b 151 }
mr_q 0:d8f2f7d5f31b 152
mr_q 0:d8f2f7d5f31b 153 /** Restart AutoIP client and check the next address (conflict detected)
mr_q 0:d8f2f7d5f31b 154 *
mr_q 0:d8f2f7d5f31b 155 * @param netif The netif under AutoIP control
mr_q 0:d8f2f7d5f31b 156 */
mr_q 0:d8f2f7d5f31b 157 static void
mr_q 0:d8f2f7d5f31b 158 autoip_restart(struct netif *netif)
mr_q 0:d8f2f7d5f31b 159 {
mr_q 0:d8f2f7d5f31b 160 netif->autoip->tried_llipaddr++;
mr_q 0:d8f2f7d5f31b 161 autoip_start(netif);
mr_q 0:d8f2f7d5f31b 162 }
mr_q 0:d8f2f7d5f31b 163
mr_q 0:d8f2f7d5f31b 164 /**
mr_q 0:d8f2f7d5f31b 165 * Handle a IP address conflict after an ARP conflict detection
mr_q 0:d8f2f7d5f31b 166 */
mr_q 0:d8f2f7d5f31b 167 static void
mr_q 0:d8f2f7d5f31b 168 autoip_handle_arp_conflict(struct netif *netif)
mr_q 0:d8f2f7d5f31b 169 {
mr_q 0:d8f2f7d5f31b 170 /* Somehow detect if we are defending or retreating */
mr_q 0:d8f2f7d5f31b 171 unsigned char defend = 1; /* tbd */
mr_q 0:d8f2f7d5f31b 172
mr_q 0:d8f2f7d5f31b 173 if(defend) {
mr_q 0:d8f2f7d5f31b 174 if(netif->autoip->lastconflict > 0) {
mr_q 0:d8f2f7d5f31b 175 /* retreat, there was a conflicting ARP in the last
mr_q 0:d8f2f7d5f31b 176 * DEFEND_INTERVAL seconds
mr_q 0:d8f2f7d5f31b 177 */
mr_q 0:d8f2f7d5f31b 178 LWIP_DEBUGF(AUTOIP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE,
mr_q 0:d8f2f7d5f31b 179 ("autoip_handle_arp_conflict(): we are defending, but in DEFEND_INTERVAL, retreating\n"));
mr_q 0:d8f2f7d5f31b 180
mr_q 0:d8f2f7d5f31b 181 /* TODO: close all TCP sessions */
mr_q 0:d8f2f7d5f31b 182 autoip_restart(netif);
mr_q 0:d8f2f7d5f31b 183 } else {
mr_q 0:d8f2f7d5f31b 184 LWIP_DEBUGF(AUTOIP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE,
mr_q 0:d8f2f7d5f31b 185 ("autoip_handle_arp_conflict(): we are defend, send ARP Announce\n"));
mr_q 0:d8f2f7d5f31b 186 autoip_arp_announce(netif);
mr_q 0:d8f2f7d5f31b 187 netif->autoip->lastconflict = DEFEND_INTERVAL * AUTOIP_TICKS_PER_SECOND;
mr_q 0:d8f2f7d5f31b 188 }
mr_q 0:d8f2f7d5f31b 189 } else {
mr_q 0:d8f2f7d5f31b 190 LWIP_DEBUGF(AUTOIP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE,
mr_q 0:d8f2f7d5f31b 191 ("autoip_handle_arp_conflict(): we do not defend, retreating\n"));
mr_q 0:d8f2f7d5f31b 192 /* TODO: close all TCP sessions */
mr_q 0:d8f2f7d5f31b 193 autoip_restart(netif);
mr_q 0:d8f2f7d5f31b 194 }
mr_q 0:d8f2f7d5f31b 195 }
mr_q 0:d8f2f7d5f31b 196
mr_q 0:d8f2f7d5f31b 197 /**
mr_q 0:d8f2f7d5f31b 198 * Create an IP-Address out of range 169.254.1.0 to 169.254.254.255
mr_q 0:d8f2f7d5f31b 199 *
mr_q 0:d8f2f7d5f31b 200 * @param netif network interface on which create the IP-Address
mr_q 0:d8f2f7d5f31b 201 * @param ipaddr ip address to initialize
mr_q 0:d8f2f7d5f31b 202 */
mr_q 0:d8f2f7d5f31b 203 static void
mr_q 0:d8f2f7d5f31b 204 autoip_create_addr(struct netif *netif, ip_addr_t *ipaddr)
mr_q 0:d8f2f7d5f31b 205 {
mr_q 0:d8f2f7d5f31b 206 /* Here we create an IP-Address out of range 169.254.1.0 to 169.254.254.255
mr_q 0:d8f2f7d5f31b 207 * compliant to RFC 3927 Section 2.1
mr_q 0:d8f2f7d5f31b 208 * We have 254 * 256 possibilities */
mr_q 0:d8f2f7d5f31b 209
mr_q 0:d8f2f7d5f31b 210 u32_t addr = ntohl(LWIP_AUTOIP_CREATE_SEED_ADDR(netif));
mr_q 0:d8f2f7d5f31b 211 addr += netif->autoip->tried_llipaddr;
mr_q 0:d8f2f7d5f31b 212 addr = AUTOIP_NET | (addr & 0xffff);
mr_q 0:d8f2f7d5f31b 213 /* Now, 169.254.0.0 <= addr <= 169.254.255.255 */
mr_q 0:d8f2f7d5f31b 214
mr_q 0:d8f2f7d5f31b 215 if (addr < AUTOIP_RANGE_START) {
mr_q 0:d8f2f7d5f31b 216 addr += AUTOIP_RANGE_END - AUTOIP_RANGE_START + 1;
mr_q 0:d8f2f7d5f31b 217 }
mr_q 0:d8f2f7d5f31b 218 if (addr > AUTOIP_RANGE_END) {
mr_q 0:d8f2f7d5f31b 219 addr -= AUTOIP_RANGE_END - AUTOIP_RANGE_START + 1;
mr_q 0:d8f2f7d5f31b 220 }
mr_q 0:d8f2f7d5f31b 221 LWIP_ASSERT("AUTOIP address not in range", (addr >= AUTOIP_RANGE_START) &&
mr_q 0:d8f2f7d5f31b 222 (addr <= AUTOIP_RANGE_END));
mr_q 0:d8f2f7d5f31b 223 ip4_addr_set_u32(ipaddr, htonl(addr));
mr_q 0:d8f2f7d5f31b 224
mr_q 0:d8f2f7d5f31b 225 LWIP_DEBUGF(AUTOIP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE,
mr_q 0:d8f2f7d5f31b 226 ("autoip_create_addr(): tried_llipaddr=%"U16_F", %"U16_F".%"U16_F".%"U16_F".%"U16_F"\n",
mr_q 0:d8f2f7d5f31b 227 (u16_t)(netif->autoip->tried_llipaddr), ip4_addr1_16(ipaddr), ip4_addr2_16(ipaddr),
mr_q 0:d8f2f7d5f31b 228 ip4_addr3_16(ipaddr), ip4_addr4_16(ipaddr)));
mr_q 0:d8f2f7d5f31b 229 }
mr_q 0:d8f2f7d5f31b 230
mr_q 0:d8f2f7d5f31b 231 /**
mr_q 0:d8f2f7d5f31b 232 * Sends an ARP probe from a network interface
mr_q 0:d8f2f7d5f31b 233 *
mr_q 0:d8f2f7d5f31b 234 * @param netif network interface used to send the probe
mr_q 0:d8f2f7d5f31b 235 */
mr_q 0:d8f2f7d5f31b 236 static err_t
mr_q 0:d8f2f7d5f31b 237 autoip_arp_probe(struct netif *netif)
mr_q 0:d8f2f7d5f31b 238 {
mr_q 0:d8f2f7d5f31b 239 return etharp_raw(netif, (struct eth_addr *)netif->hwaddr, &ethbroadcast,
mr_q 0:d8f2f7d5f31b 240 (struct eth_addr *)netif->hwaddr, IP_ADDR_ANY, &ethzero,
mr_q 0:d8f2f7d5f31b 241 &netif->autoip->llipaddr, ARP_REQUEST);
mr_q 0:d8f2f7d5f31b 242 }
mr_q 0:d8f2f7d5f31b 243
mr_q 0:d8f2f7d5f31b 244 /**
mr_q 0:d8f2f7d5f31b 245 * Sends an ARP announce from a network interface
mr_q 0:d8f2f7d5f31b 246 *
mr_q 0:d8f2f7d5f31b 247 * @param netif network interface used to send the announce
mr_q 0:d8f2f7d5f31b 248 */
mr_q 0:d8f2f7d5f31b 249 static err_t
mr_q 0:d8f2f7d5f31b 250 autoip_arp_announce(struct netif *netif)
mr_q 0:d8f2f7d5f31b 251 {
mr_q 0:d8f2f7d5f31b 252 return etharp_raw(netif, (struct eth_addr *)netif->hwaddr, &ethbroadcast,
mr_q 0:d8f2f7d5f31b 253 (struct eth_addr *)netif->hwaddr, &netif->autoip->llipaddr, &ethzero,
mr_q 0:d8f2f7d5f31b 254 &netif->autoip->llipaddr, ARP_REQUEST);
mr_q 0:d8f2f7d5f31b 255 }
mr_q 0:d8f2f7d5f31b 256
mr_q 0:d8f2f7d5f31b 257 /**
mr_q 0:d8f2f7d5f31b 258 * Configure interface for use with current LL IP-Address
mr_q 0:d8f2f7d5f31b 259 *
mr_q 0:d8f2f7d5f31b 260 * @param netif network interface to configure with current LL IP-Address
mr_q 0:d8f2f7d5f31b 261 */
mr_q 0:d8f2f7d5f31b 262 static err_t
mr_q 0:d8f2f7d5f31b 263 autoip_bind(struct netif *netif)
mr_q 0:d8f2f7d5f31b 264 {
mr_q 0:d8f2f7d5f31b 265 struct autoip *autoip = netif->autoip;
mr_q 0:d8f2f7d5f31b 266 ip_addr_t sn_mask, gw_addr;
mr_q 0:d8f2f7d5f31b 267
mr_q 0:d8f2f7d5f31b 268 LWIP_DEBUGF(AUTOIP_DEBUG | LWIP_DBG_TRACE,
mr_q 0:d8f2f7d5f31b 269 ("autoip_bind(netif=%p) %c%c%"U16_F" %"U16_F".%"U16_F".%"U16_F".%"U16_F"\n",
mr_q 0:d8f2f7d5f31b 270 (void*)netif, netif->name[0], netif->name[1], (u16_t)netif->num,
mr_q 0:d8f2f7d5f31b 271 ip4_addr1_16(&autoip->llipaddr), ip4_addr2_16(&autoip->llipaddr),
mr_q 0:d8f2f7d5f31b 272 ip4_addr3_16(&autoip->llipaddr), ip4_addr4_16(&autoip->llipaddr)));
mr_q 0:d8f2f7d5f31b 273
mr_q 0:d8f2f7d5f31b 274 IP4_ADDR(&sn_mask, 255, 255, 0, 0);
mr_q 0:d8f2f7d5f31b 275 IP4_ADDR(&gw_addr, 0, 0, 0, 0);
mr_q 0:d8f2f7d5f31b 276
mr_q 0:d8f2f7d5f31b 277 netif_set_ipaddr(netif, &autoip->llipaddr);
mr_q 0:d8f2f7d5f31b 278 netif_set_netmask(netif, &sn_mask);
mr_q 0:d8f2f7d5f31b 279 netif_set_gw(netif, &gw_addr);
mr_q 0:d8f2f7d5f31b 280
mr_q 0:d8f2f7d5f31b 281 /* bring the interface up */
mr_q 0:d8f2f7d5f31b 282 netif_set_up(netif);
mr_q 0:d8f2f7d5f31b 283
mr_q 0:d8f2f7d5f31b 284 return ERR_OK;
mr_q 0:d8f2f7d5f31b 285 }
mr_q 0:d8f2f7d5f31b 286
mr_q 0:d8f2f7d5f31b 287 /**
mr_q 0:d8f2f7d5f31b 288 * Start AutoIP client
mr_q 0:d8f2f7d5f31b 289 *
mr_q 0:d8f2f7d5f31b 290 * @param netif network interface on which start the AutoIP client
mr_q 0:d8f2f7d5f31b 291 */
mr_q 0:d8f2f7d5f31b 292 err_t
mr_q 0:d8f2f7d5f31b 293 autoip_start(struct netif *netif)
mr_q 0:d8f2f7d5f31b 294 {
mr_q 0:d8f2f7d5f31b 295 struct autoip *autoip = netif->autoip;
mr_q 0:d8f2f7d5f31b 296 err_t result = ERR_OK;
mr_q 0:d8f2f7d5f31b 297
mr_q 0:d8f2f7d5f31b 298 if(netif_is_up(netif)) {
mr_q 0:d8f2f7d5f31b 299 netif_set_down(netif);
mr_q 0:d8f2f7d5f31b 300 }
mr_q 0:d8f2f7d5f31b 301
mr_q 0:d8f2f7d5f31b 302 /* Set IP-Address, Netmask and Gateway to 0 to make sure that
mr_q 0:d8f2f7d5f31b 303 * ARP Packets are formed correctly
mr_q 0:d8f2f7d5f31b 304 */
mr_q 0:d8f2f7d5f31b 305 ip_addr_set_zero(&netif->ip_addr);
mr_q 0:d8f2f7d5f31b 306 ip_addr_set_zero(&netif->netmask);
mr_q 0:d8f2f7d5f31b 307 ip_addr_set_zero(&netif->gw);
mr_q 0:d8f2f7d5f31b 308
mr_q 0:d8f2f7d5f31b 309 LWIP_DEBUGF(AUTOIP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE,
mr_q 0:d8f2f7d5f31b 310 ("autoip_start(netif=%p) %c%c%"U16_F"\n", (void*)netif, netif->name[0],
mr_q 0:d8f2f7d5f31b 311 netif->name[1], (u16_t)netif->num));
mr_q 0:d8f2f7d5f31b 312 if(autoip == NULL) {
mr_q 0:d8f2f7d5f31b 313 /* no AutoIP client attached yet? */
mr_q 0:d8f2f7d5f31b 314 LWIP_DEBUGF(AUTOIP_DEBUG | LWIP_DBG_TRACE,
mr_q 0:d8f2f7d5f31b 315 ("autoip_start(): starting new AUTOIP client\n"));
mr_q 0:d8f2f7d5f31b 316 autoip = (struct autoip *)mem_malloc(sizeof(struct autoip));
mr_q 0:d8f2f7d5f31b 317 if(autoip == NULL) {
mr_q 0:d8f2f7d5f31b 318 LWIP_DEBUGF(AUTOIP_DEBUG | LWIP_DBG_TRACE,
mr_q 0:d8f2f7d5f31b 319 ("autoip_start(): could not allocate autoip\n"));
mr_q 0:d8f2f7d5f31b 320 return ERR_MEM;
mr_q 0:d8f2f7d5f31b 321 }
mr_q 0:d8f2f7d5f31b 322 memset(autoip, 0, sizeof(struct autoip));
mr_q 0:d8f2f7d5f31b 323 /* store this AutoIP client in the netif */
mr_q 0:d8f2f7d5f31b 324 netif->autoip = autoip;
mr_q 0:d8f2f7d5f31b 325 LWIP_DEBUGF(AUTOIP_DEBUG | LWIP_DBG_TRACE, ("autoip_start(): allocated autoip"));
mr_q 0:d8f2f7d5f31b 326 } else {
mr_q 0:d8f2f7d5f31b 327 autoip->state = AUTOIP_STATE_OFF;
mr_q 0:d8f2f7d5f31b 328 autoip->ttw = 0;
mr_q 0:d8f2f7d5f31b 329 autoip->sent_num = 0;
mr_q 0:d8f2f7d5f31b 330 ip_addr_set_zero(&autoip->llipaddr);
mr_q 0:d8f2f7d5f31b 331 autoip->lastconflict = 0;
mr_q 0:d8f2f7d5f31b 332 }
mr_q 0:d8f2f7d5f31b 333
mr_q 0:d8f2f7d5f31b 334 autoip_create_addr(netif, &(autoip->llipaddr));
mr_q 0:d8f2f7d5f31b 335 autoip_start_probing(netif);
mr_q 0:d8f2f7d5f31b 336
mr_q 0:d8f2f7d5f31b 337 return result;
mr_q 0:d8f2f7d5f31b 338 }
mr_q 0:d8f2f7d5f31b 339
mr_q 0:d8f2f7d5f31b 340 static void
mr_q 0:d8f2f7d5f31b 341 autoip_start_probing(struct netif *netif)
mr_q 0:d8f2f7d5f31b 342 {
mr_q 0:d8f2f7d5f31b 343 struct autoip *autoip = netif->autoip;
mr_q 0:d8f2f7d5f31b 344
mr_q 0:d8f2f7d5f31b 345 autoip->state = AUTOIP_STATE_PROBING;
mr_q 0:d8f2f7d5f31b 346 autoip->sent_num = 0;
mr_q 0:d8f2f7d5f31b 347 LWIP_DEBUGF(AUTOIP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE,
mr_q 0:d8f2f7d5f31b 348 ("autoip_start_probing(): changing state to PROBING: %"U16_F".%"U16_F".%"U16_F".%"U16_F"\n",
mr_q 0:d8f2f7d5f31b 349 ip4_addr1_16(&netif->autoip->llipaddr), ip4_addr2_16(&netif->autoip->llipaddr),
mr_q 0:d8f2f7d5f31b 350 ip4_addr3_16(&netif->autoip->llipaddr), ip4_addr4_16(&netif->autoip->llipaddr)));
mr_q 0:d8f2f7d5f31b 351
mr_q 0:d8f2f7d5f31b 352 /* time to wait to first probe, this is randomly
mr_q 0:d8f2f7d5f31b 353 * choosen out of 0 to PROBE_WAIT seconds.
mr_q 0:d8f2f7d5f31b 354 * compliant to RFC 3927 Section 2.2.1
mr_q 0:d8f2f7d5f31b 355 */
mr_q 0:d8f2f7d5f31b 356 autoip->ttw = (u16_t)(LWIP_AUTOIP_RAND(netif) % (PROBE_WAIT * AUTOIP_TICKS_PER_SECOND));
mr_q 0:d8f2f7d5f31b 357
mr_q 0:d8f2f7d5f31b 358 /*
mr_q 0:d8f2f7d5f31b 359 * if we tried more then MAX_CONFLICTS we must limit our rate for
mr_q 0:d8f2f7d5f31b 360 * accquiring and probing address
mr_q 0:d8f2f7d5f31b 361 * compliant to RFC 3927 Section 2.2.1
mr_q 0:d8f2f7d5f31b 362 */
mr_q 0:d8f2f7d5f31b 363 if(autoip->tried_llipaddr > MAX_CONFLICTS) {
mr_q 0:d8f2f7d5f31b 364 autoip->ttw = RATE_LIMIT_INTERVAL * AUTOIP_TICKS_PER_SECOND;
mr_q 0:d8f2f7d5f31b 365 }
mr_q 0:d8f2f7d5f31b 366 }
mr_q 0:d8f2f7d5f31b 367
mr_q 0:d8f2f7d5f31b 368 /**
mr_q 0:d8f2f7d5f31b 369 * Handle a possible change in the network configuration.
mr_q 0:d8f2f7d5f31b 370 *
mr_q 0:d8f2f7d5f31b 371 * If there is an AutoIP address configured, take the interface down
mr_q 0:d8f2f7d5f31b 372 * and begin probing with the same address.
mr_q 0:d8f2f7d5f31b 373 */
mr_q 0:d8f2f7d5f31b 374 void
mr_q 0:d8f2f7d5f31b 375 autoip_network_changed(struct netif *netif)
mr_q 0:d8f2f7d5f31b 376 {
mr_q 0:d8f2f7d5f31b 377 if (netif->autoip && netif->autoip->state != AUTOIP_STATE_OFF) {
mr_q 0:d8f2f7d5f31b 378 netif_set_down(netif);
mr_q 0:d8f2f7d5f31b 379 autoip_start_probing(netif);
mr_q 0:d8f2f7d5f31b 380 }
mr_q 0:d8f2f7d5f31b 381 }
mr_q 0:d8f2f7d5f31b 382
mr_q 0:d8f2f7d5f31b 383 /**
mr_q 0:d8f2f7d5f31b 384 * Stop AutoIP client
mr_q 0:d8f2f7d5f31b 385 *
mr_q 0:d8f2f7d5f31b 386 * @param netif network interface on which stop the AutoIP client
mr_q 0:d8f2f7d5f31b 387 */
mr_q 0:d8f2f7d5f31b 388 err_t
mr_q 0:d8f2f7d5f31b 389 autoip_stop(struct netif *netif)
mr_q 0:d8f2f7d5f31b 390 {
mr_q 0:d8f2f7d5f31b 391 netif->autoip->state = AUTOIP_STATE_OFF;
mr_q 0:d8f2f7d5f31b 392 netif_set_down(netif);
mr_q 0:d8f2f7d5f31b 393 return ERR_OK;
mr_q 0:d8f2f7d5f31b 394 }
mr_q 0:d8f2f7d5f31b 395
mr_q 0:d8f2f7d5f31b 396 /**
mr_q 0:d8f2f7d5f31b 397 * Has to be called in loop every AUTOIP_TMR_INTERVAL milliseconds
mr_q 0:d8f2f7d5f31b 398 */
mr_q 0:d8f2f7d5f31b 399 void
mr_q 0:d8f2f7d5f31b 400 autoip_tmr()
mr_q 0:d8f2f7d5f31b 401 {
mr_q 0:d8f2f7d5f31b 402 struct netif *netif = netif_list;
mr_q 0:d8f2f7d5f31b 403 /* loop through netif's */
mr_q 0:d8f2f7d5f31b 404 while (netif != NULL) {
mr_q 0:d8f2f7d5f31b 405 /* only act on AutoIP configured interfaces */
mr_q 0:d8f2f7d5f31b 406 if (netif->autoip != NULL) {
mr_q 0:d8f2f7d5f31b 407 if(netif->autoip->lastconflict > 0) {
mr_q 0:d8f2f7d5f31b 408 netif->autoip->lastconflict--;
mr_q 0:d8f2f7d5f31b 409 }
mr_q 0:d8f2f7d5f31b 410
mr_q 0:d8f2f7d5f31b 411 LWIP_DEBUGF(AUTOIP_DEBUG | LWIP_DBG_TRACE,
mr_q 0:d8f2f7d5f31b 412 ("autoip_tmr() AutoIP-State: %"U16_F", ttw=%"U16_F"\n",
mr_q 0:d8f2f7d5f31b 413 (u16_t)(netif->autoip->state), netif->autoip->ttw));
mr_q 0:d8f2f7d5f31b 414
mr_q 0:d8f2f7d5f31b 415 switch(netif->autoip->state) {
mr_q 0:d8f2f7d5f31b 416 case AUTOIP_STATE_PROBING:
mr_q 0:d8f2f7d5f31b 417 if(netif->autoip->ttw > 0) {
mr_q 0:d8f2f7d5f31b 418 netif->autoip->ttw--;
mr_q 0:d8f2f7d5f31b 419 } else {
mr_q 0:d8f2f7d5f31b 420 if(netif->autoip->sent_num >= PROBE_NUM) {
mr_q 0:d8f2f7d5f31b 421 netif->autoip->state = AUTOIP_STATE_ANNOUNCING;
mr_q 0:d8f2f7d5f31b 422 netif->autoip->sent_num = 0;
mr_q 0:d8f2f7d5f31b 423 netif->autoip->ttw = ANNOUNCE_WAIT * AUTOIP_TICKS_PER_SECOND;
mr_q 0:d8f2f7d5f31b 424 LWIP_DEBUGF(AUTOIP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE,
mr_q 0:d8f2f7d5f31b 425 ("autoip_tmr(): changing state to ANNOUNCING: %"U16_F".%"U16_F".%"U16_F".%"U16_F"\n",
mr_q 0:d8f2f7d5f31b 426 ip4_addr1_16(&netif->autoip->llipaddr), ip4_addr2_16(&netif->autoip->llipaddr),
mr_q 0:d8f2f7d5f31b 427 ip4_addr3_16(&netif->autoip->llipaddr), ip4_addr4_16(&netif->autoip->llipaddr)));
mr_q 0:d8f2f7d5f31b 428 } else {
mr_q 0:d8f2f7d5f31b 429 autoip_arp_probe(netif);
mr_q 0:d8f2f7d5f31b 430 LWIP_DEBUGF(AUTOIP_DEBUG | LWIP_DBG_TRACE,
mr_q 0:d8f2f7d5f31b 431 ("autoip_tmr() PROBING Sent Probe\n"));
mr_q 0:d8f2f7d5f31b 432 netif->autoip->sent_num++;
mr_q 0:d8f2f7d5f31b 433 /* calculate time to wait to next probe */
mr_q 0:d8f2f7d5f31b 434 netif->autoip->ttw = (u16_t)((LWIP_AUTOIP_RAND(netif) %
mr_q 0:d8f2f7d5f31b 435 ((PROBE_MAX - PROBE_MIN) * AUTOIP_TICKS_PER_SECOND) ) +
mr_q 0:d8f2f7d5f31b 436 PROBE_MIN * AUTOIP_TICKS_PER_SECOND);
mr_q 0:d8f2f7d5f31b 437 }
mr_q 0:d8f2f7d5f31b 438 }
mr_q 0:d8f2f7d5f31b 439 break;
mr_q 0:d8f2f7d5f31b 440
mr_q 0:d8f2f7d5f31b 441 case AUTOIP_STATE_ANNOUNCING:
mr_q 0:d8f2f7d5f31b 442 if(netif->autoip->ttw > 0) {
mr_q 0:d8f2f7d5f31b 443 netif->autoip->ttw--;
mr_q 0:d8f2f7d5f31b 444 } else {
mr_q 0:d8f2f7d5f31b 445 if(netif->autoip->sent_num == 0) {
mr_q 0:d8f2f7d5f31b 446 /* We are here the first time, so we waited ANNOUNCE_WAIT seconds
mr_q 0:d8f2f7d5f31b 447 * Now we can bind to an IP address and use it.
mr_q 0:d8f2f7d5f31b 448 *
mr_q 0:d8f2f7d5f31b 449 * autoip_bind calls netif_set_up. This triggers a gratuitous ARP
mr_q 0:d8f2f7d5f31b 450 * which counts as an announcement.
mr_q 0:d8f2f7d5f31b 451 */
mr_q 0:d8f2f7d5f31b 452 autoip_bind(netif);
mr_q 0:d8f2f7d5f31b 453 } else {
mr_q 0:d8f2f7d5f31b 454 autoip_arp_announce(netif);
mr_q 0:d8f2f7d5f31b 455 LWIP_DEBUGF(AUTOIP_DEBUG | LWIP_DBG_TRACE,
mr_q 0:d8f2f7d5f31b 456 ("autoip_tmr() ANNOUNCING Sent Announce\n"));
mr_q 0:d8f2f7d5f31b 457 }
mr_q 0:d8f2f7d5f31b 458 netif->autoip->ttw = ANNOUNCE_INTERVAL * AUTOIP_TICKS_PER_SECOND;
mr_q 0:d8f2f7d5f31b 459 netif->autoip->sent_num++;
mr_q 0:d8f2f7d5f31b 460
mr_q 0:d8f2f7d5f31b 461 if(netif->autoip->sent_num >= ANNOUNCE_NUM) {
mr_q 0:d8f2f7d5f31b 462 netif->autoip->state = AUTOIP_STATE_BOUND;
mr_q 0:d8f2f7d5f31b 463 netif->autoip->sent_num = 0;
mr_q 0:d8f2f7d5f31b 464 netif->autoip->ttw = 0;
mr_q 0:d8f2f7d5f31b 465 LWIP_DEBUGF(AUTOIP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE,
mr_q 0:d8f2f7d5f31b 466 ("autoip_tmr(): changing state to BOUND: %"U16_F".%"U16_F".%"U16_F".%"U16_F"\n",
mr_q 0:d8f2f7d5f31b 467 ip4_addr1_16(&netif->autoip->llipaddr), ip4_addr2_16(&netif->autoip->llipaddr),
mr_q 0:d8f2f7d5f31b 468 ip4_addr3_16(&netif->autoip->llipaddr), ip4_addr4_16(&netif->autoip->llipaddr)));
mr_q 0:d8f2f7d5f31b 469 }
mr_q 0:d8f2f7d5f31b 470 }
mr_q 0:d8f2f7d5f31b 471 break;
mr_q 0:d8f2f7d5f31b 472 }
mr_q 0:d8f2f7d5f31b 473 }
mr_q 0:d8f2f7d5f31b 474 /* proceed to next network interface */
mr_q 0:d8f2f7d5f31b 475 netif = netif->next;
mr_q 0:d8f2f7d5f31b 476 }
mr_q 0:d8f2f7d5f31b 477 }
mr_q 0:d8f2f7d5f31b 478
mr_q 0:d8f2f7d5f31b 479 /**
mr_q 0:d8f2f7d5f31b 480 * Handles every incoming ARP Packet, called by etharp_arp_input.
mr_q 0:d8f2f7d5f31b 481 *
mr_q 0:d8f2f7d5f31b 482 * @param netif network interface to use for autoip processing
mr_q 0:d8f2f7d5f31b 483 * @param hdr Incoming ARP packet
mr_q 0:d8f2f7d5f31b 484 */
mr_q 0:d8f2f7d5f31b 485 void
mr_q 0:d8f2f7d5f31b 486 autoip_arp_reply(struct netif *netif, struct etharp_hdr *hdr)
mr_q 0:d8f2f7d5f31b 487 {
mr_q 0:d8f2f7d5f31b 488 LWIP_DEBUGF(AUTOIP_DEBUG | LWIP_DBG_TRACE, ("autoip_arp_reply()\n"));
mr_q 0:d8f2f7d5f31b 489 if ((netif->autoip != NULL) && (netif->autoip->state != AUTOIP_STATE_OFF)) {
mr_q 0:d8f2f7d5f31b 490 /* when ip.src == llipaddr && hw.src != netif->hwaddr
mr_q 0:d8f2f7d5f31b 491 *
mr_q 0:d8f2f7d5f31b 492 * when probing ip.dst == llipaddr && hw.src != netif->hwaddr
mr_q 0:d8f2f7d5f31b 493 * we have a conflict and must solve it
mr_q 0:d8f2f7d5f31b 494 */
mr_q 0:d8f2f7d5f31b 495 ip_addr_t sipaddr, dipaddr;
mr_q 0:d8f2f7d5f31b 496 struct eth_addr netifaddr;
mr_q 0:d8f2f7d5f31b 497 netifaddr.addr[0] = netif->hwaddr[0];
mr_q 0:d8f2f7d5f31b 498 netifaddr.addr[1] = netif->hwaddr[1];
mr_q 0:d8f2f7d5f31b 499 netifaddr.addr[2] = netif->hwaddr[2];
mr_q 0:d8f2f7d5f31b 500 netifaddr.addr[3] = netif->hwaddr[3];
mr_q 0:d8f2f7d5f31b 501 netifaddr.addr[4] = netif->hwaddr[4];
mr_q 0:d8f2f7d5f31b 502 netifaddr.addr[5] = netif->hwaddr[5];
mr_q 0:d8f2f7d5f31b 503
mr_q 0:d8f2f7d5f31b 504 /* Copy struct ip_addr2 to aligned ip_addr, to support compilers without
mr_q 0:d8f2f7d5f31b 505 * structure packing (not using structure copy which breaks strict-aliasing rules).
mr_q 0:d8f2f7d5f31b 506 */
mr_q 0:d8f2f7d5f31b 507 IPADDR2_COPY(&sipaddr, &hdr->sipaddr);
mr_q 0:d8f2f7d5f31b 508 IPADDR2_COPY(&dipaddr, &hdr->dipaddr);
mr_q 0:d8f2f7d5f31b 509
mr_q 0:d8f2f7d5f31b 510 if ((netif->autoip->state == AUTOIP_STATE_PROBING) ||
mr_q 0:d8f2f7d5f31b 511 ((netif->autoip->state == AUTOIP_STATE_ANNOUNCING) &&
mr_q 0:d8f2f7d5f31b 512 (netif->autoip->sent_num == 0))) {
mr_q 0:d8f2f7d5f31b 513 /* RFC 3927 Section 2.2.1:
mr_q 0:d8f2f7d5f31b 514 * from beginning to after ANNOUNCE_WAIT
mr_q 0:d8f2f7d5f31b 515 * seconds we have a conflict if
mr_q 0:d8f2f7d5f31b 516 * ip.src == llipaddr OR
mr_q 0:d8f2f7d5f31b 517 * ip.dst == llipaddr && hw.src != own hwaddr
mr_q 0:d8f2f7d5f31b 518 */
mr_q 0:d8f2f7d5f31b 519 if ((ip_addr_cmp(&sipaddr, &netif->autoip->llipaddr)) ||
mr_q 0:d8f2f7d5f31b 520 (ip_addr_cmp(&dipaddr, &netif->autoip->llipaddr) &&
mr_q 0:d8f2f7d5f31b 521 !eth_addr_cmp(&netifaddr, &hdr->shwaddr))) {
mr_q 0:d8f2f7d5f31b 522 LWIP_DEBUGF(AUTOIP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE | LWIP_DBG_LEVEL_WARNING,
mr_q 0:d8f2f7d5f31b 523 ("autoip_arp_reply(): Probe Conflict detected\n"));
mr_q 0:d8f2f7d5f31b 524 autoip_restart(netif);
mr_q 0:d8f2f7d5f31b 525 }
mr_q 0:d8f2f7d5f31b 526 } else {
mr_q 0:d8f2f7d5f31b 527 /* RFC 3927 Section 2.5:
mr_q 0:d8f2f7d5f31b 528 * in any state we have a conflict if
mr_q 0:d8f2f7d5f31b 529 * ip.src == llipaddr && hw.src != own hwaddr
mr_q 0:d8f2f7d5f31b 530 */
mr_q 0:d8f2f7d5f31b 531 if (ip_addr_cmp(&sipaddr, &netif->autoip->llipaddr) &&
mr_q 0:d8f2f7d5f31b 532 !eth_addr_cmp(&netifaddr, &hdr->shwaddr)) {
mr_q 0:d8f2f7d5f31b 533 LWIP_DEBUGF(AUTOIP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE | LWIP_DBG_LEVEL_WARNING,
mr_q 0:d8f2f7d5f31b 534 ("autoip_arp_reply(): Conflicting ARP-Packet detected\n"));
mr_q 0:d8f2f7d5f31b 535 autoip_handle_arp_conflict(netif);
mr_q 0:d8f2f7d5f31b 536 }
mr_q 0:d8f2f7d5f31b 537 }
mr_q 0:d8f2f7d5f31b 538 }
mr_q 0:d8f2f7d5f31b 539 }
mr_q 0:d8f2f7d5f31b 540
mr_q 0:d8f2f7d5f31b 541 #endif /* LWIP_AUTOIP */