Commit Graph

4481 Commits

Author SHA1 Message Date
David van Moolenbroek
cd5dfa2bc5 nd6: minor 'static' consistency fix 2016-12-14 21:25:55 +01:00
sg
bd1defc1d8 added forgoten new file nd6_priv.h :-( 2016-12-14 21:24:48 +01:00
sg
281ef5d094 minor: fixed errors in some defined __DOXYGEN__ guards 2016-12-14 21:18:50 +01:00
sg
e8461f9994 minor: corrected include guard name in tcp_priv.h 2016-12-14 21:05:22 +01:00
sg
60cd25c6a1 Moved nd6 implementation details to new file nd6_priv.h (possible after David's cleanups) 2016-12-14 21:04:53 +01:00
sg
4c16ea920c Minor: nd6_packet_send_check() -> nd6_get_next_hop_addr_or_queue() (too long, but a little more self-explaining); cosmetics... 2016-12-14 20:52:44 +01:00
David van Moolenbroek
69a7039f75 nd6: centralize link-local packet send decision
Previously, ethip6 and lowpan6 each had their own copy of code that
used internal nd6 data structures to decide whether to send a packet
on the local link right away, or queue it while nd6 performed local
address resolution.  This patch moves that code into nd6, thereby
eliminating all remaining cases of external access to internal nd6
data structures, as well as the need to expose two specific nd6
functions.

As a side effect, the patch effectively fixes two bugs in the lowpan6
code that were already fixed in the ethip6 code.
2016-12-14 20:19:50 +01:00
David van Moolenbroek
06ff89cbe4 nd6: use default_router_list internally only
This patch rearranges the code division between nd6.c and ip6.c such
that the latter does not need to access ND6-internal data structures
(specifically, "default_router_list") directly anymore.
2016-12-14 20:16:38 +01:00
David van Moolenbroek
cee59ba8cd nd6: add nd6_clear_destination_cache() function
The new function, while currently not used internally, allows external
code to clear the ND destination cache in the case that it may have
become inconsistent with the current situation, for example as the
result of a change of locally assigned addresses, or a change in
routing tables implemented through the LWIP_HOOK_ND6_GET_GW hook.
2016-12-14 20:12:40 +01:00
goldsimon
d4fad5929c nd6_input(): allow using NA without lladdr_opt for DAD 2016-12-14 13:11:13 +01:00
goldsimon
1a53c106e1 CHANGELOG: added LWIP_HOOK_ND6_GET_GW() 2016-12-14 08:42:11 +01:00
David van Moolenbroek
7d119fd86b nd6: add LWIP_HOOK_ND6_GET_GW hook 2016-12-14 08:36:57 +01:00
goldsimon
74a5537e15 Revert "Added LWIP_HOOK_ETHIP6_GET_GW()"
This reverts commit 86b01e4f29.
2016-12-14 08:36:47 +01:00
goldsimon
afb21603dc Add a check for correct implementation of LWIP_CONST_CAST() to lwip_init() 2016-12-14 08:31:09 +01:00
David van Moolenbroek
002e077dbd ethip6: forward correct error code
On failure, nd6_get_next_hop_entry() returns an ERR_ type negative
error code.  ethip6_output() erroneously assumed that that error would
always be ERR_MEM, even though it may also be ERR_RTE in practice.
With this patch, ethip6_output() simply forwards the returned error.
2016-12-14 08:29:36 +01:00
sg
9d199a6d72 netif_create_ip6_linklocal_address(): use macros to assign address state to ensure callbacks are triggered; netif_add_ip6_address(): only overwrite invalid addresses, not tentative addresses 2016-12-13 21:54:49 +01:00
Pradip De
86b01e4f29 Added LWIP_HOOK_ETHIP6_GET_GW()
Signed-off-by: sg <goldsimon@gmx.de>
2016-12-13 21:53:07 +01:00
Dirk Ziegelmeier
e5f9f187ad Continue to fix incorrect casts via size_t for some platforms
Now also for casts:
- to remove alignment warnings
- casts between pointers and ints
2016-12-12 10:17:33 +01:00
Dirk Ziegelmeier
f2a5aa2866 Fix bug #49827: wrong cast to size_t on 16-bit x86 architecture
I hope I caught all of them.
TODO: Same for casts to get rid of alignment warnings, these are also casts via size_t
2016-12-12 10:07:00 +01:00
Dirk Ziegelmeier
7a1b38db6e Minor: Save an #ifdef in ip4_frag.c 2016-12-09 21:26:53 +01:00
Dirk Ziegelmeier
26e02e84a6 Fix bug #48963: ip6_frag does not support LWIP_NETIF_TX_SINGLE_PBUF
Implemented.
2016-12-09 21:26:21 +01:00
Dirk Ziegelmeier
8347d3b623 Try to fix compile warning with GCC under Linux ("large integer implicitly truncated to unsigned type") 2016-12-09 19:56:29 +01:00
Sylvain Rochet
a83c4e0897 PPP: fix build warning on wrong cast from void* to unsigned long
ppp/utils.c: In function 'ppp_vslprintf':
ppp/utils.c:251:12: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
     val = (unsigned long) va_arg(args, void *);
     ^

This is because a void* type is casted into an unsigned long type,
which obviously isn't correct on LLP64 systems such as Windows.

Actually, we are not using %p, thus we remove %p support completely
instead of trying to fix the issue in unused code.
2016-12-09 14:25:47 +01:00
goldsimon
ac4d994249 mdns.c: use group initializer constants from prot/dns.h 2016-12-09 13:10:12 +01:00
goldsimon
f308694dd4 Revert "mdns.c: use constants from dns.h/.c"
This reverts commit 0e883bbbc5.
2016-12-09 13:08:00 +01:00
goldsimon
0e883bbbc5 mdns.c: use constants from dns.h/.c 2016-12-09 12:49:49 +01:00
goldsimon
5774fdfe75 dns: added one-shot multicast DNS queries 2016-12-09 09:20:46 +01:00
Dirk Ziegelmeier
85817e7611 Minor documentation update about IP_ADDR_ANY 2016-12-08 16:56:19 +01:00
Dirk Ziegelmeier
b359b8c3e0 Minor documentation improvement 2016-12-08 13:35:34 +01:00
Dirk Ziegelmeier
bb6df52ed5 Fix doxygen parsing in my last commit 2016-12-08 12:47:30 +01:00
Dirk Ziegelmeier
8a9ab9968c Improve documentation: add compiler abstraction macros to doxygen docs 2016-12-08 12:45:21 +01:00
Dirk Ziegelmeier
a420d2530f arch.h: Add hint for struct packing #defines on GCC/clang 2016-12-08 11:13:51 +01:00
Dirk Ziegelmeier
89cb7b7aa1 Try to remove #include <stdlib.h> from many files. Does not seem necessary any more and might cause problems when porting lwIP. 2016-12-08 11:05:01 +01:00
goldsimon
9c3bbcf4e6 removed old disabled code 2016-12-08 10:24:56 +01:00
Dirk Ziegelmeier
f446194c8a pppos.c: Use arch.h to get size_t instead of including stddef.h 2016-12-07 22:29:24 +01:00
Dirk Ziegelmeier
1dd563a0ae arch.h: Implement possibility to provide own header for size_t, default is stddef.h 2016-12-07 22:27:57 +01:00
Dirk Ziegelmeier
aae0fc4908 Use new IPv6 init macro in netif.c 2016-12-07 22:19:37 +01:00
Dirk Ziegelmeier
5bb83301dd Add macro to init an IPv6 address with U32 in host byte order 2016-12-07 22:19:16 +01:00
Dirk Ziegelmeier
0ca82df062 Cleanup byte order handling a bit.
- Create LWIP_MAKEU32(a,b,c,d) to create an U32 value from bytes
- Use PP_HTONL() in some macros to emphasize network byte order conversion
2016-12-07 20:18:58 +01:00
goldsimon
ff3656f4f5 Added improved macros for ip address initialization: IPADDR4_INIT_BYTES(), IPADDR6_INIT_HOST() and IP4_ADDR_MAKEU32() 2016-12-07 13:06:07 +01:00
goldsimon
b31b0c8148 remove bogus LWIP_MAKE_U16() define and use PP_NTOHS() in ip4.c instead 2016-12-07 12:44:57 +01:00
goldsimon
c87855423c DNS: added compile-time check for some defines to fit into an u8_t (bug #49658) 2016-12-07 09:09:45 +01:00
Dirk Ziegelmeier
e00a131160 Fix bug #49778: sntp_stop does not cancel all timers
Patch by Ari Suutari
2016-12-06 20:29:12 +01:00
Axel Lin
795acf020e lwiperf: Simplify #if LWIPERF_CHECK_RX_DATA guard
The variable i is equal to q->len after exit the for loop.
Check the received data should not change the logic of update packet_idx.
So let's simplify the code a bit.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2016-12-06 11:36:25 +01:00
Dirk Ziegelmeier
cc25c2634b Cleanup: move struct ip6_addr_packed and ip6_addr_p_t type to prot/ip6.h - these types are used in prot/ip6.h and prot/mld6.h 2016-12-06 09:36:36 +01:00
Dirk Ziegelmeier
1687721600 Fix compile when IPv4 is disabled 2016-12-05 22:01:58 +01:00
Dirk Ziegelmeier
a6bc422729 Move declaration of struct ip4_addr_packed and ip4_addr_p_t to prot/ip4.h
The types are used in structs declared in ip4.h.
2016-12-05 21:53:43 +01:00
Axel Lin
92183bb354 icmp: Increment mib2.icmpintimeexcds counter if got ICMP_TE
Increment mib2.icmpintimeexcds rather than mib2.icmpindestunreachs if got ICMP_TE.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2016-12-05 12:30:09 +01:00
Sylvain Rochet
bcaf2f08aa PPP, PPPoS: fix memory leak when disconnecting if there are remaining input bytes
Art says:
  pppos_input() can call ppp_input() which can call pppos_disconnect() to
  disconnect the interface.  However, it will continue to read in
  characters and allocate a pbuf from the PBUF_POOL and keep it in
  pppos->in_head and in_tail. When a re-connect happens and pppos_connect()
  is called, this pppos->in_head and in_tail are zeroed, hence a memory
  leak. (This happens with PPP_INPROC_IRQ_SAFE not defined.)

  A fix would be inside pppos_input() to break out of the loop inputting
  characters after calling ppp_input() if pppos->open == 0.  Note that
  the loop is not even entered if pppos->open == 0.

          ppp_input(ppp, inp);
          if(pppos->open == 0) //get out if they disconnected
            break;

Fix it in a similar way which doesn't add new code by moving the
existing pppos->open check inside the byte loop.
2016-12-03 16:12:51 +01:00
Dirk Ziegelmeier
4bbed75cc4 Minor code layout cleanup in err.c and errno.h 2016-12-01 08:55:01 +01:00
Joel Cunningham
f28e63b2a3 Add netifapi macros for set link up/down
This commit extends the netifapi macros to support netif_set_link_up
and netif_set_link_down
2016-11-30 08:49:23 -06:00
Joel Cunningham
7f48289fcd Increment ip.drop when dropping due to NULL netif
This commit increments the ip.drop statistic when an IP packet is
dropped due to no matching netif found and forwarding is disabled

This adds parity to the other places where mib2.ipinaddrerrors and
mib2.ipindiscards are incremented which also increment ip.drop
2016-11-30 08:49:22 -06:00
Axel Lin
12e35c4c12 mdns: Fix assertion message in mdns_resp_add_service_txtitem()
So we know which function emits the assertion.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2016-11-30 11:36:05 +01:00
Dirk Ziegelmeier
182d7c138a Add #include <stddef.h> to a central place (arch.h) instead of #including it in several other files throughout lwip since size_t is needed in many places
See http://lwip.100.n7.nabble.com/Issue-in-arch-h-for-lwIP-2-0-0-td27948.html
2016-11-30 07:43:59 +01:00
Dirk Ziegelmeier
47fd67a35c Remove TODO comments and one check from sockets.c indicating IPV6_V6ONLY socket option handling does not work 2016-11-28 15:56:59 +01:00
goldsimon
b934c3f471 fixed bug #49726: setsockopt() set TCP_NODELAY TCP_KEEPALIVE ... with a listen state TCP will crash 2016-11-28 15:50:59 +01:00
goldsimon
2a882b6387 minor: fixed indent 2016-11-28 12:54:17 +01:00
goldsimon
ca9342c549 fixed bug #49725 (send-timeout: netwonn_write() can return ERR_OK without all bytes being written) 2016-11-28 12:51:45 +01:00
goldsimon
6f1304e03e patch by Ambroz Bizjak: fixed bug #49717 (window size in received SYN and SYN-ACK assumed scaled) 2016-11-28 10:27:21 +01:00
Axel Lin
cac3dc8a46 netif: Trivial indent fix
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2016-11-28 10:24:23 +01:00
Dirk Ziegelmeier
aea872431c Fix naming of some inet_addr_* macros in inet.h
From inet4_addr_* to inet_addr_* - inet_addr is a "known word", don't change it
2016-11-25 22:13:12 +01:00
Axel Lin
1d4cbe768d netif: Add proper lock protect for accessing netif->loop_first
All the reset part of the code accessing netif->loop_first has lock protection,
the only missing part is "while (netif->loop_first != NULL)".
Fix it by adding lock protect around the while loop.

Also convert the code to use while{} loop instead of do .. while{} loop,
then we can avoid NULL test for in pointer in each loop and reduce a level of indent.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2016-11-25 13:02:23 +01:00
goldsimon
0e07ed4b13 fixed bug #49676 (Possible endless loop when parsing dhcp options) & added unit test for that 2016-11-25 10:03:43 +01:00
Ambroz Bizjak
8ba7363d11 Optimize passing contiguous nocopy buffers to tcp_write
While TCP_OVERSIZE works only when tcp_write() is used with
TCP_WRITE_FLAG_COPY, this new code achieves
similar benefits for the use case that the caller manages their own
send buffers and passes successive chunks of those to tcp_write()
without TCP_WRITE_FLAG_COPY.

In particular, if a buffer is passed to
tcp_write() that is adjacent in memory to the previously passed
buffer, it will be combined into the previous ROM pbuf reference
whenever possible, thus extending that ROM pbuf rather than allocating
a new ROM pbuf.

For the aforementioned use case, the advantages of this code are
twofold:
1) fewer ROM pbufs need to be allocated to send the same data, and,
2) the MAC layer gets outgoing TCP packets with shorter pbuf chains.

Original patch by Ambroz Bizjak <ambrop7@gmail.com>
Edited by David van Moolenbroek <david@minix3.org>
Signed-off-by: goldsimon <goldsimon@gmx.de>
2016-11-24 11:27:34 +01:00
Joel Cunningham
5030fa81a0 bug #49684, api_msg: treat non-blocking ERR_MEM as ERR_WOULDBLOCK
This corrects a case in lwip_netconn_do_writemore() where if a
non-blocking socket receives ERR_MEM in a call to tcp_write(), it would
return ERR_MEM, which would result in ENOMEM coming out of the socket
layer

This case can be gracefully handled by returning ERR_WOULDBLOCK since the
socket is already marked as no longer writable and sent_tcp/poll_tcp will
mark the socket as writable again based on available buffer space

This is very similiar to how ERR_MEM is resolved for blocking sockets
2016-11-23 15:03:43 -06:00
Dirk Ziegelmeier
09547832ba Fix bug #49662: UDP layer should filter incoming multicast datagrams against the bound IP address
Change lwIP UDP API to match socket behavior. Multicast traffic is now only received on a UDP PCB (and therefore on a UDP socket/netconn) when the PCB is bound to IP_ADDR_ANY.
2016-11-23 12:46:35 +01:00
Sylvain Rochet
8c3c96baf7 PPP, L2TP: fix PPPOL2TP_AUTH_SUPPORT == 0 support
Fix compiler warnings on unused parameters and a function signature
mismatch in PPPAPI.
2016-11-22 22:13:24 +01:00
sg
03a9aac157 dns_enqueue(): minor readability improvement: add local variable "age" to store result of subtraction 2016-11-22 21:34:12 +01:00
David van Moolenbroek
68ec20fffc ipv4/ipv6: restrict loopback-destined traffic
Generally speaking, packets with a loopback destination address -
127.0.0.1 for IPv4 and ::1 for IPv6 - should not be accepted on
non-loopback interfaces.  For IPv4, this is implied by RFC 1122
Sec. 3.2.1.3.  For IPv6, it is mandated by RFC 4291 Sec. 2.5.3.
Failure to perform this filtering may have security implications, as
applications that bind sockets to loopback addresses may not expect
that nodes on the local external network be able to produce traffic
that will arrive at such sockets.

With this patch, lwIP drops packets that are sent to a loopback
address but do not originate from the interface that has the loopback
address assigned to it.  This approach works regardless of whether it
is lwIP or the system using it that implements a loopback netif.  The
only exception that must be made is for configurations that enable
netif packet loopback but disable the lwIP loopback netif: in that
case, loopback packets are routed across non-loopback netifs and would
thus be lost by the new filter as well.

For IPv6, loopback-destined packets are also no longer forwarded; the
IPv4 forwarding code already had a check for that.

As a small performance improvement, the IPv6 link-local/loopback
address check is now performed only once per packet rather than
repeatedly for every candidate netif.
2016-11-22 20:51:36 +01:00
Dirk Ziegelmeier
4076b12ee9 Revert "Apply patch #9165: Allowing udp src port to be 0 in cases when we don't care about outgoing port"
This reverts commit 31b0237c50.
2016-11-22 14:35:45 +01:00
David van Moolenbroek
0034abfa45 Always check whether netif_default is NULL
In general, netif_default may be NULL, and various places in the code
already check for this case before attempting to dereference the
netif_default pointer.  Some places do not perform this check though,
and may cause null pointer dereferences if netif_default is not set.
This patch adds NULL checks to those places as well.
2016-11-21 10:16:28 +01:00
Dirk Ziegelmeier
31b0237c50 Apply patch #9165: Allowing udp src port to be 0 in cases when we don't care about outgoing port 2016-11-18 08:13:15 +01:00
Dirk Ziegelmeier
9366c0eaab I decided to keep the "complexity" of handling IPv6 mapped IPv4 addresses out of netconn API.
Only socket API understands this address type now.
2016-11-17 12:41:00 +01:00
Dirk Ziegelmeier
5d5eeca008 Once more: Try fix compile with clang 2016-11-17 09:23:57 +01:00
Dirk Ziegelmeier
4b7e0f50b7 Fix indent in api_lib.c 2016-11-17 09:14:29 +01:00
Dirk Ziegelmeier
44e430ebc2 Fix compile with MSVC 2010 and remove handling for IP6_ADDR_ANY in netconn_connect() - IP6_ADDR_ANY does not make sense in connect() 2016-11-17 09:12:38 +01:00
Dirk Ziegelmeier
180ba72a06 Dual-stack: Use IPv6 mapped IPv4 addresses in receive() and getaddr() only in socket API, not in netconn API.
It is better to present correct IP types in netconn API.
Netconn API now accepts IPv6 mapped IPv4 addresses as well as IPv6 and IPv4 in send(), bind() and connect(), but does NOT map IPv4 to IPv6 mapped IPv4 in getaddr() and receive() functions.
2016-11-17 08:51:07 +01:00
Dirk Ziegelmeier
792224ead0 Try to fix compile error with clang (found by Erik's Travis-CI) 2016-11-17 08:48:55 +01:00
Dirk Ziegelmeier
e8e853f2cb Move ICMP6 protocol constants to include/lwip/prot/icmp6 2016-11-16 23:49:44 +01:00
Dirk Ziegelmeier
80a24c0399 raw, udp, tcp connect() does NOT need to match exact IP type - when PCB is bound to IPADDR_ANY_TYPE, it is OK to connect to IPv4 or IPv6
This should finally implement task #14187: Dual Stack sendto with socket APIs
2016-11-16 23:39:43 +01:00
Dirk Ziegelmeier
d026a3954a Dual-stack fixes in raw/udp/tcp
bind() may change IP type when previous type is IPADDR_TYPE_ANY
connect() IP type must exactly match bind IP type
Use correct IPADDRx_ANY type when calling ip_route()
2016-11-16 23:30:19 +01:00
Dirk Ziegelmeier
1712b06a64 Work on dual-stack netconn
IPv6 netconns are created as IPADDR_TYPE_ANY raw/udp/tcp PCBs internally
bind, connect and sendto now accept IPv6 mapped IPv4 addresses or IPv4 addresses as argument
getaddr and receive functions now return IPv6 mapped IPv4 addresses instead of IPv4 addresses
This behavior is close to BSD socket API
2016-11-16 22:58:38 +01:00
Dirk Ziegelmeier
010f3550b6 Cleanup macro parameter names 2016-11-16 21:37:41 +01:00
Dirk Ziegelmeier
b70ddf7b54 Cleanup unmap_ipv6_mapped_ipv4() macro 2016-11-16 21:37:41 +01:00
Dirk Ziegelmeier
1dd97e7d53 sockets.c, lwip_sendto(): Remove check whether IP address matches socket type. Is checked in lower layers anyway. 2016-11-16 21:37:41 +01:00
Dirk Ziegelmeier
2f37dc0606 api_msg.c: Partly add support for IPv6 mapped IPv4 addresses
- lwip_netconn_do_getaddr(): Convert IPv4 addresses to IPv6 mapped IPv4 addresses
- lwip_netconn_do_send(): Support IPv6 mapped IPv4 addresses
- Not done: connect(), bind()
2016-11-16 21:37:41 +01:00
Dirk Ziegelmeier
c1eb6d8aa4 Minor: Add macros to map/unmap IPv6 mapped IPv4 addresses 2016-11-16 21:37:41 +01:00
Dirk Ziegelmeier
ad17f345e7 mdns: Use strlen to determine string length of strings contained in a struct - padding seems to be applied to these strings, and sizeof() returns the _padded_ size???
Found by compiling with CLANG with address sanitizer enabled
2016-11-16 21:01:15 +01:00
Dirk Ziegelmeier
ee7a2f346c inet.h: Consistently name some inet <-> ipaddr conversion macros
They operate on ip4_addr_t, not on ip_addr_t
This should be clearly visible in their names
2016-11-16 20:30:13 +01:00
Dirk Ziegelmeier
b99b7577fc memp.c: Only check for overflow/underflow if an element could be allocated
In other words: Don't dereference NULL pointers
2016-11-16 20:15:51 +01:00
Joel Cunningham
f79eabd24b bug #49533: start persist timer when unsent seg can't fit in window
This commit returns LwIP to previous behavior where if the next unsent
segment can't be sent due to the current send window, we start the
persist timer. This is done to engage window probing in the case that
the subsequent window update from the receiver is dropped, thus
preventing connection deadlock

This commit refines the previous logic to only target the following case:
 1) Next unsent segment doesn't fit within the send window (not
    congestion) and there is some room in the window
 2) Unacked queue is empty (otherwise data is inflight and the RTO timer
    will take care of any dropped window updates)

