Commit Graph

3089 Commits

Author SHA1 Message Date
Sylvain Rochet
b09c891290 PPP, PPPoE, removed devname variable from pppoe_disc_input()
Only used for debug, reworked in a more clever way. It was actually broken
by design: setting an interface integer into a string without formatting
was quite a dumb idea.
2015-03-02 00:45:19 +01:00
Sylvain Rochet
d28bb04a9c PPP, PPPoE, improve reliability if we receive a PADT
Don't disconnect when we receive a PADT, we let the LCP Echo/Reply find
the fact that PPP session is down. Asking the PPP stack to end the
session require strict checking about the PPP phase to prevent endless
disconnection loops.

Luckily it previously does nothing because PADT frames are rarely sent
with a hunique tag and we only set the sc pointer if we receive a
hunique tag.
2015-03-02 00:16:25 +01:00
Sylvain Rochet
9de1c71ff7 PPP, PPPoE, removed global static buffer only used for debug
pppoe_error_tmp[] was only used in one function and only for debug purposes,
moved to stack.
2015-03-02 00:05:55 +01:00
Sylvain Rochet
3ce6dd166c PPP, L2TP, added link-level IPv6 support 2015-03-01 22:04:24 +01:00
Sylvain Rochet
684bef066f PPP, L2TP, merged common output code
New function: pppol2tp_udp_send(), common output code.
2015-03-01 21:22:21 +01:00
Sylvain Rochet
52f2221be9 PPP, L2TP, check source ip address and port
Improve L2TP defensiveness by checking source ip address and port
of input packets.
2015-03-01 21:15:15 +01:00
Sylvain Rochet
1bee131d52 PPP, L2TP, using LNS chosen destination port
L2TP LNS might chose its own local port, we actually stored
the port the LNS wanted to use but we never used it.
2015-03-01 21:14:52 +01:00
Sylvain Rochet
2731976a95 PPP, renamed ppp_open to ppp_connect
Makes it clear we are initiating the PPP session with ppp_connect
(i.e. acting as a PPP client) so there is no confusion possible
between ppp_connect and ppp_listen.
2015-03-01 10:53:08 +01:00
Sylvain Rochet
f7d5e81130 PPP, SERVER, MSCHAP: move output message from chap_server.message struct to stack
chap_server.message is only used in one function, moved to stack.
2015-03-01 00:34:00 +01:00
Sylvain Rochet
371bc91d73 PPP, SERVER: added PPPoS server support
New function: ppp_listen(), listen for an incoming PPP connection.
2015-02-28 22:41:18 +01:00
Sylvain Rochet
89771de6d0 PPP, remove VJ callback from link_callbacks if VJ support is not enabled 2015-02-28 21:39:32 +01:00
Sylvain Rochet
71b213df63 PPP, EAP: using MAXNAMELEN define instead of hardcoded 256 size for rhostname 2015-02-28 20:37:41 +01:00
Sylvain Rochet
7f3913ff58 PPP, EAP: removed malloc() and free()
Replaced pcb->eap.es_{client,server}.ea_peer pointer to a char table,
replaced strdup() with MEMCPY, etc.
2015-02-28 20:29:40 +01:00
Sylvain Rochet
d884034c9f PPP, replaced drand48() with magic_pow() 2015-02-28 19:50:25 +01:00
Sylvain Rochet
bec199c4a2 PPP, MAGIC: new function: magic_pow
magic_pow() returns a new random number between 0 and (2^pow)-1 included.
2015-02-28 19:36:03 +01:00
Sylvain Rochet
3686110ed2 PPP, SERVER: statically define our name for authentication purposes
We don't need that in RAM nor a pointer to a string, a static
define is fine for embedded devices, saved ~257 bytes of RAM.
2015-02-28 18:28:07 +01:00
Sylvain Rochet
708e421ec3 PPP, CORE: code cleaning 2015-02-28 18:08:37 +01:00
Sylvain Rochet
5ae7ee5276 PPP, SERVER: added CHAP authentication support 2015-02-28 17:40:07 +01:00
Sylvain Rochet
65493b421a PPP, SERVER, CHAP: fixed wrong pointer used on chap_timeout() 2015-02-28 15:36:35 +01:00
Sylvain Rochet
301511a840 PPP, SERVER: added PAP authentication support
New ppp auth function: auth_check_passwd() which check the user name and
passwd against configuration.