See commit d8f090a759 (which removed this
behavior) to reference the old logic. The old logic falsely started the
persit timer when the RTO timer was already running.
2016-11-16 09:12:47 -06:00
Roberto Barbieri Carrera
81a32e9b06 Fixed bug #49610: Sometimes, autoIP fails to reuse the same address
Signed-off-by: goldsimon <goldsimon@gmx.de>
2016-11-16 12:24:57 +01:00
Joel Cunningham
6dc3a2108a WND_SCALE: duplicate define check & doc cleanup
This commit cleans up a duplicate #if check for LWIP_WND_SCALE in init.c
which was already under #if LWIP_WND_SCALE

This commit also improves documentation for TCP_WND in the window scaling
case to communicate TCP_WND is always the calculated (scaled) window value,
not the value reported in the TCP header

Our developers were confused by having to set both the window and scaling
factor and only after studying the usage of TCP_WND throughout the code, was
it determined to be the calculated (scaled) window
2016-11-11 16:06:54 -06:00
Dirk Ziegelmeier
f965034366 Fix inconsistent return value in udp_sendto_if() - ERR_RTE should always be returned when there is no available route 2016-11-11 11:13:26 +01:00
Dirk Ziegelmeier
fdcd8f6faf Fix bug #49578: lwip_socket_drop_registered_memberships API may not work with LWIP_SOCKET_OFFSET 2016-11-11 11:13:25 +01:00
Erik Ekman
b90682dc8b Update email address
I am leaving Verisure at the end of the month.
2016-11-10 11:19:51 +01:00
Dirk Ziegelmeier
b9dc415178 master: Set version to 2.0.1 2016-11-10 09:59:05 +01:00
Axel Lin
d5dd5241e7 dhcp: Use DHCP_MAX_MSG_LEN_MIN_REQUIRED instead of hard-coded value
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2016-11-07 12:36:38 +01:00
Sylvain Rochet
c4eb52dcff PPP: set protocol_list[] const
This array is a constant list of protocols, save some ram space by
adding the const modifier it deserves.
2016-11-06 20:00:31 +01:00
Sylvain Rochet
1e6c4ac017 PPP, IPCP: check that the peer is allowed to use the IP address it wants
This is done in the pppd upstream and was disabled because we don't have
the allowed addresses list required for the auth_ip_addr function.

This is mostly necessary for PPP in server mode to prevent the peer to
use the IP address it wants instead of the one we want, which is
currently allowed.

Rewrite auth_ip_addr in a simple way where we forbid PPP peer to use
loopback net, a multicast address or a reserved class address. Added
to that we consider that PPP in server mode with peer required to
authenticate must provide the peer IP address, reject any IP address
wanted by peer different than the one we wanted. This is actually
an allowed addresses "list" of one entry that follows what is done
in the unused auth_ip_addr function.
2016-11-06 17:39:59 +01:00