PAP: check remote user and password
2015-02-28 14:40:09 +01:00
Sylvain Rochet
e86a0a4325 PPP, CORE, SERVER, set auth configuration before auth
Set LCP wanted options accordingly to the user auth configuration
if peer is required to authenticate itself.
2015-02-28 13:08:20 +01:00
Sylvain Rochet
8d05279599 PPP, CORE, moved auth configuration from auth_reset() to lcp_resetci()
Prepare for PPP_SERVER support, we need to move auth configuration before
lcp_allowoptions is copied into lcp_gotoptions. Restore unused
auth_reset() function using pppd original source code.
2015-02-28 12:59:29 +01:00
Sylvain Rochet
587e0e3e0c PPP, CORE, beautified ppp_set_auth()
Beautified, added PPPAUTHTYPE_MSCHAP_V2 choice support.
2015-02-27 23:55:18 +01:00
Sylvain Rochet
2315f32ca0 PPP, CORE, cleaned struct ppp_settings coding style 2015-02-27 23:12:03 +01:00
Sylvain Rochet
5a71509353 PPP, CORE, IPCP: removed useless ask_for_local boolean
We don't need ask_for_local boolean, this is only useful for setup which
can determine the local IP address from the system hostname, which is
probably meaningless for embedded devices (and probably any devices).

It was actually only set by ip_check_options() which is commented out in
lwIP because we don't parse a config file nor check PPP configuration
(user is responsible about writing a configuration which is logical ;-).
Furthermore ask_for_local boolean never set actually had the wrong
default for PPP server setups.
2015-02-27 22:39:42 +01:00
Sylvain Rochet
a310bc19a7 netif: fixed compiler warning
lwip/src/core/netif.c: In function ‘netif_set_ipaddr’:
lwip/src/core/netif.c:403:5: warning: implicit declaration of function ‘udp_netif_ipv4_addr_changed’ [-Wimplicit-function-declaration]
     udp_netif_ipv4_addr_changed(&netif->ip_addr, ipaddr);
     ^
2015-02-26 22:45:37 +01:00
sg
0647533f8c fixed bug #44378 (TCP connections are not aborted on netif remove) 2015-02-26 22:25:39 +01:00
sg
99dd78964a fixed bug #40753 (re-bind UDP pcbs on change of IP address) 2015-02-26 22:17:30 +01:00
sg
0d1606ff23 Fixed last commit: can only check for bound sockets, not for unbound. There's some work to do for IPv6 in TCP... 2015-02-26 21:31:48 +01:00
sg
a6a92d42f9 Fixed bug #41700 (Call to tcp_listen_dual() should not accept IPv4 listen PCB args) 2015-02-26 21:23:40 +01:00
Sylvain Rochet
2aabe16163 PPP, PPPoS, removed ppp_accm_mask[], saved a few bytes of ROM
This was a pretty naive way of doing a bitshift, code is smaller if we let
the compiler decide.
2015-02-25 23:04:55 +01:00
sg
5984c996a8 fixed bug #40177 (System hangs when dealing with corrupted packets), implemented task #12357 (Ensure that malicious packets don't assert-fail): improved some pbuf_header calls to not assert-fail. 2015-02-25 22:58:27 +01:00
sg
c8d126f6ef work on task #12357 (Ensure that malicious packets don't assert-fail): don't let too short IP packets assert-fail; fix that IPv6 input did not obey VLAN header offset 2015-02-25 22:23:12 +01:00
Joel Cunningham
9004554da3 fixed bug #43028 (IP_MULTICAST_TTL affects unicast datagrams) 2015-02-25 21:59:21 +01:00
Greg Renda
4eb9efdd33 fixed bug #38210 (ip reassembly while remove oldest datagram) 2015-02-25 21:43:39 +01:00
sg
83740d81f2 fixed comment 2015-02-25 21:32:33 +01:00
sg
c8581e4cd9 fixed bug #38165 (socket with mulicast): ensure igmp membership are dropped when socket (not netconn!) is closed. 2015-02-25 21:30:22 +01:00
sg
612e33c499 fixed bug #38061 (wrong multicast routing in IPv4) by adding an optional default netif for multicast routing 2015-02-25 20:58:11 +01:00
sg
3e8ac30940 Fixed bug #44297 (CORE_LOCKING was broken some days ago); fixed that netconn_connect still used message passing for LWIP_TCPIP_CORE_LOCKING==1 2015-02-25 20:34:18 +01:00
Sylvain Rochet
4bcddd72e6 PPP, CORE, cleaned ppp_close() function
Calling new_phase() instead of assigning pcb->phase directly.
Removed redundant call to link status callback.
2015-02-24 22:13:04 +01:00
Sylvain Rochet
00bb70a62d PPP, CORE, functions ppp_set_netif_statuscallback() and ppp_set_netif_linkcallback() replaced with defines
PPP is now pointerful for a while, we don't need anymore accessor functions
for the unique PPP local and static control block. Replaced
ppp_set_netif_statuscallback() and ppp_set_netif_linkcallback() functions to
defines.

Removed pppapi_do_ppp_set_netif_statuscallback() and
pppapi_do_ppp_set_netif_linkcallback(), they were useless because
netif_set_status_callback() and netif_set_link_callback() can be
safely called while PPP status is in dead (= non open) state
and even before the PPP session is actually created at all.
2015-02-24 20:41:47 +01:00
Sylvain Rochet
b4990b5bb4 Fixed warnings on whole project introduced by const pointers on ip_addr_t 2015-02-22 22:50:06 +01:00
Sylvain Rochet
65095253a9 PPP, fixed warnings introduced by const pointers on ip_addr_t 2015-02-22 22:38:02 +01:00
sg
c87efb77bc patch by Jens Nielsen: fixed bug #38803 (Source address in broadcast ping reply) 2015-02-22 22:02:17 +01:00
sg
03159254ce added proper accessor functions for pcb->multicast_ip (previously used by get/setsockopt only) 2015-02-22 21:49:46 +01:00
sg
ec5cf8593e Continued chrysn's work: changed nearly all functions taking 'ip(X)_addr_t' pointer to take const pointers (changed user callbacks: raw_recv_fn, udp_recv_fn; changed port callbacks: netif_output_fn, netif_igmp_mac_filter_fn) 2015-02-22 21:46:35 +01:00
chrysn
9f065c0ea5 (api break) qualify ip_addr_t as const where feasible
this changes the callback signatures of the ip_output and the
{udp,raw}_recv functions.

changes were made by going through all header files, searching for
occurrences of ip_addr_t, qualifying them as const and if required
modifying the corresponding c files, looking for other uses of ip_addr_t
that would be required.

the following header files were not treated as i'm not using them and
wouldn't see them compiled: api.h api_msg.h dhcp.h dns.h igmp.h
netifapi.h pppapi.h snmp.h snmp_msg.h snmp_structs.h ppp.h pppol2tp.h
test/*

no modifications were done on ip6_addr_t.
2015-02-22 21:46:02 +01:00
Sylvain Rochet
df3f05e824 PPP, apply warnings found by MSVC fixes on other files needing the same fix 2015-02-22 21:39:04 +01:00
sg
9a10afbbc6 PPP: fixed 2 warnings found by MSVC 2015-02-22 21:30:17 +01:00
Sylvain Rochet
8d916b8573 PPP, PPPoS, removed unused next field in pppos_pcb
Linked list was removed, we don't need the next pointer anymore.
2015-02-22 16:57:57 +01:00