From ce0ff0de538d0d7ce32381f6eba19a97c5c75d41 Mon Sep 17 00:00:00 2001
From: Meco Man <920369182@qq.com>
Date: Sun, 27 Jun 2021 17:12:04 +0800
Subject: [PATCH] use space to replace tab and remove meaningless space in the
 end of each line

Signed-off-by: Meco Man <920369182@qq.com>
---
 contrib/Coverity/coverity.c                   |   14 +-
 .../examples/httpd/cgi_example/cgi_example.c  |   28 +-
 .../examples/httpd/cgi_example/cgi_example.h  |   26 +-
 .../examples/httpd/fs_example/fs_example.c    |   28 +-
 .../examples/httpd/fs_example/fs_example.h    |   26 +-
 .../httpd/genfiles_example/genfiles_example.c |   28 +-
 .../httpd/genfiles_example/genfiles_example.h |   26 +-
 .../httpd/https_example/https_example.c       |   28 +-
 .../httpd/https_example/https_example.h       |   26 +-
 .../httpd/post_example/post_example.c         |   28 +-
 .../examples/httpd/ssi_example/ssi_example.c  |   28 +-
 .../examples/httpd/ssi_example/ssi_example.h  |   26 +-
 contrib/examples/lwiperf/lwiperf_example.c    |   24 +-
 contrib/examples/lwiperf/lwiperf_example.h    |   24 +-
 contrib/examples/mdns/mdns_example.c          |   26 +-
 contrib/examples/mdns/mdns_example.h          |   24 +-
 contrib/examples/mqtt/mqtt_example.h          |   24 +-
 contrib/examples/ppp/pppos_example.h          |   24 +-
 contrib/examples/snmp/snmp_example.h          |   24 +-
 .../snmp/snmp_private_mib/lwip_prvmib.c       |   38 +-
 .../snmp/snmp_private_mib/private_mib.h       |    2 +-
 contrib/examples/snmp/snmp_v3/snmpv3_dummy.c  |   10 +-
 contrib/examples/sntp/sntp_example.c          |   26 +-
 contrib/examples/sntp/sntp_example.h          |   24 +-
 contrib/examples/tftp/tftp_example.h          |    2 +-
 contrib/ports/unix/port/include/arch/cc.h     |    2 +-
 contrib/ports/unix/port/include/arch/perf.h   |    4 +-
 contrib/ports/unix/port/include/netif/fifo.h  |   32 +-
 .../ports/unix/port/include/netif/pcapif.h    |   28 +-
 contrib/ports/unix/port/include/netif/sio.h   |   40 +-
 contrib/ports/unix/port/netif/fifo.c          |  152 +-
 contrib/ports/unix/port/netif/pcapif.c        |    2 +-
 contrib/ports/unix/port/netif/sio.c           |  534 +--
 contrib/ports/unix/port/perf.c                |   40 +-
 doc/NO_SYS_SampleCode.c                       |   16 +-
 doc/ZeroCopyRx.c                              |    2 +-
 src/apps/http/makefsdata/tinydir.h            |  824 ++--
 src/apps/mdns/mdns.c                          |    2 +-
 src/core/netif.c                              |    4 +-
 src/core/tcp_out.c                            |    2 +-
 src/include/lwip/apps/mdns_domain.h           |    2 +-
 src/include/netif/ppp/ccp.h                   |   82 +-
 src/include/netif/ppp/chap-new.h              |   90 +-
 src/include/netif/ppp/eap.h                   |  172 +-
 src/include/netif/ppp/ecp.h                   |    4 +-
 src/include/netif/ppp/eui64.h                 |   60 +-
 src/include/netif/ppp/fsm.h                   |  142 +-
 src/include/netif/ppp/ipcp.h                  |   36 +-
 src/include/netif/ppp/ipv6cp.h                |   10 +-
 src/include/netif/ppp/lcp.h                   |   92 +-
 src/include/netif/ppp/magic.h                 |    2 +-
 src/include/netif/ppp/mppe.h                  |  154 +-
 src/include/netif/ppp/polarssl/arc4.h         |    4 +-
 src/include/netif/ppp/polarssl/des.h          |    4 +-
 src/include/netif/ppp/polarssl/md4.h          |    4 +-
 src/include/netif/ppp/polarssl/md5.h          |    4 +-
 src/include/netif/ppp/polarssl/sha1.h         |    4 +-
 src/include/netif/ppp/ppp.h                   |    8 +-
 src/include/netif/ppp/ppp_impl.h              |  254 +-
 src/include/netif/ppp/pppcrypt.h              |    2 +-
 src/include/netif/ppp/pppdebug.h              |    4 +-
 src/include/netif/ppp/pppoe.h                 |    4 +-
 src/include/netif/ppp/upap.h                  |   52 +-
 src/netif/ppp/auth.c                          | 1494 +++----
 src/netif/ppp/ccp.c                           | 1610 +++----
 src/netif/ppp/chap-md5.c                      |  116 +-
 src/netif/ppp/chap-new.c                      |  884 ++--
 src/netif/ppp/chap_ms.c                       |  786 ++--
 src/netif/ppp/demand.c                        |  298 +-
 src/netif/ppp/eap.c                           | 3854 ++++++++---------
 src/netif/ppp/ecp.c                           |   12 +-
 src/netif/ppp/eui64.c                         |    4 +-
 src/netif/ppp/fsm.c                           |  610 +--
 src/netif/ppp/ipcp.c                          | 2026 ++++-----
 src/netif/ppp/ipv6cp.c                        | 1026 ++---
 src/netif/ppp/lcp.c                           | 2370 +++++-----
 src/netif/ppp/mppe.c                          |  588 +--
 src/netif/ppp/multilink.c                     |  888 ++--
 src/netif/ppp/polarssl/arc4.c                 |    4 +-
 src/netif/ppp/polarssl/des.c                  |    4 +-
 src/netif/ppp/polarssl/md4.c                  |    4 +-
 src/netif/ppp/polarssl/md5.c                  |    6 +-
 src/netif/ppp/polarssl/sha1.c                 |    4 +-
 src/netif/ppp/ppp.c                           |    2 +-
 src/netif/ppp/pppapi.c                        |   22 +-
 src/netif/ppp/pppcrypt.c                      |   26 +-
 src/netif/ppp/pppoe.c                         |    8 +-
 src/netif/ppp/upap.c                          |  260 +-
 src/netif/ppp/utils.c                         |  890 ++--
 test/fuzz/fuzz.c                              |   28 +-
 test/fuzz/fuzz2.c                             |   28 +-
 test/sockets/sockets_stresstest.c             |   28 +-
 test/sockets/sockets_stresstest.h             |   26 +-
 test/unit/api/test_sockets.c                  |   10 +-
 test/unit/arch/sys_arch.c                     |   28 +-
 test/unit/arch/sys_arch.h                     |   28 +-
 test/unit/core/test_timers.c                  |    6 +-
 test/unit/lwipopts.h                          |   28 +-
 test/unit/tcp/tcp_helper.c                    |    4 +-
 test/unit/tcp/test_tcp.c                      |   10 +-
 100 files changed, 10739 insertions(+), 10739 deletions(-)

diff --git a/contrib/Coverity/coverity.c b/contrib/Coverity/coverity.c
index 99bebae9..bbc398ba 100644
--- a/contrib/Coverity/coverity.c
+++ b/contrib/Coverity/coverity.c
@@ -20,11 +20,11 @@ void mem_free(void* mem)
 
 void* memp_malloc(memp_t type)
 {
-  __coverity_alloc_nosize__();  
+  __coverity_alloc_nosize__();
 }
 void memp_free(memp_t type, void* mem)
 {
-  __coverity_free__(mem);  
+  __coverity_free__(mem);
 }
 
 void sys_mutex_lock(sys_mutex_t* mutex)
@@ -47,23 +47,23 @@ void sys_sem_signal(sys_sem_t *sem)
 
 err_t ethernet_input(struct pbuf *p, struct netif *inp)
 {
-  __coverity_tainted_string_sink_content__(p); 
+  __coverity_tainted_string_sink_content__(p);
 }
 err_t tcpip_input(struct pbuf *p, struct netif *inp)
 {
-  __coverity_tainted_string_sink_content__(p); 
+  __coverity_tainted_string_sink_content__(p);
 }
 err_t ip_input(struct pbuf *p, struct netif *inp)
 {
-  __coverity_tainted_string_sink_content__(p); 
+  __coverity_tainted_string_sink_content__(p);
 }
 err_t ip4_input(struct pbuf *p, struct netif *inp)
 {
-  __coverity_tainted_string_sink_content__(p); 
+  __coverity_tainted_string_sink_content__(p);
 }
 err_t ip6_input(struct pbuf *p, struct netif *inp)
 {
-  __coverity_tainted_string_sink_content__(p); 
+  __coverity_tainted_string_sink_content__(p);
 }
 
 err_t pbuf_take(struct pbuf *buf, const void *dataptr, u16_t len)
diff --git a/contrib/examples/httpd/cgi_example/cgi_example.c b/contrib/examples/httpd/cgi_example/cgi_example.c
index c9c74763..4c98f2fb 100644
--- a/contrib/examples/httpd/cgi_example/cgi_example.c
+++ b/contrib/examples/httpd/cgi_example/cgi_example.c
@@ -4,12 +4,12 @@
  *
  * This file demonstrates how to add support for basic CGI.
  */
- 
+
  /*
  * Copyright (c) 2017 Simon Goldschmidt
  * All rights reserved.
- * 
- * Redistribution and use in source and binary forms, with or without modification, 
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
  * are permitted provided that the following conditions are met:
  *
  * 1. Redistributions of source code must retain the above copyright notice,
@@ -18,21 +18,21 @@
  *    this list of conditions and the following disclaimer in the documentation
  *    and/or other materials provided with the distribution.
  * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
+ *    derived from this software without specific prior written permission.
  *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
+ * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
  * OF SUCH DAMAGE.
  *
  * This file is part of the lwIP TCP/IP stack.
- * 
+ *
  * Author: Simon Goldschmidt <goldsimon@gmx.de>
  *
  */
diff --git a/contrib/examples/httpd/cgi_example/cgi_example.h b/contrib/examples/httpd/cgi_example/cgi_example.h
index b655661b..3ae8f2f8 100644
--- a/contrib/examples/httpd/cgi_example/cgi_example.h
+++ b/contrib/examples/httpd/cgi_example/cgi_example.h
@@ -1,8 +1,8 @@
 /*
  * Copyright (c) 2017 Simon Goldschmidt
  * All rights reserved.
- * 
- * Redistribution and use in source and binary forms, with or without modification, 
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
  * are permitted provided that the following conditions are met:
  *
  * 1. Redistributions of source code must retain the above copyright notice,
@@ -11,21 +11,21 @@
  *    this list of conditions and the following disclaimer in the documentation
  *    and/or other materials provided with the distribution.
  * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
+ *    derived from this software without specific prior written permission.
  *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
+ * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
  * OF SUCH DAMAGE.
  *
  * This file is part of the lwIP TCP/IP stack.
- * 
+ *
  * Author: Simon Goldschmidt <goldsimon@gmx.de>
  *
  */
diff --git a/contrib/examples/httpd/fs_example/fs_example.c b/contrib/examples/httpd/fs_example/fs_example.c
index e3552b12..91f6d3a3 100644
--- a/contrib/examples/httpd/fs_example/fs_example.c
+++ b/contrib/examples/httpd/fs_example/fs_example.c
@@ -9,12 +9,12 @@
  * ATTENTION: This implementation is *not* secure: no checks are added to ensure
  * files are only read below the specified root directory!
  */
- 
+
  /*
  * Copyright (c) 2017 Simon Goldschmidt
  * All rights reserved.
- * 
- * Redistribution and use in source and binary forms, with or without modification, 
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
  * are permitted provided that the following conditions are met:
  *
  * 1. Redistributions of source code must retain the above copyright notice,
@@ -23,21 +23,21 @@
  *    this list of conditions and the following disclaimer in the documentation
  *    and/or other materials provided with the distribution.
  * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
+ *    derived from this software without specific prior written permission.
  *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
+ * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
  * OF SUCH DAMAGE.
  *
  * This file is part of the lwIP TCP/IP stack.
- * 
+ *
  * Author: Simon Goldschmidt <goldsimon@gmx.de>
  *
  */
diff --git a/contrib/examples/httpd/fs_example/fs_example.h b/contrib/examples/httpd/fs_example/fs_example.h
index b399e4d5..40449641 100644
--- a/contrib/examples/httpd/fs_example/fs_example.h
+++ b/contrib/examples/httpd/fs_example/fs_example.h
@@ -1,8 +1,8 @@
 /*
  * Copyright (c) 2017 Simon Goldschmidt
  * All rights reserved.
- * 
- * Redistribution and use in source and binary forms, with or without modification, 
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
  * are permitted provided that the following conditions are met:
  *
  * 1. Redistributions of source code must retain the above copyright notice,
@@ -11,21 +11,21 @@
  *    this list of conditions and the following disclaimer in the documentation
  *    and/or other materials provided with the distribution.
  * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
+ *    derived from this software without specific prior written permission.
  *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
+ * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
  * OF SUCH DAMAGE.
  *
  * This file is part of the lwIP TCP/IP stack.
- * 
+ *
  * Author: Simon Goldschmidt <goldsimon@gmx.de>
  *
  */
diff --git a/contrib/examples/httpd/genfiles_example/genfiles_example.c b/contrib/examples/httpd/genfiles_example/genfiles_example.c
index b96df2a7..95aaa2a1 100644
--- a/contrib/examples/httpd/genfiles_example/genfiles_example.c
+++ b/contrib/examples/httpd/genfiles_example/genfiles_example.c
@@ -4,12 +4,12 @@
  *
  * This file demonstrates how to add support for generated files to httpd.
  */
- 
+
  /*
  * Copyright (c) 2017 Simon Goldschmidt
  * All rights reserved.
- * 
- * Redistribution and use in source and binary forms, with or without modification, 
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
  * are permitted provided that the following conditions are met:
  *
  * 1. Redistributions of source code must retain the above copyright notice,
@@ -18,21 +18,21 @@
  *    this list of conditions and the following disclaimer in the documentation
  *    and/or other materials provided with the distribution.
  * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
+ *    derived from this software without specific prior written permission.
  *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
+ * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
  * OF SUCH DAMAGE.
  *
  * This file is part of the lwIP TCP/IP stack.
- * 
+ *
  * Author: Simon Goldschmidt <goldsimon@gmx.de>
  *
  */
diff --git a/contrib/examples/httpd/genfiles_example/genfiles_example.h b/contrib/examples/httpd/genfiles_example/genfiles_example.h
index dd9731e0..6b3df4e0 100644
--- a/contrib/examples/httpd/genfiles_example/genfiles_example.h
+++ b/contrib/examples/httpd/genfiles_example/genfiles_example.h
@@ -1,8 +1,8 @@
 /*
  * Copyright (c) 2017 Simon Goldschmidt
  * All rights reserved.
- * 
- * Redistribution and use in source and binary forms, with or without modification, 
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
  * are permitted provided that the following conditions are met:
  *
  * 1. Redistributions of source code must retain the above copyright notice,
@@ -11,21 +11,21 @@
  *    this list of conditions and the following disclaimer in the documentation
  *    and/or other materials provided with the distribution.
  * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
+ *    derived from this software without specific prior written permission.
  *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
+ * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
  * OF SUCH DAMAGE.
  *
  * This file is part of the lwIP TCP/IP stack.
- * 
+ *
  * Author: Simon Goldschmidt <goldsimon@gmx.de>
  *
  */
diff --git a/contrib/examples/httpd/https_example/https_example.c b/contrib/examples/httpd/https_example/https_example.c
index 76198969..a1f8cc59 100644
--- a/contrib/examples/httpd/https_example/https_example.c
+++ b/contrib/examples/httpd/https_example/https_example.c
@@ -15,12 +15,12 @@
  * - MEMP_NUM_TCPIP_MSG_INPKT
  * - MEMP_NUM_TCP_SEG
  */
- 
+
  /*
  * Copyright (c) 2017-2019 Simon Goldschmidt
  * All rights reserved.
- * 
- * Redistribution and use in source and binary forms, with or without modification, 
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
  * are permitted provided that the following conditions are met:
  *
  * 1. Redistributions of source code must retain the above copyright notice,
@@ -29,21 +29,21 @@
  *    this list of conditions and the following disclaimer in the documentation
  *    and/or other materials provided with the distribution.
  * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
+ *    derived from this software without specific prior written permission.
  *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
+ * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
  * OF SUCH DAMAGE.
  *
  * This file is part of the lwIP TCP/IP stack.
- * 
+ *
  * Author: Simon Goldschmidt <goldsimon@gmx.de>
  *
  */
diff --git a/contrib/examples/httpd/https_example/https_example.h b/contrib/examples/httpd/https_example/https_example.h
index c1525e6a..3d9cb065 100644
--- a/contrib/examples/httpd/https_example/https_example.h
+++ b/contrib/examples/httpd/https_example/https_example.h
@@ -1,8 +1,8 @@
 /*
  * Copyright (c) 2017 Simon Goldschmidt
  * All rights reserved.
- * 
- * Redistribution and use in source and binary forms, with or without modification, 
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
  * are permitted provided that the following conditions are met:
  *
  * 1. Redistributions of source code must retain the above copyright notice,
@@ -11,21 +11,21 @@
  *    this list of conditions and the following disclaimer in the documentation
  *    and/or other materials provided with the distribution.
  * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
+ *    derived from this software without specific prior written permission.
  *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
+ * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
  * OF SUCH DAMAGE.
  *
  * This file is part of the lwIP TCP/IP stack.
- * 
+ *
  * Author: Simon Goldschmidt <goldsimon@gmx.de>
  *
  */
diff --git a/contrib/examples/httpd/post_example/post_example.c b/contrib/examples/httpd/post_example/post_example.c
index f4e4369c..a4d8a22c 100644
--- a/contrib/examples/httpd/post_example/post_example.c
+++ b/contrib/examples/httpd/post_example/post_example.c
@@ -2,12 +2,12 @@
  * @file
  * HTTPD example for simple POST
  */
- 
+
  /*
  * Copyright (c) 2017 Simon Goldschmidt
  * All rights reserved.
- * 
- * Redistribution and use in source and binary forms, with or without modification, 
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
  * are permitted provided that the following conditions are met:
  *
  * 1. Redistributions of source code must retain the above copyright notice,
@@ -16,21 +16,21 @@
  *    this list of conditions and the following disclaimer in the documentation
  *    and/or other materials provided with the distribution.
  * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
+ *    derived from this software without specific prior written permission.
  *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
+ * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
  * OF SUCH DAMAGE.
  *
  * This file is part of the lwIP TCP/IP stack.
- * 
+ *
  * Author: Simon Goldschmidt <goldsimon@gmx.de>
  *
  */
diff --git a/contrib/examples/httpd/ssi_example/ssi_example.c b/contrib/examples/httpd/ssi_example/ssi_example.c
index 2024e2ea..858edc64 100644
--- a/contrib/examples/httpd/ssi_example/ssi_example.c
+++ b/contrib/examples/httpd/ssi_example/ssi_example.c
@@ -8,12 +8,12 @@
  *
  * This file also demonstrates how to integrate CGI with SSI.
  */
- 
+
  /*
  * Copyright (c) 2017 Simon Goldschmidt
  * All rights reserved.
- * 
- * Redistribution and use in source and binary forms, with or without modification, 
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
  * are permitted provided that the following conditions are met:
  *
  * 1. Redistributions of source code must retain the above copyright notice,
@@ -22,21 +22,21 @@
  *    this list of conditions and the following disclaimer in the documentation
  *    and/or other materials provided with the distribution.
  * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
+ *    derived from this software without specific prior written permission.
  *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
+ * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
  * OF SUCH DAMAGE.
  *
  * This file is part of the lwIP TCP/IP stack.
- * 
+ *
  * Author: Simon Goldschmidt <goldsimon@gmx.de>
  *
  */
diff --git a/contrib/examples/httpd/ssi_example/ssi_example.h b/contrib/examples/httpd/ssi_example/ssi_example.h
index b7ec298a..62da45d3 100644
--- a/contrib/examples/httpd/ssi_example/ssi_example.h
+++ b/contrib/examples/httpd/ssi_example/ssi_example.h
@@ -1,8 +1,8 @@
 /*
  * Copyright (c) 2017 Simon Goldschmidt
  * All rights reserved.
- * 
- * Redistribution and use in source and binary forms, with or without modification, 
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
  * are permitted provided that the following conditions are met:
  *
  * 1. Redistributions of source code must retain the above copyright notice,
@@ -11,21 +11,21 @@
  *    this list of conditions and the following disclaimer in the documentation
  *    and/or other materials provided with the distribution.
  * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
+ *    derived from this software without specific prior written permission.
  *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
+ * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
  * OF SUCH DAMAGE.
  *
  * This file is part of the lwIP TCP/IP stack.
- * 
+ *
  * Author: Simon Goldschmidt <goldsimon@gmx.de>
  *
  */
diff --git a/contrib/examples/lwiperf/lwiperf_example.c b/contrib/examples/lwiperf/lwiperf_example.c
index a33bc6f2..d2eaf975 100644
--- a/contrib/examples/lwiperf/lwiperf_example.c
+++ b/contrib/examples/lwiperf/lwiperf_example.c
@@ -1,5 +1,5 @@
 /*
- * Redistribution and use in source and binary forms, with or without modification, 
+ * Redistribution and use in source and binary forms, with or without modification,
  * are permitted provided that the following conditions are met:
  *
  * 1. Redistributions of source code must retain the above copyright notice,
@@ -8,21 +8,21 @@
  *    this list of conditions and the following disclaimer in the documentation
  *    and/or other materials provided with the distribution.
  * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
+ *    derived from this software without specific prior written permission.
  *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
+ * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
  * OF SUCH DAMAGE.
  *
  * This file is part of the lwIP TCP/IP stack.
- * 
+ *
  * Author: Dirk Ziegelmeier <dziegel@gmx.de>
  *
  */
diff --git a/contrib/examples/lwiperf/lwiperf_example.h b/contrib/examples/lwiperf/lwiperf_example.h
index d7b35c88..aedeb467 100644
--- a/contrib/examples/lwiperf/lwiperf_example.h
+++ b/contrib/examples/lwiperf/lwiperf_example.h
@@ -1,5 +1,5 @@
 /*
- * Redistribution and use in source and binary forms, with or without modification, 
+ * Redistribution and use in source and binary forms, with or without modification,
  * are permitted provided that the following conditions are met:
  *
  * 1. Redistributions of source code must retain the above copyright notice,
@@ -8,21 +8,21 @@
  *    this list of conditions and the following disclaimer in the documentation
  *    and/or other materials provided with the distribution.
  * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
+ *    derived from this software without specific prior written permission.
  *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
+ * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
  * OF SUCH DAMAGE.
  *
  * This file is part of the lwIP TCP/IP stack.
- * 
+ *
  * Author: Dirk Ziegelmeier <dziegel@gmx.de>
  *
  */
diff --git a/contrib/examples/mdns/mdns_example.c b/contrib/examples/mdns/mdns_example.c
index 49625ef1..a3ae476d 100644
--- a/contrib/examples/mdns/mdns_example.c
+++ b/contrib/examples/mdns/mdns_example.c
@@ -1,5 +1,5 @@
 /*
- * Redistribution and use in source and binary forms, with or without modification, 
+ * Redistribution and use in source and binary forms, with or without modification,
  * are permitted provided that the following conditions are met:
  *
  * 1. Redistributions of source code must retain the above copyright notice,
@@ -8,21 +8,21 @@
  *    this list of conditions and the following disclaimer in the documentation
  *    and/or other materials provided with the distribution.
  * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
+ *    derived from this software without specific prior written permission.
  *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
+ * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
  * OF SUCH DAMAGE.
  *
  * This file is part of the lwIP TCP/IP stack.
- * 
+ *
  * Author: Dirk Ziegelmeier <dziegel@gmx.de>
  *
  */
@@ -36,7 +36,7 @@ srv_txt(struct mdns_service *service, void *txt_userdata)
 {
   err_t res;
   LWIP_UNUSED_ARG(txt_userdata);
-  
+
   res = mdns_resp_add_service_txtitem(service, "path=/", 6);
   LWIP_ERROR("mdns add service txt failed\n", (res == ERR_OK), return);
 }
diff --git a/contrib/examples/mdns/mdns_example.h b/contrib/examples/mdns/mdns_example.h
index ab51ade5..94aab9c9 100644
--- a/contrib/examples/mdns/mdns_example.h
+++ b/contrib/examples/mdns/mdns_example.h
@@ -1,5 +1,5 @@
 /*
- * Redistribution and use in source and binary forms, with or without modification, 
+ * Redistribution and use in source and binary forms, with or without modification,
  * are permitted provided that the following conditions are met:
  *
  * 1. Redistributions of source code must retain the above copyright notice,
@@ -8,21 +8,21 @@
  *    this list of conditions and the following disclaimer in the documentation
  *    and/or other materials provided with the distribution.
  * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
+ *    derived from this software without specific prior written permission.
  *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
+ * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
  * OF SUCH DAMAGE.
  *
  * This file is part of the lwIP TCP/IP stack.
- * 
+ *
  * Author: Dirk Ziegelmeier <dziegel@gmx.de>
  *
  */
diff --git a/contrib/examples/mqtt/mqtt_example.h b/contrib/examples/mqtt/mqtt_example.h
index 797678b2..6927497d 100644
--- a/contrib/examples/mqtt/mqtt_example.h
+++ b/contrib/examples/mqtt/mqtt_example.h
@@ -1,5 +1,5 @@
 /*
- * Redistribution and use in source and binary forms, with or without modification, 
+ * Redistribution and use in source and binary forms, with or without modification,
  * are permitted provided that the following conditions are met:
  *
  * 1. Redistributions of source code must retain the above copyright notice,
@@ -8,21 +8,21 @@
  *    this list of conditions and the following disclaimer in the documentation
  *    and/or other materials provided with the distribution.
  * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
+ *    derived from this software without specific prior written permission.
  *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
+ * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
  * OF SUCH DAMAGE.
  *
  * This file is part of the lwIP TCP/IP stack.
- * 
+ *
  * Author: Dirk Ziegelmeier <dziegel@gmx.de>
  *
  */
diff --git a/contrib/examples/ppp/pppos_example.h b/contrib/examples/ppp/pppos_example.h
index 726961c8..ea0823c8 100644
--- a/contrib/examples/ppp/pppos_example.h
+++ b/contrib/examples/ppp/pppos_example.h
@@ -1,5 +1,5 @@
 /*
- * Redistribution and use in source and binary forms, with or without modification, 
+ * Redistribution and use in source and binary forms, with or without modification,
  * are permitted provided that the following conditions are met:
  *
  * 1. Redistributions of source code must retain the above copyright notice,
@@ -8,21 +8,21 @@
  *    this list of conditions and the following disclaimer in the documentation
  *    and/or other materials provided with the distribution.
  * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
+ *    derived from this software without specific prior written permission.
  *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
+ * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
  * OF SUCH DAMAGE.
  *
  * This file is part of the lwIP TCP/IP stack.
- * 
+ *
  * Author: Dirk Ziegelmeier <dziegel@gmx.de>
  *
  */
diff --git a/contrib/examples/snmp/snmp_example.h b/contrib/examples/snmp/snmp_example.h
index fafcd68f..58f4c80f 100644
--- a/contrib/examples/snmp/snmp_example.h
+++ b/contrib/examples/snmp/snmp_example.h
@@ -1,5 +1,5 @@
 /*
- * Redistribution and use in source and binary forms, with or without modification, 
+ * Redistribution and use in source and binary forms, with or without modification,
  * are permitted provided that the following conditions are met:
  *
  * 1. Redistributions of source code must retain the above copyright notice,
@@ -8,21 +8,21 @@
  *    this list of conditions and the following disclaimer in the documentation
  *    and/or other materials provided with the distribution.
  * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
+ *    derived from this software without specific prior written permission.
  *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
+ * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
  * OF SUCH DAMAGE.
  *
  * This file is part of the lwIP TCP/IP stack.
- * 
+ *
  * Author: Dirk Ziegelmeier <dziegel@gmx.de>
  *
  */
diff --git a/contrib/examples/snmp/snmp_private_mib/lwip_prvmib.c b/contrib/examples/snmp/snmp_private_mib/lwip_prvmib.c
index 51a49fe1..eaafeb12 100644
--- a/contrib/examples/snmp/snmp_private_mib/lwip_prvmib.c
+++ b/contrib/examples/snmp/snmp_private_mib/lwip_prvmib.c
@@ -1,6 +1,6 @@
 /**
  * @file
- * lwip Private MIB 
+ * lwip Private MIB
  *
  * @todo create MIB file for this example
  * @note the lwip enterprise tree root (26381) is owned by the lwIP project.
@@ -8,11 +8,11 @@
  * the lwip developers, permission!
  *
  * Please apply for your own ID with IANA: http://www.iana.org/numbers.html
- *  
+ *
  * lwip        OBJECT IDENTIFIER ::= { enterprises 26381 }
  * example     OBJECT IDENTIFIER ::= { lwip 1 }
  */
- 
+
 /*
  * Copyright (c) 2006 Axon Digital Design B.V., The Netherlands.
  * All rights reserved.
@@ -78,15 +78,15 @@
   Sensors may and can not be added or removed after agent
   has started. Note this is only a limitation of this crude example,
   the agent does support dynamic object insertions and removals.
-   
+
   You'll need to manually create a directory called "sensors" and
   a few single line text files with an integer temperature value.
-  The files must be called [0..9].txt. 
-   
+  The files must be called [0..9].txt.
+
   ./sensors/0.txt [content: 20]
   ./sensors/3.txt [content: 75]
-    
-  The sensor values may be changed in runtime by editing the 
+
+  The sensor values may be changed in runtime by editing the
   text files in the "sensors" directory.
 */
 
@@ -123,13 +123,13 @@ static const struct snmp_table_col_def sensor_table_columns[] = {
 
 /* sensortable .1.3.6.1.4.1.26381.1.1 */
 static const struct snmp_table_node sensor_table = SNMP_TABLE_CREATE(
-  1, sensor_table_columns, 
-  sensor_table_get_cell_instance, sensor_table_get_next_cell_instance, 
+  1, sensor_table_columns,
+  sensor_table_get_cell_instance, sensor_table_get_next_cell_instance,
   sensor_table_get_value, snmp_set_test_ok, sensor_table_set_value);
 
 /* sensorcount .1.3.6.1.4.1.26381.1.2 */
 static const struct snmp_scalar_node sensor_count = SNMP_SCALAR_CREATE_NODE_READONLY(
-  2, SNMP_ASN1_TYPE_INTEGER, sensor_count_get_value); 
+  2, SNMP_ASN1_TYPE_INTEGER, sensor_count_get_value);
 
 /* example .1.3.6.1.4.1.26381.1 */
 static const struct snmp_node* const example_nodes[] = {
@@ -185,7 +185,7 @@ lwip_privmib_init(void)
 #endif /* SENSORS_USE_FILES && SENSORS_SEARCH_FILES */
 
   memset(sensors, 0, sizeof(sensors));
-  
+
   printf("SNMP private MIB start, detecting sensors.\n");
 
 #if SENSORS_USE_FILES && SENSORS_SEARCH_FILES
@@ -205,7 +205,7 @@ lwip_privmib_init(void)
       do
       {
         long base;
-        
+
         nbytes = getdirentries(fd, buf, bufsize, &base);
         if (nbytes > 0)
         {
@@ -224,10 +224,10 @@ lwip_privmib_init(void)
             }
             cp += dp->d_reclen;
           }
-        } 
+        }
       }
       while (nbytes > 0);
-    
+
       free(buf);
     }
     close(fd);
@@ -253,7 +253,7 @@ sensor_count_get_value(struct snmp_node_instance* instance, void* value)
   u32_t *uint_ptr = (u32_t*)value;
 
   LWIP_UNUSED_ARG(instance);
-  
+
   for(count=0; count<LWIP_ARRAYSIZE(sensors); count++) {
     if(sensors[count].num == 0) {
       *uint_ptr = (u32_t)count;
@@ -261,7 +261,7 @@ sensor_count_get_value(struct snmp_node_instance* instance, void* value)
     }
   }
 
-  return 0;  
+  return 0;
 }
 
 /* sensortable .1.3.6.1.4.1.26381.1.1 */
@@ -309,7 +309,7 @@ sensor_table_get_next_cell_instance(const u32_t* column, struct snmp_obj_id* row
   u32_t result_temp[LWIP_ARRAYSIZE(sensor_table_oid_ranges)];
 
   LWIP_UNUSED_ARG(column);
-  
+
   /* init struct to search next oid */
   snmp_next_oid_init(&state, row_oid->id, row_oid->len, result_temp, LWIP_ARRAYSIZE(sensor_table_oid_ranges));
 
@@ -391,7 +391,7 @@ sensor_table_set_value(struct snmp_node_instance* instance, u16_t len, void *val
   }
 #else /* SENSORS_USE_FILES */
   sensors[i].value = *temperature;
-#endif /* SENSORS_USE_FILES */  
+#endif /* SENSORS_USE_FILES */
 
   LWIP_UNUSED_ARG(len);
 
diff --git a/contrib/examples/snmp/snmp_private_mib/private_mib.h b/contrib/examples/snmp/snmp_private_mib/private_mib.h
index 69be8a4f..a4a9f9e3 100644
--- a/contrib/examples/snmp/snmp_private_mib/private_mib.h
+++ b/contrib/examples/snmp/snmp_private_mib/private_mib.h
@@ -1,6 +1,6 @@
 /**
  * @file
- * Exports Private lwIP MIB 
+ * Exports Private lwIP MIB
  */
 
 #ifndef LWIP_HDR_PRIVATE_MIB_H
diff --git a/contrib/examples/snmp/snmp_v3/snmpv3_dummy.c b/contrib/examples/snmp/snmp_v3/snmpv3_dummy.c
index a7c53ed7..47b7d678 100644
--- a/contrib/examples/snmp/snmp_v3/snmpv3_dummy.c
+++ b/contrib/examples/snmp/snmp_v3/snmpv3_dummy.c
@@ -121,7 +121,7 @@ static void
 snmpv3_enginetime_timer(void *arg)
 {
   LWIP_UNUSED_ARG(arg);
-  
+
   enginetime++;
 
   /* This handles the engine time reset */
@@ -286,20 +286,20 @@ err_t
 snmpv3_get_user(const char* username, snmpv3_auth_algo_t *auth_algo, u8_t *auth_key, snmpv3_priv_algo_t *priv_algo, u8_t *priv_key)
 {
   const struct user_table_entry *p;
-  
+
   /* The msgUserName specifies the user (principal) on whose behalf the
      message is being exchanged. Note that a zero-length userName will
      not match any user, but it can be used for snmpEngineID discovery. */
   if(strlen(username) == 0) {
     return ERR_OK;
   }
-  
+
   p = get_user(username);
 
   if (!p) {
     return ERR_VAL;
   }
-  
+
   if (auth_algo != NULL) {
     *auth_algo = p->auth_algo;
   }
@@ -348,7 +348,7 @@ snmpv3_get_engine_boots(void)
 /**
  * Store engine boots in persistence
  */
-void 
+void
 snmpv3_set_engine_boots(u32_t boots)
 {
   engineboots = boots;
diff --git a/contrib/examples/sntp/sntp_example.c b/contrib/examples/sntp/sntp_example.c
index 60178bff..3fdc0ca7 100644
--- a/contrib/examples/sntp/sntp_example.c
+++ b/contrib/examples/sntp/sntp_example.c
@@ -1,5 +1,5 @@
 /*
- * Redistribution and use in source and binary forms, with or without modification, 
+ * Redistribution and use in source and binary forms, with or without modification,
  * are permitted provided that the following conditions are met:
  *
  * 1. Redistributions of source code must retain the above copyright notice,
@@ -8,21 +8,21 @@
  *    this list of conditions and the following disclaimer in the documentation
  *    and/or other materials provided with the distribution.
  * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
+ *    derived from this software without specific prior written permission.
  *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
+ * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
  * OF SUCH DAMAGE.
  *
  * This file is part of the lwIP TCP/IP stack.
- * 
+ *
  * Author: Dirk Ziegelmeier <dziegel@gmx.de>
  *
  */
@@ -46,7 +46,7 @@ sntp_set_system_time(u32_t sec)
 #else
   localtime_r(&current_time, &current_time_val);
 #endif
-  
+
   strftime(buf, sizeof(buf), "%d.%m.%Y %H:%M:%S", &current_time_val);
   LWIP_PLATFORM_DIAG(("SNTP time: %s\n", buf));
 }
diff --git a/contrib/examples/sntp/sntp_example.h b/contrib/examples/sntp/sntp_example.h
index 94fc10db..f03ad3e7 100644
--- a/contrib/examples/sntp/sntp_example.h
+++ b/contrib/examples/sntp/sntp_example.h
@@ -1,5 +1,5 @@
 /*
- * Redistribution and use in source and binary forms, with or without modification, 
+ * Redistribution and use in source and binary forms, with or without modification,
  * are permitted provided that the following conditions are met:
  *
  * 1. Redistributions of source code must retain the above copyright notice,
@@ -8,21 +8,21 @@
  *    this list of conditions and the following disclaimer in the documentation
  *    and/or other materials provided with the distribution.
  * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
+ *    derived from this software without specific prior written permission.
  *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
+ * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
  * OF SUCH DAMAGE.
  *
  * This file is part of the lwIP TCP/IP stack.
- * 
+ *
  * Author: Dirk Ziegelmeier <dziegel@gmx.de>
  *
  */
diff --git a/contrib/examples/tftp/tftp_example.h b/contrib/examples/tftp/tftp_example.h
index 73407004..efd8c6ba 100644
--- a/contrib/examples/tftp/tftp_example.h
+++ b/contrib/examples/tftp/tftp_example.h
@@ -4,7 +4,7 @@
  * and open the template in the editor.
  */
 
-/* 
+/*
  * File:   tftp_example.h
  * Author: dziegel
  *
diff --git a/contrib/ports/unix/port/include/arch/cc.h b/contrib/ports/unix/port/include/arch/cc.h
index 7be900bf..c7079500 100644
--- a/contrib/ports/unix/port/include/arch/cc.h
+++ b/contrib/ports/unix/port/include/arch/cc.h
@@ -55,7 +55,7 @@
 #define LWIP_ERRNO_INCLUDE <errno.h>
 
 #if defined(LWIP_UNIX_LINUX) || defined(LWIP_UNIX_HURD) || defined(LWIP_UNIX_KFREEBSD)
-#define LWIP_ERRNO_STDINCLUDE	1
+#define LWIP_ERRNO_STDINCLUDE   1
 #endif
 
 extern unsigned int lwip_port_rand(void);
diff --git a/contrib/ports/unix/port/include/arch/perf.h b/contrib/ports/unix/port/include/arch/perf.h
index 364f3164..80fdf4d7 100644
--- a/contrib/ports/unix/port/include/arch/perf.h
+++ b/contrib/ports/unix/port/include/arch/perf.h
@@ -53,8 +53,8 @@
 #endif /* PERF */
 
 void perf_print(unsigned long c1l, unsigned long c1h,
-		unsigned long c2l, unsigned long c2h,
-		char *key);
+        unsigned long c2l, unsigned long c2h,
+        char *key);
 
 void perf_print_times(struct tms *start, struct tms *end, char *key);
 
diff --git a/contrib/ports/unix/port/include/netif/fifo.h b/contrib/ports/unix/port/include/netif/fifo.h
index bda352a7..7b1a17cc 100644
--- a/contrib/ports/unix/port/include/netif/fifo.h
+++ b/contrib/ports/unix/port/include/netif/fifo.h
@@ -9,44 +9,44 @@
 /** fifo data structure, this one is passed to all fifo functions */
 typedef struct fifo_t {
   u8_t data[FIFOSIZE+10]; /* data segment, +10 is a hack probably not needed.. FIXME! */
-  int dataslot;			  /* index to next char to be read */
-  int emptyslot;		  /* index to next empty slot */
-  int len;				  /* len probably not needed, may be calculated from dataslot and emptyslot in conjunction with FIFOSIZE */
-
-  sys_sem_t sem;		/* semaphore protecting simultaneous data manipulation */
-  sys_sem_t getSem;		/* sepaphore used to signal new data if getWaiting is set */
-  u8_t getWaiting;		/* flag used to indicate that fifoget is waiting for data. fifoput is supposed to clear */
-  						/* this flag prior to signaling the getSem semaphore */
+  int dataslot;           /* index to next char to be read */
+  int emptyslot;          /* index to next empty slot */
+  int len;                /* len probably not needed, may be calculated from dataslot and emptyslot in conjunction with FIFOSIZE */
+
+  sys_sem_t sem;        /* semaphore protecting simultaneous data manipulation */
+  sys_sem_t getSem;     /* sepaphore used to signal new data if getWaiting is set */
+  u8_t getWaiting;      /* flag used to indicate that fifoget is waiting for data. fifoput is supposed to clear */
+                        /* this flag prior to signaling the getSem semaphore */
 } fifo_t;
 
 
 /**
 *   Get a character from fifo
 *   Blocking call.
-*	@param 	fifo pointer to fifo data structure
-*	@return	character read from fifo
+*   @param  fifo pointer to fifo data structure
+*   @return character read from fifo
 */
 u8_t fifoGet(fifo_t * fifo);
 
 /**
 *   Get a character from fifo
 *   Non blocking call.
-*	@param 	fifo pointer to fifo data structure
-*	@return	character read from fifo, or < zero if non was available
+*   @param  fifo pointer to fifo data structure
+*   @return character read from fifo, or < zero if non was available
 */
 s16_t fifoGetNonBlock(fifo_t * fifo);
 
 /**
-*	fifoput is called by the signalhandler when new data has arrived (or some other event is indicated)
+*   fifoput is called by the signalhandler when new data has arrived (or some other event is indicated)
 *   fifoput reads directly from the serialport and is thus highly dependent on unix arch at this moment
-*	@param 	fifo pointer to fifo data structure
-*	@param	fd	unix file descriptor
+*   @param  fifo pointer to fifo data structure
+*   @param  fd  unix file descriptor
 */
 void fifoPut(fifo_t * fifo, int fd);
 
 /**
 *   fifoinit initiate fifo
-*	@param 	fifo	pointer to fifo data structure, allocated by the user
+*   @param  fifo    pointer to fifo data structure, allocated by the user
 */
 void fifoInit(fifo_t * fifo);
 
diff --git a/contrib/ports/unix/port/include/netif/pcapif.h b/contrib/ports/unix/port/include/netif/pcapif.h
index ef7abd5f..b6905523 100644
--- a/contrib/ports/unix/port/include/netif/pcapif.h
+++ b/contrib/ports/unix/port/include/netif/pcapif.h
@@ -1,8 +1,8 @@
 /*
  * Copyright (c) 2001-2003 Swedish Institute of Computer Science.
- * All rights reserved. 
- * 
- * Redistribution and use in source and binary forms, with or without modification, 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
  * are permitted provided that the following conditions are met:
  *
  * 1. Redistributions of source code must retain the above copyright notice,
@@ -11,21 +11,21 @@
  *    this list of conditions and the following disclaimer in the documentation
  *    and/or other materials provided with the distribution.
  * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
+ *    derived from this software without specific prior written permission.
  *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
+ * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
  * OF SUCH DAMAGE.
  *
  * This file is part of the lwIP TCP/IP stack.
- * 
+ *
  * Author: Adam Dunkels <adam@sics.se>
  *
  */
diff --git a/contrib/ports/unix/port/include/netif/sio.h b/contrib/ports/unix/port/include/netif/sio.h
index b9ff131b..eccd3a0f 100644
--- a/contrib/ports/unix/port/include/netif/sio.h
+++ b/contrib/ports/unix/port/include/netif/sio.h
@@ -7,52 +7,52 @@
 /*#include "netif/pppif.h"*/
 
 struct sio_status_s {
-	int fd;
-	fifo_t myfifo;
+    int fd;
+    fifo_t myfifo;
 };
 
 /* BAUDRATE is defined in sio.c as it is implementation specific */
 /** Baudrates */
 typedef enum sioBaudrates {
-	SIO_BAUD_9600,
-	SIO_BAUD_19200,
-	SIO_BAUD_38400,
-	SIO_BAUD_57600,	
-	SIO_BAUD_115200	
+    SIO_BAUD_9600,
+    SIO_BAUD_19200,
+    SIO_BAUD_38400,
+    SIO_BAUD_57600,
+    SIO_BAUD_115200
 } sioBaudrates;
 
 /**
 * Poll for a new character from incoming data stream
-* @param 	siostat siostatus struct, contains sio instance data, given by sio_open
-* @return 	char read from input stream, or < 0 if no char was available
+* @param    siostat siostatus struct, contains sio instance data, given by sio_open
+* @return   char read from input stream, or < 0 if no char was available
 */
 s16_t sio_poll(sio_status_t * siostat);
 
 /**
-*	Parse incoming characters until a string str is received, blocking call
-* @param	str		zero terminated string to expect
-* @param 	siostat siostatus struct, contains sio instance data, given by sio_open
+*   Parse incoming characters until a string str is received, blocking call
+* @param    str     zero terminated string to expect
+* @param    siostat siostatus struct, contains sio instance data, given by sio_open
 */
 void sio_expect_string(u8_t *str, sio_status_t * siostat);
 
 /**
 * Write a char to output data stream
-* @param 	str		pointer to a zero terminated string
-* @param	siostat siostatus struct, contains sio instance data, given by sio_open
+* @param    str     pointer to a zero terminated string
+* @param    siostat siostatus struct, contains sio instance data, given by sio_open
 */
 void sio_send_string(u8_t *str, sio_status_t * siostat);
 
 /**
-*	Flush outbuffer (send everything in buffer now), useful if some layer below is 
-*	holding on to data, waitng to fill a buffer
-* @param 	siostat siostatus struct, contains sio instance data, given by sio_open
+*   Flush outbuffer (send everything in buffer now), useful if some layer below is
+*   holding on to data, waitng to fill a buffer
+* @param    siostat siostatus struct, contains sio instance data, given by sio_open
 */
 void sio_flush( sio_status_t * siostat );
 
 /**
-*	Change baudrate of port, may close and reopen port
-* @param 	baud	new baudrate
-* @param 	siostat siostatus struct, contains sio instance data, given by sio_open
+*   Change baudrate of port, may close and reopen port
+* @param    baud    new baudrate
+* @param    siostat siostatus struct, contains sio instance data, given by sio_open
 */
 void sio_change_baud( sioBaudrates baud, sio_status_t * siostat );
 
diff --git a/contrib/ports/unix/port/netif/fifo.c b/contrib/ports/unix/port/netif/fifo.c
index 350d3eae..04d4cc79 100644
--- a/contrib/ports/unix/port/netif/fifo.c
+++ b/contrib/ports/unix/port/netif/fifo.c
@@ -24,103 +24,103 @@
 
 u8_t fifoGet(fifo_t * fifo)
 {
-	u8_t c;
+    u8_t c;
 
-	sys_sem_wait(&fifo->sem);      /* enter critical section */
+    sys_sem_wait(&fifo->sem);      /* enter critical section */
 
-	if (fifo->dataslot == fifo->emptyslot)
-	{
+    if (fifo->dataslot == fifo->emptyslot)
+    {
             fifo->getWaiting = TRUE;    /* tell putFifo to signal us when data is available */
             sys_sem_signal(&fifo->sem);  /* leave critical section (allow input from serial port..) */
             sys_sem_wait(&fifo->getSem); /* wait 4 data */
             sys_sem_wait(&fifo->sem);    /* reenter critical section */
-	}
+    }
 
-	c = fifo->data[fifo->dataslot++];
-	fifo->len--;
+    c = fifo->data[fifo->dataslot++];
+    fifo->len--;
 
-	if (fifo->dataslot == FIFOSIZE)
-	{
-		fifo->dataslot = 0;
-	}
-	sys_sem_signal(&fifo->sem);    /* leave critical section */
-	return c;
+    if (fifo->dataslot == FIFOSIZE)
+    {
+        fifo->dataslot = 0;
+    }
+    sys_sem_signal(&fifo->sem);    /* leave critical section */
+    return c;
 }
 
 
 s16_t fifoGetNonBlock(fifo_t * fifo)
 {
-	u16_t c;
+    u16_t c;
 
-	sys_sem_wait(&fifo->sem);      /* enter critical section */
+    sys_sem_wait(&fifo->sem);      /* enter critical section */
 
-	if (fifo->dataslot == fifo->emptyslot)
-	{
+    if (fifo->dataslot == fifo->emptyslot)
+    {
             /* empty fifo */
-		c = -1;
-	}
-	else
-	{
-		c = fifo->data[fifo->dataslot++];
-		fifo->len--;
-
-		if (fifo->dataslot == FIFOSIZE)
-		{
-			fifo->dataslot = 0;
-		}
-	}
-	sys_sem_signal(&fifo->sem);    /* leave critical section */
-	return c;
+        c = -1;
+    }
+    else
+    {
+        c = fifo->data[fifo->dataslot++];
+        fifo->len--;
+
+        if (fifo->dataslot == FIFOSIZE)
+        {
+            fifo->dataslot = 0;
+        }
+    }
+    sys_sem_signal(&fifo->sem);    /* leave critical section */
+    return c;
 }
 
 
 void fifoPut(fifo_t * fifo, int fd)
 {
-	/* FIXME: mutex around struct data.. */
-	int cnt=0;
-
-	sys_sem_wait(&fifo->sem ); /* enter critical */
-
-	LWIP_DEBUGF( SIO_FIFO_DEBUG,("fifoput: len%d dat%d empt%d --> ", fifo->len, fifo->dataslot, fifo->emptyslot ) );
-
-	if ( fifo->emptyslot < fifo->dataslot )
-	{
-		cnt = read( fd, &fifo->data[fifo->emptyslot], fifo->dataslot - fifo->emptyslot );
-	}
-	else
-	{
-		cnt = read( fd, &fifo->data[fifo->emptyslot], FIFOSIZE-fifo->emptyslot );
-	}
-	fifo->emptyslot += cnt;
-	fifo->len += cnt;
-
-	LWIP_DEBUGF( SIO_FIFO_DEBUG,("len%d dat%d empt%d\n", fifo->len, fifo->dataslot, fifo->emptyslot ) );
-
-	if ( fifo->len > FIFOSIZE )
-	{
-		printf( "ERROR: fifo overrun detected len=%d, flushing\n", fifo->len );
-		fifo->dataslot  = 0;
-		fifo->emptyslot = 0;
-		fifo->len = 0;
-	}
-
-	if ( fifo->emptyslot == FIFOSIZE )
-	{
-		fifo->emptyslot = 0;
-		LWIP_DEBUGF( SIO_FIFO_DEBUG, ("(WRAP) ") );
-
-		sys_sem_signal(&fifo->sem ); /* leave critical */
-		fifoPut( fifo, fd );
-		return;
-	}
-	if ( fifo->getWaiting )
-	{
-		fifo->getWaiting = FALSE;
-		sys_sem_signal(&fifo->getSem );
-	}
-
-	sys_sem_signal(&fifo->sem ); /* leave critical */
-	return;
+    /* FIXME: mutex around struct data.. */
+    int cnt=0;
+
+    sys_sem_wait(&fifo->sem ); /* enter critical */
+
+    LWIP_DEBUGF( SIO_FIFO_DEBUG,("fifoput: len%d dat%d empt%d --> ", fifo->len, fifo->dataslot, fifo->emptyslot ) );
+
+    if ( fifo->emptyslot < fifo->dataslot )
+    {
+        cnt = read( fd, &fifo->data[fifo->emptyslot], fifo->dataslot - fifo->emptyslot );
+    }
+    else
+    {
+        cnt = read( fd, &fifo->data[fifo->emptyslot], FIFOSIZE-fifo->emptyslot );
+    }
+    fifo->emptyslot += cnt;
+    fifo->len += cnt;
+
+    LWIP_DEBUGF( SIO_FIFO_DEBUG,("len%d dat%d empt%d\n", fifo->len, fifo->dataslot, fifo->emptyslot ) );
+
+    if ( fifo->len > FIFOSIZE )
+    {
+        printf( "ERROR: fifo overrun detected len=%d, flushing\n", fifo->len );
+        fifo->dataslot  = 0;
+        fifo->emptyslot = 0;
+        fifo->len = 0;
+    }
+
+    if ( fifo->emptyslot == FIFOSIZE )
+    {
+        fifo->emptyslot = 0;
+        LWIP_DEBUGF( SIO_FIFO_DEBUG, ("(WRAP) ") );
+
+        sys_sem_signal(&fifo->sem ); /* leave critical */
+        fifoPut( fifo, fd );
+        return;
+    }
+    if ( fifo->getWaiting )
+    {
+        fifo->getWaiting = FALSE;
+        sys_sem_signal(&fifo->getSem );
+    }
+
+    sys_sem_signal(&fifo->sem ); /* leave critical */
+    return;
 }
 
 
diff --git a/contrib/ports/unix/port/netif/pcapif.c b/contrib/ports/unix/port/netif/pcapif.c
index 2851c822..6ff4cdc1 100644
--- a/contrib/ports/unix/port/netif/pcapif.c
+++ b/contrib/ports/unix/port/netif/pcapif.c
@@ -75,7 +75,7 @@ static char errbuf[PCAP_ERRBUF_SIZE];
 /*-----------------------------------------------------------------------------------*/
 static err_t
 pcapif_output(struct netif *netif, struct pbuf *p,
-	      ip_addr_t *ipaddr)
+          ip_addr_t *ipaddr)
 {
   return ERR_OK;
 }
diff --git a/contrib/ports/unix/port/netif/sio.c b/contrib/ports/unix/port/netif/sio.c
index 8d8be9be..25b3ea56 100644
--- a/contrib/ports/unix/port/netif/sio.c
+++ b/contrib/ports/unix/port/netif/sio.c
@@ -74,7 +74,7 @@
 
 /*  typedef struct siostruct_t */
 /*  {  */
-/*  	sio_status_t *sio; */
+/*      sio_status_t *sio; */
 /*  } siostruct_t; */
 
 /** array of ((siostruct*)netif->state)->sio structs */
@@ -86,11 +86,11 @@ static sio_status_t statusar[4];
  * Signal handler for ttyXX0 to indicate bytes received
  * one per interface is needed since we cannot send a instance number / pointer as callback argument (?)
  */
-static void	signal_handler_IO_0( int status )
+static void signal_handler_IO_0( int status )
 {
-	LWIP_UNUSED_ARG(status);
-	LWIP_DEBUGF(SIO_DEBUG, ("SigHand: rxSignal channel 0\n"));
-	fifoPut( &statusar[0].myfifo, statusar[0].fd );
+    LWIP_UNUSED_ARG(status);
+    LWIP_DEBUGF(SIO_DEBUG, ("SigHand: rxSignal channel 0\n"));
+    fifoPut( &statusar[0].myfifo, statusar[0].fd );
 }
 
 /**
@@ -99,9 +99,9 @@ static void	signal_handler_IO_0( int status )
  */
 static void signal_handler_IO_1( int status )
 {
-	LWIP_UNUSED_ARG(status);
-	LWIP_DEBUGF(SIO_DEBUG, ("SigHand: rxSignal channel 1\n"));
-	fifoPut( &statusar[1].myfifo, statusar[1].fd );
+    LWIP_UNUSED_ARG(status);
+    LWIP_DEBUGF(SIO_DEBUG, ("SigHand: rxSignal channel 1\n"));
+    fifoPut( &statusar[1].myfifo, statusar[1].fd );
 }
 #endif /* ! (PPP_SUPPORT || LWIP_HAVE_SLIPIF) */
 
@@ -114,79 +114,79 @@ static void signal_handler_IO_1( int status )
 */
 static int sio_init( char * device, int devnum, sio_status_t * siostat )
 {
-	struct termios oldtio,newtio;
+    struct termios oldtio,newtio;
 #if ! (PPP_SUPPORT || LWIP_HAVE_SLIPIF)
-	struct sigaction saio;           /* definition of signal action */
+    struct sigaction saio;           /* definition of signal action */
 #endif
-	int fd;
-	LWIP_UNUSED_ARG(siostat);
-	LWIP_UNUSED_ARG(devnum);
-
-	/* open the device to be non-blocking (read will return immediately) */
-	fd = open( device, O_RDWR | O_NOCTTY | O_NONBLOCK );
-	if ( fd < 0 )
-	{
-		perror( device );
-		exit( -1 );
-	}
+    int fd;
+    LWIP_UNUSED_ARG(siostat);
+    LWIP_UNUSED_ARG(devnum);
+
+    /* open the device to be non-blocking (read will return immediately) */
+    fd = open( device, O_RDWR | O_NOCTTY | O_NONBLOCK );
+    if ( fd < 0 )
+    {
+        perror( device );
+        exit( -1 );
+    }
 
 #if ! (PPP_SUPPORT || LWIP_HAVE_SLIPIF)
-	memset(&saio, 0, sizeof(struct sigaction));
-	/* install the signal handler before making the device asynchronous */
-	switch ( devnum )
-	{
-		case 0:
-			LWIP_DEBUGF( SIO_DEBUG, ("sioinit, signal_handler_IO_0\n") );
-			saio.sa_handler = signal_handler_IO_0;
-			break;
-		case 1:
-			LWIP_DEBUGF( SIO_DEBUG, ("sioinit, signal_handler_IO_1\n") );
-			saio.sa_handler = signal_handler_IO_1;
-			break;
-		default:
-			LWIP_DEBUGF( SIO_DEBUG,("sioinit, devnum not allowed\n") );
-			break;
-	}
-
-	sigaction( SIGIO,&saio,NULL );
-
-	/* allow the process to receive SIGIO */
-       	if ( fcntl( fd, F_SETOWN, getpid( ) ) != 0)
-	{
-		perror( device );
-		exit( -1 );
-	}
-	/* Make the file descriptor asynchronous (the manual page says only
-	O_APPEND and O_NONBLOCK, will work with F_SETFL...) */
-       	if ( fcntl( fd, F_SETFL, FASYNC ) != 0)
-	{
-		perror( device );
-		exit( -1 );
-	}
+    memset(&saio, 0, sizeof(struct sigaction));
+    /* install the signal handler before making the device asynchronous */
+    switch ( devnum )
+    {
+        case 0:
+            LWIP_DEBUGF( SIO_DEBUG, ("sioinit, signal_handler_IO_0\n") );
+            saio.sa_handler = signal_handler_IO_0;
+            break;
+        case 1:
+            LWIP_DEBUGF( SIO_DEBUG, ("sioinit, signal_handler_IO_1\n") );
+            saio.sa_handler = signal_handler_IO_1;
+            break;
+        default:
+            LWIP_DEBUGF( SIO_DEBUG,("sioinit, devnum not allowed\n") );
+            break;
+    }
+
+    sigaction( SIGIO,&saio,NULL );
+
+    /* allow the process to receive SIGIO */
+        if ( fcntl( fd, F_SETOWN, getpid( ) ) != 0)
+    {
+        perror( device );
+        exit( -1 );
+    }
+    /* Make the file descriptor asynchronous (the manual page says only
+    O_APPEND and O_NONBLOCK, will work with F_SETFL...) */
+        if ( fcntl( fd, F_SETFL, FASYNC ) != 0)
+    {
+        perror( device );
+        exit( -1 );
+    }
 #else
-       	if ( fcntl( fd, F_SETFL, 0 ) != 0)
-	{
-		perror( device );
-		exit( -1 );
-	}
+        if ( fcntl( fd, F_SETFL, 0 ) != 0)
+    {
+        perror( device );
+        exit( -1 );
+    }
 
 #endif /* ! (PPP_SUPPORT || LWIP_HAVE_SLIPIF) */
 
-	tcgetattr( fd,&oldtio ); /* save current port settings */
-	/* set new port settings */
-	/* see 'man termios' for further settings */
+    tcgetattr( fd,&oldtio ); /* save current port settings */
+    /* set new port settings */
+    /* see 'man termios' for further settings */
         memset(&newtio, 0, sizeof(newtio));
-	newtio.c_cflag = BAUDRATE | CS8 | CLOCAL | CREAD | CRTSCTS;
-	newtio.c_iflag = 0;
-	newtio.c_oflag = 0;
-	newtio.c_lflag = 0; /*ECHO; */
-	newtio.c_cc[VMIN] = 1; /* Read 1 byte at a time, no timer */
-	newtio.c_cc[VTIME] = 0;
+    newtio.c_cflag = BAUDRATE | CS8 | CLOCAL | CREAD | CRTSCTS;
+    newtio.c_iflag = 0;
+    newtio.c_oflag = 0;
+    newtio.c_lflag = 0; /*ECHO; */
+    newtio.c_cc[VMIN] = 1; /* Read 1 byte at a time, no timer */
+    newtio.c_cc[VTIME] = 0;
 
-	tcsetattr( fd,TCSANOW,&newtio );
-	tcflush( fd, TCIOFLUSH );
+    tcsetattr( fd,TCSANOW,&newtio );
+    tcflush( fd, TCIOFLUSH );
 
-	return fd;
+    return fd;
 }
 
 /**
@@ -194,64 +194,64 @@ static int sio_init( char * device, int devnum, sio_status_t * siostat )
 */
 static void sio_speed( int fd, int speed )
 {
-	struct termios oldtio,newtio;
-	/*  int fd; */
+    struct termios oldtio,newtio;
+    /*  int fd; */
 
-	LWIP_DEBUGF(SIO_DEBUG, ("sio_speed[%d]: baudcode:%d enter\n", fd, speed));
+    LWIP_DEBUGF(SIO_DEBUG, ("sio_speed[%d]: baudcode:%d enter\n", fd, speed));
 
-	if ( fd < 0 )
-	{
-		LWIP_DEBUGF(SIO_DEBUG, ("sio_speed[%d]: fd ERROR\n", fd));
-		exit( -1 );
-	}
+    if ( fd < 0 )
+    {
+        LWIP_DEBUGF(SIO_DEBUG, ("sio_speed[%d]: fd ERROR\n", fd));
+        exit( -1 );
+    }
 
-	tcgetattr( fd,&oldtio ); /* get current port settings */
+    tcgetattr( fd,&oldtio ); /* get current port settings */
 
-	/* set new port settings
-	* see 'man termios' for further settings */
+    /* set new port settings
+    * see 'man termios' for further settings */
         memset(&newtio, 0, sizeof(newtio));
-	newtio.c_cflag = speed | CS8 | CLOCAL | CREAD; /* | CRTSCTS; */
-	newtio.c_iflag = 0;
-	newtio.c_oflag = 0;
-	newtio.c_lflag = 0; /*ECHO; */
-	newtio.c_cc[VMIN] = 1; /* Read 1 byte at a time, no timer */
-	newtio.c_cc[VTIME] = 0;
+    newtio.c_cflag = speed | CS8 | CLOCAL | CREAD; /* | CRTSCTS; */
+    newtio.c_iflag = 0;
+    newtio.c_oflag = 0;
+    newtio.c_lflag = 0; /*ECHO; */
+    newtio.c_cc[VMIN] = 1; /* Read 1 byte at a time, no timer */
+    newtio.c_cc[VTIME] = 0;
 
-	tcsetattr( fd,TCSANOW,&newtio );
-	tcflush( fd, TCIOFLUSH );
+    tcsetattr( fd,TCSANOW,&newtio );
+    tcflush( fd, TCIOFLUSH );
 
-	LWIP_DEBUGF(SIO_DEBUG, ("sio_speed[%d]: leave\n", fd));
+    LWIP_DEBUGF(SIO_DEBUG, ("sio_speed[%d]: leave\n", fd));
 }
 
 /* --public-functions----------------------------------------------------------------------------- */
 void sio_send( u8_t c, sio_status_t * siostat )
 {
-    /*	sio_status_t * siostat = ((siostruct_t*)netif->state)->sio; */
+    /*  sio_status_t * siostat = ((siostruct_t*)netif->state)->sio; */
 
-	if ( write( siostat->fd, &c, 1 ) <= 0 )
-	{
-		LWIP_DEBUGF(SIO_DEBUG, ("sio_send[%d]: write refused\n", siostat->fd));
-	}
+    if ( write( siostat->fd, &c, 1 ) <= 0 )
+    {
+        LWIP_DEBUGF(SIO_DEBUG, ("sio_send[%d]: write refused\n", siostat->fd));
+    }
 }
 
 void sio_send_string( u8_t *str, sio_status_t * siostat )
 {
-    /*	sio_status_t * siostat = ((siostruct_t*)netif->state)->sio; */
-	int len = strlen( (const char *)str );
-
-	if ( write( siostat->fd, str, len ) <= 0 )
-	{
-		LWIP_DEBUGF(SIO_DEBUG, ("sio_send_string[%d]: write refused\n", siostat->fd));
-	}
-	LWIP_DEBUGF(SIO_DEBUG, ("sio_send_string[%d]: sent: %s\n", siostat->fd, str));
+    /*  sio_status_t * siostat = ((siostruct_t*)netif->state)->sio; */
+    int len = strlen( (const char *)str );
+
+    if ( write( siostat->fd, str, len ) <= 0 )
+    {
+        LWIP_DEBUGF(SIO_DEBUG, ("sio_send_string[%d]: write refused\n", siostat->fd));
+    }
+    LWIP_DEBUGF(SIO_DEBUG, ("sio_send_string[%d]: sent: %s\n", siostat->fd, str));
 }
 
 
 void sio_flush( sio_status_t * siostat )
 {
-	LWIP_UNUSED_ARG(siostat);
-	/* not implemented in unix as it is not needed */
- 	/*sio_status_t * siostat = ((siostruct_t*)netif->state)->sio; */
+    LWIP_UNUSED_ARG(siostat);
+    /* not implemented in unix as it is not needed */
+    /*sio_status_t * siostat = ((siostruct_t*)netif->state)->sio; */
 }
 
 
@@ -259,43 +259,43 @@ void sio_flush( sio_status_t * siostat )
 /*u8_t sio_recv( struct netif * netif )*/
 u8_t sio_recv( sio_status_t * siostat )
 {
-    /*	sio_status_t * siostat = ((siostruct_t*)netif->state)->sio; */
-	return fifoGet( &(siostat->myfifo) );
+    /*  sio_status_t * siostat = ((siostruct_t*)netif->state)->sio; */
+    return fifoGet( &(siostat->myfifo) );
 }
 
 s16_t sio_poll(sio_status_t * siostat)
 {
-    /*	sio_status_t * siostat = ((siostruct_t*)netif->state)->sio;*/
-	return fifoGetNonBlock( &(siostat->myfifo) );
+    /*  sio_status_t * siostat = ((siostruct_t*)netif->state)->sio;*/
+    return fifoGetNonBlock( &(siostat->myfifo) );
 }
 
 
 void sio_expect_string( u8_t *str, sio_status_t * siostat )
 {
-    /*	sio_status_t * siostat = ((siostruct_t*)netif->state)->sio;*/
-	u8_t c;
- 	int finger=0;
-
-	LWIP_DEBUGF(SIO_DEBUG, ("sio_expect_string[%d]: %s\n", siostat->fd, str));
-	while ( 1 )
-	{
-		c=fifoGet( &(siostat->myfifo) );
-		LWIP_DEBUGF(SIO_DEBUG, ("_%c", c));
-		if ( c==str[finger] )
-		{
-			finger++;
-		} else if ( finger > 0 )
-		{
+    /*  sio_status_t * siostat = ((siostruct_t*)netif->state)->sio;*/
+    u8_t c;
+    int finger=0;
+
+    LWIP_DEBUGF(SIO_DEBUG, ("sio_expect_string[%d]: %s\n", siostat->fd, str));
+    while ( 1 )
+    {
+        c=fifoGet( &(siostat->myfifo) );
+        LWIP_DEBUGF(SIO_DEBUG, ("_%c", c));
+        if ( c==str[finger] )
+        {
+            finger++;
+        } else if ( finger > 0 )
+        {
                     /*it might fit in the beginning? */
-			if ( str[0] == c )
-			{
-				finger = 1;
-			}
-		}
-		if ( 0 == str[finger] )
-                    break;	/* done, we have a match */
-	}
-	LWIP_DEBUGF(SIO_DEBUG, ("sio_expect_string[%d]: [match]\n", siostat->fd));
+            if ( str[0] == c )
+            {
+                finger = 1;
+            }
+        }
+        if ( 0 == str[finger] )
+                    break;  /* done, we have a match */
+    }
+    LWIP_DEBUGF(SIO_DEBUG, ("sio_expect_string[%d]: [match]\n", siostat->fd));
 }
 #endif /* ! (PPP_SUPPORT || LWIP_HAVE_SLIPIF) */
 
@@ -321,133 +321,133 @@ void sio_read_abort(sio_status_t * siostat)
 
 sio_fd_t sio_open(u8_t devnum)
 {
-	char dev[20];
+    char dev[20];
 
-	/* would be nice with dynamic memory alloc */
-	sio_status_t * siostate = &statusar[ devnum ];
-/* 	siostruct_t * tmp; */
+    /* would be nice with dynamic memory alloc */
+    sio_status_t * siostate = &statusar[ devnum ];
+/*  siostruct_t * tmp; */
 
 
-/* 	tmp = (siostruct_t*)(netif->state); */
-/* 	tmp->sio = siostate; */
+/*  tmp = (siostruct_t*)(netif->state); */
+/*  tmp->sio = siostate; */
 
-/* 	tmp = (siostruct_t*)(netif->state); */
+/*  tmp = (siostruct_t*)(netif->state); */
 
-/* 	((sio_status_t*)(tmp->sio))->fd = 0; */
+/*  ((sio_status_t*)(tmp->sio))->fd = 0; */
 
-	LWIP_DEBUGF(SIO_DEBUG, ("sio_open: for devnum %d\n", devnum));
+    LWIP_DEBUGF(SIO_DEBUG, ("sio_open: for devnum %d\n", devnum));
 
 #if ! (PPP_SUPPORT || LWIP_HAVE_SLIPIF)
-	fifoInit( &siostate->myfifo );
+    fifoInit( &siostate->myfifo );
 #endif /* ! PPP_SUPPORT */
 
-	snprintf( dev, sizeof(dev), "/dev/ttyS%d", devnum );
-
-	if ( (devnum == 1) || (devnum == 0) )
-	{
-		if ( ( siostate->fd = sio_init( dev, devnum, siostate ) ) == 0 )
-		{
-			LWIP_DEBUGF(SIO_DEBUG, ("sio_open: ERROR opening serial device dev=%s\n", dev));
-			abort( );
-			return NULL;
-		}
-		LWIP_DEBUGF(SIO_DEBUG, ("sio_open[%d]: dev=%s open.\n", siostate->fd, dev));
-	}
+    snprintf( dev, sizeof(dev), "/dev/ttyS%d", devnum );
+
+    if ( (devnum == 1) || (devnum == 0) )
+    {
+        if ( ( siostate->fd = sio_init( dev, devnum, siostate ) ) == 0 )
+        {
+            LWIP_DEBUGF(SIO_DEBUG, ("sio_open: ERROR opening serial device dev=%s\n", dev));
+            abort( );
+            return NULL;
+        }
+        LWIP_DEBUGF(SIO_DEBUG, ("sio_open[%d]: dev=%s open.\n", siostate->fd, dev));
+    }
 #if PPP_SUPPORT
-	else if (devnum == 2) {
-	    pid_t childpid;
-	    char name[256];
-	    childpid = forkpty(&siostate->fd, name, NULL, NULL);
-	    if(childpid < 0) {
-		perror("forkpty");
-		exit (1);
-	    }
-	    if(childpid == 0) {
-		execl("/usr/sbin/pppd", "pppd",
-			"ms-dns", "198.168.100.7",
-			"local", "crtscts",
-			"debug",
+    else if (devnum == 2) {
+        pid_t childpid;
+        char name[256];
+        childpid = forkpty(&siostate->fd, name, NULL, NULL);
+        if(childpid < 0) {
+        perror("forkpty");
+        exit (1);
+        }
+        if(childpid == 0) {
+        execl("/usr/sbin/pppd", "pppd",
+            "ms-dns", "198.168.100.7",
+            "local", "crtscts",
+            "debug",
 #ifdef LWIP_PPP_CHAP_TEST
-			"auth",
-			"require-chap",
-			"remotename", "lwip",
+            "auth",
+            "require-chap",
+            "remotename", "lwip",
 #else
-			"noauth",
+            "noauth",
 #endif
 #if LWIP_IPV6
-			"+ipv6",
+            "+ipv6",
 #endif
-			"192.168.1.1:192.168.1.2",
-			NULL);
-		perror("execl pppd");
-		exit (1);
-	    } else {
-		LWIP_DEBUGF(SIO_DEBUG, ("sio_open[%d]: spawned pppd pid %d on %s\n",
-			siostate->fd, childpid, name));
-	    }
-
-	}
+            "192.168.1.1:192.168.1.2",
+            NULL);
+        perror("execl pppd");
+        exit (1);
+        } else {
+        LWIP_DEBUGF(SIO_DEBUG, ("sio_open[%d]: spawned pppd pid %d on %s\n",
+            siostate->fd, childpid, name));
+        }
+
+    }
 #endif
 #if LWIP_HAVE_SLIPIF
-	else if (devnum == 3) {
-	    pid_t childpid;
-	    /* create PTY pair */
-	    siostate->fd = posix_openpt(O_RDWR | O_NOCTTY);
-	    if (siostate->fd < 0) {
-		perror("open pty master");
-		exit (1);
-	    }
-	    if (grantpt(siostate->fd) != 0) {
-		perror("grant pty master");
-		exit (1);
-	    }
-	    if (unlockpt(siostate->fd) != 0) {
-		perror("unlock pty master");
-		exit (1);
-	    }
-	    LWIP_DEBUGF(SIO_DEBUG, ("sio_open[%d]: for %s\n",
-		    siostate->fd, ptsname(siostate->fd)));
-	    /* fork for slattach */
-	    childpid = fork();
-	    if(childpid < 0) {
-		perror("fork");
-		exit (1);
-	    }
-	    if(childpid == 0) {
-		/* esteblish SLIP interface on host side connected to PTY slave */
-		execl("/sbin/slattach", "slattach",
-			"-d", "-v", "-L", "-p", "slip",
-			ptsname(siostate->fd),
-			NULL);
-		perror("execl slattach");
-		exit (1);
-	    } else {
-		int ret;
-		char buf[1024];
-		LWIP_DEBUGF(SIO_DEBUG, ("sio_open[%d]: spawned slattach pid %d on %s\n",
-			siostate->fd, childpid, ptsname(siostate->fd)));
-		/* wait a moment for slattach startup */
-		sleep(1);
-		/* configure SLIP interface on host side as P2P interface */
-		snprintf(buf, sizeof(buf),
-			"/sbin/ifconfig sl0 mtu %d %s pointopoint %s up",
-			SLIP_MAX_SIZE, "192.168.2.1", "192.168.2.2");
-		LWIP_DEBUGF(SIO_DEBUG, ("sio_open[%d]: system(\"%s\");\n", siostate->fd, buf));
-		ret = system(buf);
-		if (ret < 0) {
-		    perror("ifconfig failed");
-		    exit(1);
-		}
-	    }
-	}
+    else if (devnum == 3) {
+        pid_t childpid;
+        /* create PTY pair */
+        siostate->fd = posix_openpt(O_RDWR | O_NOCTTY);
+        if (siostate->fd < 0) {
+        perror("open pty master");
+        exit (1);
+        }
+        if (grantpt(siostate->fd) != 0) {
+        perror("grant pty master");
+        exit (1);
+        }
+        if (unlockpt(siostate->fd) != 0) {
+        perror("unlock pty master");
+        exit (1);
+        }
+        LWIP_DEBUGF(SIO_DEBUG, ("sio_open[%d]: for %s\n",
+            siostate->fd, ptsname(siostate->fd)));
+        /* fork for slattach */
+        childpid = fork();
+        if(childpid < 0) {
+        perror("fork");
+        exit (1);
+        }
+        if(childpid == 0) {
+        /* esteblish SLIP interface on host side connected to PTY slave */
+        execl("/sbin/slattach", "slattach",
+            "-d", "-v", "-L", "-p", "slip",
+            ptsname(siostate->fd),
+            NULL);
+        perror("execl slattach");
+        exit (1);
+        } else {
+        int ret;
+        char buf[1024];
+        LWIP_DEBUGF(SIO_DEBUG, ("sio_open[%d]: spawned slattach pid %d on %s\n",
+            siostate->fd, childpid, ptsname(siostate->fd)));
+        /* wait a moment for slattach startup */
+        sleep(1);
+        /* configure SLIP interface on host side as P2P interface */
+        snprintf(buf, sizeof(buf),
+            "/sbin/ifconfig sl0 mtu %d %s pointopoint %s up",
+            SLIP_MAX_SIZE, "192.168.2.1", "192.168.2.2");
+        LWIP_DEBUGF(SIO_DEBUG, ("sio_open[%d]: system(\"%s\");\n", siostate->fd, buf));
+        ret = system(buf);
+        if (ret < 0) {
+            perror("ifconfig failed");
+            exit(1);
+        }
+        }
+    }
 #endif /* LWIP_HAVE_SLIPIF */
-	else
-	{
-		LWIP_DEBUGF(SIO_DEBUG, ("sio_open: device %s (%d) is not supported\n", dev, devnum));
-		return NULL;
-	}
+    else
+    {
+        LWIP_DEBUGF(SIO_DEBUG, ("sio_open: device %s (%d) is not supported\n", dev, devnum));
+        return NULL;
+    }
 
-	return siostate;
+    return siostate;
 }
 
 /**
@@ -455,31 +455,31 @@ sio_fd_t sio_open(u8_t devnum)
 */
 void sio_change_baud( sioBaudrates baud, sio_status_t * siostat )
 {
-    /*	sio_status_t * siostat = ((siostruct_t*)netif->state)->sio;*/
-
-	LWIP_DEBUGF(SIO_DEBUG, ("sio_change_baud[%d]\n", siostat->fd));
-
-	switch ( baud )
-	{
-		case SIO_BAUD_9600:
-			sio_speed( siostat->fd, B9600 );
-			break;
-		case SIO_BAUD_19200:
-			sio_speed( siostat->fd, B19200 );
-			break;
-		case SIO_BAUD_38400:
-			sio_speed( siostat->fd, B38400 );
-			break;
-		case SIO_BAUD_57600:
-			sio_speed( siostat->fd, B57600 );
-			break;
-		case SIO_BAUD_115200:
-			sio_speed( siostat->fd, B115200 );
-			break;
-
-		default:
-			LWIP_DEBUGF(SIO_DEBUG, ("sio_change_baud[%d]: Unknown baudrate, code:%d\n",
-					siostat->fd, baud));
-			break;
-	}
+    /*  sio_status_t * siostat = ((siostruct_t*)netif->state)->sio;*/
+
+    LWIP_DEBUGF(SIO_DEBUG, ("sio_change_baud[%d]\n", siostat->fd));
+
+    switch ( baud )
+    {
+        case SIO_BAUD_9600:
+            sio_speed( siostat->fd, B9600 );
+            break;
+        case SIO_BAUD_19200:
+            sio_speed( siostat->fd, B19200 );
+            break;
+        case SIO_BAUD_38400:
+            sio_speed( siostat->fd, B38400 );
+            break;
+        case SIO_BAUD_57600:
+            sio_speed( siostat->fd, B57600 );
+            break;
+        case SIO_BAUD_115200:
+            sio_speed( siostat->fd, B115200 );
+            break;
+
+        default:
+            LWIP_DEBUGF(SIO_DEBUG, ("sio_change_baud[%d]: Unknown baudrate, code:%d\n",
+                    siostat->fd, baud));
+            break;
+    }
 }
diff --git a/contrib/ports/unix/port/perf.c b/contrib/ports/unix/port/perf.c
index bed4614a..e838ec40 100644
--- a/contrib/ports/unix/port/perf.c
+++ b/contrib/ports/unix/port/perf.c
@@ -1,8 +1,8 @@
 /*
  * Copyright (c) 2001-2003 Swedish Institute of Computer Science.
- * All rights reserved. 
- * 
- * Redistribution and use in source and binary forms, with or without modification, 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
  * are permitted provided that the following conditions are met:
  *
  * 1. Redistributions of source code must retain the above copyright notice,
@@ -11,21 +11,21 @@
  *    this list of conditions and the following disclaimer in the documentation
  *    and/or other materials provided with the distribution.
  * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
+ *    derived from this software without specific prior written permission.
  *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
+ * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
  * OF SUCH DAMAGE.
  *
  * This file is part of the lwIP TCP/IP stack.
- * 
+ *
  * Author: Adam Dunkels <adam@sics.se>
  *
  */
@@ -38,11 +38,11 @@ static FILE *f;
 
 void
 perf_print(unsigned long c1l, unsigned long c1h,
-	   unsigned long c2l, unsigned long c2h,
-	   char *key)
+       unsigned long c2l, unsigned long c2h,
+       char *key)
 {
   unsigned long sub_ms, sub_ls;
-  
+
   sub_ms = c2h - c1h;
   sub_ls = c2l - c1l;
   if (c2l < c1l) sub_ms--;
@@ -54,12 +54,12 @@ void
 perf_print_times(struct tms *start, struct tms *end, char *key)
 {
   fprintf(f, "%s: %lu\n", key, end->tms_stime - start->tms_stime);
-  fflush(NULL);  
+  fflush(NULL);
 }
 
 void
 perf_init(char *fname)
 {
-  f = fopen(fname, "w");  
+  f = fopen(fname, "w");
 }
-	
+
diff --git a/doc/NO_SYS_SampleCode.c b/doc/NO_SYS_SampleCode.c
index b263420c..357473dd 100644
--- a/doc/NO_SYS_SampleCode.c
+++ b/doc/NO_SYS_SampleCode.c
@@ -18,7 +18,7 @@ eth_mac_irq()
   }
 }
 
-static err_t 
+static err_t
 netif_output(struct netif *netif, struct pbuf *p)
 {
   LINK_STATS_INC(link.xmit);
@@ -40,13 +40,13 @@ netif_output(struct netif *netif, struct pbuf *p)
   return ERR_OK;
 }
 
-static void 
+static void
 netif_status_callback(struct netif *netif)
 {
   printf("netif status changed %s\n", ip4addr_ntoa(netif_ip4_addr(netif)));
 }
 
-static err_t 
+static err_t
 netif_init(struct netif *netif)
 {
   netif->linkoutput = netif_output;
@@ -62,7 +62,7 @@ netif_init(struct netif *netif)
   return ERR_OK;
 }
 
-void 
+void
 main(void)
 {
   struct netif netif;
@@ -76,7 +76,7 @@ main(void)
   netif_set_status_callback(&netif, netif_status_callback);
   netif_set_default(&netif);
   netif_set_up(&netif);
-  
+
   /* Start DHCP and HTTPD */
   dhcp_start(&netif );
   httpd_init();
@@ -98,7 +98,7 @@ main(void)
 
     if(p != NULL) {
       LINK_STATS_INC(link.recv);
- 
+
       /* Update SNMP stats (only if you use SNMP) */
       MIB2_STATS_NETIF_ADD(netif, ifinoctets, p->tot_len);
       int unicast = ((p->payload[0] & 0x01) == 0);
@@ -112,10 +112,10 @@ main(void)
         pbuf_free(p);
       }
     }
-     
+
     /* Cyclic lwIP timers check */
     sys_check_timeouts();
-     
+
     /* your application goes here */
   }
 }
diff --git a/doc/ZeroCopyRx.c b/doc/ZeroCopyRx.c
index 600b13a0..cdce4073 100644
--- a/doc/ZeroCopyRx.c
+++ b/doc/ZeroCopyRx.c
@@ -31,7 +31,7 @@ void eth_rx_irq()
   my_pbuf->dma_descriptor         = dma_desc;
 
   invalidate_cpu_cache(dma_desc->rx_data, dma_desc->rx_length);
-  
+
   struct pbuf* p = pbuf_alloced_custom(PBUF_RAW,
      dma_desc->rx_length,
      PBUF_REF,
diff --git a/src/apps/http/makefsdata/tinydir.h b/src/apps/http/makefsdata/tinydir.h
index 32ae5e84..88043e8e 100644
--- a/src/apps/http/makefsdata/tinydir.h
+++ b/src/apps/http/makefsdata/tinydir.h
@@ -121,7 +121,7 @@ extern "C" {
 /* readdir_r is a POSIX-only function, and may not be available under various
  * environments/settings, e.g. MinGW. Use readdir fallback */
 #if _POSIX_C_SOURCE >= 1 || _XOPEN_SOURCE || _BSD_SOURCE || _SVID_SOURCE ||\
-	_POSIX_SOURCE
+    _POSIX_SOURCE
 # define _TINYDIR_HAS_READDIR_R
 #endif
 #if _POSIX_C_SOURCE >= 200112L
@@ -129,16 +129,16 @@ extern "C" {
 # include <unistd.h>
 #endif
 #if _BSD_SOURCE || _SVID_SOURCE || \
-	(_POSIX_C_SOURCE >= 200809L || _XOPEN_SOURCE >= 700)
+    (_POSIX_C_SOURCE >= 200809L || _XOPEN_SOURCE >= 700)
 # define _TINYDIR_HAS_DIRFD
 # include <sys/types.h>
 #endif
 #if defined _TINYDIR_HAS_FPATHCONF && defined _TINYDIR_HAS_DIRFD &&\
-	defined _PC_NAME_MAX
+    defined _PC_NAME_MAX
 # define _TINYDIR_USE_FPATHCONF
 #endif
 #if defined __MINGW32__ || !defined _TINYDIR_HAS_READDIR_R ||\
-	!(defined _TINYDIR_USE_FPATHCONF || defined NAME_MAX)
+    !(defined _TINYDIR_USE_FPATHCONF || defined NAME_MAX)
 # define _TINYDIR_USE_READDIR
 #endif
 
@@ -172,42 +172,42 @@ extern "C" {
 #endif
 
 #if !defined(_TINYDIR_MALLOC)
-	#define _TINYDIR_MALLOC(_size) malloc(_size)
-	#define _TINYDIR_FREE(_ptr)    free(_ptr)
+    #define _TINYDIR_MALLOC(_size) malloc(_size)
+    #define _TINYDIR_FREE(_ptr)    free(_ptr)
 #endif /* !defined(_TINYDIR_MALLOC) */
 
 typedef struct tinydir_file
 {
-	_tinydir_char_t path[_TINYDIR_PATH_MAX];
-	_tinydir_char_t name[_TINYDIR_FILENAME_MAX];
-	_tinydir_char_t *extension;
-	int is_dir;
-	int is_reg;
+    _tinydir_char_t path[_TINYDIR_PATH_MAX];
+    _tinydir_char_t name[_TINYDIR_FILENAME_MAX];
+    _tinydir_char_t *extension;
+    int is_dir;
+    int is_reg;
 
 #ifndef _MSC_VER
 #ifdef __MINGW32__
-	struct _stat _s;
+    struct _stat _s;
 #else
-	struct stat _s;
+    struct stat _s;
 #endif
 #endif
 } tinydir_file;
 
 typedef struct tinydir_dir
 {
-	_tinydir_char_t path[_TINYDIR_PATH_MAX];
-	int has_next;
-	size_t n_files;
+    _tinydir_char_t path[_TINYDIR_PATH_MAX];
+    int has_next;
+    size_t n_files;
 
-	tinydir_file *_files;
+    tinydir_file *_files;
 #ifdef _MSC_VER
-	HANDLE _h;
-	WIN32_FIND_DATA _f;
+    HANDLE _h;
+    WIN32_FIND_DATA _f;
 #else
-	_TINYDIR_DIR *_d;
-	struct _tinydir_dirent *_e;
+    _TINYDIR_DIR *_d;
+    struct _tinydir_dirent *_e;
 #ifndef _TINYDIR_USE_READDIR
-	struct _tinydir_dirent *_ep;
+    struct _tinydir_dirent *_ep;
 #endif
 #endif
 } tinydir_dir;
@@ -252,184 +252,184 @@ int tinydir_open(tinydir_dir *dir, const _tinydir_char_t *path)
 {
 #ifndef _MSC_VER
 #ifndef _TINYDIR_USE_READDIR
-	int error;
-	int size;	/* using int size */
+    int error;
+    int size;   /* using int size */
 #endif
 #else
-	_tinydir_char_t path_buf[_TINYDIR_PATH_MAX];
-#endif
-	_tinydir_char_t *pathp;
-
-	if (dir == NULL || path == NULL || _tinydir_strlen(path) == 0)
-	{
-		errno = EINVAL;
-		return -1;
-	}
-	if (_tinydir_strlen(path) + _TINYDIR_PATH_EXTRA >= _TINYDIR_PATH_MAX)
-	{
-		errno = ENAMETOOLONG;
-		return -1;
-	}
-
-	/* initialise dir */
-	dir->_files = NULL;
+    _tinydir_char_t path_buf[_TINYDIR_PATH_MAX];
+#endif
+    _tinydir_char_t *pathp;
+
+    if (dir == NULL || path == NULL || _tinydir_strlen(path) == 0)
+    {
+        errno = EINVAL;
+        return -1;
+    }
+    if (_tinydir_strlen(path) + _TINYDIR_PATH_EXTRA >= _TINYDIR_PATH_MAX)
+    {
+        errno = ENAMETOOLONG;
+        return -1;
+    }
+
+    /* initialise dir */
+    dir->_files = NULL;
 #ifdef _MSC_VER
-	dir->_h = INVALID_HANDLE_VALUE;
+    dir->_h = INVALID_HANDLE_VALUE;
 #else
-	dir->_d = NULL;
+    dir->_d = NULL;
 #ifndef _TINYDIR_USE_READDIR
-	dir->_ep = NULL;
+    dir->_ep = NULL;
 #endif
 #endif
-	tinydir_close(dir);
+    tinydir_close(dir);
 
-	_tinydir_strcpy(dir->path, path);
-	/* Remove trailing slashes */
-	pathp = &dir->path[_tinydir_strlen(dir->path) - 1];
-	while (pathp != dir->path && (*pathp == TINYDIR_STRING('\\') || *pathp == TINYDIR_STRING('/')))
-	{
-		*pathp = TINYDIR_STRING('\0');
-		pathp++;
-	}
+    _tinydir_strcpy(dir->path, path);
+    /* Remove trailing slashes */
+    pathp = &dir->path[_tinydir_strlen(dir->path) - 1];
+    while (pathp != dir->path && (*pathp == TINYDIR_STRING('\\') || *pathp == TINYDIR_STRING('/')))
+    {
+        *pathp = TINYDIR_STRING('\0');
+        pathp++;
+    }
 #ifdef _MSC_VER
-	_tinydir_strcpy(path_buf, dir->path);
-	_tinydir_strcat(path_buf, TINYDIR_STRING("\\*"));
+    _tinydir_strcpy(path_buf, dir->path);
+    _tinydir_strcat(path_buf, TINYDIR_STRING("\\*"));
 #if (defined WINAPI_FAMILY) && (WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP)
-	dir->_h = FindFirstFileEx(path_buf, FindExInfoStandard, &dir->_f, FindExSearchNameMatch, NULL, 0);
+    dir->_h = FindFirstFileEx(path_buf, FindExInfoStandard, &dir->_f, FindExSearchNameMatch, NULL, 0);
 #else
-	dir->_h = FindFirstFile(path_buf, &dir->_f);
+    dir->_h = FindFirstFile(path_buf, &dir->_f);
 #endif
-	if (dir->_h == INVALID_HANDLE_VALUE)
-	{
-		errno = ENOENT;
+    if (dir->_h == INVALID_HANDLE_VALUE)
+    {
+        errno = ENOENT;
 #else
-	dir->_d = _tinydir_opendir(path);
-	if (dir->_d == NULL)
-	{
+    dir->_d = _tinydir_opendir(path);
+    if (dir->_d == NULL)
+    {
 #endif
-		goto bail;
-	}
+        goto bail;
+    }
 
-	/* read first file */
-	dir->has_next = 1;
+    /* read first file */
+    dir->has_next = 1;
 #ifndef _MSC_VER
 #ifdef _TINYDIR_USE_READDIR
-	dir->_e = _tinydir_readdir(dir->_d);
+    dir->_e = _tinydir_readdir(dir->_d);
 #else
-	/* allocate dirent buffer for readdir_r */
-	size = _tinydir_dirent_buf_size(dir->_d); /* conversion to int */
-	if (size == -1) return -1;
-	dir->_ep = (struct _tinydir_dirent*)_TINYDIR_MALLOC(size);
-	if (dir->_ep == NULL) return -1;
+    /* allocate dirent buffer for readdir_r */
+    size = _tinydir_dirent_buf_size(dir->_d); /* conversion to int */
+    if (size == -1) return -1;
+    dir->_ep = (struct _tinydir_dirent*)_TINYDIR_MALLOC(size);
+    if (dir->_ep == NULL) return -1;
 
-	error = readdir_r(dir->_d, dir->_ep, &dir->_e);
-	if (error != 0) return -1;
+    error = readdir_r(dir->_d, dir->_ep, &dir->_e);
+    if (error != 0) return -1;
 #endif
-	if (dir->_e == NULL)
-	{
-		dir->has_next = 0;
-	}
+    if (dir->_e == NULL)
+    {
+        dir->has_next = 0;
+    }
 #endif
 
-	return 0;
+    return 0;
 
 bail:
-	tinydir_close(dir);
-	return -1;
+    tinydir_close(dir);
+    return -1;
 }
 
 _TINYDIR_FUNC
 int tinydir_open_sorted(tinydir_dir *dir, const _tinydir_char_t *path)
 {
-	/* Count the number of files first, to pre-allocate the files array */
-	size_t n_files = 0;
-	if (tinydir_open(dir, path) == -1)
-	{
-		return -1;
-	}
-	while (dir->has_next)
-	{
-		n_files++;
-		if (tinydir_next(dir) == -1)
-		{
-			goto bail;
-		}
-	}
-	tinydir_close(dir);
-
-	if (tinydir_open(dir, path) == -1)
-	{
-		return -1;
-	}
-
-	dir->n_files = 0;
-	dir->_files = (tinydir_file *)_TINYDIR_MALLOC(sizeof *dir->_files * n_files);
-	if (dir->_files == NULL)
-	{
-		goto bail;
-	}
-	while (dir->has_next)
-	{
-		tinydir_file *p_file;
-		dir->n_files++;
-
-		p_file = &dir->_files[dir->n_files - 1];
-		if (tinydir_readfile(dir, p_file) == -1)
-		{
-			goto bail;
-		}
-
-		if (tinydir_next(dir) == -1)
-		{
-			goto bail;
-		}
-
-		/* Just in case the number of files has changed between the first and
-		second reads, terminate without writing into unallocated memory */
-		if (dir->n_files == n_files)
-		{
-			break;
-		}
-	}
-
-	qsort(dir->_files, dir->n_files, sizeof(tinydir_file), _tinydir_file_cmp);
-
-	return 0;
+    /* Count the number of files first, to pre-allocate the files array */
+    size_t n_files = 0;
+    if (tinydir_open(dir, path) == -1)
+    {
+        return -1;
+    }
+    while (dir->has_next)
+    {
+        n_files++;
+        if (tinydir_next(dir) == -1)
+        {
+            goto bail;
+        }
+    }
+    tinydir_close(dir);
+
+    if (tinydir_open(dir, path) == -1)
+    {
+        return -1;
+    }
+
+    dir->n_files = 0;
+    dir->_files = (tinydir_file *)_TINYDIR_MALLOC(sizeof *dir->_files * n_files);
+    if (dir->_files == NULL)
+    {
+        goto bail;
+    }
+    while (dir->has_next)
+    {
+        tinydir_file *p_file;
+        dir->n_files++;
+
+        p_file = &dir->_files[dir->n_files - 1];
+        if (tinydir_readfile(dir, p_file) == -1)
+        {
+            goto bail;
+        }
+
+        if (tinydir_next(dir) == -1)
+        {
+            goto bail;
+        }
+
+        /* Just in case the number of files has changed between the first and
+        second reads, terminate without writing into unallocated memory */
+        if (dir->n_files == n_files)
+        {
+            break;
+        }
+    }
+
+    qsort(dir->_files, dir->n_files, sizeof(tinydir_file), _tinydir_file_cmp);
+
+    return 0;
 
 bail:
-	tinydir_close(dir);
-	return -1;
+    tinydir_close(dir);
+    return -1;
 }
 
 _TINYDIR_FUNC
 void tinydir_close(tinydir_dir *dir)
 {
-	if (dir == NULL)
-	{
-		return;
-	}
-
-	memset(dir->path, 0, sizeof(dir->path));
-	dir->has_next = 0;
-	dir->n_files = 0;
-	_TINYDIR_FREE(dir->_files);
-	dir->_files = NULL;
+    if (dir == NULL)
+    {
+        return;
+    }
+
+    memset(dir->path, 0, sizeof(dir->path));
+    dir->has_next = 0;
+    dir->n_files = 0;
+    _TINYDIR_FREE(dir->_files);
+    dir->_files = NULL;
 #ifdef _MSC_VER
-	if (dir->_h != INVALID_HANDLE_VALUE)
-	{
-		FindClose(dir->_h);
-	}
-	dir->_h = INVALID_HANDLE_VALUE;
+    if (dir->_h != INVALID_HANDLE_VALUE)
+    {
+        FindClose(dir->_h);
+    }
+    dir->_h = INVALID_HANDLE_VALUE;
 #else
-	if (dir->_d)
-	{
-		_tinydir_closedir(dir->_d);
-	}
-	dir->_d = NULL;
-	dir->_e = NULL;
+    if (dir->_d)
+    {
+        _tinydir_closedir(dir->_d);
+    }
+    dir->_d = NULL;
+    dir->_e = NULL;
 #ifndef _TINYDIR_USE_READDIR
-	_TINYDIR_FREE(dir->_ep);
-	dir->_ep = NULL;
+    _TINYDIR_FREE(dir->_ep);
+    dir->_ep = NULL;
 #endif
 #endif
 }
@@ -437,323 +437,323 @@ void tinydir_close(tinydir_dir *dir)
 _TINYDIR_FUNC
 int tinydir_next(tinydir_dir *dir)
 {
-	if (dir == NULL)
-	{
-		errno = EINVAL;
-		return -1;
-	}
-	if (!dir->has_next)
-	{
-		errno = ENOENT;
-		return -1;
-	}
+    if (dir == NULL)
+    {
+        errno = EINVAL;
+        return -1;
+    }
+    if (!dir->has_next)
+    {
+        errno = ENOENT;
+        return -1;
+    }
 
 #ifdef _MSC_VER
-	if (FindNextFile(dir->_h, &dir->_f) == 0)
+    if (FindNextFile(dir->_h, &dir->_f) == 0)
 #else
 #ifdef _TINYDIR_USE_READDIR
-	dir->_e = _tinydir_readdir(dir->_d);
+    dir->_e = _tinydir_readdir(dir->_d);
 #else
-	if (dir->_ep == NULL)
-	{
-		return -1;
-	}
-	if (readdir_r(dir->_d, dir->_ep, &dir->_e) != 0)
-	{
-		return -1;
-	}
-#endif
-	if (dir->_e == NULL)
-#endif
-	{
-		dir->has_next = 0;
+    if (dir->_ep == NULL)
+    {
+        return -1;
+    }
+    if (readdir_r(dir->_d, dir->_ep, &dir->_e) != 0)
+    {
+        return -1;
+    }
+#endif
+    if (dir->_e == NULL)
+#endif
+    {
+        dir->has_next = 0;
 #ifdef _MSC_VER
-		if (GetLastError() != ERROR_SUCCESS &&
-			GetLastError() != ERROR_NO_MORE_FILES)
-		{
-			tinydir_close(dir);
-			errno = EIO;
-			return -1;
-		}
+        if (GetLastError() != ERROR_SUCCESS &&
+            GetLastError() != ERROR_NO_MORE_FILES)
+        {
+            tinydir_close(dir);
+            errno = EIO;
+            return -1;
+        }
 #endif
-	}
+    }
 
-	return 0;
+    return 0;
 }
 
 _TINYDIR_FUNC
 int tinydir_readfile(const tinydir_dir *dir, tinydir_file *file)
 {
-	if (dir == NULL || file == NULL)
-	{
-		errno = EINVAL;
-		return -1;
-	}
+    if (dir == NULL || file == NULL)
+    {
+        errno = EINVAL;
+        return -1;
+    }
 #ifdef _MSC_VER
-	if (dir->_h == INVALID_HANDLE_VALUE)
+    if (dir->_h == INVALID_HANDLE_VALUE)
 #else
-	if (dir->_e == NULL)
-#endif
-	{
-		errno = ENOENT;
-		return -1;
-	}
-	if (_tinydir_strlen(dir->path) +
-		_tinydir_strlen(
+    if (dir->_e == NULL)
+#endif
+    {
+        errno = ENOENT;
+        return -1;
+    }
+    if (_tinydir_strlen(dir->path) +
+        _tinydir_strlen(
 #ifdef _MSC_VER
-			dir->_f.cFileName
+            dir->_f.cFileName
 #else
-			dir->_e->d_name
-#endif
-		) + 1 + _TINYDIR_PATH_EXTRA >=
-		_TINYDIR_PATH_MAX)
-	{
-		/* the path for the file will be too long */
-		errno = ENAMETOOLONG;
-		return -1;
-	}
-	if (_tinydir_strlen(
+            dir->_e->d_name
+#endif
+        ) + 1 + _TINYDIR_PATH_EXTRA >=
+        _TINYDIR_PATH_MAX)
+    {
+        /* the path for the file will be too long */
+        errno = ENAMETOOLONG;
+        return -1;
+    }
+    if (_tinydir_strlen(
 #ifdef _MSC_VER
-			dir->_f.cFileName
+            dir->_f.cFileName
 #else
-			dir->_e->d_name
+            dir->_e->d_name
 #endif
-		) >= _TINYDIR_FILENAME_MAX)
-	{
-		errno = ENAMETOOLONG;
-		return -1;
-	}
+        ) >= _TINYDIR_FILENAME_MAX)
+    {
+        errno = ENAMETOOLONG;
+        return -1;
+    }
 
-	_tinydir_strcpy(file->path, dir->path);
-	_tinydir_strcat(file->path, TINYDIR_STRING("/"));
-	_tinydir_strcpy(file->name,
+    _tinydir_strcpy(file->path, dir->path);
+    _tinydir_strcat(file->path, TINYDIR_STRING("/"));
+    _tinydir_strcpy(file->name,
 #ifdef _MSC_VER
-		dir->_f.cFileName
+        dir->_f.cFileName
 #else
-		dir->_e->d_name
+        dir->_e->d_name
 #endif
-	);
-	_tinydir_strcat(file->path, file->name);
+    );
+    _tinydir_strcat(file->path, file->name);
 #ifndef _MSC_VER
 #ifdef __MINGW32__
-	if (_tstat(
+    if (_tstat(
 #else
-	if (stat(
+    if (stat(
 #endif
-		file->path, &file->_s) == -1)
-	{
-		return -1;
-	}
+        file->path, &file->_s) == -1)
+    {
+        return -1;
+    }
 #endif
-	_tinydir_get_ext(file);
+    _tinydir_get_ext(file);
 
-	file->is_dir =
+    file->is_dir =
 #ifdef _MSC_VER
-		!!(dir->_f.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY);
+        !!(dir->_f.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY);
 #else
-		S_ISDIR(file->_s.st_mode);
+        S_ISDIR(file->_s.st_mode);
 #endif
-	file->is_reg =
+    file->is_reg =
 #ifdef _MSC_VER
-		!!(dir->_f.dwFileAttributes & FILE_ATTRIBUTE_NORMAL) ||
-		(
-			!(dir->_f.dwFileAttributes & FILE_ATTRIBUTE_DEVICE) &&
-			!(dir->_f.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) &&
-			!(dir->_f.dwFileAttributes & FILE_ATTRIBUTE_ENCRYPTED) &&
+        !!(dir->_f.dwFileAttributes & FILE_ATTRIBUTE_NORMAL) ||
+        (
+            !(dir->_f.dwFileAttributes & FILE_ATTRIBUTE_DEVICE) &&
+            !(dir->_f.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) &&
+            !(dir->_f.dwFileAttributes & FILE_ATTRIBUTE_ENCRYPTED) &&
 #ifdef FILE_ATTRIBUTE_INTEGRITY_STREAM
-			!(dir->_f.dwFileAttributes & FILE_ATTRIBUTE_INTEGRITY_STREAM) &&
+            !(dir->_f.dwFileAttributes & FILE_ATTRIBUTE_INTEGRITY_STREAM) &&
 #endif
 #ifdef FILE_ATTRIBUTE_NO_SCRUB_DATA
-			!(dir->_f.dwFileAttributes & FILE_ATTRIBUTE_NO_SCRUB_DATA) &&
+            !(dir->_f.dwFileAttributes & FILE_ATTRIBUTE_NO_SCRUB_DATA) &&
 #endif
-			!(dir->_f.dwFileAttributes & FILE_ATTRIBUTE_OFFLINE) &&
-			!(dir->_f.dwFileAttributes & FILE_ATTRIBUTE_TEMPORARY));
+            !(dir->_f.dwFileAttributes & FILE_ATTRIBUTE_OFFLINE) &&
+            !(dir->_f.dwFileAttributes & FILE_ATTRIBUTE_TEMPORARY));
 #else
-		S_ISREG(file->_s.st_mode);
+        S_ISREG(file->_s.st_mode);
 #endif
 
-	return 0;
+    return 0;
 }
 
 _TINYDIR_FUNC
 int tinydir_readfile_n(const tinydir_dir *dir, tinydir_file *file, size_t i)
 {
-	if (dir == NULL || file == NULL)
-	{
-		errno = EINVAL;
-		return -1;
-	}
-	if (i >= dir->n_files)
-	{
-		errno = ENOENT;
-		return -1;
-	}
-
-	memcpy(file, &dir->_files[i], sizeof(tinydir_file));
-	_tinydir_get_ext(file);
-
-	return 0;
+    if (dir == NULL || file == NULL)
+    {
+        errno = EINVAL;
+        return -1;
+    }
+    if (i >= dir->n_files)
+    {
+        errno = ENOENT;
+        return -1;
+    }
+
+    memcpy(file, &dir->_files[i], sizeof(tinydir_file));
+    _tinydir_get_ext(file);
+
+    return 0;
 }
 
 _TINYDIR_FUNC
 int tinydir_open_subdir_n(tinydir_dir *dir, size_t i)
 {
-	_tinydir_char_t path[_TINYDIR_PATH_MAX];
-	if (dir == NULL)
-	{
-		errno = EINVAL;
-		return -1;
-	}
-	if (i >= dir->n_files || !dir->_files[i].is_dir)
-	{
-		errno = ENOENT;
-		return -1;
-	}
-
-	_tinydir_strcpy(path, dir->_files[i].path);
-	tinydir_close(dir);
-	if (tinydir_open_sorted(dir, path) == -1)
-	{
-		return -1;
-	}
-
-	return 0;
+    _tinydir_char_t path[_TINYDIR_PATH_MAX];
+    if (dir == NULL)
+    {
+        errno = EINVAL;
+        return -1;
+    }
+    if (i >= dir->n_files || !dir->_files[i].is_dir)
+    {
+        errno = ENOENT;
+        return -1;
+    }
+
+    _tinydir_strcpy(path, dir->_files[i].path);
+    tinydir_close(dir);
+    if (tinydir_open_sorted(dir, path) == -1)
+    {
+        return -1;
+    }
+
+    return 0;
 }
 
 /* Open a single file given its path */
 _TINYDIR_FUNC
 int tinydir_file_open(tinydir_file *file, const _tinydir_char_t *path)
 {
-	tinydir_dir dir;
-	int result = 0;
-	int found = 0;
-	_tinydir_char_t dir_name_buf[_TINYDIR_PATH_MAX];
-	_tinydir_char_t file_name_buf[_TINYDIR_FILENAME_MAX];
-	_tinydir_char_t *dir_name;
-	_tinydir_char_t *base_name;
+    tinydir_dir dir;
+    int result = 0;
+    int found = 0;
+    _tinydir_char_t dir_name_buf[_TINYDIR_PATH_MAX];
+    _tinydir_char_t file_name_buf[_TINYDIR_FILENAME_MAX];
+    _tinydir_char_t *dir_name;
+    _tinydir_char_t *base_name;
 #if (defined _MSC_VER || defined __MINGW32__)
-	_tinydir_char_t drive_buf[_TINYDIR_PATH_MAX];
-	_tinydir_char_t ext_buf[_TINYDIR_FILENAME_MAX];
-#endif
-
-	if (file == NULL || path == NULL || _tinydir_strlen(path) == 0)
-	{
-		errno = EINVAL;
-		return -1;
-	}
-	if (_tinydir_strlen(path) + _TINYDIR_PATH_EXTRA >= _TINYDIR_PATH_MAX)
-	{
-		errno = ENAMETOOLONG;
-		return -1;
-	}
-
-	/* Get the parent path */
+    _tinydir_char_t drive_buf[_TINYDIR_PATH_MAX];
+    _tinydir_char_t ext_buf[_TINYDIR_FILENAME_MAX];
+#endif
+
+    if (file == NULL || path == NULL || _tinydir_strlen(path) == 0)
+    {
+        errno = EINVAL;
+        return -1;
+    }
+    if (_tinydir_strlen(path) + _TINYDIR_PATH_EXTRA >= _TINYDIR_PATH_MAX)
+    {
+        errno = ENAMETOOLONG;
+        return -1;
+    }
+
+    /* Get the parent path */
 #if (defined _MSC_VER || defined __MINGW32__)
 #if ((defined _MSC_VER) && (_MSC_VER >= 1400))
-		_tsplitpath_s(
-			path,
-			drive_buf, _TINYDIR_DRIVE_MAX,
-			dir_name_buf, _TINYDIR_FILENAME_MAX,
-			file_name_buf, _TINYDIR_FILENAME_MAX,
-			ext_buf, _TINYDIR_FILENAME_MAX);
+        _tsplitpath_s(
+            path,
+            drive_buf, _TINYDIR_DRIVE_MAX,
+            dir_name_buf, _TINYDIR_FILENAME_MAX,
+            file_name_buf, _TINYDIR_FILENAME_MAX,
+            ext_buf, _TINYDIR_FILENAME_MAX);
 #else
-		_tsplitpath(
-			path,
-			drive_buf,
-			dir_name_buf,
-			file_name_buf,
-			ext_buf);
+        _tsplitpath(
+            path,
+            drive_buf,
+            dir_name_buf,
+            file_name_buf,
+            ext_buf);
 #endif
 
 /* _splitpath_s not work fine with only filename and widechar support */
 #ifdef _UNICODE
-		if (drive_buf[0] == L'\xFEFE')
-			drive_buf[0] = '\0';
-		if (dir_name_buf[0] == L'\xFEFE')
-			dir_name_buf[0] = '\0';
-#endif
-
-	if (errno)
-	{
-		errno = EINVAL;
-		return -1;
-	}
-	/* Emulate the behavior of dirname by returning "." for dir name if it's
-	empty */
-	if (drive_buf[0] == '\0' && dir_name_buf[0] == '\0')
-	{
-		_tinydir_strcpy(dir_name_buf, TINYDIR_STRING("."));
-	}
-	/* Concatenate the drive letter and dir name to form full dir name */
-	_tinydir_strcat(drive_buf, dir_name_buf);
-	dir_name = drive_buf;
-	/* Concatenate the file name and extension to form base name */
-	_tinydir_strcat(file_name_buf, ext_buf);
-	base_name = file_name_buf;
+        if (drive_buf[0] == L'\xFEFE')
+            drive_buf[0] = '\0';
+        if (dir_name_buf[0] == L'\xFEFE')
+            dir_name_buf[0] = '\0';
+#endif
+
+    if (errno)
+    {
+        errno = EINVAL;
+        return -1;
+    }
+    /* Emulate the behavior of dirname by returning "." for dir name if it's
+    empty */
+    if (drive_buf[0] == '\0' && dir_name_buf[0] == '\0')
+    {
+        _tinydir_strcpy(dir_name_buf, TINYDIR_STRING("."));
+    }
+    /* Concatenate the drive letter and dir name to form full dir name */
+    _tinydir_strcat(drive_buf, dir_name_buf);
+    dir_name = drive_buf;
+    /* Concatenate the file name and extension to form base name */
+    _tinydir_strcat(file_name_buf, ext_buf);
+    base_name = file_name_buf;
 #else
-	_tinydir_strcpy(dir_name_buf, path);
-	dir_name = dirname(dir_name_buf);
-	_tinydir_strcpy(file_name_buf, path);
-	base_name =basename(file_name_buf);
-#endif
-
-	/* Open the parent directory */
-	if (tinydir_open(&dir, dir_name) == -1)
-	{
-		return -1;
-	}
-
-	/* Read through the parent directory and look for the file */
-	while (dir.has_next)
-	{
-		if (tinydir_readfile(&dir, file) == -1)
-		{
-			result = -1;
-			goto bail;
-		}
-		if (_tinydir_strcmp(file->name, base_name) == 0)
-		{
-			/* File found */
-			found = 1;
-			break;
-		}
-		tinydir_next(&dir);
-	}
-	if (!found)
-	{
-		result = -1;
-		errno = ENOENT;
-	}
+    _tinydir_strcpy(dir_name_buf, path);
+    dir_name = dirname(dir_name_buf);
+    _tinydir_strcpy(file_name_buf, path);
+    base_name =basename(file_name_buf);
+#endif
+
+    /* Open the parent directory */
+    if (tinydir_open(&dir, dir_name) == -1)
+    {
+        return -1;
+    }
+
+    /* Read through the parent directory and look for the file */
+    while (dir.has_next)
+    {
+        if (tinydir_readfile(&dir, file) == -1)
+        {
+            result = -1;
+            goto bail;
+        }
+        if (_tinydir_strcmp(file->name, base_name) == 0)
+        {
+            /* File found */
+            found = 1;
+            break;
+        }
+        tinydir_next(&dir);
+    }
+    if (!found)
+    {
+        result = -1;
+        errno = ENOENT;
+    }
 
 bail:
-	tinydir_close(&dir);
-	return result;
+    tinydir_close(&dir);
+    return result;
 }
 
 _TINYDIR_FUNC
 void _tinydir_get_ext(tinydir_file *file)
 {
-	_tinydir_char_t *period = _tinydir_strrchr(file->name, TINYDIR_STRING('.'));
-	if (period == NULL)
-	{
-		file->extension = &(file->name[_tinydir_strlen(file->name)]);
-	}
-	else
-	{
-		file->extension = period + 1;
-	}
+    _tinydir_char_t *period = _tinydir_strrchr(file->name, TINYDIR_STRING('.'));
+    if (period == NULL)
+    {
+        file->extension = &(file->name[_tinydir_strlen(file->name)]);
+    }
+    else
+    {
+        file->extension = period + 1;
+    }
 }
 
 _TINYDIR_FUNC
 int _tinydir_file_cmp(const void *a, const void *b)
 {
-	const tinydir_file *fa = (const tinydir_file *)a;
-	const tinydir_file *fb = (const tinydir_file *)b;
-	if (fa->is_dir != fb->is_dir)
-	{
-		return -(fa->is_dir - fb->is_dir);
-	}
-	return _tinydir_strncmp(fa->name, fb->name, _TINYDIR_FILENAME_MAX);
+    const tinydir_file *fa = (const tinydir_file *)a;
+    const tinydir_file *fb = (const tinydir_file *)b;
+    if (fa->is_dir != fb->is_dir)
+    {
+        return -(fa->is_dir - fb->is_dir);
+    }
+    return _tinydir_strncmp(fa->name, fb->name, _TINYDIR_FILENAME_MAX);
 }
 
 #ifndef _MSC_VER
@@ -772,27 +772,27 @@ from https://womble.decadent.org.uk/readdir_r-advisory.html
 _TINYDIR_FUNC
 size_t _tinydir_dirent_buf_size(_TINYDIR_DIR *dirp)
 {
-	long name_max;
-	size_t name_end;
-	/* parameter may be unused */
-	(void)dirp;
+    long name_max;
+    size_t name_end;
+    /* parameter may be unused */
+    (void)dirp;
 
 #if defined _TINYDIR_USE_FPATHCONF
-	name_max = fpathconf(dirfd(dirp), _PC_NAME_MAX);
-	if (name_max == -1)
+    name_max = fpathconf(dirfd(dirp), _PC_NAME_MAX);
+    if (name_max == -1)
 #if defined(NAME_MAX)
-		name_max = (NAME_MAX > 255) ? NAME_MAX : 255;
+        name_max = (NAME_MAX > 255) ? NAME_MAX : 255;
 #else
-		return (size_t)(-1);
+        return (size_t)(-1);
 #endif
 #elif defined(NAME_MAX)
- 	name_max = (NAME_MAX > 255) ? NAME_MAX : 255;
+    name_max = (NAME_MAX > 255) ? NAME_MAX : 255;
 #else
 #error "buffer size for readdir_r cannot be determined"
 #endif
-	name_end = (size_t)offsetof(struct _tinydir_dirent, d_name) + name_max + 1;
-	return (name_end > sizeof(struct _tinydir_dirent) ?
-		name_end : sizeof(struct _tinydir_dirent));
+    name_end = (size_t)offsetof(struct _tinydir_dirent, d_name) + name_max + 1;
+    return (name_end > sizeof(struct _tinydir_dirent) ?
+        name_end : sizeof(struct _tinydir_dirent));
 }
 #endif
 #endif
diff --git a/src/apps/mdns/mdns.c b/src/apps/mdns/mdns.c
index 24504c31..2e3d22b5 100644
--- a/src/apps/mdns/mdns.c
+++ b/src/apps/mdns/mdns.c
@@ -2492,7 +2492,7 @@ mdns_resp_rename_netif(struct netif *netif, const char *hostname)
 int
 mdns_resp_netif_active(struct netif *netif)
 {
-	return NETIF_TO_HOST(netif) != NULL;
+    return NETIF_TO_HOST(netif) != NULL;
 }
 
 /**
diff --git a/src/core/netif.c b/src/core/netif.c
index cf73a209..1d977fe4 100644
--- a/src/core/netif.c
+++ b/src/core/netif.c
@@ -1105,11 +1105,11 @@ netif_set_link_callback(struct netif *netif, netif_status_callback_fn link_callb
 /**
  * @ingroup netif
  * Send an IP packet to be received on the same netif (loopif-like).
- * The pbuf is copied and added to an internal queue which is fed to 
+ * The pbuf is copied and added to an internal queue which is fed to
  * netif->input by netif_poll().
  * In multithreaded mode, the call to netif_poll() is queued to be done on the
  * TCP/IP thread.
- * In callback mode, the user has the responsibility to call netif_poll() in 
+ * In callback mode, the user has the responsibility to call netif_poll() in
  * the main loop of their application.
  *
  * @param netif the lwip network interface structure
diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c
index c40e5af8..ab57729b 100644
--- a/src/core/tcp_out.c
+++ b/src/core/tcp_out.c
@@ -2036,7 +2036,7 @@ tcp_rst(const struct tcp_pcb *pcb, u32_t seqno, u32_t ackno,
         u16_t local_port, u16_t remote_port)
 {
   struct pbuf *p;
-  
+
   p = tcp_rst_common(pcb, seqno, ackno, local_ip, remote_ip, local_port, remote_port);
   if (p != NULL) {
     tcp_output_control_segment(pcb, p, local_ip, remote_ip);
diff --git a/src/include/lwip/apps/mdns_domain.h b/src/include/lwip/apps/mdns_domain.h
index 9fa804e6..48fa8e8e 100644
--- a/src/include/lwip/apps/mdns_domain.h
+++ b/src/include/lwip/apps/mdns_domain.h
@@ -1,6 +1,6 @@
 /**
  * @file
- * MDNS responder - domain related functionalities 
+ * MDNS responder - domain related functionalities
  */
 
  /*
diff --git a/src/include/netif/ppp/ccp.h b/src/include/netif/ppp/ccp.h
index b2285228..830dc313 100644
--- a/src/include/netif/ppp/ccp.h
+++ b/src/include/netif/ppp/ccp.h
@@ -44,48 +44,48 @@ extern "C" {
  * CCP codes.
  */
 
-#define CCP_CONFREQ	1
-#define CCP_CONFACK	2
-#define CCP_TERMREQ	5
-#define CCP_TERMACK	6
-#define CCP_RESETREQ	14
-#define CCP_RESETACK	15
+#define CCP_CONFREQ 1
+#define CCP_CONFACK 2
+#define CCP_TERMREQ 5
+#define CCP_TERMACK 6
+#define CCP_RESETREQ    14
+#define CCP_RESETACK    15
 
 /*
  * Max # bytes for a CCP option
  */
 
-#define CCP_MAX_OPTION_LENGTH	32
+#define CCP_MAX_OPTION_LENGTH   32
 
 /*
  * Parts of a CCP packet.
  */
 
-#define CCP_CODE(dp)		((dp)[0])
-#define CCP_ID(dp)		((dp)[1])
-#define CCP_LENGTH(dp)		(((dp)[2] << 8) + (dp)[3])
-#define CCP_HDRLEN		4
+#define CCP_CODE(dp)        ((dp)[0])
+#define CCP_ID(dp)      ((dp)[1])
+#define CCP_LENGTH(dp)      (((dp)[2] << 8) + (dp)[3])
+#define CCP_HDRLEN      4
 
-#define CCP_OPT_CODE(dp)	((dp)[0])
-#define CCP_OPT_LENGTH(dp)	((dp)[1])
-#define CCP_OPT_MINLEN		2
+#define CCP_OPT_CODE(dp)    ((dp)[0])
+#define CCP_OPT_LENGTH(dp)  ((dp)[1])
+#define CCP_OPT_MINLEN      2
 
 #if BSDCOMPRESS_SUPPORT
 /*
  * Definitions for BSD-Compress.
  */
 
-#define CI_BSD_COMPRESS		21	/* config. option for BSD-Compress */
-#define CILEN_BSD_COMPRESS	3	/* length of config. option */
+#define CI_BSD_COMPRESS     21  /* config. option for BSD-Compress */
+#define CILEN_BSD_COMPRESS  3   /* length of config. option */
 
 /* Macros for handling the 3rd byte of the BSD-Compress config option. */
-#define BSD_NBITS(x)		((x) & 0x1F)	/* number of bits requested */
-#define BSD_VERSION(x)		((x) >> 5)	/* version of option format */
-#define BSD_CURRENT_VERSION	1		/* current version number */
-#define BSD_MAKE_OPT(v, n)	(((v) << 5) | (n))
+#define BSD_NBITS(x)        ((x) & 0x1F)    /* number of bits requested */
+#define BSD_VERSION(x)      ((x) >> 5)  /* version of option format */
+#define BSD_CURRENT_VERSION 1       /* current version number */
+#define BSD_MAKE_OPT(v, n)  (((v) << 5) | (n))
 
-#define BSD_MIN_BITS		9	/* smallest code size supported */
-#define BSD_MAX_BITS		15	/* largest code size supported */
+#define BSD_MIN_BITS        9   /* smallest code size supported */
+#define BSD_MAX_BITS        15  /* largest code size supported */
 #endif /* BSDCOMPRESS_SUPPORT */
 
 #if DEFLATE_SUPPORT
@@ -93,17 +93,17 @@ extern "C" {
  * Definitions for Deflate.
  */
 
-#define CI_DEFLATE		26	/* config option for Deflate */
-#define CI_DEFLATE_DRAFT	24	/* value used in original draft RFC */
-#define CILEN_DEFLATE		4	/* length of its config option */
-
-#define DEFLATE_MIN_SIZE	9
-#define DEFLATE_MAX_SIZE	15
-#define DEFLATE_METHOD_VAL	8
-#define DEFLATE_SIZE(x)		(((x) >> 4) + 8)
-#define DEFLATE_METHOD(x)	((x) & 0x0F)
-#define DEFLATE_MAKE_OPT(w)	((((w) - 8) << 4) + DEFLATE_METHOD_VAL)
-#define DEFLATE_CHK_SEQUENCE	0
+#define CI_DEFLATE      26  /* config option for Deflate */
+#define CI_DEFLATE_DRAFT    24  /* value used in original draft RFC */
+#define CILEN_DEFLATE       4   /* length of its config option */
+
+#define DEFLATE_MIN_SIZE    9
+#define DEFLATE_MAX_SIZE    15
+#define DEFLATE_METHOD_VAL  8
+#define DEFLATE_SIZE(x)     (((x) >> 4) + 8)
+#define DEFLATE_METHOD(x)   ((x) & 0x0F)
+#define DEFLATE_MAKE_OPT(w) ((((w) - 8) << 4) + DEFLATE_METHOD_VAL)
+#define DEFLATE_CHK_SEQUENCE    0
 #endif /* DEFLATE_SUPPORT */
 
 #if MPPE_SUPPORT
@@ -120,10 +120,10 @@ extern "C" {
  * Definitions for other, as yet unsupported, compression methods.
  */
 
-#define CI_PREDICTOR_1		1	/* config option for Predictor-1 */
-#define CILEN_PREDICTOR_1	2	/* length of its config option */
-#define CI_PREDICTOR_2		2	/* config option for Predictor-2 */
-#define CILEN_PREDICTOR_2	2	/* length of its config option */
+#define CI_PREDICTOR_1      1   /* config option for Predictor-1 */
+#define CILEN_PREDICTOR_1   2   /* length of its config option */
+#define CI_PREDICTOR_2      2   /* config option for Predictor-2 */
+#define CILEN_PREDICTOR_2   2   /* length of its config option */
 #endif /* PREDICTOR_SUPPORT */
 
 typedef struct ccp_options {
@@ -141,15 +141,15 @@ typedef struct ccp_options {
 #endif /* PREDICTOR_SUPPORT */
 
 #if MPPE_SUPPORT
-    u8_t mppe;			/* MPPE bitfield */
+    u8_t mppe;          /* MPPE bitfield */
 #endif /* MPPE_SUPPORT */
 #if BSDCOMPRESS_SUPPORT
-    u_short bsd_bits;		/* # bits/code for BSD Compress */
+    u_short bsd_bits;       /* # bits/code for BSD Compress */
 #endif /* BSDCOMPRESS_SUPPORT */
 #if DEFLATE_SUPPORT
-    u_short deflate_size;	/* lg(window size) for Deflate */
+    u_short deflate_size;   /* lg(window size) for Deflate */
 #endif /* DEFLATE_SUPPORT */
-    u8_t method;		/* code for chosen compression method */
+    u8_t method;        /* code for chosen compression method */
 } ccp_options;
 
 extern const struct protent ccp_protent;
diff --git a/src/include/netif/ppp/chap-new.h b/src/include/netif/ppp/chap-new.h
index 2d8cd9ca..3d264136 100644
--- a/src/include/netif/ppp/chap-new.h
+++ b/src/include/netif/ppp/chap-new.h
@@ -43,45 +43,45 @@ extern "C" {
 /*
  * CHAP packets begin with a standard header with code, id, len (2 bytes).
  */
-#define CHAP_HDRLEN	4
+#define CHAP_HDRLEN 4
 
 /*
  * Values for the code field.
  */
-#define CHAP_CHALLENGE	1
-#define CHAP_RESPONSE	2
-#define CHAP_SUCCESS	3
-#define CHAP_FAILURE	4
+#define CHAP_CHALLENGE  1
+#define CHAP_RESPONSE   2
+#define CHAP_SUCCESS    3
+#define CHAP_FAILURE    4
 
 /*
  * CHAP digest codes.
  */
-#define CHAP_MD5		5
+#define CHAP_MD5        5
 #if MSCHAP_SUPPORT
-#define CHAP_MICROSOFT		0x80
-#define CHAP_MICROSOFT_V2	0x81
+#define CHAP_MICROSOFT      0x80
+#define CHAP_MICROSOFT_V2   0x81
 #endif /* MSCHAP_SUPPORT */
 
 /*
  * Semi-arbitrary limits on challenge and response fields.
  */
-#define MAX_CHALLENGE_LEN	64
-#define MAX_RESPONSE_LEN	64
+#define MAX_CHALLENGE_LEN   64
+#define MAX_RESPONSE_LEN    64
 
 /*
  * These limits apply to challenge and response packets we send.
  * The +4 is the +1 that we actually need rounded up.
  */
-#define CHAL_MAX_PKTLEN	(PPP_HDRLEN + CHAP_HDRLEN + 4 + MAX_CHALLENGE_LEN + MAXNAMELEN)
-#define RESP_MAX_PKTLEN	(PPP_HDRLEN + CHAP_HDRLEN + 4 + MAX_RESPONSE_LEN + MAXNAMELEN)
+#define CHAL_MAX_PKTLEN (PPP_HDRLEN + CHAP_HDRLEN + 4 + MAX_CHALLENGE_LEN + MAXNAMELEN)
+#define RESP_MAX_PKTLEN (PPP_HDRLEN + CHAP_HDRLEN + 4 + MAX_RESPONSE_LEN + MAXNAMELEN)
 
 /* bitmask of supported algorithms */
 #if MSCHAP_SUPPORT
-#define MDTYPE_MICROSOFT_V2	0x1
-#define MDTYPE_MICROSOFT	0x2
+#define MDTYPE_MICROSOFT_V2 0x1
+#define MDTYPE_MICROSOFT    0x2
 #endif /* MSCHAP_SUPPORT */
-#define MDTYPE_MD5		0x4
-#define MDTYPE_NONE		0
+#define MDTYPE_MD5      0x4
+#define MDTYPE_NONE     0
 
 #if MSCHAP_SUPPORT
 /* Return the digest alg. ID for the most preferred digest type. */
@@ -129,24 +129,24 @@ extern "C" {
  * The code for each digest type has to supply one of these.
  */
 struct chap_digest_type {
-	int code;
+    int code;
 
 #if PPP_SERVER
-	/*
-	 * Note: challenge and response arguments below are formatted as
-	 * a length byte followed by the actual challenge/response data.
-	 */
-	void (*generate_challenge)(ppp_pcb *pcb, unsigned char *challenge);
-	int (*verify_response)(ppp_pcb *pcb, int id, const char *name,
-		const unsigned char *secret, int secret_len,
-		const unsigned char *challenge, const unsigned char *response,
-		char *message, int message_space);
+    /*
+     * Note: challenge and response arguments below are formatted as
+     * a length byte followed by the actual challenge/response data.
+     */
+    void (*generate_challenge)(ppp_pcb *pcb, unsigned char *challenge);
+    int (*verify_response)(ppp_pcb *pcb, int id, const char *name,
+        const unsigned char *secret, int secret_len,
+        const unsigned char *challenge, const unsigned char *response,
+        char *message, int message_space);
 #endif /* PPP_SERVER */
-	void (*make_response)(ppp_pcb *pcb, unsigned char *response, int id, const char *our_name,
-		const unsigned char *challenge, const char *secret, int secret_len,
-		unsigned char *priv);
-	int (*check_success)(ppp_pcb *pcb, unsigned char *pkt, int len, unsigned char *priv);
-	void (*handle_failure)(ppp_pcb *pcb, unsigned char *pkt, int len);
+    void (*make_response)(ppp_pcb *pcb, unsigned char *response, int id, const char *our_name,
+        const unsigned char *challenge, const char *secret, int secret_len,
+        unsigned char *priv);
+    int (*check_success)(ppp_pcb *pcb, unsigned char *pkt, int len, unsigned char *priv);
+    void (*handle_failure)(ppp_pcb *pcb, unsigned char *pkt, int len);
 };
 
 /*
@@ -154,21 +154,21 @@ struct chap_digest_type {
  */
 #if CHAP_SUPPORT
 typedef struct chap_client_state {
-	u8_t flags;
-	const char *name;
-	const struct chap_digest_type *digest;
-	unsigned char priv[64];		/* private area for digest's use */
+    u8_t flags;
+    const char *name;
+    const struct chap_digest_type *digest;
+    unsigned char priv[64];     /* private area for digest's use */
 } chap_client_state;
 
 #if PPP_SERVER
 typedef struct chap_server_state {
-	u8_t flags;
-	u8_t id;
-	const char *name;
-	const struct chap_digest_type *digest;
-	int challenge_xmits;
-	int challenge_pktlen;
-	unsigned char challenge[CHAL_MAX_PKTLEN];
+    u8_t flags;
+    u8_t id;
+    const char *name;
+    const struct chap_digest_type *digest;
+    int challenge_xmits;
+    int challenge_pktlen;
+    unsigned char challenge[CHAL_MAX_PKTLEN];
 } chap_server_state;
 #endif /* PPP_SERVER */
 #endif /* CHAP_SUPPORT */
@@ -176,9 +176,9 @@ typedef struct chap_server_state {
 #if 0 /* UNUSED */
 /* Hook for a plugin to validate CHAP challenge */
 extern int (*chap_verify_hook)(char *name, char *ourname, int id,
-			const struct chap_digest_type *digest,
-			unsigned char *challenge, unsigned char *response,
-			char *message, int message_space);
+            const struct chap_digest_type *digest,
+            unsigned char *challenge, unsigned char *response,
+            char *message, int message_space);
 #endif /* UNUSED */
 
 #if PPP_SERVER
diff --git a/src/include/netif/ppp/eap.h b/src/include/netif/ppp/eap.h
index 32434ed5..40f2006d 100644
--- a/src/include/netif/ppp/eap.h
+++ b/src/include/netif/ppp/eap.h
@@ -24,135 +24,135 @@
 #if PPP_SUPPORT && EAP_SUPPORT  /* don't build if not configured for use in lwipopts.h */
 
 #ifndef PPP_EAP_H
-#define	PPP_EAP_H
+#define PPP_EAP_H
 
 #include "ppp.h"
 
-#ifdef	__cplusplus
+#ifdef  __cplusplus
 extern "C" {
 #endif
 
 /*
  * Packet header = Code, id, length.
  */
-#define	EAP_HEADERLEN	4
+#define EAP_HEADERLEN   4
 
 
 /* EAP message codes. */
-#define	EAP_REQUEST	1
-#define	EAP_RESPONSE	2
-#define	EAP_SUCCESS	3
-#define	EAP_FAILURE	4
+#define EAP_REQUEST 1
+#define EAP_RESPONSE    2
+#define EAP_SUCCESS 3
+#define EAP_FAILURE 4
 
 /* EAP types */
-#define	EAPT_IDENTITY		1
-#define	EAPT_NOTIFICATION	2
-#define	EAPT_NAK		3	/* (response only) */
-#define	EAPT_MD5CHAP		4
-#define	EAPT_OTP		5	/* One-Time Password; RFC 1938 */
-#define	EAPT_TOKEN		6	/* Generic Token Card */
+#define EAPT_IDENTITY       1
+#define EAPT_NOTIFICATION   2
+#define EAPT_NAK        3   /* (response only) */
+#define EAPT_MD5CHAP        4
+#define EAPT_OTP        5   /* One-Time Password; RFC 1938 */
+#define EAPT_TOKEN      6   /* Generic Token Card */
 /* 7 and 8 are unassigned. */
-#define	EAPT_RSA		9	/* RSA Public Key Authentication */
-#define	EAPT_DSS		10	/* DSS Unilateral */
-#define	EAPT_KEA		11	/* KEA */
-#define	EAPT_KEA_VALIDATE	12	/* KEA-VALIDATE	*/
-#define	EAPT_TLS		13	/* EAP-TLS */
-#define	EAPT_DEFENDER		14	/* Defender Token (AXENT) */
-#define	EAPT_W2K		15	/* Windows 2000 EAP */
-#define	EAPT_ARCOT		16	/* Arcot Systems */
-#define	EAPT_CISCOWIRELESS	17	/* Cisco Wireless */
-#define	EAPT_NOKIACARD		18	/* Nokia IP smart card */
-#define	EAPT_SRP		19	/* Secure Remote Password */
+#define EAPT_RSA        9   /* RSA Public Key Authentication */
+#define EAPT_DSS        10  /* DSS Unilateral */
+#define EAPT_KEA        11  /* KEA */
+#define EAPT_KEA_VALIDATE   12  /* KEA-VALIDATE */
+#define EAPT_TLS        13  /* EAP-TLS */
+#define EAPT_DEFENDER       14  /* Defender Token (AXENT) */
+#define EAPT_W2K        15  /* Windows 2000 EAP */
+#define EAPT_ARCOT      16  /* Arcot Systems */
+#define EAPT_CISCOWIRELESS  17  /* Cisco Wireless */
+#define EAPT_NOKIACARD      18  /* Nokia IP smart card */
+#define EAPT_SRP        19  /* Secure Remote Password */
 /* 20 is deprecated */
 
 /* EAP SRP-SHA1 Subtypes */
-#define	EAPSRP_CHALLENGE	1	/* Request 1 - Challenge */
-#define	EAPSRP_CKEY		1	/* Response 1 - Client Key */
-#define	EAPSRP_SKEY		2	/* Request 2 - Server Key */
-#define	EAPSRP_CVALIDATOR	2	/* Response 2 - Client Validator */
-#define	EAPSRP_SVALIDATOR	3	/* Request 3 - Server Validator */
-#define	EAPSRP_ACK		3	/* Response 3 - final ack */
-#define	EAPSRP_LWRECHALLENGE	4	/* Req/resp 4 - Lightweight rechal */
-
-#define	SRPVAL_EBIT	0x00000001	/* Use shared key for ECP */
-
-#define	SRP_PSEUDO_ID	"pseudo_"
-#define	SRP_PSEUDO_LEN	7
-
-#define MD5_SIGNATURE_SIZE	16
-#define EAP_MIN_CHALLENGE_LENGTH	17
-#define EAP_MAX_CHALLENGE_LENGTH	24
+#define EAPSRP_CHALLENGE    1   /* Request 1 - Challenge */
+#define EAPSRP_CKEY     1   /* Response 1 - Client Key */
+#define EAPSRP_SKEY     2   /* Request 2 - Server Key */
+#define EAPSRP_CVALIDATOR   2   /* Response 2 - Client Validator */
+#define EAPSRP_SVALIDATOR   3   /* Request 3 - Server Validator */
+#define EAPSRP_ACK      3   /* Response 3 - final ack */
+#define EAPSRP_LWRECHALLENGE    4   /* Req/resp 4 - Lightweight rechal */
+
+#define SRPVAL_EBIT 0x00000001  /* Use shared key for ECP */
+
+#define SRP_PSEUDO_ID   "pseudo_"
+#define SRP_PSEUDO_LEN  7
+
+#define MD5_SIGNATURE_SIZE  16
+#define EAP_MIN_CHALLENGE_LENGTH    17
+#define EAP_MAX_CHALLENGE_LENGTH    24
 #define EAP_MIN_MAX_POWER_OF_TWO_CHALLENGE_LENGTH     3   /* 2^3-1 = 7, 17+7 = 24 */
 
-#define	EAP_STATES	\
-	"Initial", "Pending", "Closed", "Listen", "Identify", \
-	"SRP1", "SRP2", "SRP3", "MD5Chall", "Open", "SRP4", "BadAuth"
+#define EAP_STATES  \
+    "Initial", "Pending", "Closed", "Listen", "Identify", \
+    "SRP1", "SRP2", "SRP3", "MD5Chall", "Open", "SRP4", "BadAuth"
 
-#define	eap_client_active(pcb)	((pcb)->eap.es_client.ea_state == eapListen)
+#define eap_client_active(pcb)  ((pcb)->eap.es_client.ea_state == eapListen)
 #if PPP_SERVER
-#define	eap_server_active(pcb)	\
-	((pcb)->eap.es_server.ea_state >= eapIdentify && \
-	 (pcb)->eap.es_server.ea_state <= eapMD5Chall)
+#define eap_server_active(pcb)  \
+    ((pcb)->eap.es_server.ea_state >= eapIdentify && \
+     (pcb)->eap.es_server.ea_state <= eapMD5Chall)
 #endif /* PPP_SERVER */
 
 /*
  * Complete EAP state for one PPP session.
  */
 enum eap_state_code {
-	eapInitial = 0,	/* No EAP authentication yet requested */
-	eapPending,	/* Waiting for LCP (no timer) */
-	eapClosed,	/* Authentication not in use */
-	eapListen,	/* Client ready (and timer running) */
-	eapIdentify,	/* EAP Identify sent */
-	eapSRP1,	/* Sent EAP SRP-SHA1 Subtype 1 */
-	eapSRP2,	/* Sent EAP SRP-SHA1 Subtype 2 */
-	eapSRP3,	/* Sent EAP SRP-SHA1 Subtype 3 */
-	eapMD5Chall,	/* Sent MD5-Challenge */
-	eapOpen,	/* Completed authentication */
-	eapSRP4,	/* Sent EAP SRP-SHA1 Subtype 4 */
-	eapBadAuth	/* Failed authentication */
+    eapInitial = 0, /* No EAP authentication yet requested */
+    eapPending, /* Waiting for LCP (no timer) */
+    eapClosed,  /* Authentication not in use */
+    eapListen,  /* Client ready (and timer running) */
+    eapIdentify,    /* EAP Identify sent */
+    eapSRP1,    /* Sent EAP SRP-SHA1 Subtype 1 */
+    eapSRP2,    /* Sent EAP SRP-SHA1 Subtype 2 */
+    eapSRP3,    /* Sent EAP SRP-SHA1 Subtype 3 */
+    eapMD5Chall,    /* Sent MD5-Challenge */
+    eapOpen,    /* Completed authentication */
+    eapSRP4,    /* Sent EAP SRP-SHA1 Subtype 4 */
+    eapBadAuth  /* Failed authentication */
 };
 
 struct eap_auth {
-	const char *ea_name;	/* Our name */
-	char ea_peer[MAXNAMELEN +1];	/* Peer's name */
-	void *ea_session;	/* Authentication library linkage */
-	u_char *ea_skey;	/* Shared encryption key */
-	u_short ea_namelen;	/* Length of our name */
-	u_short ea_peerlen;	/* Length of peer's name */
-	enum eap_state_code ea_state;
-	u_char ea_id;		/* Current id */
-	u_char ea_requests;	/* Number of Requests sent/received */
-	u_char ea_responses;	/* Number of Responses */
-	u_char ea_type;		/* One of EAPT_* */
-	u32_t ea_keyflags;	/* SRP shared key usage flags */
+    const char *ea_name;    /* Our name */
+    char ea_peer[MAXNAMELEN +1];    /* Peer's name */
+    void *ea_session;   /* Authentication library linkage */
+    u_char *ea_skey;    /* Shared encryption key */
+    u_short ea_namelen; /* Length of our name */
+    u_short ea_peerlen; /* Length of peer's name */
+    enum eap_state_code ea_state;
+    u_char ea_id;       /* Current id */
+    u_char ea_requests; /* Number of Requests sent/received */
+    u_char ea_responses;    /* Number of Responses */
+    u_char ea_type;     /* One of EAPT_* */
+    u32_t ea_keyflags;  /* SRP shared key usage flags */
 };
 
 #ifndef EAP_MAX_CHALLENGE_LENGTH
-#define EAP_MAX_CHALLENGE_LENGTH	24
+#define EAP_MAX_CHALLENGE_LENGTH    24
 #endif
 typedef struct eap_state {
-	struct eap_auth es_client;	/* Client (authenticatee) data */
+    struct eap_auth es_client;  /* Client (authenticatee) data */
 #if PPP_SERVER
-	struct eap_auth es_server;	/* Server (authenticator) data */
+    struct eap_auth es_server;  /* Server (authenticator) data */
 #endif /* PPP_SERVER */
-	int es_savedtime;		/* Saved timeout */
-	int es_rechallenge;		/* EAP rechallenge interval */
-	int es_lwrechallenge;		/* SRP lightweight rechallenge inter */
-	u8_t es_usepseudo;		/* Use SRP Pseudonym if offered one */
-	int es_usedpseudo;		/* Set if we already sent PN */
-	int es_challen;			/* Length of challenge string */
-	u_char es_challenge[EAP_MAX_CHALLENGE_LENGTH];
+    int es_savedtime;       /* Saved timeout */
+    int es_rechallenge;     /* EAP rechallenge interval */
+    int es_lwrechallenge;       /* SRP lightweight rechallenge inter */
+    u8_t es_usepseudo;      /* Use SRP Pseudonym if offered one */
+    int es_usedpseudo;      /* Set if we already sent PN */
+    int es_challen;         /* Length of challenge string */
+    u_char es_challenge[EAP_MAX_CHALLENGE_LENGTH];
 } eap_state;
 
 /*
  * Timeouts.
  */
 #if 0 /* moved to ppp_opts.h */
-#define	EAP_DEFTIMEOUT		3	/* Timeout (seconds) for rexmit */
-#define	EAP_DEFTRANSMITS	10	/* max # times to transmit */
-#define	EAP_DEFREQTIME		20	/* Time to wait for peer request */
-#define	EAP_DEFALLOWREQ		20	/* max # times to accept requests */
+#define EAP_DEFTIMEOUT      3   /* Timeout (seconds) for rexmit */
+#define EAP_DEFTRANSMITS    10  /* max # times to transmit */
+#define EAP_DEFREQTIME      20  /* Time to wait for peer request */
+#define EAP_DEFALLOWREQ     20  /* max # times to accept requests */
 #endif /* moved to ppp_opts.h */
 
 void eap_authwithpeer(ppp_pcb *pcb, const char *localname);
@@ -160,7 +160,7 @@ void eap_authpeer(ppp_pcb *pcb, const char *localname);
 
 extern const struct protent eap_protent;
 
-#ifdef	__cplusplus
+#ifdef  __cplusplus
 }
 #endif
 
diff --git a/src/include/netif/ppp/ecp.h b/src/include/netif/ppp/ecp.h
index d8808c3a..fa373fe7 100644
--- a/src/include/netif/ppp/ecp.h
+++ b/src/include/netif/ppp/ecp.h
@@ -42,8 +42,8 @@ extern "C" {
 #endif
 
 typedef struct ecp_options {
-    bool required;		/* Is ECP required? */
-    unsigned enctype;		/* Encryption type */
+    bool required;      /* Is ECP required? */
+    unsigned enctype;       /* Encryption type */
 } ecp_options;
 
 extern fsm ecp_fsm[];
diff --git a/src/include/netif/ppp/eui64.h b/src/include/netif/ppp/eui64.h
index 5adeb482..3a20081f 100644
--- a/src/include/netif/ppp/eui64.h
+++ b/src/include/netif/ppp/eui64.h
@@ -57,42 +57,42 @@ typedef union
     u32_t e32[2];
 } eui64_t;
 
-#define eui64_iszero(e)		(((e).e32[0] | (e).e32[1]) == 0)
-#define eui64_equals(e, o)	(((e).e32[0] == (o).e32[0]) && \
-				((e).e32[1] == (o).e32[1]))
-#define eui64_zero(e)		(e).e32[0] = (e).e32[1] = 0;
+#define eui64_iszero(e)     (((e).e32[0] | (e).e32[1]) == 0)
+#define eui64_equals(e, o)  (((e).e32[0] == (o).e32[0]) && \
+                ((e).e32[1] == (o).e32[1]))
+#define eui64_zero(e)       (e).e32[0] = (e).e32[1] = 0;
 
-#define eui64_copy(s, d)	memcpy(&(d), &(s), sizeof(eui64_t))
+#define eui64_copy(s, d)    memcpy(&(d), &(s), sizeof(eui64_t))
 
-#define eui64_magic(e)		do {			\
-				(e).e32[0] = magic();	\
-				(e).e32[1] = magic();	\
-				(e).e8[0] &= ~2;	\
-				} while (0)
-#define eui64_magic_nz(x)	do {				\
-				eui64_magic(x);			\
-				} while (eui64_iszero(x))
-#define eui64_magic_ne(x, y)	do {				\
-				eui64_magic(x);			\
-				} while (eui64_equals(x, y))
+#define eui64_magic(e)      do {            \
+                (e).e32[0] = magic();   \
+                (e).e32[1] = magic();   \
+                (e).e8[0] &= ~2;    \
+                } while (0)
+#define eui64_magic_nz(x)   do {                \
+                eui64_magic(x);         \
+                } while (eui64_iszero(x))
+#define eui64_magic_ne(x, y)    do {                \
+                eui64_magic(x);         \
+                } while (eui64_equals(x, y))
 
-#define eui64_get(ll, cp)	do {				\
-				eui64_copy((*cp), (ll));	\
-				(cp) += sizeof(eui64_t);	\
-				} while (0)
+#define eui64_get(ll, cp)   do {                \
+                eui64_copy((*cp), (ll));    \
+                (cp) += sizeof(eui64_t);    \
+                } while (0)
 
-#define eui64_put(ll, cp)	do {				\
-				eui64_copy((ll), (*cp));	\
-				(cp) += sizeof(eui64_t);	\
-				} while (0)
+#define eui64_put(ll, cp)   do {                \
+                eui64_copy((ll), (*cp));    \
+                (cp) += sizeof(eui64_t);    \
+                } while (0)
 
-#define eui64_set32(e, l)	do {			\
-				(e).e32[0] = 0;		\
-				(e).e32[1] = lwip_htonl(l);	\
-				} while (0)
-#define eui64_setlo32(e, l)	eui64_set32(e, l)
+#define eui64_set32(e, l)   do {            \
+                (e).e32[0] = 0;     \
+                (e).e32[1] = lwip_htonl(l); \
+                } while (0)
+#define eui64_setlo32(e, l) eui64_set32(e, l)
 
-char *eui64_ntoa(eui64_t);	/* Returns ascii representation of id */
+char *eui64_ntoa(eui64_t);  /* Returns ascii representation of id */
 
 #ifdef __cplusplus
 }
diff --git a/src/include/netif/ppp/fsm.h b/src/include/netif/ppp/fsm.h
index 8dec700e..69d965a5 100644
--- a/src/include/netif/ppp/fsm.h
+++ b/src/include/netif/ppp/fsm.h
@@ -46,7 +46,7 @@
 #if PPP_SUPPORT /* don't build if not configured for use in lwipopts.h */
 
 #ifndef FSM_H
-#define	FSM_H
+#define FSM_H
 
 #include "ppp.h"
 
@@ -57,108 +57,108 @@ extern "C" {
 /*
  * Packet header = Code, id, length.
  */
-#define HEADERLEN	4
+#define HEADERLEN   4
 
 
 /*
  *  CP (LCP, IPCP, etc.) codes.
  */
-#define CONFREQ		1	/* Configuration Request */
-#define CONFACK		2	/* Configuration Ack */
-#define CONFNAK		3	/* Configuration Nak */
-#define CONFREJ		4	/* Configuration Reject */
-#define TERMREQ		5	/* Termination Request */
-#define TERMACK		6	/* Termination Ack */
-#define CODEREJ		7	/* Code Reject */
+#define CONFREQ     1   /* Configuration Request */
+#define CONFACK     2   /* Configuration Ack */
+#define CONFNAK     3   /* Configuration Nak */
+#define CONFREJ     4   /* Configuration Reject */
+#define TERMREQ     5   /* Termination Request */
+#define TERMACK     6   /* Termination Ack */
+#define CODEREJ     7   /* Code Reject */
 
 
 /*
  * Each FSM is described by an fsm structure and fsm callbacks.
  */
 typedef struct fsm {
-    ppp_pcb *pcb;		/* PPP Interface */
-    const struct fsm_callbacks *callbacks;	/* Callback routines */
-    const char *term_reason;	/* Reason for closing protocol */
-    u8_t seen_ack;		/* Have received valid Ack/Nak/Rej to Req */
-				  /* -- This is our only flag, we might use u_int :1 if we have more flags */
-    u16_t protocol;		/* Data Link Layer Protocol field value */
-    u8_t state;			/* State */
-    u8_t flags;			/* Contains option bits */
-    u8_t id;			/* Current id */
-    u8_t reqid;			/* Current request id */
-    u8_t retransmits;		/* Number of retransmissions left */
-    u8_t nakloops;		/* Number of nak loops since last ack */
-    u8_t rnakloops;		/* Number of naks received */
-    u8_t maxnakloops;		/* Maximum number of nak loops tolerated
-				   (necessary because IPCP require a custom large max nak loops value) */
-    u8_t term_reason_len;	/* Length of term_reason */
+    ppp_pcb *pcb;       /* PPP Interface */
+    const struct fsm_callbacks *callbacks;  /* Callback routines */
+    const char *term_reason;    /* Reason for closing protocol */
+    u8_t seen_ack;      /* Have received valid Ack/Nak/Rej to Req */
+                  /* -- This is our only flag, we might use u_int :1 if we have more flags */
+    u16_t protocol;     /* Data Link Layer Protocol field value */
+    u8_t state;         /* State */
+    u8_t flags;         /* Contains option bits */
+    u8_t id;            /* Current id */
+    u8_t reqid;         /* Current request id */
+    u8_t retransmits;       /* Number of retransmissions left */
+    u8_t nakloops;      /* Number of nak loops since last ack */
+    u8_t rnakloops;     /* Number of naks received */
+    u8_t maxnakloops;       /* Maximum number of nak loops tolerated
+                   (necessary because IPCP require a custom large max nak loops value) */
+    u8_t term_reason_len;   /* Length of term_reason */
 } fsm;
 
 
 typedef struct fsm_callbacks {
-    void (*resetci)		/* Reset our Configuration Information */
-		(fsm *);
-    int  (*cilen)		/* Length of our Configuration Information */
-		(fsm *);
-    void (*addci) 		/* Add our Configuration Information */
-		(fsm *, u_char *, int *);
-    int  (*ackci)		/* ACK our Configuration Information */
-		(fsm *, u_char *, int);
-    int  (*nakci)		/* NAK our Configuration Information */
-		(fsm *, u_char *, int, int);
-    int  (*rejci)		/* Reject our Configuration Information */
-		(fsm *, u_char *, int);
-    int  (*reqci)		/* Request peer's Configuration Information */
-		(fsm *, u_char *, int *, int);
-    void (*up)			/* Called when fsm reaches PPP_FSM_OPENED state */
-		(fsm *);
-    void (*down)		/* Called when fsm leaves PPP_FSM_OPENED state */
-		(fsm *);
-    void (*starting)		/* Called when we want the lower layer */
-		(fsm *);
-    void (*finished)		/* Called when we don't want the lower layer */
-		(fsm *);
-    void (*protreject)		/* Called when Protocol-Reject received */
-		(int);
-    void (*retransmit)		/* Retransmission is necessary */
-		(fsm *);
-    int  (*extcode)		/* Called when unknown code received */
-		(fsm *, int, int, u_char *, int);
-    const char *proto_name;	/* String name for protocol (for messages) */
+    void (*resetci)     /* Reset our Configuration Information */
+        (fsm *);
+    int  (*cilen)       /* Length of our Configuration Information */
+        (fsm *);
+    void (*addci)       /* Add our Configuration Information */
+        (fsm *, u_char *, int *);
+    int  (*ackci)       /* ACK our Configuration Information */
+        (fsm *, u_char *, int);
+    int  (*nakci)       /* NAK our Configuration Information */
+        (fsm *, u_char *, int, int);
+    int  (*rejci)       /* Reject our Configuration Information */
+        (fsm *, u_char *, int);
+    int  (*reqci)       /* Request peer's Configuration Information */
+        (fsm *, u_char *, int *, int);
+    void (*up)          /* Called when fsm reaches PPP_FSM_OPENED state */
+        (fsm *);
+    void (*down)        /* Called when fsm leaves PPP_FSM_OPENED state */
+        (fsm *);
+    void (*starting)        /* Called when we want the lower layer */
+        (fsm *);
+    void (*finished)        /* Called when we don't want the lower layer */
+        (fsm *);
+    void (*protreject)      /* Called when Protocol-Reject received */
+        (int);
+    void (*retransmit)      /* Retransmission is necessary */
+        (fsm *);
+    int  (*extcode)     /* Called when unknown code received */
+        (fsm *, int, int, u_char *, int);
+    const char *proto_name; /* String name for protocol (for messages) */
 } fsm_callbacks;
 
 
 /*
  * Link states.
  */
-#define PPP_FSM_INITIAL		0	/* Down, hasn't been opened */
-#define PPP_FSM_STARTING	1	/* Down, been opened */
-#define PPP_FSM_CLOSED		2	/* Up, hasn't been opened */
-#define PPP_FSM_STOPPED		3	/* Open, waiting for down event */
-#define PPP_FSM_CLOSING		4	/* Terminating the connection, not open */
-#define PPP_FSM_STOPPING	5	/* Terminating, but open */
-#define PPP_FSM_REQSENT		6	/* We've sent a Config Request */
-#define PPP_FSM_ACKRCVD		7	/* We've received a Config Ack */
-#define PPP_FSM_ACKSENT		8	/* We've sent a Config Ack */
-#define PPP_FSM_OPENED		9	/* Connection available */
+#define PPP_FSM_INITIAL     0   /* Down, hasn't been opened */
+#define PPP_FSM_STARTING    1   /* Down, been opened */
+#define PPP_FSM_CLOSED      2   /* Up, hasn't been opened */
+#define PPP_FSM_STOPPED     3   /* Open, waiting for down event */
+#define PPP_FSM_CLOSING     4   /* Terminating the connection, not open */
+#define PPP_FSM_STOPPING    5   /* Terminating, but open */
+#define PPP_FSM_REQSENT     6   /* We've sent a Config Request */
+#define PPP_FSM_ACKRCVD     7   /* We've received a Config Ack */
+#define PPP_FSM_ACKSENT     8   /* We've sent a Config Ack */
+#define PPP_FSM_OPENED      9   /* Connection available */
 
 
 /*
  * Flags - indicate options controlling FSM operation
  */
-#define OPT_PASSIVE	1	/* Don't die if we don't get a response */
-#define OPT_RESTART	2	/* Treat 2nd OPEN as DOWN, UP */
-#define OPT_SILENT	4	/* Wait for peer to speak first */
+#define OPT_PASSIVE 1   /* Don't die if we don't get a response */
+#define OPT_RESTART 2   /* Treat 2nd OPEN as DOWN, UP */
+#define OPT_SILENT  4   /* Wait for peer to speak first */
 
 
 /*
  * Timeouts.
  */
 #if 0 /* moved to ppp_opts.h */
-#define DEFTIMEOUT	3	/* Timeout time in seconds */
-#define DEFMAXTERMREQS	2	/* Maximum Terminate-Request transmissions */
-#define DEFMAXCONFREQS	10	/* Maximum Configure-Request transmissions */
-#define DEFMAXNAKLOOPS	5	/* Maximum number of nak loops */
+#define DEFTIMEOUT  3   /* Timeout time in seconds */
+#define DEFMAXTERMREQS  2   /* Maximum Terminate-Request transmissions */
+#define DEFMAXCONFREQS  10  /* Maximum Configure-Request transmissions */
+#define DEFMAXNAKLOOPS  5   /* Maximum number of nak loops */
 #endif /* moved to ppp_opts.h */
 
 
diff --git a/src/include/netif/ppp/ipcp.h b/src/include/netif/ppp/ipcp.h
index 32fdd1c6..6d822fef 100644
--- a/src/include/netif/ppp/ipcp.h
+++ b/src/include/netif/ppp/ipcp.h
@@ -46,7 +46,7 @@
 #if PPP_SUPPORT && PPP_IPV4_SUPPORT /* don't build if not configured for use in lwipopts.h */
 
 #ifndef IPCP_H
-#define	IPCP_H
+#define IPCP_H
 
 #ifdef __cplusplus
 extern "C" {
@@ -55,32 +55,32 @@ extern "C" {
 /*
  * Options.
  */
-#define CI_ADDRS	1	/* IP Addresses */
+#define CI_ADDRS    1   /* IP Addresses */
 #if VJ_SUPPORT
-#define CI_COMPRESSTYPE	2	/* Compression Type */
+#define CI_COMPRESSTYPE 2   /* Compression Type */
 #endif /* VJ_SUPPORT */
-#define	CI_ADDR		3
+#define CI_ADDR     3
 
 #if LWIP_DNS
-#define CI_MS_DNS1      129	/* Primary DNS value */
+#define CI_MS_DNS1      129 /* Primary DNS value */
 #define CI_MS_DNS2      131     /* Secondary DNS value */
 #endif /* LWIP_DNS */
 #if 0 /* UNUSED - WINS */
 #define CI_MS_WINS1     130     /* Primary WINS value */
-#define CI_MS_WINS2     132	/* Secondary WINS value */
+#define CI_MS_WINS2     132 /* Secondary WINS value */
 #endif /* UNUSED - WINS */
 
 #if VJ_SUPPORT
-#define MAX_STATES 16		/* from slcompress.h */
+#define MAX_STATES 16       /* from slcompress.h */
 
-#define IPCP_VJMODE_OLD 1	/* "old" mode (option # = 0x0037) */
-#define IPCP_VJMODE_RFC1172 2	/* "old-rfc"mode (option # = 0x002d) */
-#define IPCP_VJMODE_RFC1332 3	/* "new-rfc"mode (option # = 0x002d, */
+#define IPCP_VJMODE_OLD 1   /* "old" mode (option # = 0x0037) */
+#define IPCP_VJMODE_RFC1172 2   /* "old-rfc"mode (option # = 0x002d) */
+#define IPCP_VJMODE_RFC1332 3   /* "new-rfc"mode (option # = 0x002d, */
                                 /*  maxslot and slot number compression) */
 
-#define IPCP_VJ_COMP 0x002d	/* current value for VJ compression option*/
-#define IPCP_VJ_COMP_OLD 0x0037	/* "old" (i.e, broken) value for VJ */
-				/* compression option*/ 
+#define IPCP_VJ_COMP 0x002d /* current value for VJ compression option*/
+#define IPCP_VJ_COMP_OLD 0x0037 /* "old" (i.e, broken) value for VJ */
+                /* compression option*/
 #endif /* VJ_SUPPORT */
 
 typedef struct ipcp_options {
@@ -106,17 +106,17 @@ typedef struct ipcp_options {
     unsigned int req_dns2               :1; /* Ask peer to send secondary DNS address? */
 #endif /* LWIP_DNS */
 
-    u32_t ouraddr, hisaddr;	/* Addresses in NETWORK BYTE ORDER */
+    u32_t ouraddr, hisaddr; /* Addresses in NETWORK BYTE ORDER */
 #if LWIP_DNS
-    u32_t dnsaddr[2];	/* Primary and secondary MS DNS entries */
+    u32_t dnsaddr[2];   /* Primary and secondary MS DNS entries */
 #endif /* LWIP_DNS */
 #if 0 /* UNUSED - WINS */
-    u32_t winsaddr[2];	/* Primary and secondary MS WINS entries */
+    u32_t winsaddr[2];  /* Primary and secondary MS WINS entries */
 #endif /* UNUSED - WINS */
 
 #if VJ_SUPPORT
-    u16_t vj_protocol;		/* protocol value to use in VJ option */
-    u8_t  maxslotindex;		/* values for RFC1332 VJ compression neg. */
+    u16_t vj_protocol;      /* protocol value to use in VJ option */
+    u8_t  maxslotindex;     /* values for RFC1332 VJ compression neg. */
 #endif /* VJ_SUPPORT */
 } ipcp_options;
 
diff --git a/src/include/netif/ppp/ipv6cp.h b/src/include/netif/ppp/ipv6cp.h
index 90999738..756b3ecd 100644
--- a/src/include/netif/ppp/ipv6cp.h
+++ b/src/include/netif/ppp/ipv6cp.h
@@ -73,7 +73,7 @@
     between BULL S.A. and INRIA).
 
     This software is available with usual "research" terms
-    with the aim of retain credits of the software. 
+    with the aim of retain credits of the software.
     Permission to use, copy, modify and distribute this software for any
     purpose and without fee is hereby granted, provided that the above
     copyright notice and this permission notice appear in all copies,
@@ -142,7 +142,7 @@
 #if PPP_SUPPORT && PPP_IPV6_SUPPORT  /* don't build if not configured for use in lwipopts.h */
 
 #ifndef IPV6CP_H
-#define	IPV6CP_H
+#define IPV6CP_H
 
 #include "eui64.h"
 
@@ -153,13 +153,13 @@ extern "C" {
 /*
  * Options.
  */
-#define CI_IFACEID	1	/* Interface Identifier */
+#define CI_IFACEID  1   /* Interface Identifier */
 #ifdef IPV6CP_COMP
-#define CI_COMPRESSTYPE	2	/* Compression Type     */
+#define CI_COMPRESSTYPE 2   /* Compression Type     */
 #endif /* IPV6CP_COMP */
 
 /* No compression types yet defined.
- *#define IPV6CP_COMP	0x004f
+ *#define IPV6CP_COMP   0x004f
  */
 typedef struct ipv6cp_options {
     unsigned int neg_ifaceid    :1;  /* Negotiate interface identifier? */
diff --git a/src/include/netif/ppp/lcp.h b/src/include/netif/ppp/lcp.h
index 18ad1cb2..2b49bf7e 100644
--- a/src/include/netif/ppp/lcp.h
+++ b/src/include/netif/ppp/lcp.h
@@ -46,7 +46,7 @@
 #if PPP_SUPPORT /* don't build if not configured for use in lwipopts.h */
 
 #ifndef LCP_H
-#define	LCP_H
+#define LCP_H
 
 #include "ppp.h"
 
@@ -57,55 +57,55 @@ extern "C" {
 /*
  * Options.
  */
-#define CI_VENDOR	0	/* Vendor Specific */
-#define CI_MRU		1	/* Maximum Receive Unit */
-#define CI_ASYNCMAP	2	/* Async Control Character Map */
-#define CI_AUTHTYPE	3	/* Authentication Type */
-#define CI_QUALITY	4	/* Quality Protocol */
-#define CI_MAGICNUMBER	5	/* Magic Number */
-#define CI_PCOMPRESSION	7	/* Protocol Field Compression */
-#define CI_ACCOMPRESSION 8	/* Address/Control Field Compression */
-#define CI_FCSALTERN	9	/* FCS-Alternatives */
-#define CI_SDP		10	/* Self-Describing-Pad */
-#define CI_NUMBERED	11	/* Numbered-Mode */
-#define CI_CALLBACK	13	/* callback */
-#define CI_MRRU		17	/* max reconstructed receive unit; multilink */
-#define CI_SSNHF	18	/* short sequence numbers for multilink */
-#define CI_EPDISC	19	/* endpoint discriminator */
-#define CI_MPPLUS	22	/* Multi-Link-Plus-Procedure */
-#define CI_LDISC	23	/* Link-Discriminator */
-#define CI_LCPAUTH	24	/* LCP Authentication */
-#define CI_COBS		25	/* Consistent Overhead Byte Stuffing */
-#define CI_PREFELIS	26	/* Prefix Elision */
-#define CI_MPHDRFMT	27	/* MP Header Format */
-#define CI_I18N		28	/* Internationalization */
-#define CI_SDL		29	/* Simple Data Link */
+#define CI_VENDOR   0   /* Vendor Specific */
+#define CI_MRU      1   /* Maximum Receive Unit */
+#define CI_ASYNCMAP 2   /* Async Control Character Map */
+#define CI_AUTHTYPE 3   /* Authentication Type */
+#define CI_QUALITY  4   /* Quality Protocol */
+#define CI_MAGICNUMBER  5   /* Magic Number */
+#define CI_PCOMPRESSION 7   /* Protocol Field Compression */
+#define CI_ACCOMPRESSION 8  /* Address/Control Field Compression */
+#define CI_FCSALTERN    9   /* FCS-Alternatives */
+#define CI_SDP      10  /* Self-Describing-Pad */
+#define CI_NUMBERED 11  /* Numbered-Mode */
+#define CI_CALLBACK 13  /* callback */
+#define CI_MRRU     17  /* max reconstructed receive unit; multilink */
+#define CI_SSNHF    18  /* short sequence numbers for multilink */
+#define CI_EPDISC   19  /* endpoint discriminator */
+#define CI_MPPLUS   22  /* Multi-Link-Plus-Procedure */
+#define CI_LDISC    23  /* Link-Discriminator */
+#define CI_LCPAUTH  24  /* LCP Authentication */
+#define CI_COBS     25  /* Consistent Overhead Byte Stuffing */
+#define CI_PREFELIS 26  /* Prefix Elision */
+#define CI_MPHDRFMT 27  /* MP Header Format */
+#define CI_I18N     28  /* Internationalization */
+#define CI_SDL      29  /* Simple Data Link */
 
 /*
  * LCP-specific packet types (code numbers).
  */
-#define PROTREJ		8	/* Protocol Reject */
-#define ECHOREQ		9	/* Echo Request */
-#define ECHOREP		10	/* Echo Reply */
-#define DISCREQ		11	/* Discard Request */
-#define IDENTIF		12	/* Identification */
-#define TIMEREM		13	/* Time Remaining */
+#define PROTREJ     8   /* Protocol Reject */
+#define ECHOREQ     9   /* Echo Request */
+#define ECHOREP     10  /* Echo Reply */
+#define DISCREQ     11  /* Discard Request */
+#define IDENTIF     12  /* Identification */
+#define TIMEREM     13  /* Time Remaining */
 
 /* Value used as data for CI_CALLBACK option */
-#define CBCP_OPT	6	/* Use callback control protocol */
+#define CBCP_OPT    6   /* Use callback control protocol */
 
 #if 0 /* moved to ppp_opts.h */
-#define DEFMRU	1500		/* Try for this */
-#define MINMRU	128		/* No MRUs below this */
-#define MAXMRU	16384		/* Normally limit MRU to this */
+#define DEFMRU  1500        /* Try for this */
+#define MINMRU  128     /* No MRUs below this */
+#define MAXMRU  16384       /* Normally limit MRU to this */
 #endif /* moved to ppp_opts.h */
 
 /* An endpoint discriminator, used with multilink. */
-#define MAX_ENDP_LEN	20	/* maximum length of discriminator value */
+#define MAX_ENDP_LEN    20  /* maximum length of discriminator value */
 struct epdisc {
-    unsigned char	class_; /* -- The word "class" is reserved in C++. */
-    unsigned char	length;
-    unsigned char	value[MAX_ENDP_LEN];
+    unsigned char   class_; /* -- The word "class" is reserved in C++. */
+    unsigned char   length;
+    unsigned char   value[MAX_ENDP_LEN];
 };
 
 /*
@@ -141,20 +141,20 @@ typedef struct lcp_options {
     unsigned int neg_ssnhf         :1; /* negotiate short sequence numbers */
     unsigned int neg_endpoint      :1; /* negotiate endpoint discriminator */
 
-    u16_t mru;			/* Value of MRU */
+    u16_t mru;          /* Value of MRU */
 #ifdef HAVE_MULTILINK
-    u16_t mrru;			/* Value of MRRU, and multilink enable */
+    u16_t mrru;         /* Value of MRRU, and multilink enable */
 #endif /* MULTILINK */
 #if CHAP_SUPPORT
-    u8_t chap_mdtype;		/* which MD types (hashing algorithm) */
+    u8_t chap_mdtype;       /* which MD types (hashing algorithm) */
 #endif /* CHAP_SUPPORT */
-    u32_t asyncmap;		/* Value of async map */
+    u32_t asyncmap;     /* Value of async map */
     u32_t magicnumber;
-    u8_t  numloops;		/* Number of loops during magic number neg. */
+    u8_t  numloops;     /* Number of loops during magic number neg. */
 #if LQR_SUPPORT
-    u32_t lqr_period;	/* Reporting period for LQR 1/100ths second */
+    u32_t lqr_period;   /* Reporting period for LQR 1/100ths second */
 #endif /* LQR_SUPPORT */
-    struct epdisc endpoint;	/* endpoint discriminator */
+    struct epdisc endpoint; /* endpoint discriminator */
 } lcp_options;
 
 void lcp_open(ppp_pcb *pcb);
@@ -168,7 +168,7 @@ extern const struct protent lcp_protent;
 #if 0 /* moved to ppp_opts.h */
 /* Default number of times we receive our magic number from the peer
    before deciding the link is looped-back. */
-#define DEFLOOPBACKFAIL	10
+#define DEFLOOPBACKFAIL 10
 #endif /* moved to ppp_opts.h */
 
 #ifdef __cplusplus
diff --git a/src/include/netif/ppp/magic.h b/src/include/netif/ppp/magic.h
index 12a002cd..585e3a7a 100644
--- a/src/include/netif/ppp/magic.h
+++ b/src/include/netif/ppp/magic.h
@@ -102,7 +102,7 @@ void magic_randomize(void);
 /*
  * Return a new random number.
  */
-u32_t magic(void);	/* Returns the next magic number */
+u32_t magic(void);  /* Returns the next magic number */
 
 /*
  * Fill buffer with random bytes
diff --git a/src/include/netif/ppp/mppe.h b/src/include/netif/ppp/mppe.h
index 5de11284..55f0487b 100644
--- a/src/include/netif/ppp/mppe.h
+++ b/src/include/netif/ppp/mppe.h
@@ -45,19 +45,19 @@
 extern "C" {
 #endif
 
-#define MPPE_PAD		4	/* MPPE growth per frame */
-#define MPPE_MAX_KEY_LEN	16	/* largest key length (128-bit) */
+#define MPPE_PAD        4   /* MPPE growth per frame */
+#define MPPE_MAX_KEY_LEN    16  /* largest key length (128-bit) */
 
 /* option bits for ccp_options.mppe */
-#define MPPE_OPT_40		0x01	/* 40 bit */
-#define MPPE_OPT_128		0x02	/* 128 bit */
-#define MPPE_OPT_STATEFUL	0x04	/* stateful mode */
+#define MPPE_OPT_40     0x01    /* 40 bit */
+#define MPPE_OPT_128        0x02    /* 128 bit */
+#define MPPE_OPT_STATEFUL   0x04    /* stateful mode */
 /* unsupported opts */
-#define MPPE_OPT_56		0x08	/* 56 bit */
-#define MPPE_OPT_MPPC		0x10	/* MPPC compression */
-#define MPPE_OPT_D		0x20	/* Unknown */
+#define MPPE_OPT_56     0x08    /* 56 bit */
+#define MPPE_OPT_MPPC       0x10    /* MPPC compression */
+#define MPPE_OPT_D      0x20    /* Unknown */
 #define MPPE_OPT_UNSUPPORTED (MPPE_OPT_56|MPPE_OPT_MPPC|MPPE_OPT_D)
-#define MPPE_OPT_UNKNOWN	0x40	/* Bits !defined in RFC 3078 were set */
+#define MPPE_OPT_UNKNOWN    0x40    /* Bits !defined in RFC 3078 were set */
 
 /*
  * This is not nice ... the alternative is a bitfield struct though.
@@ -66,70 +66,70 @@ extern "C" {
  * but then we have to do a lwip_htonl() all the time and/or we still need
  * to know which octet is which.
  */
-#define MPPE_C_BIT		0x01	/* MPPC */
-#define MPPE_D_BIT		0x10	/* Obsolete, usage unknown */
-#define MPPE_L_BIT		0x20	/* 40-bit */
-#define MPPE_S_BIT		0x40	/* 128-bit */
-#define MPPE_M_BIT		0x80	/* 56-bit, not supported */
-#define MPPE_H_BIT		0x01	/* Stateless (in a different byte) */
+#define MPPE_C_BIT      0x01    /* MPPC */
+#define MPPE_D_BIT      0x10    /* Obsolete, usage unknown */
+#define MPPE_L_BIT      0x20    /* 40-bit */
+#define MPPE_S_BIT      0x40    /* 128-bit */
+#define MPPE_M_BIT      0x80    /* 56-bit, not supported */
+#define MPPE_H_BIT      0x01    /* Stateless (in a different byte) */
 
 /* Does not include H bit; used for least significant octet only. */
 #define MPPE_ALL_BITS (MPPE_D_BIT|MPPE_L_BIT|MPPE_S_BIT|MPPE_M_BIT|MPPE_H_BIT)
 
 /* Build a CI from mppe opts (see RFC 3078) */
-#define MPPE_OPTS_TO_CI(opts, ci)		\
-    do {					\
-	u_char *ptr = ci; /* u_char[4] */	\
-						\
-	/* H bit */				\
-	if (opts & MPPE_OPT_STATEFUL)		\
-	    *ptr++ = 0x0;			\
-	else					\
-	    *ptr++ = MPPE_H_BIT;		\
-	*ptr++ = 0;				\
-	*ptr++ = 0;				\
-						\
-	/* S,L bits */				\
-	*ptr = 0;				\
-	if (opts & MPPE_OPT_128)		\
-	    *ptr |= MPPE_S_BIT;			\
-	if (opts & MPPE_OPT_40)			\
-	    *ptr |= MPPE_L_BIT;			\
-	/* M,D,C bits not supported */		\
+#define MPPE_OPTS_TO_CI(opts, ci)       \
+    do {                    \
+    u_char *ptr = ci; /* u_char[4] */   \
+                        \
+    /* H bit */             \
+    if (opts & MPPE_OPT_STATEFUL)       \
+        *ptr++ = 0x0;           \
+    else                    \
+        *ptr++ = MPPE_H_BIT;        \
+    *ptr++ = 0;             \
+    *ptr++ = 0;             \
+                        \
+    /* S,L bits */              \
+    *ptr = 0;               \
+    if (opts & MPPE_OPT_128)        \
+        *ptr |= MPPE_S_BIT;         \
+    if (opts & MPPE_OPT_40)         \
+        *ptr |= MPPE_L_BIT;         \
+    /* M,D,C bits not supported */      \
     } while (/* CONSTCOND */ 0)
 
 /* The reverse of the above */
-#define MPPE_CI_TO_OPTS(ci, opts)		\
-    do {					\
-	const u_char *ptr = ci; /* u_char[4] */	\
-						\
-	opts = 0;				\
-						\
-	/* H bit */				\
-	if (!(ptr[0] & MPPE_H_BIT))		\
-	    opts |= MPPE_OPT_STATEFUL;		\
-						\
-	/* S,L bits */				\
-	if (ptr[3] & MPPE_S_BIT)		\
-	    opts |= MPPE_OPT_128;		\
-	if (ptr[3] & MPPE_L_BIT)		\
-	    opts |= MPPE_OPT_40;		\
-						\
-	/* M,D,C bits */			\
-	if (ptr[3] & MPPE_M_BIT)		\
-	    opts |= MPPE_OPT_56;		\
-	if (ptr[3] & MPPE_D_BIT)		\
-	    opts |= MPPE_OPT_D;			\
-	if (ptr[3] & MPPE_C_BIT)		\
-	    opts |= MPPE_OPT_MPPC;		\
-						\
-	/* Other bits */			\
-	if (ptr[0] & ~MPPE_H_BIT)		\
-	    opts |= MPPE_OPT_UNKNOWN;		\
-	if (ptr[1] || ptr[2])			\
-	    opts |= MPPE_OPT_UNKNOWN;		\
-	if (ptr[3] & ~MPPE_ALL_BITS)		\
-	    opts |= MPPE_OPT_UNKNOWN;		\
+#define MPPE_CI_TO_OPTS(ci, opts)       \
+    do {                    \
+    const u_char *ptr = ci; /* u_char[4] */ \
+                        \
+    opts = 0;               \
+                        \
+    /* H bit */             \
+    if (!(ptr[0] & MPPE_H_BIT))     \
+        opts |= MPPE_OPT_STATEFUL;      \
+                        \
+    /* S,L bits */              \
+    if (ptr[3] & MPPE_S_BIT)        \
+        opts |= MPPE_OPT_128;       \
+    if (ptr[3] & MPPE_L_BIT)        \
+        opts |= MPPE_OPT_40;        \
+                        \
+    /* M,D,C bits */            \
+    if (ptr[3] & MPPE_M_BIT)        \
+        opts |= MPPE_OPT_56;        \
+    if (ptr[3] & MPPE_D_BIT)        \
+        opts |= MPPE_OPT_D;         \
+    if (ptr[3] & MPPE_C_BIT)        \
+        opts |= MPPE_OPT_MPPC;      \
+                        \
+    /* Other bits */            \
+    if (ptr[0] & ~MPPE_H_BIT)       \
+        opts |= MPPE_OPT_UNKNOWN;       \
+    if (ptr[1] || ptr[2])           \
+        opts |= MPPE_OPT_UNKNOWN;       \
+    if (ptr[3] & ~MPPE_ALL_BITS)        \
+        opts |= MPPE_OPT_UNKNOWN;       \
     } while (/* CONSTCOND */ 0)
 
 /* Shared MPPE padding between MSCHAP and MPPE */
@@ -152,18 +152,18 @@ static const u8_t mppe_sha1_pad2[SHA1_PAD_SIZE] = {
  * State for an MPPE (de)compressor.
  */
 typedef struct ppp_mppe_state {
-	lwip_arc4_context arc4;
-	u8_t master_key[MPPE_MAX_KEY_LEN];
-	u8_t session_key[MPPE_MAX_KEY_LEN];
-	u8_t keylen;                /* key length in bytes */
-	/* NB: 128-bit == 16, 40-bit == 8!
-	 * If we want to support 56-bit, the unit has to change to bits
-	 */
-	u8_t bits;                  /* MPPE control bits */
-	u16_t ccount;               /* 12-bit coherency count (seqno)  */
-	u16_t sanity_errors;        /* take down LCP if too many */
-	unsigned int stateful  :1;  /* stateful mode flag */
-	unsigned int discard   :1;  /* stateful mode packet loss flag */
+    lwip_arc4_context arc4;
+    u8_t master_key[MPPE_MAX_KEY_LEN];
+    u8_t session_key[MPPE_MAX_KEY_LEN];
+    u8_t keylen;                /* key length in bytes */
+    /* NB: 128-bit == 16, 40-bit == 8!
+     * If we want to support 56-bit, the unit has to change to bits
+     */
+    u8_t bits;                  /* MPPE control bits */
+    u16_t ccount;               /* 12-bit coherency count (seqno)  */
+    u16_t sanity_errors;        /* take down LCP if too many */
+    unsigned int stateful  :1;  /* stateful mode flag */
+    unsigned int discard   :1;  /* stateful mode packet loss flag */
 } ppp_mppe_state;
 
 void mppe_set_key(ppp_pcb *pcb, ppp_mppe_state *state, u8_t *key);
diff --git a/src/include/netif/ppp/polarssl/arc4.h b/src/include/netif/ppp/polarssl/arc4.h
index 4af724cd..91b08e67 100644
--- a/src/include/netif/ppp/polarssl/arc4.h
+++ b/src/include/netif/ppp/polarssl/arc4.h
@@ -10,7 +10,7 @@
  *  Redistribution and use in source and binary forms, with or without
  *  modification, are permitted provided that the following conditions
  *  are met:
- *  
+ *
  *    * Redistributions of source code must retain the above copyright
  *      notice, this list of conditions and the following disclaimer.
  *    * Redistributions in binary form must reproduce the above copyright
@@ -19,7 +19,7 @@
  *    * Neither the names of PolarSSL or XySSL nor the names of its contributors
  *      may be used to endorse or promote products derived from this software
  *      without specific prior written permission.
- *  
+ *
  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
diff --git a/src/include/netif/ppp/polarssl/des.h b/src/include/netif/ppp/polarssl/des.h
index e893890e..5e3a0851 100644
--- a/src/include/netif/ppp/polarssl/des.h
+++ b/src/include/netif/ppp/polarssl/des.h
@@ -10,7 +10,7 @@
  *  Redistribution and use in source and binary forms, with or without
  *  modification, are permitted provided that the following conditions
  *  are met:
- *  
+ *
  *    * Redistributions of source code must retain the above copyright
  *      notice, this list of conditions and the following disclaimer.
  *    * Redistributions in binary form must reproduce the above copyright
@@ -19,7 +19,7 @@
  *    * Neither the names of PolarSSL or XySSL nor the names of its contributors
  *      may be used to endorse or promote products derived from this software
  *      without specific prior written permission.
- *  
+ *
  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
diff --git a/src/include/netif/ppp/polarssl/md4.h b/src/include/netif/ppp/polarssl/md4.h
index 57044568..a4aa1dcc 100644
--- a/src/include/netif/ppp/polarssl/md4.h
+++ b/src/include/netif/ppp/polarssl/md4.h
@@ -10,7 +10,7 @@
  *  Redistribution and use in source and binary forms, with or without
  *  modification, are permitted provided that the following conditions
  *  are met:
- *  
+ *
  *    * Redistributions of source code must retain the above copyright
  *      notice, this list of conditions and the following disclaimer.
  *    * Redistributions in binary form must reproduce the above copyright
@@ -19,7 +19,7 @@
  *    * Neither the names of PolarSSL or XySSL nor the names of its contributors
  *      may be used to endorse or promote products derived from this software
  *      without specific prior written permission.
- *  
+ *
  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
diff --git a/src/include/netif/ppp/polarssl/md5.h b/src/include/netif/ppp/polarssl/md5.h
index 12440118..4d7b04d8 100644
--- a/src/include/netif/ppp/polarssl/md5.h
+++ b/src/include/netif/ppp/polarssl/md5.h
@@ -10,7 +10,7 @@
  *  Redistribution and use in source and binary forms, with or without
  *  modification, are permitted provided that the following conditions
  *  are met:
- *  
+ *
  *    * Redistributions of source code must retain the above copyright
  *      notice, this list of conditions and the following disclaimer.
  *    * Redistributions in binary form must reproduce the above copyright
@@ -19,7 +19,7 @@
  *    * Neither the names of PolarSSL or XySSL nor the names of its contributors
  *      may be used to endorse or promote products derived from this software
  *      without specific prior written permission.
- *  
+ *
  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
diff --git a/src/include/netif/ppp/polarssl/sha1.h b/src/include/netif/ppp/polarssl/sha1.h
index a4c53e07..d8f347c6 100644
--- a/src/include/netif/ppp/polarssl/sha1.h
+++ b/src/include/netif/ppp/polarssl/sha1.h
@@ -10,7 +10,7 @@
  *  Redistribution and use in source and binary forms, with or without
  *  modification, are permitted provided that the following conditions
  *  are met:
- *  
+ *
  *    * Redistributions of source code must retain the above copyright
  *      notice, this list of conditions and the following disclaimer.
  *    * Redistributions in binary form must reproduce the above copyright
@@ -19,7 +19,7 @@
  *    * Neither the names of PolarSSL or XySSL nor the names of its contributors
  *      may be used to endorse or promote products derived from this software
  *      without specific prior written permission.
- *  
+ *
  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
diff --git a/src/include/netif/ppp/ppp.h b/src/include/netif/ppp/ppp.h
index f93747fb..829f5599 100644
--- a/src/include/netif/ppp/ppp.h
+++ b/src/include/netif/ppp/ppp.h
@@ -7,13 +7,13 @@
 * The authors hereby grant permission to use, copy, modify, distribute,
 * and license this software and its documentation for any purpose, provided
 * that existing copyright notices are retained in all copies and that this
-* notice and the following disclaimer are included verbatim in any 
+* notice and the following disclaimer are included verbatim in any
 * distributions. No written agreement, license, or royalty fee is required
 * for any of the authorized uses.
 *
 * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
+* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 * IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
@@ -107,8 +107,8 @@ extern "C" {
 /*
  * The basic PPP frame.
  */
-#define PPP_HDRLEN	4	/* octets for standard ppp header */
-#define PPP_FCSLEN	2	/* octets for FCS */
+#define PPP_HDRLEN  4   /* octets for standard ppp header */
+#define PPP_FCSLEN  2   /* octets for FCS */
 
 /*
  * Values for phase.
diff --git a/src/include/netif/ppp/ppp_impl.h b/src/include/netif/ppp/ppp_impl.h
index 22828311..c770c1ad 100644
--- a/src/include/netif/ppp/ppp_impl.h
+++ b/src/include/netif/ppp/ppp_impl.h
@@ -68,18 +68,18 @@ extern "C" {
 /*
  * The basic PPP frame.
  */
-#define PPP_ADDRESS(p)	(((u_char *)(p))[0])
-#define PPP_CONTROL(p)	(((u_char *)(p))[1])
-#define PPP_PROTOCOL(p)	((((u_char *)(p))[2] << 8) + ((u_char *)(p))[3])
+#define PPP_ADDRESS(p)  (((u_char *)(p))[0])
+#define PPP_CONTROL(p)  (((u_char *)(p))[1])
+#define PPP_PROTOCOL(p) ((((u_char *)(p))[2] << 8) + ((u_char *)(p))[3])
 
 /*
  * Significant octet values.
  */
-#define	PPP_ALLSTATIONS	0xff	/* All-Stations broadcast address */
-#define	PPP_UI		0x03	/* Unnumbered Information */
-#define	PPP_FLAG	0x7e	/* Flag Sequence */
-#define	PPP_ESCAPE	0x7d	/* Asynchronous Control Escape */
-#define	PPP_TRANS	0x20	/* Asynchronous transparency modifier */
+#define PPP_ALLSTATIONS 0xff    /* All-Stations broadcast address */
+#define PPP_UI      0x03    /* Unnumbered Information */
+#define PPP_FLAG    0x7e    /* Flag Sequence */
+#define PPP_ESCAPE  0x7d    /* Asynchronous Control Escape */
+#define PPP_TRANS   0x20    /* Asynchronous transparency modifier */
 
 /*
  * PPP_DEFMRU: MRU value used prior negotiation and unless negotiated later.
@@ -91,51 +91,51 @@ extern "C" {
  * Protocol field values.
  */
 #if PPP_IPV4_SUPPORT
-#define PPP_IP		0x21	/* Internet Protocol */
+#define PPP_IP      0x21    /* Internet Protocol */
 #endif /* PPP_IPV4_SUPPORT */
 #if 0 /* UNUSED */
-#define PPP_AT		0x29	/* AppleTalk Protocol */
-#define PPP_IPX		0x2b	/* IPX protocol */
+#define PPP_AT      0x29    /* AppleTalk Protocol */
+#define PPP_IPX     0x2b    /* IPX protocol */
 #endif /* UNUSED */
 #if VJ_SUPPORT
-#define	PPP_VJC_COMP	0x2d	/* VJ compressed TCP */
-#define	PPP_VJC_UNCOMP	0x2f	/* VJ uncompressed TCP */
+#define PPP_VJC_COMP    0x2d    /* VJ compressed TCP */
+#define PPP_VJC_UNCOMP  0x2f    /* VJ uncompressed TCP */
 #endif /* VJ_SUPPORT */
 #if PPP_IPV6_SUPPORT
-#define PPP_IPV6	0x57	/* Internet Protocol Version 6 */
+#define PPP_IPV6    0x57    /* Internet Protocol Version 6 */
 #endif /* PPP_IPV6_SUPPORT */
 #if CCP_SUPPORT
-#define PPP_COMP	0xfd	/* compressed packet */
+#define PPP_COMP    0xfd    /* compressed packet */
 #endif /* CCP_SUPPORT */
-#define PPP_IPCP	0x8021	/* IP Control Protocol */
+#define PPP_IPCP    0x8021  /* IP Control Protocol */
 #if 0 /* UNUSED */
-#define PPP_ATCP	0x8029	/* AppleTalk Control Protocol */
-#define PPP_IPXCP	0x802b	/* IPX Control Protocol */
+#define PPP_ATCP    0x8029  /* AppleTalk Control Protocol */
+#define PPP_IPXCP   0x802b  /* IPX Control Protocol */
 #endif /* UNUSED */
 #if PPP_IPV6_SUPPORT
-#define PPP_IPV6CP	0x8057	/* IPv6 Control Protocol */
+#define PPP_IPV6CP  0x8057  /* IPv6 Control Protocol */
 #endif /* PPP_IPV6_SUPPORT */
 #if CCP_SUPPORT
-#define PPP_CCP		0x80fd	/* Compression Control Protocol */
+#define PPP_CCP     0x80fd  /* Compression Control Protocol */
 #endif /* CCP_SUPPORT */
 #if ECP_SUPPORT
-#define PPP_ECP		0x8053	/* Encryption Control Protocol */
+#define PPP_ECP     0x8053  /* Encryption Control Protocol */
 #endif /* ECP_SUPPORT */
-#define PPP_LCP		0xc021	/* Link Control Protocol */
+#define PPP_LCP     0xc021  /* Link Control Protocol */
 #if PAP_SUPPORT
-#define PPP_PAP		0xc023	/* Password Authentication Protocol */
+#define PPP_PAP     0xc023  /* Password Authentication Protocol */
 #endif /* PAP_SUPPORT */
 #if LQR_SUPPORT
-#define PPP_LQR		0xc025	/* Link Quality Report protocol */
+#define PPP_LQR     0xc025  /* Link Quality Report protocol */
 #endif /* LQR_SUPPORT */
 #if CHAP_SUPPORT
-#define PPP_CHAP	0xc223	/* Cryptographic Handshake Auth. Protocol */
+#define PPP_CHAP    0xc223  /* Cryptographic Handshake Auth. Protocol */
 #endif /* CHAP_SUPPORT */
 #if CBCP_SUPPORT
-#define PPP_CBCP	0xc029	/* Callback Control Protocol */
+#define PPP_CBCP    0xc029  /* Callback Control Protocol */
 #endif /* CBCP_SUPPORT */
 #if EAP_SUPPORT
-#define PPP_EAP		0xc227	/* Extensible Authentication Protocol */
+#define PPP_EAP     0xc227  /* Extensible Authentication Protocol */
 #endif /* EAP_SUPPORT */
 
 /*
@@ -167,59 +167,59 @@ struct link_callbacks {
  * What to do with network protocol (NP) packets.
  */
 enum NPmode {
-    NPMODE_PASS,		/* pass the packet through */
-    NPMODE_DROP,		/* silently drop the packet */
-    NPMODE_ERROR,		/* return an error */
-    NPMODE_QUEUE		/* save it up for later. */
+    NPMODE_PASS,        /* pass the packet through */
+    NPMODE_DROP,        /* silently drop the packet */
+    NPMODE_ERROR,       /* return an error */
+    NPMODE_QUEUE        /* save it up for later. */
 };
 
 /*
  * Statistics.
  */
 #if PPP_STATS_SUPPORT
-struct pppstat	{
-    unsigned int ppp_ibytes;	/* bytes received */
-    unsigned int ppp_ipackets;	/* packets received */
-    unsigned int ppp_ierrors;	/* receive errors */
-    unsigned int ppp_obytes;	/* bytes sent */
-    unsigned int ppp_opackets;	/* packets sent */
-    unsigned int ppp_oerrors;	/* transmit errors */
+struct pppstat  {
+    unsigned int ppp_ibytes;    /* bytes received */
+    unsigned int ppp_ipackets;  /* packets received */
+    unsigned int ppp_ierrors;   /* receive errors */
+    unsigned int ppp_obytes;    /* bytes sent */
+    unsigned int ppp_opackets;  /* packets sent */
+    unsigned int ppp_oerrors;   /* transmit errors */
 };
 
 #if VJ_SUPPORT
 struct vjstat {
-    unsigned int vjs_packets;	/* outbound packets */
+    unsigned int vjs_packets;   /* outbound packets */
     unsigned int vjs_compressed; /* outbound compressed packets */
-    unsigned int vjs_searches;	/* searches for connection state */
-    unsigned int vjs_misses;	/* times couldn't find conn. state */
+    unsigned int vjs_searches;  /* searches for connection state */
+    unsigned int vjs_misses;    /* times couldn't find conn. state */
     unsigned int vjs_uncompressedin; /* inbound uncompressed packets */
     unsigned int vjs_compressedin; /* inbound compressed packets */
-    unsigned int vjs_errorin;	/* inbound unknown type packets */
-    unsigned int vjs_tossed;	/* inbound packets tossed because of error */
+    unsigned int vjs_errorin;   /* inbound unknown type packets */
+    unsigned int vjs_tossed;    /* inbound packets tossed because of error */
 };
 #endif /* VJ_SUPPORT */
 
 struct ppp_stats {
-    struct pppstat p;		/* basic PPP statistics */
+    struct pppstat p;       /* basic PPP statistics */
 #if VJ_SUPPORT
-    struct vjstat vj;		/* VJ header compression statistics */
+    struct vjstat vj;       /* VJ header compression statistics */
 #endif /* VJ_SUPPORT */
 };
 
 #if CCP_SUPPORT
 struct compstat {
-    unsigned int unc_bytes;	/* total uncompressed bytes */
-    unsigned int unc_packets;	/* total uncompressed packets */
-    unsigned int comp_bytes;	/* compressed bytes */
-    unsigned int comp_packets;	/* compressed packets */
-    unsigned int inc_bytes;	/* incompressible bytes */
-    unsigned int inc_packets;	/* incompressible packets */
-    unsigned int ratio;		/* recent compression ratio << 8 */
+    unsigned int unc_bytes; /* total uncompressed bytes */
+    unsigned int unc_packets;   /* total uncompressed packets */
+    unsigned int comp_bytes;    /* compressed bytes */
+    unsigned int comp_packets;  /* compressed packets */
+    unsigned int inc_bytes; /* incompressible bytes */
+    unsigned int inc_packets;   /* incompressible packets */
+    unsigned int ratio;     /* recent compression ratio << 8 */
 };
 
 struct ppp_comp_stats {
-    struct compstat c;		/* packet compression statistics */
-    struct compstat d;		/* packet decompression statistics */
+    struct compstat c;      /* packet compression statistics */
+    struct compstat d;      /* packet decompression statistics */
 };
 #endif /* CCP_SUPPORT */
 
@@ -231,37 +231,37 @@ struct ppp_comp_stats {
  * the last NP packet was sent or received.
  */
 struct ppp_idle {
-    time_t xmit_idle;		/* time since last NP packet sent */
-    time_t recv_idle;		/* time since last NP packet received */
+    time_t xmit_idle;       /* time since last NP packet sent */
+    time_t recv_idle;       /* time since last NP packet received */
 };
 #endif /* PPP_IDLETIMELIMIT */
 
 /* values for epdisc.class */
-#define EPD_NULL	0	/* null discriminator, no data */
-#define EPD_LOCAL	1
-#define EPD_IP		2
-#define EPD_MAC		3
-#define EPD_MAGIC	4
-#define EPD_PHONENUM	5
+#define EPD_NULL    0   /* null discriminator, no data */
+#define EPD_LOCAL   1
+#define EPD_IP      2
+#define EPD_MAC     3
+#define EPD_MAGIC   4
+#define EPD_PHONENUM    5
 
 /*
  * Global variables.
  */
 #ifdef HAVE_MULTILINK
-extern u8_t	multilink;	/* enable multilink operation */
-extern u8_t	doing_multilink;
-extern u8_t	multilink_master;
-extern u8_t	bundle_eof;
-extern u8_t	bundle_terminating;
+extern u8_t multilink;  /* enable multilink operation */
+extern u8_t doing_multilink;
+extern u8_t multilink_master;
+extern u8_t bundle_eof;
+extern u8_t bundle_terminating;
 #endif
 
 #ifdef MAXOCTETS
-extern unsigned int maxoctets;	     /* Maximum octetes per session (in bytes) */
+extern unsigned int maxoctets;       /* Maximum octetes per session (in bytes) */
 extern int       maxoctets_dir;      /* Direction :
-				      0 - in+out (default)
-				      1 - in
-				      2 - out
-				      3 - max(in,out) */
+                      0 - in+out (default)
+                      1 - in
+                      2 - out
+                      3 - max(in,out) */
 extern int       maxoctets_timeout;  /* Timeout for check of octets limit */
 #define PPP_OCTETS_DIRECTION_SUM        0
 #define PPP_OCTETS_DIRECTION_IN         1
@@ -281,7 +281,7 @@ extern int       maxoctets_timeout;  /* Timeout for check of octets limit */
  * for a particular protocol.
  */
 struct protent {
-    u_short protocol;		/* PPP protocol number */
+    u_short protocol;       /* PPP protocol number */
     /* Initialization procedure */
     void (*init) (ppp_pcb *pcb);
     /* Process a received packet */
@@ -299,19 +299,19 @@ struct protent {
 #if PRINTPKT_SUPPORT
     /* Print a packet in readable form */
     int  (*printpkt) (const u_char *pkt, int len,
-			  void (*printer) (void *, const char *, ...),
-			  void *arg);
+              void (*printer) (void *, const char *, ...),
+              void *arg);
 #endif /* PRINTPKT_SUPPORT */
 #if PPP_DATAINPUT
     /* Process a received data packet */
     void (*datainput) (ppp_pcb *pcb, u_char *pkt, int len);
 #endif /* PPP_DATAINPUT */
 #if PRINTPKT_SUPPORT
-    const char *name;		/* Text name of protocol */
-    const char *data_name;	/* Text name of corresponding data protocol */
+    const char *name;       /* Text name of protocol */
+    const char *data_name;  /* Text name of corresponding data protocol */
 #endif /* PRINTPKT_SUPPORT */
 #if PPP_OPTIONS
-    option_t *options;		/* List of command-line options */
+    option_t *options;      /* List of command-line options */
     /* Check requested options, assign defaults */
     void (*check_options) (void);
 #endif /* PPP_OPTIONS */
@@ -329,28 +329,28 @@ extern const struct protent* const protocols[];
 
 /* Values for auth_pending, auth_done */
 #if PAP_SUPPORT
-#define PAP_WITHPEER	0x1
-#define PAP_PEER	0x2
+#define PAP_WITHPEER    0x1
+#define PAP_PEER    0x2
 #endif /* PAP_SUPPORT */
 #if CHAP_SUPPORT
-#define CHAP_WITHPEER	0x4
-#define CHAP_PEER	0x8
+#define CHAP_WITHPEER   0x4
+#define CHAP_PEER   0x8
 #endif /* CHAP_SUPPORT */
 #if EAP_SUPPORT
-#define EAP_WITHPEER	0x10
-#define EAP_PEER	0x20
+#define EAP_WITHPEER    0x10
+#define EAP_PEER    0x20
 #endif /* EAP_SUPPORT */
 
 /* Values for auth_done only */
 #if CHAP_SUPPORT
-#define CHAP_MD5_WITHPEER	0x40
-#define CHAP_MD5_PEER		0x80
+#define CHAP_MD5_WITHPEER   0x40
+#define CHAP_MD5_PEER       0x80
 #if MSCHAP_SUPPORT
-#define CHAP_MS_SHIFT		8	/* LSB position for MS auths */
-#define CHAP_MS_WITHPEER	0x100
-#define CHAP_MS_PEER		0x200
-#define CHAP_MS2_WITHPEER	0x400
-#define CHAP_MS2_PEER		0x800
+#define CHAP_MS_SHIFT       8   /* LSB position for MS auths */
+#define CHAP_MS_WITHPEER    0x100
+#define CHAP_MS_PEER        0x200
+#define CHAP_MS2_WITHPEER   0x400
+#define CHAP_MS2_PEER       0x800
 #endif /* MSCHAP_SUPPORT */
 #endif /* CHAP_SUPPORT */
 
@@ -372,10 +372,10 @@ extern const struct protent* const protocols[];
  * PPP statistics structure
  */
 struct pppd_stats {
-    unsigned int	bytes_in;
-    unsigned int	bytes_out;
-    unsigned int	pkts_in;
-    unsigned int	pkts_out;
+    unsigned int    bytes_in;
+    unsigned int    bytes_out;
+    unsigned int    pkts_in;
+    unsigned int    pkts_out;
 };
 #endif /* PPP_STATS_SUPPORT */
 
@@ -384,7 +384,7 @@ struct pppd_stats {
  * PPP private functions
  */
 
- 
+
 /*
  * Functions called from lwIP core.
  */
@@ -502,34 +502,34 @@ void update_link_stats(int u); /* Get stats at link termination */
  * cp MUST be u_char *.
  */
 #define GETCHAR(c, cp) { \
-	(c) = *(cp)++; \
+    (c) = *(cp)++; \
 }
 #define PUTCHAR(c, cp) { \
-	*(cp)++ = (u_char) (c); \
+    *(cp)++ = (u_char) (c); \
 }
 #define GETSHORT(s, cp) { \
-	(s) = *(cp)++ << 8; \
-	(s) |= *(cp)++; \
+    (s) = *(cp)++ << 8; \
+    (s) |= *(cp)++; \
 }
 #define PUTSHORT(s, cp) { \
-	*(cp)++ = (u_char) ((s) >> 8); \
-	*(cp)++ = (u_char) (s); \
+    *(cp)++ = (u_char) ((s) >> 8); \
+    *(cp)++ = (u_char) (s); \
 }
 #define GETLONG(l, cp) { \
-	(l) = *(cp)++ << 8; \
-	(l) |= *(cp)++; (l) <<= 8; \
-	(l) |= *(cp)++; (l) <<= 8; \
-	(l) |= *(cp)++; \
+    (l) = *(cp)++ << 8; \
+    (l) |= *(cp)++; (l) <<= 8; \
+    (l) |= *(cp)++; (l) <<= 8; \
+    (l) |= *(cp)++; \
 }
 #define PUTLONG(l, cp) { \
-	*(cp)++ = (u_char) ((l) >> 24); \
-	*(cp)++ = (u_char) ((l) >> 16); \
-	*(cp)++ = (u_char) ((l) >> 8); \
-	*(cp)++ = (u_char) (l); \
+    *(cp)++ = (u_char) ((l) >> 24); \
+    *(cp)++ = (u_char) ((l) >> 16); \
+    *(cp)++ = (u_char) ((l) >> 8); \
+    *(cp)++ = (u_char) (l); \
 }
 
-#define INCPTR(n, cp)	((cp) += (n))
-#define DECPTR(n, cp)	((cp) -= (n))
+#define INCPTR(n, cp)   ((cp) += (n))
+#define DECPTR(n, cp)   ((cp) -= (n))
 
 /*
  * System dependent definitions for user-level 4.3BSD UNIX implementation.
@@ -538,10 +538,10 @@ void update_link_stats(int u); /* Get stats at link termination */
 #define TIMEOUTMS(f, a, t)      do { sys_untimeout((f), (a)); sys_timeout((t), (f), (a)); } while(0)
 #define UNTIMEOUT(f, a)         sys_untimeout((f), (a))
 
-#define BZERO(s, n)		memset(s, 0, n)
-#define	BCMP(s1, s2, l)		memcmp(s1, s2, l)
+#define BZERO(s, n)     memset(s, 0, n)
+#define BCMP(s1, s2, l)     memcmp(s1, s2, l)
 
-#define PRINTMSG(m, l)		{ ppp_info(("Remote message: %0.*v", l, m)); }
+#define PRINTMSG(m, l)      { ppp_info(("Remote message: %0.*v", l, m)); }
 
 /*
  * MAKEHEADER - Add Header fields to a packet.
@@ -554,7 +554,7 @@ void update_link_stats(int u); /* Get stats at link termination */
 /* Procedures exported from auth.c */
 void link_required(ppp_pcb *pcb);     /* we are starting to use the link */
 void link_terminated(ppp_pcb *pcb);   /* we are finished with the link */
-void link_down(ppp_pcb *pcb);	      /* the LCP layer has left the Opened state */
+void link_down(ppp_pcb *pcb);         /* the LCP layer has left the Opened state */
 void upper_layers_down(ppp_pcb *pcb); /* take all NCPs down */
 void link_established(ppp_pcb *pcb);  /* the link is up; authenticate now */
 void start_networks(ppp_pcb *pcb);    /* start all the network control protos */
@@ -564,21 +564,21 @@ void continue_networks(ppp_pcb *pcb); /* start network [ip, etc] control protos
 int auth_check_passwd(ppp_pcb *pcb, char *auser, unsigned int userlen, char *apasswd, unsigned int passwdlen, const char **msg, int *msglen);
                                 /* check the user name and passwd against configuration */
 void auth_peer_fail(ppp_pcb *pcb, int protocol);
-				/* peer failed to authenticate itself */
+                /* peer failed to authenticate itself */
 void auth_peer_success(ppp_pcb *pcb, int protocol, int prot_flavor, const char *name, int namelen);
-				/* peer successfully authenticated itself */
+                /* peer successfully authenticated itself */
 #endif /* PPP_SERVER */
 void auth_withpeer_fail(ppp_pcb *pcb, int protocol);
-				/* we failed to authenticate ourselves */
+                /* we failed to authenticate ourselves */
 void auth_withpeer_success(ppp_pcb *pcb, int protocol, int prot_flavor);
-				/* we successfully authenticated ourselves */
+                /* we successfully authenticated ourselves */
 #endif /* PPP_AUTH_SUPPORT */
 void np_up(ppp_pcb *pcb, int proto);    /* a network protocol has come up */
 void np_down(ppp_pcb *pcb, int proto);  /* a network protocol has gone down */
 void np_finished(ppp_pcb *pcb, int proto); /* a network protocol no longer needs link */
 #if PPP_AUTH_SUPPORT
 int get_secret(ppp_pcb *pcb, const char *client, const char *server, char *secret, int *secret_len, int am_server);
-				/* get "secret" for chap */
+                /* get "secret" for chap */
 #endif /* PPP_AUTH_SUPPORT */
 
 /* Procedures exported from ipcp.c */
@@ -586,8 +586,8 @@ int get_secret(ppp_pcb *pcb, const char *client, const char *server, char *secre
 
 /* Procedures exported from demand.c */
 #if DEMAND_SUPPORT
-void demand_conf (void);	/* config interface(s) for demand-dial */
-void demand_block (void);	/* set all NPs to queue up packets */
+void demand_conf (void);    /* config interface(s) for demand-dial */
+void demand_block (void);   /* set all NPs to queue up packets */
 void demand_unblock (void); /* set all NPs to pass packets */
 void demand_discard (void); /* set all NPs to discard packets */
 void demand_rexmit (int, u32_t); /* retransmit saved frames for an NP*/
@@ -604,10 +604,10 @@ void mp_bundle_terminated (void);
 char *epdisc_to_str (struct epdisc *); /* string from endpoint discrim. */
 int  str_to_epdisc (struct epdisc *, char *); /* endpt disc. from str */
 #else
-#define mp_bundle_terminated()	/* nothing */
-#define mp_exit_bundle()	/* nothing */
-#define doing_multilink		0
-#define multilink_master	0
+#define mp_bundle_terminated()  /* nothing */
+#define mp_exit_bundle()    /* nothing */
+#define doing_multilink     0
+#define multilink_master    0
 #endif
 
 /* Procedures exported from utils.c. */
diff --git a/src/include/netif/ppp/pppcrypt.h b/src/include/netif/ppp/pppcrypt.h
index c0230bbc..2531ee0a 100644
--- a/src/include/netif/ppp/pppcrypt.h
+++ b/src/include/netif/ppp/pppcrypt.h
@@ -36,7 +36,7 @@
 /* This header file is included in all PPP modules needing hashes and/or ciphers */
 
 #ifndef PPPCRYPT_H
-#define	PPPCRYPT_H
+#define PPPCRYPT_H
 
 /*
  * If included PolarSSL copy is not used, user is expected to include
diff --git a/src/include/netif/ppp/pppdebug.h b/src/include/netif/ppp/pppdebug.h
index 36ee4f9b..5e6741bf 100644
--- a/src/include/netif/ppp/pppdebug.h
+++ b/src/include/netif/ppp/pppdebug.h
@@ -8,13 +8,13 @@
 * The authors hereby grant permission to use, copy, modify, distribute,
 * and license this software and its documentation for any purpose, provided
 * that existing copyright notices are retained in all copies and that this
-* notice and the following disclaimer are included verbatim in any 
+* notice and the following disclaimer are included verbatim in any
 * distributions. No written agreement, license, or royalty fee is required
 * for any of the authorized uses.
 *
 * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
+* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 * IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
diff --git a/src/include/netif/ppp/pppoe.h b/src/include/netif/ppp/pppoe.h
index 8994d38c..acdd3eae 100644
--- a/src/include/netif/ppp/pppoe.h
+++ b/src/include/netif/ppp/pppoe.h
@@ -6,13 +6,13 @@
 * The authors hereby grant permission to use, copy, modify, distribute,
 * and license this software and its documentation for any purpose, provided
 * that existing copyright notices are retained in all copies and that this
-* notice and the following disclaimer are included verbatim in any 
+* notice and the following disclaimer are included verbatim in any
 * distributions. No written agreement, license, or royalty fee is required
 * for any of the authorized uses.
 *
 * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
+* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 * IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
diff --git a/src/include/netif/ppp/upap.h b/src/include/netif/ppp/upap.h
index 540d9814..caf81939 100644
--- a/src/include/netif/ppp/upap.h
+++ b/src/include/netif/ppp/upap.h
@@ -57,44 +57,44 @@ extern "C" {
 /*
  * Packet header = Code, id, length.
  */
-#define UPAP_HEADERLEN	4
+#define UPAP_HEADERLEN  4
 
 
 /*
  * UPAP codes.
  */
-#define UPAP_AUTHREQ	1	/* Authenticate-Request */
-#define UPAP_AUTHACK	2	/* Authenticate-Ack */
-#define UPAP_AUTHNAK	3	/* Authenticate-Nak */
+#define UPAP_AUTHREQ    1   /* Authenticate-Request */
+#define UPAP_AUTHACK    2   /* Authenticate-Ack */
+#define UPAP_AUTHNAK    3   /* Authenticate-Nak */
 
 
 /*
  * Client states.
  */
-#define UPAPCS_INITIAL	0	/* Connection down */
-#define UPAPCS_CLOSED	1	/* Connection up, haven't requested auth */
-#define UPAPCS_PENDING	2	/* Connection down, have requested auth */
-#define UPAPCS_AUTHREQ	3	/* We've sent an Authenticate-Request */
-#define UPAPCS_OPEN	4	/* We've received an Ack */
-#define UPAPCS_BADAUTH	5	/* We've received a Nak */
+#define UPAPCS_INITIAL  0   /* Connection down */
+#define UPAPCS_CLOSED   1   /* Connection up, haven't requested auth */
+#define UPAPCS_PENDING  2   /* Connection down, have requested auth */
+#define UPAPCS_AUTHREQ  3   /* We've sent an Authenticate-Request */
+#define UPAPCS_OPEN 4   /* We've received an Ack */
+#define UPAPCS_BADAUTH  5   /* We've received a Nak */
 
 /*
  * Server states.
  */
-#define UPAPSS_INITIAL	0	/* Connection down */
-#define UPAPSS_CLOSED	1	/* Connection up, haven't requested auth */
-#define UPAPSS_PENDING	2	/* Connection down, have requested auth */
-#define UPAPSS_LISTEN	3	/* Listening for an Authenticate */
-#define UPAPSS_OPEN	4	/* We've sent an Ack */
-#define UPAPSS_BADAUTH	5	/* We've sent a Nak */
+#define UPAPSS_INITIAL  0   /* Connection down */
+#define UPAPSS_CLOSED   1   /* Connection up, haven't requested auth */
+#define UPAPSS_PENDING  2   /* Connection down, have requested auth */
+#define UPAPSS_LISTEN   3   /* Listening for an Authenticate */
+#define UPAPSS_OPEN 4   /* We've sent an Ack */
+#define UPAPSS_BADAUTH  5   /* We've sent a Nak */
 
 
 /*
  * Timeouts.
  */
 #if 0 /* moved to ppp_opts.h */
-#define UPAP_DEFTIMEOUT	3	/* Timeout (seconds) for retransmitting req */
-#define UPAP_DEFREQTIME	30	/* Time to wait for auth-req from peer */
+#define UPAP_DEFTIMEOUT 3   /* Timeout (seconds) for retransmitting req */
+#define UPAP_DEFREQTIME 30  /* Time to wait for auth-req from peer */
 #endif /* moved to ppp_opts.h */
 
 /*
@@ -102,16 +102,16 @@ extern "C" {
  */
 #if PAP_SUPPORT
 typedef struct upap_state {
-    const char *us_user;	/* User */
-    u8_t us_userlen;		/* User length */
-    const char *us_passwd;	/* Password */
-    u8_t us_passwdlen;		/* Password length */
-    u8_t us_clientstate;	/* Client state */
+    const char *us_user;    /* User */
+    u8_t us_userlen;        /* User length */
+    const char *us_passwd;  /* Password */
+    u8_t us_passwdlen;      /* Password length */
+    u8_t us_clientstate;    /* Client state */
 #if PPP_SERVER
-    u8_t us_serverstate;	/* Server state */
+    u8_t us_serverstate;    /* Server state */
 #endif /* PPP_SERVER */
-    u8_t us_id;		        /* Current id */
-    u8_t us_transmits;		/* Number of auth-reqs sent */
+    u8_t us_id;             /* Current id */
+    u8_t us_transmits;      /* Number of auth-reqs sent */
 } upap_state;
 #endif /* PAP_SUPPORT */
 
diff --git a/src/netif/ppp/auth.c b/src/netif/ppp/auth.c
index 3e174187..99e4b2ec 100644
--- a/src/netif/ppp/auth.c
+++ b/src/netif/ppp/auth.c
@@ -133,10 +133,10 @@
 
 #if 0 /* UNUSED */
 /* Bits in scan_authfile return value */
-#define NONWILD_SERVER	1
-#define NONWILD_CLIENT	2
+#define NONWILD_SERVER  1
+#define NONWILD_CLIENT  2
 
-#define ISWILD(word)	(word[0] == '*' && word[1] == 0)
+#define ISWILD(word)    (word[0] == '*' && word[1] == 0)
 #endif /* UNUSED */
 
 #if 0 /* UNUSED */
@@ -169,8 +169,8 @@ int (*pap_check_hook) (void) = NULL;
 
 /* Hook for a plugin to check the PAP user and password */
 int (*pap_auth_hook) (char *user, char *passwd, char **msgp,
-			  struct wordlist **paddrs,
-			  struct wordlist **popts) = NULL;
+              struct wordlist **paddrs,
+              struct wordlist **popts) = NULL;
 
 /* Hook for a plugin to know about the PAP user logout */
 void (*pap_logout_hook) (void) = NULL;
@@ -187,7 +187,7 @@ int (*chap_passwd_hook) (char *user, char *passwd) = NULL;
 /* Hook for a plugin to say whether it is OK if the peer
    refuses to authenticate. */
 int (*null_auth_hook) (struct wordlist **paddrs,
-			   struct wordlist **popts) = NULL;
+               struct wordlist **popts) = NULL;
 
 int (*allowed_address_hook) (u32_t addr) = NULL;
 #endif /* UNUSED */
@@ -210,27 +210,27 @@ struct notifier *link_down_notifier = NULL;
  * Option variables.
  */
 #if 0 /* MOVED TO ppp_settings */
-bool uselogin = 0;		/* Use /etc/passwd for checking PAP */
-bool session_mgmt = 0;		/* Do session management (login records) */
-bool cryptpap = 0;		/* Passwords in pap-secrets are encrypted */
-bool refuse_pap = 0;		/* Don't wanna auth. ourselves with PAP */
-bool refuse_chap = 0;		/* Don't wanna auth. ourselves with CHAP */
-bool refuse_eap = 0;		/* Don't wanna auth. ourselves with EAP */
+bool uselogin = 0;      /* Use /etc/passwd for checking PAP */
+bool session_mgmt = 0;      /* Do session management (login records) */
+bool cryptpap = 0;      /* Passwords in pap-secrets are encrypted */
+bool refuse_pap = 0;        /* Don't wanna auth. ourselves with PAP */
+bool refuse_chap = 0;       /* Don't wanna auth. ourselves with CHAP */
+bool refuse_eap = 0;        /* Don't wanna auth. ourselves with EAP */
 #if MSCHAP_SUPPORT
-bool refuse_mschap = 0;		/* Don't wanna auth. ourselves with MS-CHAP */
-bool refuse_mschap_v2 = 0;	/* Don't wanna auth. ourselves with MS-CHAPv2 */
+bool refuse_mschap = 0;     /* Don't wanna auth. ourselves with MS-CHAP */
+bool refuse_mschap_v2 = 0;  /* Don't wanna auth. ourselves with MS-CHAPv2 */
 #else /* MSCHAP_SUPPORT */
-bool refuse_mschap = 1;		/* Don't wanna auth. ourselves with MS-CHAP */
-bool refuse_mschap_v2 = 1;	/* Don't wanna auth. ourselves with MS-CHAPv2 */
+bool refuse_mschap = 1;     /* Don't wanna auth. ourselves with MS-CHAP */
+bool refuse_mschap_v2 = 1;  /* Don't wanna auth. ourselves with MS-CHAPv2 */
 #endif /* MSCHAP_SUPPORT */
-bool usehostname = 0;		/* Use hostname for our_name */
-bool auth_required = 0;		/* Always require authentication from peer */
-bool allow_any_ip = 0;		/* Allow peer to use any IP address */
-bool explicit_remote = 0;	/* User specified explicit remote name */
-bool explicit_user = 0;		/* Set if "user" option supplied */
-bool explicit_passwd = 0;	/* Set if "password" option supplied */
-char remote_name[MAXNAMELEN];	/* Peer's name for authentication */
-static char *uafname;		/* name of most recent +ua file */
+bool usehostname = 0;       /* Use hostname for our_name */
+bool auth_required = 0;     /* Always require authentication from peer */
+bool allow_any_ip = 0;      /* Allow peer to use any IP address */
+bool explicit_remote = 0;   /* User specified explicit remote name */
+bool explicit_user = 0;     /* Set if "user" option supplied */
+bool explicit_passwd = 0;   /* Set if "password" option supplied */
+char remote_name[MAXNAMELEN];   /* Peer's name for authentication */
+static char *uafname;       /* name of most recent +ua file */
 
 extern char *crypt (const char *, const char *);
 #endif /* UNUSED */
@@ -252,8 +252,8 @@ static int  have_srp_secret (char *client, char *server, int need_ip,
     int *lacks_ipp);
 static int  ip_addr_check (u32_t, struct permitted_ip *);
 static int  scan_authfile (FILE *, char *, char *, char *,
-			       struct wordlist **, struct wordlist **,
-			       char *, int);
+                   struct wordlist **, struct wordlist **,
+                   char *, int);
 static void free_wordlist (struct wordlist *);
 static void set_allowed_addrs (int, struct wordlist *, struct wordlist *);
 static int  some_ip_ok (struct wordlist *);
@@ -427,46 +427,46 @@ setupapfile(argv)
     /* open user info file */
     fname = strdup(*argv);
     if (fname == NULL)
-	novm("+ua file name");
+    novm("+ua file name");
     euid = geteuid();
     if (seteuid(getuid()) == -1) {
-	option_error("unable to reset uid before opening %s: %m", fname);
-	return 0;
+    option_error("unable to reset uid before opening %s: %m", fname);
+    return 0;
     }
     ufile = fopen(fname, "r");
     if (seteuid(euid) == -1)
-	fatal("unable to regain privileges: %m");
+    fatal("unable to regain privileges: %m");
     if (ufile == NULL) {
-	option_error("unable to open user login data file %s", fname);
-	return 0;
+    option_error("unable to open user login data file %s", fname);
+    return 0;
     }
     check_access(ufile, fname);
     uafname = fname;
 
     /* get username */
     if (fgets(u, MAXNAMELEN - 1, ufile) == NULL
-	|| fgets(p, MAXSECRETLEN - 1, ufile) == NULL) {
-	fclose(ufile);
-	option_error("unable to read user login data file %s", fname);
-	return 0;
+    || fgets(p, MAXSECRETLEN - 1, ufile) == NULL) {
+    fclose(ufile);
+    option_error("unable to read user login data file %s", fname);
+    return 0;
     }
     fclose(ufile);
 
     /* get rid of newlines */
     l = strlen(u);
     if (l > 0 && u[l-1] == '\n')
-	u[l-1] = 0;
+    u[l-1] = 0;
     l = strlen(p);
     if (l > 0 && p[l-1] == '\n')
-	p[l-1] = 0;
+    p[l-1] = 0;
 
     if (override_value("user", option_priority, fname)) {
-	strlcpy(ppp_settings.user, u, sizeof(ppp_settings.user));
-	explicit_user = 1;
+    strlcpy(ppp_settings.user, u, sizeof(ppp_settings.user));
+    explicit_user = 1;
     }
     if (override_value("passwd", option_priority, fname)) {
-	strlcpy(ppp_settings.passwd, p, sizeof(ppp_settings.passwd));
-	explicit_passwd = 1;
+    strlcpy(ppp_settings.passwd, p, sizeof(ppp_settings.passwd));
+    explicit_passwd = 1;
     }
 
     return (1);
@@ -484,14 +484,14 @@ privgroup(argv)
 
     g = getgrnam(*argv);
     if (g == 0) {
-	option_error("group %s is unknown", *argv);
-	return 0;
+    option_error("group %s is unknown", *argv);
+    return 0;
     }
     for (i = 0; i < ngroups; ++i) {
-	if (groups[i] == g->gr_gid) {
-	    privileged = 1;
-	    break;
-	}
+    if (groups[i] == g->gr_gid) {
+        privileged = 1;
+        break;
+    }
     }
     return 1;
 }
@@ -511,7 +511,7 @@ set_noauth_addr(argv)
 
     wp = (struct wordlist *) malloc(sizeof(struct wordlist) + l);
     if (wp == NULL)
-	novm("allow-ip argument");
+    novm("allow-ip argument");
     wp->word = (char *) (wp + 1);
     wp->next = noauth_addrs;
     MEMCPY(wp->word, addr, l);
@@ -533,7 +533,7 @@ set_permitted_number(argv)
 
     wp = (struct wordlist *) malloc(sizeof(struct wordlist) + l);
     if (wp == NULL)
-	novm("allow-number argument");
+    novm("allow-number argument");
     wp->word = (char *) (wp + 1);
     wp->next = permitted_numbers;
     MEMCPY(wp->word, number, l);
@@ -566,7 +566,7 @@ void start_link(unit)
     devfd = the_channel->connect();
     msg = "Connect script failed";
     if (devfd < 0)
-	goto fail;
+    goto fail;
 
     /* set up the serial device as a ppp interface */
     /*
@@ -579,21 +579,21 @@ void start_link(unit)
     fd_ppp = the_channel->establish_ppp(devfd);
     msg = "ppp establishment failed";
     if (fd_ppp < 0) {
-	status = EXIT_FATAL_ERROR;
-	goto disconnect;
+    status = EXIT_FATAL_ERROR;
+    goto disconnect;
     }
 
     if (!demand && ifunit >= 0)
-	set_ifunit(1);
+    set_ifunit(1);
 
     /*
      * Start opening the connection and wait for
      * incoming events (reply, timeout, etc.).
      */
     if (ifunit >= 0)
-	ppp_notice(("Connect: %s <--> %s", ifname, ppp_devnam));
+    ppp_notice(("Connect: %s <--> %s", ifname, ppp_devnam));
     else
-	ppp_notice(("Starting negotiation on %s", ppp_devnam));
+    ppp_notice(("Starting negotiation on %s", ppp_devnam));
     add_fd(fd_ppp);
 
     new_phase(pcb, PPP_PHASE_ESTABLISH);
@@ -604,12 +604,12 @@ void start_link(unit)
  disconnect:
     new_phase(pcb, PPP_PHASE_DISCONNECT);
     if (the_channel->disconnect)
-	the_channel->disconnect();
+    the_channel->disconnect();
 
  fail:
     new_phase(pcb, PPP_PHASE_DEAD);
     if (the_channel->cleanup)
-	(*the_channel->cleanup)();
+    (*the_channel->cleanup)();
 }
 #endif
 
@@ -623,23 +623,23 @@ void link_terminated(ppp_pcb *pcb) {
     || pcb->phase == PPP_PHASE_MASTER
 #endif /* HAVE_MULTILINK */
     )
-	return;
+    return;
     new_phase(pcb, PPP_PHASE_DISCONNECT);
 
 #if 0 /* UNUSED */
     if (pap_logout_hook) {
-	pap_logout_hook();
+    pap_logout_hook();
     }
     session_end(devnam);
 #endif /* UNUSED */
 
     if (!doing_multilink) {
-	ppp_notice(("Connection terminated."));
+    ppp_notice(("Connection terminated."));
 #if PPP_STATS_SUPPORT
-	print_link_stats();
+    print_link_stats();
 #endif /* PPP_STATS_SUPPORT */
     } else
-	ppp_notice(("Link terminated."));
+    ppp_notice(("Link terminated."));
 
     lcp_lowerdown(pcb);
 
@@ -651,7 +651,7 @@ void link_terminated(ppp_pcb *pcb) {
      * we delete its pid file.
      */
     if (!doing_multilink && !demand)
-	remove_pidfiles();
+    remove_pidfiles();
 
     /*
      * If we may want to bring the link up again, transfer
@@ -659,36 +659,36 @@ void link_terminated(ppp_pcb *pcb) {
      * real serial device back to its normal mode of operation.
      */
     if (fd_ppp >= 0) {
-	remove_fd(fd_ppp);
-	clean_check();
-	the_channel->disestablish_ppp(devfd);
-	if (doing_multilink)
-	    mp_exit_bundle();
-	fd_ppp = -1;
+    remove_fd(fd_ppp);
+    clean_check();
+    the_channel->disestablish_ppp(devfd);
+    if (doing_multilink)
+        mp_exit_bundle();
+    fd_ppp = -1;
     }
     if (!hungup)
-	lcp_lowerdown(pcb);
+    lcp_lowerdown(pcb);
     if (!doing_multilink && !demand)
-	script_unsetenv("IFNAME");
+    script_unsetenv("IFNAME");
 
     /*
      * Run disconnector script, if requested.
      * XXX we may not be able to do this if the line has hung up!
      */
     if (devfd >= 0 && the_channel->disconnect) {
-	the_channel->disconnect();
-	devfd = -1;
+    the_channel->disconnect();
+    devfd = -1;
     }
     if (the_channel->cleanup)
-	(*the_channel->cleanup)();
+    (*the_channel->cleanup)();
 
     if (doing_multilink && multilink_master) {
-	if (!bundle_terminating)
-	    new_phase(pcb, PPP_PHASE_MASTER);
-	else
-	    mp_bundle_terminated();
+    if (!bundle_terminating)
+        new_phase(pcb, PPP_PHASE_MASTER);
+    else
+        mp_bundle_terminated();
     } else
-	new_phase(pcb, PPP_PHASE_DEAD);
+    new_phase(pcb, PPP_PHASE_DEAD);
 #endif
 }
 
@@ -701,13 +701,13 @@ void link_down(ppp_pcb *pcb) {
 #endif /* PPP_NOTIFY */
 
     if (!doing_multilink) {
-	upper_layers_down(pcb);
-	if (pcb->phase != PPP_PHASE_DEAD
+    upper_layers_down(pcb);
+    if (pcb->phase != PPP_PHASE_DEAD
 #ifdef HAVE_MULTILINK
-	&& pcb->phase != PPP_PHASE_MASTER
+    && pcb->phase != PPP_PHASE_MASTER
 #endif /* HAVE_MULTILINK */
-	)
-	    new_phase(pcb, PPP_PHASE_ESTABLISH);
+    )
+        new_phase(pcb, PPP_PHASE_ESTABLISH);
     }
     /* XXX if doing_multilink, should do something to stop
        network-layer traffic on the link */
@@ -719,9 +719,9 @@ void upper_layers_down(ppp_pcb *pcb) {
 
     for (i = 0; (protp = protocols[i]) != NULL; ++i) {
         if (protp->protocol != PPP_LCP && protp->lowerdown != NULL)
-	    (*protp->lowerdown)(pcb);
+        (*protp->lowerdown)(pcb);
         if (protp->protocol < 0xC000 && protp->close != NULL)
-	    (*protp->close)(pcb, "LCP down");
+        (*protp->close)(pcb, "LCP down");
     }
     pcb->num_np_open = 0;
     pcb->num_np_up = 0;
@@ -749,56 +749,56 @@ void link_established(ppp_pcb *pcb) {
      * Tell higher-level protocols that LCP is up.
      */
     if (!doing_multilink) {
-	for (i = 0; (protp = protocols[i]) != NULL; ++i)
-	    if (protp->protocol != PPP_LCP
-		&& protp->lowerup != NULL)
-		(*protp->lowerup)(pcb);
+    for (i = 0; (protp = protocols[i]) != NULL; ++i)
+        if (protp->protocol != PPP_LCP
+        && protp->lowerup != NULL)
+        (*protp->lowerup)(pcb);
     }
 
 #if PPP_AUTH_SUPPORT
 #if PPP_SERVER
 #if PPP_ALLOWED_ADDRS
     if (!auth_required && noauth_addrs != NULL)
-	set_allowed_addrs(unit, NULL, NULL);
+    set_allowed_addrs(unit, NULL, NULL);
 #endif /* PPP_ALLOWED_ADDRS */
 
     if (pcb->settings.auth_required && !(0
 #if PAP_SUPPORT
-	|| go->neg_upap
+    || go->neg_upap
 #endif /* PAP_SUPPORT */
 #if CHAP_SUPPORT
-	|| go->neg_chap
+    || go->neg_chap
 #endif /* CHAP_SUPPORT */
 #if EAP_SUPPORT
-	|| go->neg_eap
+    || go->neg_eap
 #endif /* EAP_SUPPORT */
-	)) {
+    )) {
 
 #if PPP_ALLOWED_ADDRS
-	/*
-	 * We wanted the peer to authenticate itself, and it refused:
-	 * if we have some address(es) it can use without auth, fine,
-	 * otherwise treat it as though it authenticated with PAP using
-	 * a username of "" and a password of "".  If that's not OK,
-	 * boot it out.
-	 */
-	if (noauth_addrs != NULL) {
-	    set_allowed_addrs(unit, NULL, NULL);
-	} else
+    /*
+     * We wanted the peer to authenticate itself, and it refused:
+     * if we have some address(es) it can use without auth, fine,
+     * otherwise treat it as though it authenticated with PAP using
+     * a username of "" and a password of "".  If that's not OK,
+     * boot it out.
+     */
+    if (noauth_addrs != NULL) {
+        set_allowed_addrs(unit, NULL, NULL);
+    } else
 #endif /* PPP_ALLOWED_ADDRS */
-	if (!pcb->settings.null_login
+    if (!pcb->settings.null_login
 #if PAP_SUPPORT
-	    || !wo->neg_upap
+        || !wo->neg_upap
 #endif /* PAP_SUPPORT */
-	    ) {
-	    ppp_warn(("peer refused to authenticate: terminating link"));
+        ) {
+        ppp_warn(("peer refused to authenticate: terminating link"));
 #if 0 /* UNUSED */
-	    status = EXIT_PEER_AUTH_FAILED;
+        status = EXIT_PEER_AUTH_FAILED;
 #endif /* UNUSED */
-	    pcb->err_code = PPPERR_AUTHFAIL;
-	    lcp_close(pcb, "peer refused to authenticate");
-	    return;
-	}
+        pcb->err_code = PPPERR_AUTHFAIL;
+        lcp_close(pcb, "peer refused to authenticate");
+        return;
+    }
     }
 #endif /* PPP_SERVER */
 
@@ -807,20 +807,20 @@ void link_established(ppp_pcb *pcb) {
 #if PPP_SERVER
 #if EAP_SUPPORT
     if (go->neg_eap) {
-	eap_authpeer(pcb, PPP_OUR_NAME);
-	auth |= EAP_PEER;
+    eap_authpeer(pcb, PPP_OUR_NAME);
+    auth |= EAP_PEER;
     } else
 #endif /* EAP_SUPPORT */
 #if CHAP_SUPPORT
     if (go->neg_chap) {
-	chap_auth_peer(pcb, PPP_OUR_NAME, CHAP_DIGEST(go->chap_mdtype));
-	auth |= CHAP_PEER;
+    chap_auth_peer(pcb, PPP_OUR_NAME, CHAP_DIGEST(go->chap_mdtype));
+    auth |= CHAP_PEER;
     } else
 #endif /* CHAP_SUPPORT */
 #if PAP_SUPPORT
     if (go->neg_upap) {
-	upap_authpeer(pcb);
-	auth |= PAP_PEER;
+    upap_authpeer(pcb);
+    auth |= PAP_PEER;
     } else
 #endif /* PAP_SUPPORT */
     {}
@@ -828,20 +828,20 @@ void link_established(ppp_pcb *pcb) {
 
 #if EAP_SUPPORT
     if (ho->neg_eap) {
-	eap_authwithpeer(pcb, pcb->settings.user);
-	auth |= EAP_WITHPEER;
+    eap_authwithpeer(pcb, pcb->settings.user);
+    auth |= EAP_WITHPEER;
     } else
 #endif /* EAP_SUPPORT */
 #if CHAP_SUPPORT
     if (ho->neg_chap) {
-	chap_auth_with_peer(pcb, pcb->settings.user, CHAP_DIGEST(ho->chap_mdtype));
-	auth |= CHAP_WITHPEER;
+    chap_auth_with_peer(pcb, pcb->settings.user, CHAP_DIGEST(ho->chap_mdtype));
+    auth |= CHAP_WITHPEER;
     } else
 #endif /* CHAP_SUPPORT */
 #if PAP_SUPPORT
     if (ho->neg_upap) {
-	upap_authwithpeer(pcb, pcb->settings.user, pcb->settings.passwd);
-	auth |= PAP_WITHPEER;
+    upap_authwithpeer(pcb, pcb->settings.user, pcb->settings.passwd);
+    auth |= PAP_WITHPEER;
     } else
 #endif /* PAP_SUPPORT */
     {}
@@ -851,7 +851,7 @@ void link_established(ppp_pcb *pcb) {
 
     if (!auth)
 #endif /* PPP_AUTH_SUPPORT */
-	network_phase(pcb);
+    network_phase(pcb);
 }
 
 /*
@@ -868,7 +868,7 @@ static void network_phase(ppp_pcb *pcb) {
 #if 0 /* UNUSED */
     /* Log calling number. */
     if (*remote_number)
-	ppp_notice(("peer from calling number %q authorized", remote_number));
+    ppp_notice(("peer from calling number %q authorized", remote_number));
 #endif /* UNUSED */
 
 #if PPP_NOTIFY
@@ -877,16 +877,16 @@ static void network_phase(ppp_pcb *pcb) {
      */
     if (0
 #if CHAP_SUPPORT
-	|| go->neg_chap
+    || go->neg_chap
 #endif /* CHAP_SUPPORT */
 #if PAP_SUPPORT
-	|| go->neg_upap
+    || go->neg_upap
 #endif /* PAP_SUPPORT */
 #if EAP_SUPPORT
-	|| go->neg_eap
+    || go->neg_eap
 #endif /* EAP_SUPPORT */
-	) {
-	notify(auth_up_notifier, 0);
+    ) {
+    notify(auth_up_notifier, 0);
     }
 #endif /* PPP_NOTIFY */
 
@@ -895,9 +895,9 @@ static void network_phase(ppp_pcb *pcb) {
      * If we negotiated callback, do it now.
      */
     if (go->neg_cbcp) {
-	new_phase(pcb, PPP_PHASE_CALLBACK);
-	(*cbcp_protent.open)(pcb);
-	return;
+    new_phase(pcb, PPP_PHASE_CALLBACK);
+    (*cbcp_protent.open)(pcb);
+    return;
     }
 #endif
 
@@ -906,9 +906,9 @@ static void network_phase(ppp_pcb *pcb) {
      * Process extra options from the secrets file
      */
     if (extra_options) {
-	options_from_list(extra_options, 1);
-	free_wordlist(extra_options);
-	extra_options = 0;
+    options_from_list(extra_options, 1);
+    free_wordlist(extra_options);
+    extra_options = 0;
     }
 #endif /* PPP_OPTIONS */
     start_networks(pcb);
@@ -924,34 +924,34 @@ void start_networks(ppp_pcb *pcb) {
 
 #ifdef HAVE_MULTILINK
     if (multilink) {
-	if (mp_join_bundle()) {
-	    if (multilink_join_hook)
-		(*multilink_join_hook)();
-	    if (updetach && !nodetach)
-		detach();
-	    return;
-	}
+    if (mp_join_bundle()) {
+        if (multilink_join_hook)
+        (*multilink_join_hook)();
+        if (updetach && !nodetach)
+        detach();
+        return;
+    }
     }
 #endif /* HAVE_MULTILINK */
 
 #ifdef PPP_FILTER
     if (!demand)
-	set_filters(&pass_filter, &active_filter);
+    set_filters(&pass_filter, &active_filter);
 #endif
 #if CCP_SUPPORT || ECP_SUPPORT
     /* Start CCP and ECP */
     for (i = 0; (protp = protocols[i]) != NULL; ++i)
-	if (
-	    (0
+    if (
+        (0
 #if ECP_SUPPORT
-	    || protp->protocol == PPP_ECP
+        || protp->protocol == PPP_ECP
 #endif /* ECP_SUPPORT */
 #if CCP_SUPPORT
-	    || protp->protocol == PPP_CCP
+        || protp->protocol == PPP_CCP
 #endif /* CCP_SUPPORT */
-	    )
-	    && protp->open != NULL)
-	    (*protp->open)(pcb);
+        )
+        && protp->open != NULL)
+        (*protp->open)(pcb);
 #endif /* CCP_SUPPORT || ECP_SUPPORT */
 
     /*
@@ -965,7 +965,7 @@ void start_networks(ppp_pcb *pcb) {
         && !pcb->ccp_gotoptions.mppe
 #endif /* MPPE_SUPPORT */
         )
-	continue_networks(pcb);
+    continue_networks(pcb);
 }
 
 void continue_networks(ppp_pcb *pcb) {
@@ -976,21 +976,21 @@ void continue_networks(ppp_pcb *pcb) {
      * Start the "real" network protocols.
      */
     for (i = 0; (protp = protocols[i]) != NULL; ++i)
-	if (protp->protocol < 0xC000
+    if (protp->protocol < 0xC000
 #if CCP_SUPPORT
-	    && protp->protocol != PPP_CCP
+        && protp->protocol != PPP_CCP
 #endif /* CCP_SUPPORT */
 #if ECP_SUPPORT
-	    && protp->protocol != PPP_ECP
+        && protp->protocol != PPP_ECP
 #endif /* ECP_SUPPORT */
-	    && protp->open != NULL) {
-	    (*protp->open)(pcb);
-	    ++pcb->num_np_open;
-	}
+        && protp->open != NULL) {
+        (*protp->open)(pcb);
+        ++pcb->num_np_open;
+    }
 
     if (pcb->num_np_open == 0)
-	/* nothing to do */
-	lcp_close(pcb, "No network protocols running");
+    /* nothing to do */
+    lcp_close(pcb, "No network protocols running");
 }
 
 #if PPP_AUTH_SUPPORT
@@ -1054,37 +1054,37 @@ void auth_peer_success(ppp_pcb *pcb, int protocol, int prot_flavor, const char *
     switch (protocol) {
 #if CHAP_SUPPORT
     case PPP_CHAP:
-	bit = CHAP_PEER;
-	switch (prot_flavor) {
-	case CHAP_MD5:
-	    bit |= CHAP_MD5_PEER;
-	    break;
+    bit = CHAP_PEER;
+    switch (prot_flavor) {
+    case CHAP_MD5:
+        bit |= CHAP_MD5_PEER;
+        break;
 #if MSCHAP_SUPPORT
-	case CHAP_MICROSOFT:
-	    bit |= CHAP_MS_PEER;
-	    break;
-	case CHAP_MICROSOFT_V2:
-	    bit |= CHAP_MS2_PEER;
-	    break;
+    case CHAP_MICROSOFT:
+        bit |= CHAP_MS_PEER;
+        break;
+    case CHAP_MICROSOFT_V2:
+        bit |= CHAP_MS2_PEER;
+        break;
 #endif /* MSCHAP_SUPPORT */
-	default:
-	    break;
-	}
-	break;
+    default:
+        break;
+    }
+    break;
 #endif /* CHAP_SUPPORT */
 #if PAP_SUPPORT
     case PPP_PAP:
-	bit = PAP_PEER;
-	break;
+    bit = PAP_PEER;
+    break;
 #endif /* PAP_SUPPORT */
 #if EAP_SUPPORT
     case PPP_EAP:
-	bit = EAP_PEER;
-	break;
+    bit = EAP_PEER;
+    break;
 #endif /* EAP_SUPPORT */
     default:
-	ppp_warn(("auth_peer_success: unknown protocol %x", protocol));
-	return;
+    ppp_warn(("auth_peer_success: unknown protocol %x", protocol));
+    return;
     }
 
 #ifdef HAVE_MULTILINK
@@ -1092,7 +1092,7 @@ void auth_peer_success(ppp_pcb *pcb, int protocol, int prot_flavor, const char *
      * Save the authenticated name of the peer for later.
      */
     if (namelen > (int)sizeof(pcb->peer_authname) - 1)
-	namelen = (int)sizeof(pcb->peer_authname) - 1;
+    namelen = (int)sizeof(pcb->peer_authname) - 1;
     MEMCPY(pcb->peer_authname, name, namelen);
     pcb->peer_authname[namelen] = 0;
 #endif /* HAVE_MULTILINK */
@@ -1142,41 +1142,41 @@ void auth_withpeer_success(ppp_pcb *pcb, int protocol, int prot_flavor) {
     switch (protocol) {
 #if CHAP_SUPPORT
     case PPP_CHAP:
-	bit = CHAP_WITHPEER;
-	prot = "CHAP";
-	switch (prot_flavor) {
-	case CHAP_MD5:
-	    bit |= CHAP_MD5_WITHPEER;
-	    break;
+    bit = CHAP_WITHPEER;
+    prot = "CHAP";
+    switch (prot_flavor) {
+    case CHAP_MD5:
+        bit |= CHAP_MD5_WITHPEER;
+        break;
 #if MSCHAP_SUPPORT
-	case CHAP_MICROSOFT:
-	    bit |= CHAP_MS_WITHPEER;
-	    break;
-	case CHAP_MICROSOFT_V2:
-	    bit |= CHAP_MS2_WITHPEER;
-	    break;
+    case CHAP_MICROSOFT:
+        bit |= CHAP_MS_WITHPEER;
+        break;
+    case CHAP_MICROSOFT_V2:
+        bit |= CHAP_MS2_WITHPEER;
+        break;
 #endif /* MSCHAP_SUPPORT */
-	default:
-	    break;
-	}
-	break;
+    default:
+        break;
+    }
+    break;
 #endif /* CHAP_SUPPORT */
 #if PAP_SUPPORT
     case PPP_PAP:
-	bit = PAP_WITHPEER;
-	prot = "PAP";
-	break;
+    bit = PAP_WITHPEER;
+    prot = "PAP";
+    break;
 #endif /* PAP_SUPPORT */
 #if EAP_SUPPORT
     case PPP_EAP:
-	bit = EAP_WITHPEER;
-	prot = "EAP";
-	break;
+    bit = EAP_WITHPEER;
+    prot = "EAP";
+    break;
 #endif /* EAP_SUPPORT */
     default:
-	ppp_warn(("auth_withpeer_success: unknown protocol %x", protocol));
-	bit = 0;
-	/* no break */
+    ppp_warn(("auth_withpeer_success: unknown protocol %x", protocol));
+    bit = 0;
+    /* no break */
     }
 
     ppp_notice(("%s authentication succeeded", prot));
@@ -1189,7 +1189,7 @@ void auth_withpeer_success(ppp_pcb *pcb, int protocol, int prot_flavor) {
      * proceed to the network (or callback) phase.
      */
     if ((pcb->auth_pending &= ~bit) == 0)
-	network_phase(pcb);
+    network_phase(pcb);
 }
 #endif /* PPP_AUTH_SUPPORT */
 
@@ -1204,42 +1204,42 @@ void np_up(ppp_pcb *pcb, int proto) {
     LWIP_UNUSED_ARG(proto);
 
     if (pcb->num_np_up == 0) {
-	/*
-	 * At this point we consider that the link has come up successfully.
-	 */
-	new_phase(pcb, PPP_PHASE_RUNNING);
+    /*
+     * At this point we consider that the link has come up successfully.
+     */
+    new_phase(pcb, PPP_PHASE_RUNNING);
 
 #if PPP_IDLETIMELIMIT
 #if 0 /* UNUSED */
-	if (idle_time_hook != 0)
-	    tlim = (*idle_time_hook)(NULL);
-	else
+    if (idle_time_hook != 0)
+        tlim = (*idle_time_hook)(NULL);
+    else
 #endif /* UNUSED */
-	    tlim = pcb->settings.idle_time_limit;
-	if (tlim > 0)
-	    TIMEOUT(check_idle, (void*)pcb, tlim);
+        tlim = pcb->settings.idle_time_limit;
+    if (tlim > 0)
+        TIMEOUT(check_idle, (void*)pcb, tlim);
 #endif /* PPP_IDLETIMELIMIT */
 
 #if PPP_MAXCONNECT
-	/*
-	 * Set a timeout to close the connection once the maximum
-	 * connect time has expired.
-	 */
-	if (pcb->settings.maxconnect > 0)
-	    TIMEOUT(connect_time_expired, (void*)pcb, pcb->settings.maxconnect);
+    /*
+     * Set a timeout to close the connection once the maximum
+     * connect time has expired.
+     */
+    if (pcb->settings.maxconnect > 0)
+        TIMEOUT(connect_time_expired, (void*)pcb, pcb->settings.maxconnect);
 #endif /* PPP_MAXCONNECT */
 
 #ifdef MAXOCTETS
-	if (maxoctets > 0)
-	    TIMEOUT(check_maxoctets, NULL, maxoctets_timeout);
+    if (maxoctets > 0)
+        TIMEOUT(check_maxoctets, NULL, maxoctets_timeout);
 #endif
 
 #if 0 /* Unused */
-	/*
-	 * Detach now, if the updetach option was given.
-	 */
-	if (updetach && !nodetach)
-	    detach();
+    /*
+     * Detach now, if the updetach option was given.
+     */
+    if (updetach && !nodetach)
+        detach();
 #endif /* Unused */
     }
     ++pcb->num_np_up;
@@ -1252,15 +1252,15 @@ void np_down(ppp_pcb *pcb, int proto) {
     LWIP_UNUSED_ARG(proto);
     if (--pcb->num_np_up == 0) {
 #if PPP_IDLETIMELIMIT
-	UNTIMEOUT(check_idle, (void*)pcb);
+    UNTIMEOUT(check_idle, (void*)pcb);
 #endif /* PPP_IDLETIMELIMIT */
 #if PPP_MAXCONNECT
-	UNTIMEOUT(connect_time_expired, NULL);
+    UNTIMEOUT(connect_time_expired, NULL);
 #endif /* PPP_MAXCONNECT */
 #ifdef MAXOCTETS
-	UNTIMEOUT(check_maxoctets, NULL);
+    UNTIMEOUT(check_maxoctets, NULL);
 #endif
-	new_phase(pcb, PPP_PHASE_NETWORK);
+    new_phase(pcb, PPP_PHASE_NETWORK);
     }
 }
 
@@ -1270,8 +1270,8 @@ void np_down(ppp_pcb *pcb, int proto) {
 void np_finished(ppp_pcb *pcb, int proto) {
     LWIP_UNUSED_ARG(proto);
     if (--pcb->num_np_open <= 0) {
-	/* no further use for the link: shut up shop. */
-	lcp_close(pcb, "No network protocols running");
+    /* no further use for the link: shut up shop. */
+    lcp_close(pcb, "No network protocols running");
     }
 }
 
@@ -1287,26 +1287,26 @@ check_maxoctets(arg)
     link_stats_valid=0;
 
     switch(maxoctets_dir) {
-	case PPP_OCTETS_DIRECTION_IN:
-	    used = link_stats.bytes_in;
-	    break;
-	case PPP_OCTETS_DIRECTION_OUT:
-	    used = link_stats.bytes_out;
-	    break;
-	case PPP_OCTETS_DIRECTION_MAXOVERAL:
-	case PPP_OCTETS_DIRECTION_MAXSESSION:
-	    used = (link_stats.bytes_in > link_stats.bytes_out) ? link_stats.bytes_in : link_stats.bytes_out;
-	    break;
-	default:
-	    used = link_stats.bytes_in+link_stats.bytes_out;
-	    break;
+    case PPP_OCTETS_DIRECTION_IN:
+        used = link_stats.bytes_in;
+        break;
+    case PPP_OCTETS_DIRECTION_OUT:
+        used = link_stats.bytes_out;
+        break;
+    case PPP_OCTETS_DIRECTION_MAXOVERAL:
+    case PPP_OCTETS_DIRECTION_MAXSESSION:
+        used = (link_stats.bytes_in > link_stats.bytes_out) ? link_stats.bytes_in : link_stats.bytes_out;
+        break;
+    default:
+        used = link_stats.bytes_in+link_stats.bytes_out;
+        break;
     }
     if (used > maxoctets) {
-	ppp_notice(("Traffic limit reached. Limit: %u Used: %u", maxoctets, used));
-	status = EXIT_TRAFFIC_LIMIT;
-	lcp_close(pcb, "Traffic limit");
+    ppp_notice(("Traffic limit reached. Limit: %u Used: %u", maxoctets, used));
+    status = EXIT_TRAFFIC_LIMIT;
+    lcp_close(pcb, "Traffic limit");
 #if 0 /* UNUSED */
-	need_holdoff = 0;
+    need_holdoff = 0;
 #endif /* UNUSED */
     } else {
         TIMEOUT(check_maxoctets, NULL, maxoctets_timeout);
@@ -1327,27 +1327,27 @@ static void check_idle(void *arg) {
     int tlim;
 
     if (!get_idle_time(pcb, &idle))
-	return;
+    return;
 #if 0 /* UNUSED */
     if (idle_time_hook != 0) {
-	tlim = idle_time_hook(&idle);
+    tlim = idle_time_hook(&idle);
     } else {
 #endif /* UNUSED */
-	itime = LWIP_MIN(idle.xmit_idle, idle.recv_idle);
-	tlim = pcb->settings.idle_time_limit - itime;
+    itime = LWIP_MIN(idle.xmit_idle, idle.recv_idle);
+    tlim = pcb->settings.idle_time_limit - itime;
 #if 0 /* UNUSED */
     }
 #endif /* UNUSED */
     if (tlim <= 0) {
-	/* link is idle: shut it down. */
-	ppp_notice(("Terminating connection due to lack of activity."));
-	pcb->err_code = PPPERR_IDLETIMEOUT;
-	lcp_close(pcb, "Link inactive");
+    /* link is idle: shut it down. */
+    ppp_notice(("Terminating connection due to lack of activity."));
+    pcb->err_code = PPPERR_IDLETIMEOUT;
+    lcp_close(pcb, "Link inactive");
 #if 0 /* UNUSED */
-	need_holdoff = 0;
+    need_holdoff = 0;
 #endif /* UNUSED */
     } else {
-	TIMEOUT(check_idle, (void*)pcb, tlim);
+    TIMEOUT(check_idle, (void*)pcb, tlim);
     }
 }
 #endif /* PPP_IDLETIMELIMIT */
@@ -1360,7 +1360,7 @@ static void connect_time_expired(void *arg) {
     ppp_pcb *pcb = (ppp_pcb*)arg;
     ppp_info(("Connect time expired"));
     pcb->err_code = PPPERR_CONNECTTIME;
-    lcp_close(pcb, "Connect time expired");	/* Close connection */
+    lcp_close(pcb, "Connect time expired"); /* Close connection */
 }
 #endif /* PPP_MAXCONNECT */
 
@@ -1377,62 +1377,62 @@ auth_check_options()
 
     /* Default our_name to hostname, and user to our_name */
     if (our_name[0] == 0 || usehostname)
-	strlcpy(our_name, hostname, sizeof(our_name));
+    strlcpy(our_name, hostname, sizeof(our_name));
     /* If a blank username was explicitly given as an option, trust
        the user and don't use our_name */
     if (ppp_settings.user[0] == 0 && !explicit_user)
-	strlcpy(ppp_settings.user, our_name, sizeof(ppp_settings.user));
+    strlcpy(ppp_settings.user, our_name, sizeof(ppp_settings.user));
 
     /*
      * If we have a default route, require the peer to authenticate
      * unless the noauth option was given or the real user is root.
      */
     if (!auth_required && !allow_any_ip && have_route_to(0) && !privileged) {
-	auth_required = 1;
-	default_auth = 1;
+    auth_required = 1;
+    default_auth = 1;
     }
 
 #if CHAP_SUPPORT
     /* If we selected any CHAP flavors, we should probably negotiate it. :-) */
     if (wo->chap_mdtype)
-	wo->neg_chap = 1;
+    wo->neg_chap = 1;
 #endif /* CHAP_SUPPORT */
 
     /* If authentication is required, ask peer for CHAP, PAP, or EAP. */
     if (auth_required) {
-	allow_any_ip = 0;
-	if (1
+    allow_any_ip = 0;
+    if (1
 #if CHAP_SUPPORT
-	    && !wo->neg_chap
+        && !wo->neg_chap
 #endif /* CHAP_SUPPORT */
 #if PAP_SUPPORT
-	    && !wo->neg_upap
+        && !wo->neg_upap
 #endif /* PAP_SUPPORT */
 #if EAP_SUPPORT
-	    && !wo->neg_eap
+        && !wo->neg_eap
 #endif /* EAP_SUPPORT */
-	    ) {
+        ) {
 #if CHAP_SUPPORT
-	    wo->neg_chap = CHAP_MDTYPE_SUPPORTED != MDTYPE_NONE;
-	    wo->chap_mdtype = CHAP_MDTYPE_SUPPORTED;
+        wo->neg_chap = CHAP_MDTYPE_SUPPORTED != MDTYPE_NONE;
+        wo->chap_mdtype = CHAP_MDTYPE_SUPPORTED;
 #endif /* CHAP_SUPPORT */
 #if PAP_SUPPORT
-	    wo->neg_upap = 1;
+        wo->neg_upap = 1;
 #endif /* PAP_SUPPORT */
 #if EAP_SUPPORT
-	    wo->neg_eap = 1;
+        wo->neg_eap = 1;
 #endif /* EAP_SUPPORT */
-	}
+    }
     } else {
 #if CHAP_SUPPORT
-	wo->neg_chap = 0;
-	wo->chap_mdtype = MDTYPE_NONE;
+    wo->neg_chap = 0;
+    wo->chap_mdtype = MDTYPE_NONE;
 #endif /* CHAP_SUPPORT */
 #if PAP_SUPPORT
-	wo->neg_upap = 0;
+    wo->neg_upap = 0;
 #endif /* PAP_SUPPORT */
 #if EAP_SUPPORT
-	wo->neg_eap = 0;
+    wo->neg_eap = 0;
 #endif /* EAP_SUPPORT */
     }
 
@@ -1449,56 +1449,56 @@ auth_check_options()
 #endif /* PAP_SUPPORT */
     if (!can_auth && (0
 #if CHAP_SUPPORT
-	|| wo->neg_chap
+    || wo->neg_chap
 #endif /* CHAP_SUPPORT */
 #if EAP_SUPPORT
-	|| wo->neg_eap
+    || wo->neg_eap
 #endif /* EAP_SUPPORT */
-	)) {
+    )) {
 #if CHAP_SUPPORT
-	can_auth = have_chap_secret((explicit_remote? remote_name: NULL),
-				    our_name, 1, &lacks_ip);
+    can_auth = have_chap_secret((explicit_remote? remote_name: NULL),
+                    our_name, 1, &lacks_ip);
 #else
-	can_auth = 0;
+    can_auth = 0;
 #endif
     }
     if (!can_auth
 #if EAP_SUPPORT
-	&& wo->neg_eap
+    && wo->neg_eap
 #endif /* EAP_SUPPORT */
-	) {
-	can_auth = have_srp_secret((explicit_remote? remote_name: NULL),
-				    our_name, 1, &lacks_ip);
+    ) {
+    can_auth = have_srp_secret((explicit_remote? remote_name: NULL),
+                    our_name, 1, &lacks_ip);
     }
 
     if (auth_required && !can_auth && noauth_addrs == NULL) {
-	if (default_auth) {
-	    option_error(
+    if (default_auth) {
+        option_error(
 "By default the remote system is required to authenticate itself");
-	    option_error(
+        option_error(
 "(because this system has a default route to the internet)");
-	} else if (explicit_remote)
-	    option_error(
+    } else if (explicit_remote)
+        option_error(
 "The remote system (%s) is required to authenticate itself",
-			 remote_name);
-	else
-	    option_error(
+             remote_name);
+    else
+        option_error(
 "The remote system is required to authenticate itself");
-	option_error(
+    option_error(
 "but I couldn't find any suitable secret (password) for it to use to do so.");
-	if (lacks_ip)
-	    option_error(
+    if (lacks_ip)
+        option_error(
 "(None of the available passwords would let it use an IP address.)");
 
-	exit(1);
+    exit(1);
     }
 
     /*
      * Early check for remote number authorization.
      */
     if (!auth_number()) {
-	ppp_warn(("calling number %q is not authorized", remote_number));
-	exit(EXIT_CNID_AUTH_FAILED);
+    ppp_warn(("calling number %q is not authorized", remote_number));
+    exit(EXIT_CNID_AUTH_FAILED);
     }
 }
 #endif /* PPP_OPTIONS */
@@ -1520,30 +1520,30 @@ auth_reset(unit)
     hadchap = -1;
     ao->neg_upap = !refuse_pap && (passwd[0] != 0 || get_pap_passwd(NULL));
     ao->neg_chap = (!refuse_chap || !refuse_mschap || !refuse_mschap_v2)
-	&& (passwd[0] != 0 ||
-	    (hadchap = have_chap_secret(user, (explicit_remote? remote_name:
-					       NULL), 0, NULL)));
+    && (passwd[0] != 0 ||
+        (hadchap = have_chap_secret(user, (explicit_remote? remote_name:
+                           NULL), 0, NULL)));
     ao->neg_eap = !refuse_eap && (
-	passwd[0] != 0 ||
-	(hadchap == 1 || (hadchap == -1 && have_chap_secret(user,
-	    (explicit_remote? remote_name: NULL), 0, NULL))) ||
-	have_srp_secret(user, (explicit_remote? remote_name: NULL), 0, NULL));
+    passwd[0] != 0 ||
+    (hadchap == 1 || (hadchap == -1 && have_chap_secret(user,
+        (explicit_remote? remote_name: NULL), 0, NULL))) ||
+    have_srp_secret(user, (explicit_remote? remote_name: NULL), 0, NULL));
 
     hadchap = -1;
     if (go->neg_upap && !uselogin && !have_pap_secret(NULL))
-	go->neg_upap = 0;
+    go->neg_upap = 0;
     if (go->neg_chap) {
-	if (!(hadchap = have_chap_secret((explicit_remote? remote_name: NULL),
-			      our_name, 1, NULL)))
-	    go->neg_chap = 0;
+    if (!(hadchap = have_chap_secret((explicit_remote? remote_name: NULL),
+                  our_name, 1, NULL)))
+        go->neg_chap = 0;
     }
     if (go->neg_eap &&
-	(hadchap == 0 || (hadchap == -1 &&
-	    !have_chap_secret((explicit_remote? remote_name: NULL), our_name,
-		1, NULL))) &&
-	!have_srp_secret((explicit_remote? remote_name: NULL), our_name, 1,
-	    NULL))
-	go->neg_eap = 0;
+    (hadchap == 0 || (hadchap == -1 &&
+        !have_chap_secret((explicit_remote? remote_name: NULL), our_name,
+        1, NULL))) &&
+    !have_srp_secret((explicit_remote? remote_name: NULL), our_name, 1,
+        NULL))
+    go->neg_eap = 0;
 }
 
 /*
@@ -1552,8 +1552,8 @@ auth_reset(unit)
  * and login the user if OK.
  *
  * returns:
- *	UPAP_AUTHNAK: Authentication failed.
- *	UPAP_AUTHACK: Authentication succeeded.
+ *  UPAP_AUTHNAK: Authentication failed.
+ *  UPAP_AUTHACK: Authentication succeeded.
  * In either case, msg points to an appropriate message.
  */
 int
@@ -1587,19 +1587,19 @@ check_passwd(unit, auser, userlen, apasswd, passwdlen, msg)
      * Check if a plugin wants to handle this.
      */
     if (pap_auth_hook) {
-	ret = (*pap_auth_hook)(ppp_settings.user, ppp_settings.passwd, msg, &addrs, &opts);
-	if (ret >= 0) {
-	    /* note: set_allowed_addrs() saves opts (but not addrs):
-	       don't free it! */
-	    if (ret)
-		set_allowed_addrs(unit, addrs, opts);
-	    else if (opts != 0)
-		free_wordlist(opts);
-	    if (addrs != 0)
-		free_wordlist(addrs);
-	    BZERO(ppp_settings.passwd, sizeof(ppp_settings.passwd));
-	    return ret? UPAP_AUTHACK: UPAP_AUTHNAK;
-	}
+    ret = (*pap_auth_hook)(ppp_settings.user, ppp_settings.passwd, msg, &addrs, &opts);
+    if (ret >= 0) {
+        /* note: set_allowed_addrs() saves opts (but not addrs):
+           don't free it! */
+        if (ret)
+        set_allowed_addrs(unit, addrs, opts);
+        else if (opts != 0)
+        free_wordlist(opts);
+        if (addrs != 0)
+        free_wordlist(addrs);
+        BZERO(ppp_settings.passwd, sizeof(ppp_settings.passwd));
+        return ret? UPAP_AUTHACK: UPAP_AUTHNAK;
+    }
     }
 
     /*
@@ -1611,67 +1611,67 @@ check_passwd(unit, auser, userlen, apasswd, passwdlen, msg)
     ret = UPAP_AUTHNAK;
     f = fopen(filename, "r");
     if (f == NULL) {
-	ppp_error(("Can't open PAP password file %s: %m", filename));
+    ppp_error(("Can't open PAP password file %s: %m", filename));
 
     } else {
-	check_access(f, filename);
-	if (scan_authfile(f, ppp_settings.user, our_name, secret, &addrs, &opts, filename, 0) < 0) {
-	    ppp_warn(("no PAP secret found for %s", user));
-	} else {
-	    /*
-	     * If the secret is "@login", it means to check
-	     * the password against the login database.
-	     */
-	    int login_secret = strcmp(secret, "@login") == 0;
-	    ret = UPAP_AUTHACK;
-	    if (uselogin || login_secret) {
-		/* login option or secret is @login */
-		if (session_full(ppp_settings.user, ppp_settings.passwd, devnam, msg) == 0) {
-		    ret = UPAP_AUTHNAK;
-		}
-	    } else if (session_mgmt) {
-		if (session_check(ppp_settings.user, NULL, devnam, NULL) == 0) {
-		    ppp_warn(("Peer %q failed PAP Session verification", user));
-		    ret = UPAP_AUTHNAK;
-		}
-	    }
-	    if (secret[0] != 0 && !login_secret) {
-		/* password given in pap-secrets - must match */
-		if ((cryptpap || strcmp(ppp_settings.passwd, secret) != 0)
-		    && strcmp(crypt(ppp_settings.passwd, secret), secret) != 0)
-		    ret = UPAP_AUTHNAK;
-	    }
-	}
-	fclose(f);
+    check_access(f, filename);
+    if (scan_authfile(f, ppp_settings.user, our_name, secret, &addrs, &opts, filename, 0) < 0) {
+        ppp_warn(("no PAP secret found for %s", user));
+    } else {
+        /*
+         * If the secret is "@login", it means to check
+         * the password against the login database.
+         */
+        int login_secret = strcmp(secret, "@login") == 0;
+        ret = UPAP_AUTHACK;
+        if (uselogin || login_secret) {
+        /* login option or secret is @login */
+        if (session_full(ppp_settings.user, ppp_settings.passwd, devnam, msg) == 0) {
+            ret = UPAP_AUTHNAK;
+        }
+        } else if (session_mgmt) {
+        if (session_check(ppp_settings.user, NULL, devnam, NULL) == 0) {
+            ppp_warn(("Peer %q failed PAP Session verification", user));
+            ret = UPAP_AUTHNAK;
+        }
+        }
+        if (secret[0] != 0 && !login_secret) {
+        /* password given in pap-secrets - must match */
+        if ((cryptpap || strcmp(ppp_settings.passwd, secret) != 0)
+            && strcmp(crypt(ppp_settings.passwd, secret), secret) != 0)
+            ret = UPAP_AUTHNAK;
+        }
+    }
+    fclose(f);
     }
 
     if (ret == UPAP_AUTHNAK) {
         if (**msg == 0)
-	    *msg = "Login incorrect";
-	/*
-	 * XXX can we ever get here more than once??
-	 * Frustrate passwd stealer programs.
-	 * Allow 10 tries, but start backing off after 3 (stolen from login).
-	 * On 10'th, drop the connection.
-	 */
-	if (attempts++ >= 10) {
-	    ppp_warn(("%d LOGIN FAILURES ON %s, %s", attempts, devnam, user));
-	    lcp_close(pcb, "login failed");
-	}
-	if (attempts > 3)
-	    sleep((u_int) (attempts - 3) * 5);
-	if (opts != NULL)
-	    free_wordlist(opts);
+        *msg = "Login incorrect";
+    /*
+     * XXX can we ever get here more than once??
+     * Frustrate passwd stealer programs.
+     * Allow 10 tries, but start backing off after 3 (stolen from login).
+     * On 10'th, drop the connection.
+     */
+    if (attempts++ >= 10) {
+        ppp_warn(("%d LOGIN FAILURES ON %s, %s", attempts, devnam, user));
+        lcp_close(pcb, "login failed");
+    }
+    if (attempts > 3)
+        sleep((u_int) (attempts - 3) * 5);
+    if (opts != NULL)
+        free_wordlist(opts);
 
     } else {
-	attempts = 0;			/* Reset count */
-	if (**msg == 0)
-	    *msg = "Login ok";
-	set_allowed_addrs(unit, addrs, opts);
+    attempts = 0;           /* Reset count */
+    if (**msg == 0)
+        *msg = "Login ok";
+    set_allowed_addrs(unit, addrs, opts);
     }
 
     if (addrs != NULL)
-	free_wordlist(addrs);
+    free_wordlist(addrs);
     BZERO(ppp_settings.passwd, sizeof(ppp_settings.passwd));
     BZERO(secret, sizeof(secret));
 
@@ -1698,31 +1698,31 @@ null_login(unit)
      */
     ret = -1;
     if (null_auth_hook)
-	ret = (*null_auth_hook)(&addrs, &opts);
+    ret = (*null_auth_hook)(&addrs, &opts);
 
     /*
      * Open the file of pap secrets and scan for a suitable secret.
      */
     if (ret <= 0) {
-	filename = _PATH_UPAPFILE;
-	addrs = NULL;
-	f = fopen(filename, "r");
-	if (f == NULL)
-	    return 0;
-	check_access(f, filename);
+    filename = _PATH_UPAPFILE;
+    addrs = NULL;
+    f = fopen(filename, "r");
+    if (f == NULL)
+        return 0;
+    check_access(f, filename);
 
-	i = scan_authfile(f, "", our_name, secret, &addrs, &opts, filename, 0);
-	ret = i >= 0 && secret[0] == 0;
-	BZERO(secret, sizeof(secret));
-	fclose(f);
+    i = scan_authfile(f, "", our_name, secret, &addrs, &opts, filename, 0);
+    ret = i >= 0 && secret[0] == 0;
+    BZERO(secret, sizeof(secret));
+    fclose(f);
     }
 
     if (ret)
-	set_allowed_addrs(unit, addrs, opts);
+    set_allowed_addrs(unit, addrs, opts);
     else if (opts != 0)
-	free_wordlist(opts);
+    free_wordlist(opts);
     if (addrs != 0)
-	free_wordlist(addrs);
+    free_wordlist(addrs);
 
     return ret;
 }
@@ -1746,24 +1746,24 @@ get_pap_passwd(passwd)
      * Check whether a plugin wants to supply this.
      */
     if (pap_passwd_hook) {
-	ret = (*pap_passwd_hook)(ppp_settings,user, ppp_settings.passwd);
-	if (ret >= 0)
-	    return ret;
+    ret = (*pap_passwd_hook)(ppp_settings,user, ppp_settings.passwd);
+    if (ret >= 0)
+        return ret;
     }
 
     filename = _PATH_UPAPFILE;
     f = fopen(filename, "r");
     if (f == NULL)
-	return 0;
+    return 0;
     check_access(f, filename);
     ret = scan_authfile(f, user,
-			(remote_name[0]? remote_name: NULL),
-			secret, NULL, NULL, filename, 0);
+            (remote_name[0]? remote_name: NULL),
+            secret, NULL, NULL, filename, 0);
     fclose(f);
     if (ret < 0)
-	return 0;
+    return 0;
     if (passwd != NULL)
-	strlcpy(passwd, secret, MAXSECRETLEN);
+    strlcpy(passwd, secret, MAXSECRETLEN);
     BZERO(secret, sizeof(secret));
     return 1;
 }
@@ -1783,26 +1783,26 @@ have_pap_secret(lacks_ipp)
 
     /* let the plugin decide, if there is one */
     if (pap_check_hook) {
-	ret = (*pap_check_hook)();
-	if (ret >= 0)
-	    return ret;
+    ret = (*pap_check_hook)();
+    if (ret >= 0)
+        return ret;
     }
 
     filename = _PATH_UPAPFILE;
     f = fopen(filename, "r");
     if (f == NULL)
-	return 0;
+    return 0;
 
     ret = scan_authfile(f, (explicit_remote? remote_name: NULL), our_name,
-			NULL, &addrs, NULL, filename, 0);
+            NULL, &addrs, NULL, filename, 0);
     fclose(f);
     if (ret >= 0 && !some_ip_ok(addrs)) {
-	if (lacks_ipp != 0)
-	    *lacks_ipp = 1;
-	ret = -1;
+    if (lacks_ipp != 0)
+        *lacks_ipp = 1;
+    ret = -1;
     }
     if (addrs != 0)
-	free_wordlist(addrs);
+    free_wordlist(addrs);
 
     return ret >= 0;
 }
@@ -1826,31 +1826,31 @@ have_chap_secret(client, server, need_ip, lacks_ipp)
     struct wordlist *addrs;
 
     if (chap_check_hook) {
-	ret = (*chap_check_hook)();
-	if (ret >= 0) {
-	    return ret;
-	}
+    ret = (*chap_check_hook)();
+    if (ret >= 0) {
+        return ret;
+    }
     }
 
     filename = _PATH_CHAPFILE;
     f = fopen(filename, "r");
     if (f == NULL)
-	return 0;
+    return 0;
 
     if (client != NULL && client[0] == 0)
-	client = NULL;
+    client = NULL;
     else if (server != NULL && server[0] == 0)
-	server = NULL;
+    server = NULL;
 
     ret = scan_authfile(f, client, server, NULL, &addrs, NULL, filename, 0);
     fclose(f);
     if (ret >= 0 && need_ip && !some_ip_ok(addrs)) {
-	if (lacks_ipp != 0)
-	    *lacks_ipp = 1;
-	ret = -1;
+    if (lacks_ipp != 0)
+        *lacks_ipp = 1;
+    ret = -1;
     }
     if (addrs != 0)
-	free_wordlist(addrs);
+    free_wordlist(addrs);
 
     return ret >= 0;
 }
@@ -1876,22 +1876,22 @@ have_srp_secret(client, server, need_ip, lacks_ipp)
     filename = _PATH_SRPFILE;
     f = fopen(filename, "r");
     if (f == NULL)
-	return 0;
+    return 0;
 
     if (client != NULL && client[0] == 0)
-	client = NULL;
+    client = NULL;
     else if (server != NULL && server[0] == 0)
-	server = NULL;
+    server = NULL;
 
     ret = scan_authfile(f, client, server, NULL, &addrs, NULL, filename, 0);
     fclose(f);
     if (ret >= 0 && need_ip && !some_ip_ok(addrs)) {
-	if (lacks_ipp != 0)
-	    *lacks_ipp = 1;
-	ret = -1;
+    if (lacks_ipp != 0)
+        *lacks_ipp = 1;
+    ret = -1;
     }
     if (addrs != 0)
-	free_wordlist(addrs);
+    free_wordlist(addrs);
 
     return ret >= 0;
 }
@@ -1933,42 +1933,42 @@ int get_secret(ppp_pcb *pcb, const char *client, const char *server, char *secre
     addrs = NULL;
 
     if (!am_server && ppp_settings.passwd[0] != 0) {
-	strlcpy(secbuf, ppp_settings.passwd, sizeof(secbuf));
+    strlcpy(secbuf, ppp_settings.passwd, sizeof(secbuf));
     } else if (!am_server && chap_passwd_hook) {
-	if ( (*chap_passwd_hook)(client, secbuf) < 0) {
-	    ppp_error(("Unable to obtain CHAP password for %s on %s from plugin",
-		  client, server));
-	    return 0;
-	}
+    if ( (*chap_passwd_hook)(client, secbuf) < 0) {
+        ppp_error(("Unable to obtain CHAP password for %s on %s from plugin",
+          client, server));
+        return 0;
+    }
     } else {
-	filename = _PATH_CHAPFILE;
-	addrs = NULL;
-	secbuf[0] = 0;
-
-	f = fopen(filename, "r");
-	if (f == NULL) {
-	    ppp_error(("Can't open chap secret file %s: %m", filename));
-	    return 0;
-	}
-	check_access(f, filename);
-
-	ret = scan_authfile(f, client, server, secbuf, &addrs, &opts, filename, 0);
-	fclose(f);
-	if (ret < 0)
-	    return 0;
-
-	if (am_server)
-	    set_allowed_addrs(unit, addrs, opts);
-	else if (opts != 0)
-	    free_wordlist(opts);
-	if (addrs != 0)
-	    free_wordlist(addrs);
+    filename = _PATH_CHAPFILE;
+    addrs = NULL;
+    secbuf[0] = 0;
+
+    f = fopen(filename, "r");
+    if (f == NULL) {
+        ppp_error(("Can't open chap secret file %s: %m", filename));
+        return 0;
+    }
+    check_access(f, filename);
+
+    ret = scan_authfile(f, client, server, secbuf, &addrs, &opts, filename, 0);
+    fclose(f);
+    if (ret < 0)
+        return 0;
+
+    if (am_server)
+        set_allowed_addrs(unit, addrs, opts);
+    else if (opts != 0)
+        free_wordlist(opts);
+    if (addrs != 0)
+        free_wordlist(addrs);
     }
 
     len = strlen(secbuf);
     if (len > MAXSECRETLEN) {
-	ppp_error(("Secret for %s on %s is too long", client, server));
-	len = MAXSECRETLEN;
+    ppp_error(("Secret for %s on %s is too long", client, server));
+    len = MAXSECRETLEN;
     }
     MEMCPY(secret, secbuf, len);
     BZERO(secbuf, sizeof(secbuf));
@@ -2000,31 +2000,31 @@ get_srp_secret(unit, client, server, secret, am_server)
     struct wordlist *addrs, *opts;
 
     if (!am_server && ppp_settings.passwd[0] != '\0') {
-	strlcpy(secret, ppp_settings.passwd, MAXWORDLEN);
+    strlcpy(secret, ppp_settings.passwd, MAXWORDLEN);
     } else {
-	filename = _PATH_SRPFILE;
-	addrs = NULL;
-
-	fp = fopen(filename, "r");
-	if (fp == NULL) {
-	    ppp_error(("Can't open srp secret file %s: %m", filename));
-	    return 0;
-	}
-	check_access(fp, filename);
-
-	secret[0] = '\0';
-	ret = scan_authfile(fp, client, server, secret, &addrs, &opts,
-	    filename, am_server);
-	fclose(fp);
-	if (ret < 0)
-	    return 0;
-
-	if (am_server)
-	    set_allowed_addrs(unit, addrs, opts);
-	else if (opts != NULL)
-	    free_wordlist(opts);
-	if (addrs != NULL)
-	    free_wordlist(addrs);
+    filename = _PATH_SRPFILE;
+    addrs = NULL;
+
+    fp = fopen(filename, "r");
+    if (fp == NULL) {
+        ppp_error(("Can't open srp secret file %s: %m", filename));
+        return 0;
+    }
+    check_access(fp, filename);
+
+    secret[0] = '\0';
+    ret = scan_authfile(fp, client, server, secret, &addrs, &opts,
+        filename, am_server);
+    fclose(fp);
+    if (ret < 0)
+        return 0;
+
+    if (am_server)
+        set_allowed_addrs(unit, addrs, opts);
+    else if (opts != NULL)
+        free_wordlist(opts);
+    if (addrs != NULL)
+        free_wordlist(addrs);
     }
 
     return 1;
@@ -2052,10 +2052,10 @@ set_allowed_addrs(unit, addrs, opts)
     u32_t suggested_ip = 0;
 
     if (addresses[unit] != NULL)
-	free(addresses[unit]);
+    free(addresses[unit]);
     addresses[unit] = NULL;
     if (extra_options != NULL)
-	free_wordlist(extra_options);
+    free_wordlist(extra_options);
     extra_options = opts;
 
     /*
@@ -2063,109 +2063,109 @@ set_allowed_addrs(unit, addrs, opts)
      */
     n = wordlist_count(addrs) + wordlist_count(noauth_addrs);
     if (n == 0)
-	return;
+    return;
     ip = (struct permitted_ip *) malloc((n + 1) * sizeof(struct permitted_ip));
     if (ip == 0)
-	return;
+    return;
 
     /* temporarily append the noauth_addrs list to addrs */
     for (plink = &addrs; *plink != NULL; plink = &(*plink)->next)
-	;
+    ;
     *plink = noauth_addrs;
 
     n = 0;
     for (ap = addrs; ap != NULL; ap = ap->next) {
-	/* "-" means no addresses authorized, "*" means any address allowed */
-	ptr_word = ap->word;
-	if (strcmp(ptr_word, "-") == 0)
-	    break;
-	if (strcmp(ptr_word, "*") == 0) {
-	    ip[n].permit = 1;
-	    ip[n].base = ip[n].mask = 0;
-	    ++n;
-	    break;
-	}
-
-	ip[n].permit = 1;
-	if (*ptr_word == '!') {
-	    ip[n].permit = 0;
-	    ++ptr_word;
-	}
-
-	mask = ~ (u32_t) 0;
-	offset = 0;
-	ptr_mask = strchr (ptr_word, '/');
-	if (ptr_mask != NULL) {
-	    int bit_count;
-	    char *endp;
-
-	    bit_count = (int) strtol (ptr_mask+1, &endp, 10);
-	    if (bit_count <= 0 || bit_count > 32) {
-		ppp_warn(("invalid address length %v in auth. address list",
-		     ptr_mask+1));
-		continue;
-	    }
-	    bit_count = 32 - bit_count;	/* # bits in host part */
-	    if (*endp == '+') {
-		offset = ifunit + 1;
-		++endp;
-	    }
-	    if (*endp != 0) {
-		ppp_warn(("invalid address length syntax: %v", ptr_mask+1));
-		continue;
-	    }
-	    *ptr_mask = '\0';
-	    mask <<= bit_count;
-	}
-
-	hp = gethostbyname(ptr_word);
-	if (hp != NULL && hp->h_addrtype == AF_INET) {
-	    a = *(u32_t *)hp->h_addr;
-	} else {
-	    np = getnetbyname (ptr_word);
-	    if (np != NULL && np->n_addrtype == AF_INET) {
-		a = lwip_htonl ((u32_t)np->n_net);
-		if (ptr_mask == NULL) {
-		    /* calculate appropriate mask for net */
-		    ah = lwip_ntohl(a);
-		    if (IN_CLASSA(ah))
-			mask = IN_CLASSA_NET;
-		    else if (IN_CLASSB(ah))
-			mask = IN_CLASSB_NET;
-		    else if (IN_CLASSC(ah))
-			mask = IN_CLASSC_NET;
-		}
-	    } else {
-		a = inet_addr (ptr_word);
-	    }
-	}
-
-	if (ptr_mask != NULL)
-	    *ptr_mask = '/';
-
-	if (a == (u32_t)-1L) {
-	    ppp_warn(("unknown host %s in auth. address list", ap->word));
-	    continue;
-	}
-	if (offset != 0) {
-	    if (offset >= ~mask) {
-		ppp_warn(("interface unit %d too large for subnet %v",
-		     ifunit, ptr_word));
-		continue;
-	    }
-	    a = lwip_htonl((lwip_ntohl(a) & mask) + offset);
-	    mask = ~(u32_t)0;
-	}
-	ip[n].mask = lwip_htonl(mask);
-	ip[n].base = a & ip[n].mask;
-	++n;
-	if (~mask == 0 && suggested_ip == 0)
-	    suggested_ip = a;
+    /* "-" means no addresses authorized, "*" means any address allowed */
+    ptr_word = ap->word;
+    if (strcmp(ptr_word, "-") == 0)
+        break;
+    if (strcmp(ptr_word, "*") == 0) {
+        ip[n].permit = 1;
+        ip[n].base = ip[n].mask = 0;
+        ++n;
+        break;
+    }
+
+    ip[n].permit = 1;
+    if (*ptr_word == '!') {
+        ip[n].permit = 0;
+        ++ptr_word;
+    }
+
+    mask = ~ (u32_t) 0;
+    offset = 0;
+    ptr_mask = strchr (ptr_word, '/');
+    if (ptr_mask != NULL) {
+        int bit_count;
+        char *endp;
+
+        bit_count = (int) strtol (ptr_mask+1, &endp, 10);
+        if (bit_count <= 0 || bit_count > 32) {
+        ppp_warn(("invalid address length %v in auth. address list",
+             ptr_mask+1));
+        continue;
+        }
+        bit_count = 32 - bit_count; /* # bits in host part */
+        if (*endp == '+') {
+        offset = ifunit + 1;
+        ++endp;
+        }
+        if (*endp != 0) {
+        ppp_warn(("invalid address length syntax: %v", ptr_mask+1));
+        continue;
+        }
+        *ptr_mask = '\0';
+        mask <<= bit_count;
+    }
+
+    hp = gethostbyname(ptr_word);
+    if (hp != NULL && hp->h_addrtype == AF_INET) {
+        a = *(u32_t *)hp->h_addr;
+    } else {
+        np = getnetbyname (ptr_word);
+        if (np != NULL && np->n_addrtype == AF_INET) {
+        a = lwip_htonl ((u32_t)np->n_net);
+        if (ptr_mask == NULL) {
+            /* calculate appropriate mask for net */
+            ah = lwip_ntohl(a);
+            if (IN_CLASSA(ah))
+            mask = IN_CLASSA_NET;
+            else if (IN_CLASSB(ah))
+            mask = IN_CLASSB_NET;
+            else if (IN_CLASSC(ah))
+            mask = IN_CLASSC_NET;
+        }
+        } else {
+        a = inet_addr (ptr_word);
+        }
+    }
+
+    if (ptr_mask != NULL)
+        *ptr_mask = '/';
+
+    if (a == (u32_t)-1L) {
+        ppp_warn(("unknown host %s in auth. address list", ap->word));
+        continue;
+    }
+    if (offset != 0) {
+        if (offset >= ~mask) {
+        ppp_warn(("interface unit %d too large for subnet %v",
+             ifunit, ptr_word));
+        continue;
+        }
+        a = lwip_htonl((lwip_ntohl(a) & mask) + offset);
+        mask = ~(u32_t)0;
+    }
+    ip[n].mask = lwip_htonl(mask);
+    ip[n].base = a & ip[n].mask;
+    ++n;
+    if (~mask == 0 && suggested_ip == 0)
+        suggested_ip = a;
     }
     *plink = NULL;
 
-    ip[n].permit = 0;		/* make the last entry forbid all addresses */
-    ip[n].base = 0;		/* to terminate the list */
+    ip[n].permit = 0;       /* make the last entry forbid all addresses */
+    ip[n].base = 0;     /* to terminate the list */
     ip[n].mask = 0;
 
     addresses[unit] = ip;
@@ -2176,14 +2176,14 @@ set_allowed_addrs(unit, addrs, opts)
      * which is a single host, then use that if we find one.
      */
     if (suggested_ip != 0
-	&& (wo->hisaddr == 0 || !auth_ip_addr(unit, wo->hisaddr))) {
-	wo->hisaddr = suggested_ip;
-	/*
-	 * Do we insist on this address?  No, if there are other
-	 * addresses authorized than the suggested one.
-	 */
-	if (n > 1)
-	    wo->accept_remote = 1;
+    && (wo->hisaddr == 0 || !auth_ip_addr(unit, wo->hisaddr))) {
+    wo->hisaddr = suggested_ip;
+    /*
+     * Do we insist on this address?  No, if there are other
+     * addresses authorized than the suggested one.
+     */
+    if (n > 1)
+        wo->accept_remote = 1;
     }
 }
 
@@ -2200,21 +2200,21 @@ auth_ip_addr(unit, addr)
 
     /* don't allow loopback or multicast address */
     if (bad_ip_adrs(addr))
-	return 0;
+    return 0;
 
     if (allowed_address_hook) {
-	ok = allowed_address_hook(addr);
-	if (ok >= 0) return ok;
+    ok = allowed_address_hook(addr);
+    if (ok >= 0) return ok;
     }
 
     if (addresses[unit] != NULL) {
-	ok = ip_addr_check(addr, addresses[unit]);
-	if (ok >= 0)
-	    return ok;
+    ok = ip_addr_check(addr, addresses[unit]);
+    if (ok >= 0)
+        return ok;
     }
 
     if (auth_required)
-	return 0;		/* no addresses authorized */
+    return 0;       /* no addresses authorized */
     return allow_any_ip || privileged || !have_route_to(addr);
 }
 
@@ -2224,8 +2224,8 @@ ip_addr_check(addr, addrs)
     struct permitted_ip *addrs;
 {
     for (; ; ++addrs)
-	if ((addr & addrs->mask) == addrs->base)
-	    return addrs->permit;
+    if ((addr & addrs->mask) == addrs->base)
+        return addrs->permit;
 }
 
 /*
@@ -2239,7 +2239,7 @@ bad_ip_adrs(addr)
 {
     addr = lwip_ntohl(addr);
     return (addr >> IN_CLASSA_NSHIFT) == IN_LOOPBACKNET
-	|| IN_MULTICAST(addr) || IN_BADCLASS(addr);
+    || IN_MULTICAST(addr) || IN_BADCLASS(addr);
 }
 
 /*
@@ -2251,10 +2251,10 @@ some_ip_ok(addrs)
     struct wordlist *addrs;
 {
     for (; addrs != 0; addrs = addrs->next) {
-	if (addrs->word[0] == '-')
-	    break;
-	if (addrs->word[0] != '!')
-	    return 1;		/* some IP address is allowed */
+    if (addrs->word[0] == '-')
+        break;
+    if (addrs->word[0] != '!')
+        return 1;       /* some IP address is allowed */
     }
     return 0;
 }
@@ -2271,17 +2271,17 @@ auth_number()
 
     /* Allow all if no authorization list. */
     if (!wp)
-	return 1;
+    return 1;
 
     /* Allow if we have a match in the authorization list. */
     while (wp) {
-	/* trailing '*' wildcard */
-	l = strlen(wp->word);
-	if ((wp->word)[l - 1] == '*')
-	    l--;
-	if (!strncasecmp(wp->word, remote_number, l))
-	    return 1;
-	wp = wp->next;
+    /* trailing '*' wildcard */
+    l = strlen(wp->word);
+    if ((wp->word)[l - 1] == '*')
+        l--;
+    if (!strncasecmp(wp->word, remote_number, l))
+        return 1;
+    wp = wp->next;
     }
 
     return 0;
@@ -2298,10 +2298,10 @@ check_access(f, filename)
     struct stat sbuf;
 
     if (fstat(fileno(f), &sbuf) < 0) {
-	ppp_warn(("cannot stat secret file %s: %m", filename));
+    ppp_warn(("cannot stat secret file %s: %m", filename));
     } else if ((sbuf.st_mode & (S_IRWXG | S_IRWXO)) != 0) {
-	ppp_warn(("Warning - secret file %s has world and/or group access",
-	     filename));
+    ppp_warn(("Warning - secret file %s has world and/or group access",
+         filename));
     }
 }
 
@@ -2340,141 +2340,141 @@ scan_authfile(f, client, server, secret, addrs, opts, filename, flags)
     char *cp;
 
     if (addrs != NULL)
-	*addrs = NULL;
+    *addrs = NULL;
     if (opts != NULL)
-	*opts = NULL;
+    *opts = NULL;
     addr_list = NULL;
     if (!getword(f, word, &newline, filename))
-	return -1;		/* file is empty??? */
+    return -1;      /* file is empty??? */
     newline = 1;
     best_flag = -1;
     for (;;) {
-	/*
-	 * Skip until we find a word at the start of a line.
-	 */
-	while (!newline && getword(f, word, &newline, filename))
-	    ;
-	if (!newline)
-	    break;		/* got to end of file */
-
-	/*
-	 * Got a client - check if it's a match or a wildcard.
-	 */
-	got_flag = 0;
-	if (client != NULL && strcmp(word, client) != 0 && !ISWILD(word)) {
-	    newline = 0;
-	    continue;
-	}
-	if (!ISWILD(word))
-	    got_flag = NONWILD_CLIENT;
-
-	/*
-	 * Now get a server and check if it matches.
-	 */
-	if (!getword(f, word, &newline, filename))
-	    break;
-	if (newline)
-	    continue;
-	if (!ISWILD(word)) {
-	    if (server != NULL && strcmp(word, server) != 0)
-		continue;
-	    got_flag |= NONWILD_SERVER;
-	}
-
-	/*
-	 * Got some sort of a match - see if it's better than what
-	 * we have already.
-	 */
-	if (got_flag <= best_flag)
-	    continue;
-
-	/*
-	 * Get the secret.
-	 */
-	if (!getword(f, word, &newline, filename))
-	    break;
-	if (newline)
-	    continue;
-
-	/*
-	 * SRP-SHA1 authenticator should never be reading secrets from
-	 * a file.  (Authenticatee may, though.)
-	 */
-	if (flags && ((cp = strchr(word, ':')) == NULL ||
-	    strchr(cp + 1, ':') == NULL))
-	    continue;
-
-	if (secret != NULL) {
-	    /*
-	     * Special syntax: @/pathname means read secret from file.
-	     */
-	    if (word[0] == '@' && word[1] == '/') {
-		strlcpy(atfile, word+1, sizeof(atfile));
-		if ((sf = fopen(atfile, "r")) == NULL) {
-		    ppp_warn(("can't open indirect secret file %s", atfile));
-		    continue;
-		}
-		check_access(sf, atfile);
-		if (!getword(sf, word, &xxx, atfile)) {
-		    ppp_warn(("no secret in indirect secret file %s", atfile));
-		    fclose(sf);
-		    continue;
-		}
-		fclose(sf);
-	    }
-	    strlcpy(lsecret, word, sizeof(lsecret));
-	}
-
-	/*
-	 * Now read address authorization info and make a wordlist.
-	 */
-	app = &alist;
-	for (;;) {
-	    if (!getword(f, word, &newline, filename) || newline)
-		break;
-	    ap = (struct wordlist *)
-		    malloc(sizeof(struct wordlist) + strlen(word) + 1);
-	    if (ap == NULL)
-		novm("authorized addresses");
-	    ap->word = (char *) (ap + 1);
-	    strcpy(ap->word, word);
-	    *app = ap;
-	    app = &ap->next;
-	}
-	*app = NULL;
-
-	/*
-	 * This is the best so far; remember it.
-	 */
-	best_flag = got_flag;
-	if (addr_list)
-	    free_wordlist(addr_list);
-	addr_list = alist;
-	if (secret != NULL)
-	    strlcpy(secret, lsecret, MAXWORDLEN);
-
-	if (!newline)
-	    break;
+    /*
+     * Skip until we find a word at the start of a line.
+     */
+    while (!newline && getword(f, word, &newline, filename))
+        ;
+    if (!newline)
+        break;      /* got to end of file */
+
+    /*
+     * Got a client - check if it's a match or a wildcard.
+     */
+    got_flag = 0;
+    if (client != NULL && strcmp(word, client) != 0 && !ISWILD(word)) {
+        newline = 0;
+        continue;
+    }
+    if (!ISWILD(word))
+        got_flag = NONWILD_CLIENT;
+
+    /*
+     * Now get a server and check if it matches.
+     */
+    if (!getword(f, word, &newline, filename))
+        break;
+    if (newline)
+        continue;
+    if (!ISWILD(word)) {
+        if (server != NULL && strcmp(word, server) != 0)
+        continue;
+        got_flag |= NONWILD_SERVER;
+    }
+
+    /*
+     * Got some sort of a match - see if it's better than what
+     * we have already.
+     */
+    if (got_flag <= best_flag)
+        continue;
+
+    /*
+     * Get the secret.
+     */
+    if (!getword(f, word, &newline, filename))
+        break;
+    if (newline)
+        continue;
+
+    /*
+     * SRP-SHA1 authenticator should never be reading secrets from
+     * a file.  (Authenticatee may, though.)
+     */
+    if (flags && ((cp = strchr(word, ':')) == NULL ||
+        strchr(cp + 1, ':') == NULL))
+        continue;
+
+    if (secret != NULL) {
+        /*
+         * Special syntax: @/pathname means read secret from file.
+         */
+        if (word[0] == '@' && word[1] == '/') {
+        strlcpy(atfile, word+1, sizeof(atfile));
+        if ((sf = fopen(atfile, "r")) == NULL) {
+            ppp_warn(("can't open indirect secret file %s", atfile));
+            continue;
+        }
+        check_access(sf, atfile);
+        if (!getword(sf, word, &xxx, atfile)) {
+            ppp_warn(("no secret in indirect secret file %s", atfile));
+            fclose(sf);
+            continue;
+        }
+        fclose(sf);
+        }
+        strlcpy(lsecret, word, sizeof(lsecret));
+    }
+
+    /*
+     * Now read address authorization info and make a wordlist.
+     */
+    app = &alist;
+    for (;;) {
+        if (!getword(f, word, &newline, filename) || newline)
+        break;
+        ap = (struct wordlist *)
+            malloc(sizeof(struct wordlist) + strlen(word) + 1);
+        if (ap == NULL)
+        novm("authorized addresses");
+        ap->word = (char *) (ap + 1);
+        strcpy(ap->word, word);
+        *app = ap;
+        app = &ap->next;
+    }
+    *app = NULL;
+
+    /*
+     * This is the best so far; remember it.
+     */
+    best_flag = got_flag;
+    if (addr_list)
+        free_wordlist(addr_list);
+    addr_list = alist;
+    if (secret != NULL)
+        strlcpy(secret, lsecret, MAXWORDLEN);
+
+    if (!newline)
+        break;
     }
 
     /* scan for a -- word indicating the start of options */
     for (app = &addr_list; (ap = *app) != NULL; app = &ap->next)
-	if (strcmp(ap->word, "--") == 0)
-	    break;
+    if (strcmp(ap->word, "--") == 0)
+        break;
     /* ap = start of options */
     if (ap != NULL) {
-	ap = ap->next;		/* first option */
-	free(*app);			/* free the "--" word */
-	*app = NULL;		/* terminate addr list */
+    ap = ap->next;      /* first option */
+    free(*app);         /* free the "--" word */
+    *app = NULL;        /* terminate addr list */
     }
     if (opts != NULL)
-	*opts = ap;
+    *opts = ap;
     else if (ap != NULL)
-	free_wordlist(ap);
+    free_wordlist(ap);
     if (addrs != NULL)
-	*addrs = addr_list;
+    *addrs = addr_list;
     else if (addr_list != NULL)
-	free_wordlist(addr_list);
+    free_wordlist(addr_list);
 
     return best_flag;
 }
@@ -2489,7 +2489,7 @@ wordlist_count(wp)
     int n;
 
     for (n = 0; wp != NULL; wp = wp->next)
-	++n;
+    ++n;
     return n;
 }
 
@@ -2503,9 +2503,9 @@ free_wordlist(wp)
     struct wordlist *next;
 
     while (wp != NULL) {
-	next = wp->next;
-	free(wp);
-	wp = next;
+    next = wp->next;
+    free(wp);
+    wp = next;
     }
 }
 #endif /* UNUSED */
diff --git a/src/netif/ppp/ccp.c b/src/netif/ppp/ccp.c
index 86ecb9fb..edd3e93f 100644
--- a/src/netif/ppp/ccp.c
+++ b/src/netif/ppp/ccp.c
@@ -40,8 +40,8 @@
 #include "netif/ppp/ccp.h"
 
 #if MPPE_SUPPORT
-#include "netif/ppp/lcp.h"	/* lcp_close(), lcp_fsm */
-#include "netif/ppp/mppe.h"	/* mppe_init() */
+#include "netif/ppp/lcp.h"  /* lcp_close(), lcp_fsm */
+#include "netif/ppp/mppe.h" /* mppe_init() */
 #endif /* MPPE_SUPPORT */
 
 /*
@@ -51,7 +51,7 @@
  * Until this is fixed we only accept sizes in the range 9 .. 15.
  * Thanks to James Carlson for pointing this out.
  */
-#define DEFLATE_MIN_WORKS	9
+#define DEFLATE_MIN_WORKS   9
 
 /*
  * Command-line options.
@@ -66,7 +66,7 @@ static char deflate_value[8];
  * Option variables.
  */
 #if MPPE_SUPPORT
-bool refuse_mppe_stateful = 1;		/* Allow stateful mode? */
+bool refuse_mppe_stateful = 1;      /* Allow stateful mode? */
 #endif /* MPPE_SUPPORT */
 
 static option_t ccp_option_list[] = {
@@ -248,27 +248,27 @@ static const fsm_callbacks ccp_callbacks = {
 static int ccp_anycompress(ccp_options *opt) {
     return (0
 #if DEFLATE_SUPPORT
-	|| (opt)->deflate
+    || (opt)->deflate
 #endif /* DEFLATE_SUPPORT */
 #if BSDCOMPRESS_SUPPORT
-	|| (opt)->bsd_compress
+    || (opt)->bsd_compress
 #endif /* BSDCOMPRESS_SUPPORT */
 #if PREDICTOR_SUPPORT
-	|| (opt)->predictor_1 || (opt)->predictor_2
+    || (opt)->predictor_1 || (opt)->predictor_2
 #endif /* PREDICTOR_SUPPORT */
 #if MPPE_SUPPORT
-	|| (opt)->mppe
+    || (opt)->mppe
 #endif /* MPPE_SUPPORT */
-	);
+    );
 }
 
 /*
  * Local state (mainly for handling reset-reqs and reset-acks).
  */
-#define RACK_PENDING	1	/* waiting for reset-ack */
-#define RREQ_REPEAT	2	/* send another reset-req if no reset-ack */
+#define RACK_PENDING    1   /* waiting for reset-ack */
+#define RREQ_REPEAT 2   /* send another reset-req if no reset-ack */
 
-#define RACKTIMEOUT	1	/* second */
+#define RACKTIMEOUT 1   /* second */
 
 #if PPP_OPTIONS
 /*
@@ -284,31 +284,31 @@ setbsdcomp(argv)
     str = *argv;
     abits = rbits = strtol(str, &endp, 0);
     if (endp != str && *endp == ',') {
-	str = endp + 1;
-	abits = strtol(str, &endp, 0);
+    str = endp + 1;
+    abits = strtol(str, &endp, 0);
     }
     if (*endp != 0 || endp == str) {
-	option_error("invalid parameter '%s' for bsdcomp option", *argv);
-	return 0;
+    option_error("invalid parameter '%s' for bsdcomp option", *argv);
+    return 0;
     }
     if ((rbits != 0 && (rbits < BSD_MIN_BITS || rbits > BSD_MAX_BITS))
-	|| (abits != 0 && (abits < BSD_MIN_BITS || abits > BSD_MAX_BITS))) {
-	option_error("bsdcomp option values must be 0 or %d .. %d",
-		     BSD_MIN_BITS, BSD_MAX_BITS);
-	return 0;
+    || (abits != 0 && (abits < BSD_MIN_BITS || abits > BSD_MAX_BITS))) {
+    option_error("bsdcomp option values must be 0 or %d .. %d",
+             BSD_MIN_BITS, BSD_MAX_BITS);
+    return 0;
     }
     if (rbits > 0) {
-	ccp_wantoptions[0].bsd_compress = 1;
-	ccp_wantoptions[0].bsd_bits = rbits;
+    ccp_wantoptions[0].bsd_compress = 1;
+    ccp_wantoptions[0].bsd_bits = rbits;
     } else
-	ccp_wantoptions[0].bsd_compress = 0;
+    ccp_wantoptions[0].bsd_compress = 0;
     if (abits > 0) {
-	ccp_allowoptions[0].bsd_compress = 1;
-	ccp_allowoptions[0].bsd_bits = abits;
+    ccp_allowoptions[0].bsd_compress = 1;
+    ccp_allowoptions[0].bsd_bits = abits;
     } else
-	ccp_allowoptions[0].bsd_compress = 0;
+    ccp_allowoptions[0].bsd_compress = 0;
     ppp_slprintf(bsd_value, sizeof(bsd_value),
-	     rbits == abits? "%d": "%d,%d", rbits, abits);
+         rbits == abits? "%d": "%d,%d", rbits, abits);
 
     return 1;
 }
@@ -323,40 +323,40 @@ setdeflate(argv)
     str = *argv;
     abits = rbits = strtol(str, &endp, 0);
     if (endp != str && *endp == ',') {
-	str = endp + 1;
-	abits = strtol(str, &endp, 0);
+    str = endp + 1;
+    abits = strtol(str, &endp, 0);
     }
     if (*endp != 0 || endp == str) {
-	option_error("invalid parameter '%s' for deflate option", *argv);
-	return 0;
+    option_error("invalid parameter '%s' for deflate option", *argv);
+    return 0;
     }
     if ((rbits != 0 && (rbits < DEFLATE_MIN_SIZE || rbits > DEFLATE_MAX_SIZE))
-	|| (abits != 0 && (abits < DEFLATE_MIN_SIZE
-			  || abits > DEFLATE_MAX_SIZE))) {
-	option_error("deflate option values must be 0 or %d .. %d",
-		     DEFLATE_MIN_SIZE, DEFLATE_MAX_SIZE);
-	return 0;
+    || (abits != 0 && (abits < DEFLATE_MIN_SIZE
+              || abits > DEFLATE_MAX_SIZE))) {
+    option_error("deflate option values must be 0 or %d .. %d",
+             DEFLATE_MIN_SIZE, DEFLATE_MAX_SIZE);
+    return 0;
     }
     if (rbits == DEFLATE_MIN_SIZE || abits == DEFLATE_MIN_SIZE) {
-	if (rbits == DEFLATE_MIN_SIZE)
-	    rbits = DEFLATE_MIN_WORKS;
-	if (abits == DEFLATE_MIN_SIZE)
-	    abits = DEFLATE_MIN_WORKS;
-	warn("deflate option value of %d changed to %d to avoid zlib bug",
-	     DEFLATE_MIN_SIZE, DEFLATE_MIN_WORKS);
+    if (rbits == DEFLATE_MIN_SIZE)
+        rbits = DEFLATE_MIN_WORKS;
+    if (abits == DEFLATE_MIN_SIZE)
+        abits = DEFLATE_MIN_WORKS;
+    warn("deflate option value of %d changed to %d to avoid zlib bug",
+         DEFLATE_MIN_SIZE, DEFLATE_MIN_WORKS);
     }
     if (rbits > 0) {
-	ccp_wantoptions[0].deflate = 1;
-	ccp_wantoptions[0].deflate_size = rbits;
+    ccp_wantoptions[0].deflate = 1;
+    ccp_wantoptions[0].deflate_size = rbits;
     } else
-	ccp_wantoptions[0].deflate = 0;
+    ccp_wantoptions[0].deflate = 0;
     if (abits > 0) {
-	ccp_allowoptions[0].deflate = 1;
-	ccp_allowoptions[0].deflate_size = abits;
+    ccp_allowoptions[0].deflate = 1;
+    ccp_allowoptions[0].deflate_size = abits;
     } else
-	ccp_allowoptions[0].deflate = 0;
+    ccp_allowoptions[0].deflate = 0;
     ppp_slprintf(deflate_value, sizeof(deflate_value),
-	     rbits == abits? "%d": "%d,%d", rbits, abits);
+         rbits == abits? "%d": "%d,%d", rbits, abits);
 
     return 1;
 }
@@ -411,7 +411,7 @@ static void ccp_open(ppp_pcb *pcb) {
     ccp_options *go = &pcb->ccp_gotoptions;
 
     if (f->state != PPP_FSM_OPENED)
-	ccp_set(pcb, 1, 0, 0, 0);
+    ccp_set(pcb, 1, 0, 0, 0);
 
     /*
      * Find out which compressors the kernel supports before
@@ -419,7 +419,7 @@ static void ccp_open(ppp_pcb *pcb) {
      */
     ccp_resetci(f);
     if (!ccp_anycompress(go))
-	f->flags |= OPT_SILENT;
+    f->flags |= OPT_SILENT;
 
     fsm_open(f);
 }
@@ -463,12 +463,12 @@ static void ccp_input(ppp_pcb *pcb, u_char *p, int len) {
     oldstate = f->state;
     fsm_input(f, p, len);
     if (oldstate == PPP_FSM_OPENED && p[0] == TERMREQ && f->state != PPP_FSM_OPENED) {
-	ppp_notice(("Compression disabled by peer."));
+    ppp_notice(("Compression disabled by peer."));
 #if MPPE_SUPPORT
-	if (go->mppe) {
-	    ppp_error(("MPPE disabled, closing LCP"));
-	    lcp_close(pcb, "MPPE disabled by peer");
-	}
+    if (go->mppe) {
+        ppp_error(("MPPE disabled, closing LCP"));
+        lcp_close(pcb, "MPPE disabled by peer");
+    }
 #endif /* MPPE_SUPPORT */
     }
 
@@ -477,8 +477,8 @@ static void ccp_input(ppp_pcb *pcb, u_char *p, int len) {
      * close CCP.
      */
     if (oldstate == PPP_FSM_REQSENT && p[0] == TERMACK
-	&& !ccp_anycompress(go))
-	ccp_close(pcb, "No compression negotiated");
+    && !ccp_anycompress(go))
+    ccp_close(pcb, "No compression negotiated");
 }
 
 /*
@@ -491,24 +491,24 @@ static int ccp_extcode(fsm *f, int code, int id, u_char *p, int len) {
 
     switch (code) {
     case CCP_RESETREQ:
-	if (f->state != PPP_FSM_OPENED)
-	    break;
-	ccp_reset_comp(pcb);
-	/* send a reset-ack, which the transmitter will see and
-	   reset its compression state. */
-	fsm_sdata(f, CCP_RESETACK, id, NULL, 0);
-	break;
+    if (f->state != PPP_FSM_OPENED)
+        break;
+    ccp_reset_comp(pcb);
+    /* send a reset-ack, which the transmitter will see and
+       reset its compression state. */
+    fsm_sdata(f, CCP_RESETACK, id, NULL, 0);
+    break;
 
     case CCP_RESETACK:
-	if ((pcb->ccp_localstate & RACK_PENDING) && id == f->reqid) {
-	    pcb->ccp_localstate &= ~(RACK_PENDING | RREQ_REPEAT);
-	    UNTIMEOUT(ccp_rack_timeout, f);
-	    ccp_reset_decomp(pcb);
-	}
-	break;
+    if ((pcb->ccp_localstate & RACK_PENDING) && id == f->reqid) {
+        pcb->ccp_localstate &= ~(RACK_PENDING | RREQ_REPEAT);
+        UNTIMEOUT(ccp_rack_timeout, f);
+        ccp_reset_decomp(pcb);
+    }
+    break;
 
     default:
-	return 0;
+    return 0;
     }
 
     return 1;
@@ -528,8 +528,8 @@ static void ccp_protrej(ppp_pcb *pcb) {
 
 #if MPPE_SUPPORT
     if (go->mppe) {
-	ppp_error(("MPPE required but peer negotiation failed"));
-	lcp_close(pcb, "MPPE required but peer negotiation failed");
+    ppp_error(("MPPE required but peer negotiation failed"));
+    lcp_close(pcb, "MPPE required but peer negotiation failed");
     }
 #endif /* MPPE_SUPPORT */
 
@@ -554,9 +554,9 @@ static void ccp_resetci(fsm *f) {
 
 #if MPPE_SUPPORT
     if (pcb->settings.require_mppe) {
-	wo->mppe = ao->mppe =
-		    (pcb->settings.refuse_mppe_40 ? 0 : MPPE_OPT_40)
-		  | (pcb->settings.refuse_mppe_128 ? 0 : MPPE_OPT_128);
+    wo->mppe = ao->mppe =
+            (pcb->settings.refuse_mppe_40 ? 0 : MPPE_OPT_40)
+          | (pcb->settings.refuse_mppe_128 ? 0 : MPPE_OPT_128);
     }
 #endif /* MPPE_SUPPORT */
 
@@ -565,78 +565,78 @@ static void ccp_resetci(fsm *f) {
 
 #if MPPE_SUPPORT
     if (go->mppe) {
-	int auth_mschap_bits = pcb->auth_done;
-	int numbits;
-
-	/*
-	 * Start with a basic sanity check: mschap[v2] auth must be in
-	 * exactly one direction.  RFC 3079 says that the keys are
-	 * 'derived from the credentials of the peer that initiated the call',
-	 * however the PPP protocol doesn't have such a concept, and pppd
-	 * cannot get this info externally.  Instead we do the best we can.
-	 * NB: If MPPE is required, all other compression opts are invalid.
-	 *     So, we return right away if we can't do it.
-	 */
-
-	/* Leave only the mschap auth bits set */
-	auth_mschap_bits &= (CHAP_MS_WITHPEER  | CHAP_MS_PEER |
-			     CHAP_MS2_WITHPEER | CHAP_MS2_PEER);
-	/* Count the mschap auths */
-	auth_mschap_bits >>= CHAP_MS_SHIFT;
-	numbits = 0;
-	do {
-	    numbits += auth_mschap_bits & 1;
-	    auth_mschap_bits >>= 1;
-	} while (auth_mschap_bits);
-	if (numbits > 1) {
-	    ppp_error(("MPPE required, but auth done in both directions."));
-	    lcp_close(pcb, "MPPE required but not available");
-	    return;
-	}
-	if (!numbits) {
-	    ppp_error(("MPPE required, but MS-CHAP[v2] auth not performed."));
-	    lcp_close(pcb, "MPPE required but not available");
-	    return;
-	}
-
-	/* A plugin (eg radius) may not have obtained key material. */
-	if (!pcb->mppe_keys_set) {
-	    ppp_error(("MPPE required, but keys are not available.  "
-		  "Possible plugin problem?"));
-	    lcp_close(pcb, "MPPE required but not available");
-	    return;
-	}
-
-	/* LM auth not supported for MPPE */
-	if (pcb->auth_done & (CHAP_MS_WITHPEER | CHAP_MS_PEER)) {
-	    /* This might be noise */
-	    if (go->mppe & MPPE_OPT_40) {
-		ppp_notice(("Disabling 40-bit MPPE; MS-CHAP LM not supported"));
-		go->mppe &= ~MPPE_OPT_40;
-		wo->mppe &= ~MPPE_OPT_40;
-	    }
-	}
-
-	/* Last check: can we actually negotiate something? */
-	if (!(go->mppe & (MPPE_OPT_40 | MPPE_OPT_128))) {
-	    /* Could be misconfig, could be 40-bit disabled above. */
-	    ppp_error(("MPPE required, but both 40-bit and 128-bit disabled."));
-	    lcp_close(pcb, "MPPE required but not available");
-	    return;
-	}
-
-	/* sync options */
-	ao->mppe = go->mppe;
-	/* MPPE is not compatible with other compression types */
+    int auth_mschap_bits = pcb->auth_done;
+    int numbits;
+
+    /*
+     * Start with a basic sanity check: mschap[v2] auth must be in
+     * exactly one direction.  RFC 3079 says that the keys are
+     * 'derived from the credentials of the peer that initiated the call',
+     * however the PPP protocol doesn't have such a concept, and pppd
+     * cannot get this info externally.  Instead we do the best we can.
+     * NB: If MPPE is required, all other compression opts are invalid.
+     *     So, we return right away if we can't do it.
+     */
+
+    /* Leave only the mschap auth bits set */
+    auth_mschap_bits &= (CHAP_MS_WITHPEER  | CHAP_MS_PEER |
+                 CHAP_MS2_WITHPEER | CHAP_MS2_PEER);
+    /* Count the mschap auths */
+    auth_mschap_bits >>= CHAP_MS_SHIFT;
+    numbits = 0;
+    do {
+        numbits += auth_mschap_bits & 1;
+        auth_mschap_bits >>= 1;
+    } while (auth_mschap_bits);
+    if (numbits > 1) {
+        ppp_error(("MPPE required, but auth done in both directions."));
+        lcp_close(pcb, "MPPE required but not available");
+        return;
+    }
+    if (!numbits) {
+        ppp_error(("MPPE required, but MS-CHAP[v2] auth not performed."));
+        lcp_close(pcb, "MPPE required but not available");
+        return;
+    }
+
+    /* A plugin (eg radius) may not have obtained key material. */
+    if (!pcb->mppe_keys_set) {
+        ppp_error(("MPPE required, but keys are not available.  "
+          "Possible plugin problem?"));
+        lcp_close(pcb, "MPPE required but not available");
+        return;
+    }
+
+    /* LM auth not supported for MPPE */
+    if (pcb->auth_done & (CHAP_MS_WITHPEER | CHAP_MS_PEER)) {
+        /* This might be noise */
+        if (go->mppe & MPPE_OPT_40) {
+        ppp_notice(("Disabling 40-bit MPPE; MS-CHAP LM not supported"));
+        go->mppe &= ~MPPE_OPT_40;
+        wo->mppe &= ~MPPE_OPT_40;
+        }
+    }
+
+    /* Last check: can we actually negotiate something? */
+    if (!(go->mppe & (MPPE_OPT_40 | MPPE_OPT_128))) {
+        /* Could be misconfig, could be 40-bit disabled above. */
+        ppp_error(("MPPE required, but both 40-bit and 128-bit disabled."));
+        lcp_close(pcb, "MPPE required but not available");
+        return;
+    }
+
+    /* sync options */
+    ao->mppe = go->mppe;
+    /* MPPE is not compatible with other compression types */
 #if BSDCOMPRESS_SUPPORT
-	ao->bsd_compress = go->bsd_compress = 0;
+    ao->bsd_compress = go->bsd_compress = 0;
 #endif /* BSDCOMPRESS_SUPPORT */
 #if PREDICTOR_SUPPORT
-	ao->predictor_1  = go->predictor_1  = 0;
-	ao->predictor_2  = go->predictor_2  = 0;
+    ao->predictor_1  = go->predictor_1  = 0;
+    ao->predictor_2  = go->predictor_2  = 0;
 #endif /* PREDICTOR_SUPPORT */
 #if DEFLATE_SUPPORT
-	ao->deflate      = go->deflate      = 0;
+    ao->deflate      = go->deflate      = 0;
 #endif /* DEFLATE_SUPPORT */
     }
 #endif /* MPPE_SUPPORT */
@@ -650,23 +650,23 @@ static void ccp_resetci(fsm *f) {
      * if BSDCOMPRESS_SUPPORT is set, it is.
      */
     if (go->bsd_compress) {
-	opt_buf[0] = CI_BSD_COMPRESS;
-	opt_buf[1] = CILEN_BSD_COMPRESS;
-	for (;;) {
-	    if (go->bsd_bits < BSD_MIN_BITS) {
-		go->bsd_compress = 0;
-		break;
-	    }
-	    opt_buf[2] = BSD_MAKE_OPT(BSD_CURRENT_VERSION, go->bsd_bits);
-	    res = ccp_test(pcb, opt_buf, CILEN_BSD_COMPRESS, 0);
-	    if (res > 0) {
-		break;
-	    } else if (res < 0) {
-		go->bsd_compress = 0;
-		break;
-	    }
-	    go->bsd_bits--;
-	}
+    opt_buf[0] = CI_BSD_COMPRESS;
+    opt_buf[1] = CILEN_BSD_COMPRESS;
+    for (;;) {
+        if (go->bsd_bits < BSD_MIN_BITS) {
+        go->bsd_compress = 0;
+        break;
+        }
+        opt_buf[2] = BSD_MAKE_OPT(BSD_CURRENT_VERSION, go->bsd_bits);
+        res = ccp_test(pcb, opt_buf, CILEN_BSD_COMPRESS, 0);
+        if (res > 0) {
+        break;
+        } else if (res < 0) {
+        go->bsd_compress = 0;
+        break;
+        }
+        go->bsd_bits--;
+    }
     }
 #endif /* BSDCOMPRESS_SUPPORT */
 #if DEFLATE_SUPPORT
@@ -674,48 +674,48 @@ static void ccp_resetci(fsm *f) {
      * if DEFLATE_SUPPORT is set, it is.
      */
     if (go->deflate) {
-	if (go->deflate_correct) {
-	    opt_buf[0] = CI_DEFLATE;
-	    opt_buf[1] = CILEN_DEFLATE;
-	    opt_buf[3] = DEFLATE_CHK_SEQUENCE;
-	    for (;;) {
-		if (go->deflate_size < DEFLATE_MIN_WORKS) {
-		    go->deflate_correct = 0;
-		    break;
-		}
-		opt_buf[2] = DEFLATE_MAKE_OPT(go->deflate_size);
-		res = ccp_test(pcb, opt_buf, CILEN_DEFLATE, 0);
-		if (res > 0) {
-		    break;
-		} else if (res < 0) {
-		    go->deflate_correct = 0;
-		    break;
-		}
-		go->deflate_size--;
-	    }
-	}
-	if (go->deflate_draft) {
-	    opt_buf[0] = CI_DEFLATE_DRAFT;
-	    opt_buf[1] = CILEN_DEFLATE;
-	    opt_buf[3] = DEFLATE_CHK_SEQUENCE;
-	    for (;;) {
-		if (go->deflate_size < DEFLATE_MIN_WORKS) {
-		    go->deflate_draft = 0;
-		    break;
-		}
-		opt_buf[2] = DEFLATE_MAKE_OPT(go->deflate_size);
-		res = ccp_test(pcb, opt_buf, CILEN_DEFLATE, 0);
-		if (res > 0) {
-		    break;
-		} else if (res < 0) {
-		    go->deflate_draft = 0;
-		    break;
-		}
-		go->deflate_size--;
-	    }
-	}
-	if (!go->deflate_correct && !go->deflate_draft)
-	    go->deflate = 0;
+    if (go->deflate_correct) {
+        opt_buf[0] = CI_DEFLATE;
+        opt_buf[1] = CILEN_DEFLATE;
+        opt_buf[3] = DEFLATE_CHK_SEQUENCE;
+        for (;;) {
+        if (go->deflate_size < DEFLATE_MIN_WORKS) {
+            go->deflate_correct = 0;
+            break;
+        }
+        opt_buf[2] = DEFLATE_MAKE_OPT(go->deflate_size);
+        res = ccp_test(pcb, opt_buf, CILEN_DEFLATE, 0);
+        if (res > 0) {
+            break;
+        } else if (res < 0) {
+            go->deflate_correct = 0;
+            break;
+        }
+        go->deflate_size--;
+        }
+    }
+    if (go->deflate_draft) {
+        opt_buf[0] = CI_DEFLATE_DRAFT;
+        opt_buf[1] = CILEN_DEFLATE;
+        opt_buf[3] = DEFLATE_CHK_SEQUENCE;
+        for (;;) {
+        if (go->deflate_size < DEFLATE_MIN_WORKS) {
+            go->deflate_draft = 0;
+            break;
+        }
+        opt_buf[2] = DEFLATE_MAKE_OPT(go->deflate_size);
+        res = ccp_test(pcb, opt_buf, CILEN_DEFLATE, 0);
+        if (res > 0) {
+            break;
+        } else if (res < 0) {
+            go->deflate_draft = 0;
+            break;
+        }
+        go->deflate_size--;
+        }
+    }
+    if (!go->deflate_correct && !go->deflate_draft)
+        go->deflate = 0;
     }
 #endif /* DEFLATE_SUPPORT */
 #if PREDICTOR_SUPPORT
@@ -723,16 +723,16 @@ static void ccp_resetci(fsm *f) {
      * if PREDICTOR_SUPPORT is set, it is.
      */
     if (go->predictor_1) {
-	opt_buf[0] = CI_PREDICTOR_1;
-	opt_buf[1] = CILEN_PREDICTOR_1;
-	if (ccp_test(pcb, opt_buf, CILEN_PREDICTOR_1, 0) <= 0)
-	    go->predictor_1 = 0;
+    opt_buf[0] = CI_PREDICTOR_1;
+    opt_buf[1] = CILEN_PREDICTOR_1;
+    if (ccp_test(pcb, opt_buf, CILEN_PREDICTOR_1, 0) <= 0)
+        go->predictor_1 = 0;
     }
     if (go->predictor_2) {
-	opt_buf[0] = CI_PREDICTOR_2;
-	opt_buf[1] = CILEN_PREDICTOR_2;
-	if (ccp_test(pcb, opt_buf, CILEN_PREDICTOR_2, 0) <= 0)
-	    go->predictor_2 = 0;
+    opt_buf[0] = CI_PREDICTOR_2;
+    opt_buf[1] = CILEN_PREDICTOR_2;
+    if (ccp_test(pcb, opt_buf, CILEN_PREDICTOR_2, 0) <= 0)
+        go->predictor_2 = 0;
     }
 #endif /* PREDICTOR_SUPPORT */
 }
@@ -746,20 +746,20 @@ static int ccp_cilen(fsm *f) {
 
     return 0
 #if BSDCOMPRESS_SUPPORT
-	+ (go->bsd_compress? CILEN_BSD_COMPRESS: 0)
+    + (go->bsd_compress? CILEN_BSD_COMPRESS: 0)
 #endif /* BSDCOMPRESS_SUPPORT */
 #if DEFLATE_SUPPORT
-	+ (go->deflate && go->deflate_correct? CILEN_DEFLATE: 0)
-	+ (go->deflate && go->deflate_draft? CILEN_DEFLATE: 0)
+    + (go->deflate && go->deflate_correct? CILEN_DEFLATE: 0)
+    + (go->deflate && go->deflate_draft? CILEN_DEFLATE: 0)
 #endif /* DEFLATE_SUPPORT */
 #if PREDICTOR_SUPPORT
-	+ (go->predictor_1? CILEN_PREDICTOR_1: 0)
-	+ (go->predictor_2? CILEN_PREDICTOR_2: 0)
+    + (go->predictor_1? CILEN_PREDICTOR_1: 0)
+    + (go->predictor_2? CILEN_PREDICTOR_2: 0)
 #endif /* PREDICTOR_SUPPORT */
 #if MPPE_SUPPORT
-	+ (go->mppe? CILEN_MPPE: 0)
+    + (go->mppe? CILEN_MPPE: 0)
 #endif /* MPPE_SUPPORT */
-	;
+    ;
 }
 
 /*
@@ -776,50 +776,50 @@ static void ccp_addci(fsm *f, u_char *p, int *lenp) {
      */
 #if MPPE_SUPPORT
     if (go->mppe) {
-	p[0] = CI_MPPE;
-	p[1] = CILEN_MPPE;
-	MPPE_OPTS_TO_CI(go->mppe, &p[2]);
-	mppe_init(pcb, &pcb->mppe_decomp, go->mppe);
-	p += CILEN_MPPE;
+    p[0] = CI_MPPE;
+    p[1] = CILEN_MPPE;
+    MPPE_OPTS_TO_CI(go->mppe, &p[2]);
+    mppe_init(pcb, &pcb->mppe_decomp, go->mppe);
+    p += CILEN_MPPE;
     }
 #endif /* MPPE_SUPPORT */
 #if DEFLATE_SUPPORT
     if (go->deflate) {
-	if (go->deflate_correct) {
-	    p[0] = CI_DEFLATE;
-	    p[1] = CILEN_DEFLATE;
-	    p[2] = DEFLATE_MAKE_OPT(go->deflate_size);
-	    p[3] = DEFLATE_CHK_SEQUENCE;
-	    p += CILEN_DEFLATE;
-	}
-	if (go->deflate_draft) {
-	    p[0] = CI_DEFLATE_DRAFT;
-	    p[1] = CILEN_DEFLATE;
-	    p[2] = p[2 - CILEN_DEFLATE];
-	    p[3] = DEFLATE_CHK_SEQUENCE;
-	    p += CILEN_DEFLATE;
-	}
+    if (go->deflate_correct) {
+        p[0] = CI_DEFLATE;
+        p[1] = CILEN_DEFLATE;
+        p[2] = DEFLATE_MAKE_OPT(go->deflate_size);
+        p[3] = DEFLATE_CHK_SEQUENCE;
+        p += CILEN_DEFLATE;
+    }
+    if (go->deflate_draft) {
+        p[0] = CI_DEFLATE_DRAFT;
+        p[1] = CILEN_DEFLATE;
+        p[2] = p[2 - CILEN_DEFLATE];
+        p[3] = DEFLATE_CHK_SEQUENCE;
+        p += CILEN_DEFLATE;
+    }
     }
 #endif /* DEFLATE_SUPPORT */
 #if BSDCOMPRESS_SUPPORT
     if (go->bsd_compress) {
-	p[0] = CI_BSD_COMPRESS;
-	p[1] = CILEN_BSD_COMPRESS;
-	p[2] = BSD_MAKE_OPT(BSD_CURRENT_VERSION, go->bsd_bits);
-	p += CILEN_BSD_COMPRESS;
+    p[0] = CI_BSD_COMPRESS;
+    p[1] = CILEN_BSD_COMPRESS;
+    p[2] = BSD_MAKE_OPT(BSD_CURRENT_VERSION, go->bsd_bits);
+    p += CILEN_BSD_COMPRESS;
     }
 #endif /* BSDCOMPRESS_SUPPORT */
 #if PREDICTOR_SUPPORT
     /* XXX Should Predictor 2 be preferable to Predictor 1? */
     if (go->predictor_1) {
-	p[0] = CI_PREDICTOR_1;
-	p[1] = CILEN_PREDICTOR_1;
-	p += CILEN_PREDICTOR_1;
+    p[0] = CI_PREDICTOR_1;
+    p[1] = CILEN_PREDICTOR_1;
+    p += CILEN_PREDICTOR_1;
     }
     if (go->predictor_2) {
-	p[0] = CI_PREDICTOR_2;
-	p[1] = CILEN_PREDICTOR_2;
-	p += CILEN_PREDICTOR_2;
+    p[0] = CI_PREDICTOR_2;
+    p[1] = CILEN_PREDICTOR_2;
+    p += CILEN_PREDICTOR_2;
     }
 #endif /* PREDICTOR_SUPPORT */
 
@@ -841,83 +841,83 @@ static int ccp_ackci(fsm *f, u_char *p, int len) {
 
 #if MPPE_SUPPORT
     if (go->mppe) {
-	u_char opt_buf[CILEN_MPPE];
-
-	opt_buf[0] = CI_MPPE;
-	opt_buf[1] = CILEN_MPPE;
-	MPPE_OPTS_TO_CI(go->mppe, &opt_buf[2]);
-	if (len < CILEN_MPPE || memcmp(opt_buf, p, CILEN_MPPE))
-	    return 0;
-	p += CILEN_MPPE;
-	len -= CILEN_MPPE;
-	/* XXX Cope with first/fast ack */
-	if (len == 0)
-	    return 1;
+    u_char opt_buf[CILEN_MPPE];
+
+    opt_buf[0] = CI_MPPE;
+    opt_buf[1] = CILEN_MPPE;
+    MPPE_OPTS_TO_CI(go->mppe, &opt_buf[2]);
+    if (len < CILEN_MPPE || memcmp(opt_buf, p, CILEN_MPPE))
+        return 0;
+    p += CILEN_MPPE;
+    len -= CILEN_MPPE;
+    /* XXX Cope with first/fast ack */
+    if (len == 0)
+        return 1;
     }
 #endif /* MPPE_SUPPORT */
 #if DEFLATE_SUPPORT
     if (go->deflate) {
-	if (len < CILEN_DEFLATE
-	    || p[0] != (go->deflate_correct? CI_DEFLATE: CI_DEFLATE_DRAFT)
-	    || p[1] != CILEN_DEFLATE
-	    || p[2] != DEFLATE_MAKE_OPT(go->deflate_size)
-	    || p[3] != DEFLATE_CHK_SEQUENCE)
-	    return 0;
-	p += CILEN_DEFLATE;
-	len -= CILEN_DEFLATE;
-	/* XXX Cope with first/fast ack */
-	if (len == 0)
-	    return 1;
-	if (go->deflate_correct && go->deflate_draft) {
-	    if (len < CILEN_DEFLATE
-		|| p[0] != CI_DEFLATE_DRAFT
-		|| p[1] != CILEN_DEFLATE
-		|| p[2] != DEFLATE_MAKE_OPT(go->deflate_size)
-		|| p[3] != DEFLATE_CHK_SEQUENCE)
-		return 0;
-	    p += CILEN_DEFLATE;
-	    len -= CILEN_DEFLATE;
-	}
+    if (len < CILEN_DEFLATE
+        || p[0] != (go->deflate_correct? CI_DEFLATE: CI_DEFLATE_DRAFT)
+        || p[1] != CILEN_DEFLATE
+        || p[2] != DEFLATE_MAKE_OPT(go->deflate_size)
+        || p[3] != DEFLATE_CHK_SEQUENCE)
+        return 0;
+    p += CILEN_DEFLATE;
+    len -= CILEN_DEFLATE;
+    /* XXX Cope with first/fast ack */
+    if (len == 0)
+        return 1;
+    if (go->deflate_correct && go->deflate_draft) {
+        if (len < CILEN_DEFLATE
+        || p[0] != CI_DEFLATE_DRAFT
+        || p[1] != CILEN_DEFLATE
+        || p[2] != DEFLATE_MAKE_OPT(go->deflate_size)
+        || p[3] != DEFLATE_CHK_SEQUENCE)
+        return 0;
+        p += CILEN_DEFLATE;
+        len -= CILEN_DEFLATE;
+    }
     }
 #endif /* DEFLATE_SUPPORT */
 #if BSDCOMPRESS_SUPPORT
     if (go->bsd_compress) {
-	if (len < CILEN_BSD_COMPRESS
-	    || p[0] != CI_BSD_COMPRESS || p[1] != CILEN_BSD_COMPRESS
-	    || p[2] != BSD_MAKE_OPT(BSD_CURRENT_VERSION, go->bsd_bits))
-	    return 0;
-	p += CILEN_BSD_COMPRESS;
-	len -= CILEN_BSD_COMPRESS;
-	/* XXX Cope with first/fast ack */
-	if (p == p0 && len == 0)
-	    return 1;
+    if (len < CILEN_BSD_COMPRESS
+        || p[0] != CI_BSD_COMPRESS || p[1] != CILEN_BSD_COMPRESS
+        || p[2] != BSD_MAKE_OPT(BSD_CURRENT_VERSION, go->bsd_bits))
+        return 0;
+    p += CILEN_BSD_COMPRESS;
+    len -= CILEN_BSD_COMPRESS;
+    /* XXX Cope with first/fast ack */
+    if (p == p0 && len == 0)
+        return 1;
     }
 #endif /* BSDCOMPRESS_SUPPORT */
 #if PREDICTOR_SUPPORT
     if (go->predictor_1) {
-	if (len < CILEN_PREDICTOR_1
-	    || p[0] != CI_PREDICTOR_1 || p[1] != CILEN_PREDICTOR_1)
-	    return 0;
-	p += CILEN_PREDICTOR_1;
-	len -= CILEN_PREDICTOR_1;
-	/* XXX Cope with first/fast ack */
-	if (p == p0 && len == 0)
-	    return 1;
+    if (len < CILEN_PREDICTOR_1
+        || p[0] != CI_PREDICTOR_1 || p[1] != CILEN_PREDICTOR_1)
+        return 0;
+    p += CILEN_PREDICTOR_1;
+    len -= CILEN_PREDICTOR_1;
+    /* XXX Cope with first/fast ack */
+    if (p == p0 && len == 0)
+        return 1;
     }
     if (go->predictor_2) {
-	if (len < CILEN_PREDICTOR_2
-	    || p[0] != CI_PREDICTOR_2 || p[1] != CILEN_PREDICTOR_2)
-	    return 0;
-	p += CILEN_PREDICTOR_2;
-	len -= CILEN_PREDICTOR_2;
-	/* XXX Cope with first/fast ack */
-	if (p == p0 && len == 0)
-	    return 1;
+    if (len < CILEN_PREDICTOR_2
+        || p[0] != CI_PREDICTOR_2 || p[1] != CILEN_PREDICTOR_2)
+        return 0;
+    p += CILEN_PREDICTOR_2;
+    len -= CILEN_PREDICTOR_2;
+    /* XXX Cope with first/fast ack */
+    if (p == p0 && len == 0)
+        return 1;
     }
 #endif /* PREDICTOR_SUPPORT */
 
     if (len != 0)
-	return 0;
+    return 0;
     return 1;
 }
 
@@ -928,8 +928,8 @@ static int ccp_ackci(fsm *f, u_char *p, int len) {
 static int ccp_nakci(fsm *f, u_char *p, int len, int treat_as_reject) {
     ppp_pcb *pcb = f->pcb;
     ccp_options *go = &pcb->ccp_gotoptions;
-    ccp_options no;		/* options we've seen already */
-    ccp_options try_;		/* options to ask for next time */
+    ccp_options no;     /* options we've seen already */
+    ccp_options try_;       /* options to ask for next time */
     LWIP_UNUSED_ARG(treat_as_reject);
 #if !MPPE_SUPPORT && !DEFLATE_SUPPORT && !BSDCOMPRESS_SUPPORT
     LWIP_UNUSED_ARG(p);
@@ -941,66 +941,66 @@ static int ccp_nakci(fsm *f, u_char *p, int len, int treat_as_reject) {
 
 #if MPPE_SUPPORT
     if (go->mppe && len >= CILEN_MPPE
-	&& p[0] == CI_MPPE && p[1] == CILEN_MPPE) {
-	no.mppe = 1;
-	/*
-	 * Peer wants us to use a different strength or other setting.
-	 * Fail if we aren't willing to use his suggestion.
-	 */
-	MPPE_CI_TO_OPTS(&p[2], try_.mppe);
-	if ((try_.mppe & MPPE_OPT_STATEFUL) && pcb->settings.refuse_mppe_stateful) {
-	    ppp_error(("Refusing MPPE stateful mode offered by peer"));
-	    try_.mppe = 0;
-	} else if (((go->mppe | MPPE_OPT_STATEFUL) & try_.mppe) != try_.mppe) {
-	    /* Peer must have set options we didn't request (suggest) */
-	    try_.mppe = 0;
-	}
-
-	if (!try_.mppe) {
-	    ppp_error(("MPPE required but peer negotiation failed"));
-	    lcp_close(pcb, "MPPE required but peer negotiation failed");
-	}
+    && p[0] == CI_MPPE && p[1] == CILEN_MPPE) {
+    no.mppe = 1;
+    /*
+     * Peer wants us to use a different strength or other setting.
+     * Fail if we aren't willing to use his suggestion.
+     */
+    MPPE_CI_TO_OPTS(&p[2], try_.mppe);
+    if ((try_.mppe & MPPE_OPT_STATEFUL) && pcb->settings.refuse_mppe_stateful) {
+        ppp_error(("Refusing MPPE stateful mode offered by peer"));
+        try_.mppe = 0;
+    } else if (((go->mppe | MPPE_OPT_STATEFUL) & try_.mppe) != try_.mppe) {
+        /* Peer must have set options we didn't request (suggest) */
+        try_.mppe = 0;
+    }
+
+    if (!try_.mppe) {
+        ppp_error(("MPPE required but peer negotiation failed"));
+        lcp_close(pcb, "MPPE required but peer negotiation failed");
+    }
     }
 #endif /* MPPE_SUPPORT */
 #if DEFLATE_SUPPORT
     if (go->deflate && len >= CILEN_DEFLATE
-	&& p[0] == (go->deflate_correct? CI_DEFLATE: CI_DEFLATE_DRAFT)
-	&& p[1] == CILEN_DEFLATE) {
-	no.deflate = 1;
-	/*
-	 * Peer wants us to use a different code size or something.
-	 * Stop asking for Deflate if we don't understand his suggestion.
-	 */
-	if (DEFLATE_METHOD(p[2]) != DEFLATE_METHOD_VAL
-	    || DEFLATE_SIZE(p[2]) < DEFLATE_MIN_WORKS
-	    || p[3] != DEFLATE_CHK_SEQUENCE)
-	    try_.deflate = 0;
-	else if (DEFLATE_SIZE(p[2]) < go->deflate_size)
-	    try_.deflate_size = DEFLATE_SIZE(p[2]);
-	p += CILEN_DEFLATE;
-	len -= CILEN_DEFLATE;
-	if (go->deflate_correct && go->deflate_draft
-	    && len >= CILEN_DEFLATE && p[0] == CI_DEFLATE_DRAFT
-	    && p[1] == CILEN_DEFLATE) {
-	    p += CILEN_DEFLATE;
-	    len -= CILEN_DEFLATE;
-	}
+    && p[0] == (go->deflate_correct? CI_DEFLATE: CI_DEFLATE_DRAFT)
+    && p[1] == CILEN_DEFLATE) {
+    no.deflate = 1;
+    /*
+     * Peer wants us to use a different code size or something.
+     * Stop asking for Deflate if we don't understand his suggestion.
+     */
+    if (DEFLATE_METHOD(p[2]) != DEFLATE_METHOD_VAL
+        || DEFLATE_SIZE(p[2]) < DEFLATE_MIN_WORKS
+        || p[3] != DEFLATE_CHK_SEQUENCE)
+        try_.deflate = 0;
+    else if (DEFLATE_SIZE(p[2]) < go->deflate_size)
+        try_.deflate_size = DEFLATE_SIZE(p[2]);
+    p += CILEN_DEFLATE;
+    len -= CILEN_DEFLATE;
+    if (go->deflate_correct && go->deflate_draft
+        && len >= CILEN_DEFLATE && p[0] == CI_DEFLATE_DRAFT
+        && p[1] == CILEN_DEFLATE) {
+        p += CILEN_DEFLATE;
+        len -= CILEN_DEFLATE;
+    }
     }
 #endif /* DEFLATE_SUPPORT */
 #if BSDCOMPRESS_SUPPORT
     if (go->bsd_compress && len >= CILEN_BSD_COMPRESS
-	&& p[0] == CI_BSD_COMPRESS && p[1] == CILEN_BSD_COMPRESS) {
-	no.bsd_compress = 1;
-	/*
-	 * Peer wants us to use a different number of bits
-	 * or a different version.
-	 */
-	if (BSD_VERSION(p[2]) != BSD_CURRENT_VERSION)
-	    try_.bsd_compress = 0;
-	else if (BSD_NBITS(p[2]) < go->bsd_bits)
-	    try_.bsd_bits = BSD_NBITS(p[2]);
-	p += CILEN_BSD_COMPRESS;
-	len -= CILEN_BSD_COMPRESS;
+    && p[0] == CI_BSD_COMPRESS && p[1] == CILEN_BSD_COMPRESS) {
+    no.bsd_compress = 1;
+    /*
+     * Peer wants us to use a different number of bits
+     * or a different version.
+     */
+    if (BSD_VERSION(p[2]) != BSD_CURRENT_VERSION)
+        try_.bsd_compress = 0;
+    else if (BSD_NBITS(p[2]) < go->bsd_bits)
+        try_.bsd_bits = BSD_NBITS(p[2]);
+    p += CILEN_BSD_COMPRESS;
+    len -= CILEN_BSD_COMPRESS;
     }
 #endif /* BSDCOMPRESS_SUPPORT */
 
@@ -1011,7 +1011,7 @@ static int ccp_nakci(fsm *f, u_char *p, int len, int treat_as_reject) {
      */
 
     if (f->state != PPP_FSM_OPENED)
-	*go = try_;
+    *go = try_;
     return 1;
 }
 
@@ -1021,7 +1021,7 @@ static int ccp_nakci(fsm *f, u_char *p, int len, int treat_as_reject) {
 static int ccp_rejci(fsm *f, u_char *p, int len) {
     ppp_pcb *pcb = f->pcb;
     ccp_options *go = &pcb->ccp_gotoptions;
-    ccp_options try_;		/* options to request next time */
+    ccp_options try_;       /* options to request next time */
 
     try_ = *go;
 
@@ -1030,69 +1030,69 @@ static int ccp_rejci(fsm *f, u_char *p, int len) {
      * configure-requests.
      */
     if (len == 0 && pcb->ccp_all_rejected)
-	return -1;
+    return -1;
 
 #if MPPE_SUPPORT
     if (go->mppe && len >= CILEN_MPPE
-	&& p[0] == CI_MPPE && p[1] == CILEN_MPPE) {
-	ppp_error(("MPPE required but peer refused"));
-	lcp_close(pcb, "MPPE required but peer refused");
-	p += CILEN_MPPE;
-	len -= CILEN_MPPE;
+    && p[0] == CI_MPPE && p[1] == CILEN_MPPE) {
+    ppp_error(("MPPE required but peer refused"));
+    lcp_close(pcb, "MPPE required but peer refused");
+    p += CILEN_MPPE;
+    len -= CILEN_MPPE;
     }
 #endif /* MPPE_SUPPORT */
 #if DEFLATE_SUPPORT
     if (go->deflate_correct && len >= CILEN_DEFLATE
-	&& p[0] == CI_DEFLATE && p[1] == CILEN_DEFLATE) {
-	if (p[2] != DEFLATE_MAKE_OPT(go->deflate_size)
-	    || p[3] != DEFLATE_CHK_SEQUENCE)
-	    return 0;		/* Rej is bad */
-	try_.deflate_correct = 0;
-	p += CILEN_DEFLATE;
-	len -= CILEN_DEFLATE;
+    && p[0] == CI_DEFLATE && p[1] == CILEN_DEFLATE) {
+    if (p[2] != DEFLATE_MAKE_OPT(go->deflate_size)
+        || p[3] != DEFLATE_CHK_SEQUENCE)
+        return 0;       /* Rej is bad */
+    try_.deflate_correct = 0;
+    p += CILEN_DEFLATE;
+    len -= CILEN_DEFLATE;
     }
     if (go->deflate_draft && len >= CILEN_DEFLATE
-	&& p[0] == CI_DEFLATE_DRAFT && p[1] == CILEN_DEFLATE) {
-	if (p[2] != DEFLATE_MAKE_OPT(go->deflate_size)
-	    || p[3] != DEFLATE_CHK_SEQUENCE)
-	    return 0;		/* Rej is bad */
-	try_.deflate_draft = 0;
-	p += CILEN_DEFLATE;
-	len -= CILEN_DEFLATE;
+    && p[0] == CI_DEFLATE_DRAFT && p[1] == CILEN_DEFLATE) {
+    if (p[2] != DEFLATE_MAKE_OPT(go->deflate_size)
+        || p[3] != DEFLATE_CHK_SEQUENCE)
+        return 0;       /* Rej is bad */
+    try_.deflate_draft = 0;
+    p += CILEN_DEFLATE;
+    len -= CILEN_DEFLATE;
     }
     if (!try_.deflate_correct && !try_.deflate_draft)
-	try_.deflate = 0;
+    try_.deflate = 0;
 #endif /* DEFLATE_SUPPORT */
 #if BSDCOMPRESS_SUPPORT
     if (go->bsd_compress && len >= CILEN_BSD_COMPRESS
-	&& p[0] == CI_BSD_COMPRESS && p[1] == CILEN_BSD_COMPRESS) {
-	if (p[2] != BSD_MAKE_OPT(BSD_CURRENT_VERSION, go->bsd_bits))
-	    return 0;
-	try_.bsd_compress = 0;
-	p += CILEN_BSD_COMPRESS;
-	len -= CILEN_BSD_COMPRESS;
+    && p[0] == CI_BSD_COMPRESS && p[1] == CILEN_BSD_COMPRESS) {
+    if (p[2] != BSD_MAKE_OPT(BSD_CURRENT_VERSION, go->bsd_bits))
+        return 0;
+    try_.bsd_compress = 0;
+    p += CILEN_BSD_COMPRESS;
+    len -= CILEN_BSD_COMPRESS;
     }
 #endif /* BSDCOMPRESS_SUPPORT */
 #if PREDICTOR_SUPPORT
     if (go->predictor_1 && len >= CILEN_PREDICTOR_1
-	&& p[0] == CI_PREDICTOR_1 && p[1] == CILEN_PREDICTOR_1) {
-	try_.predictor_1 = 0;
-	p += CILEN_PREDICTOR_1;
-	len -= CILEN_PREDICTOR_1;
+    && p[0] == CI_PREDICTOR_1 && p[1] == CILEN_PREDICTOR_1) {
+    try_.predictor_1 = 0;
+    p += CILEN_PREDICTOR_1;
+    len -= CILEN_PREDICTOR_1;
     }
     if (go->predictor_2 && len >= CILEN_PREDICTOR_2
-	&& p[0] == CI_PREDICTOR_2 && p[1] == CILEN_PREDICTOR_2) {
-	try_.predictor_2 = 0;
-	p += CILEN_PREDICTOR_2;
-	len -= CILEN_PREDICTOR_2;
+    && p[0] == CI_PREDICTOR_2 && p[1] == CILEN_PREDICTOR_2) {
+    try_.predictor_2 = 0;
+    p += CILEN_PREDICTOR_2;
+    len -= CILEN_PREDICTOR_2;
     }
 #endif /* PREDICTOR_SUPPORT */
 
     if (len != 0)
-	return 0;
+    return 0;
 
     if (f->state != PPP_FSM_OPENED)
-	*go = try_;
+    *go = try_;
 
     return 1;
 }
@@ -1114,8 +1114,8 @@ static int ccp_reqci(fsm *f, u_char *p, int *lenp, int dont_nak) {
     u_char *p0, *retp;
     int len, clen, type;
 #if MPPE_SUPPORT
-    u8_t rej_for_ci_mppe = 1;	/* Are we rejecting based on a bad/missing */
-				/* CI_MPPE, or due to other options?       */
+    u8_t rej_for_ci_mppe = 1;   /* Are we rejecting based on a bad/missing */
+                /* CI_MPPE, or due to other options?       */
 #endif /* MPPE_SUPPORT */
 
     ret = CONFACK;
@@ -1126,257 +1126,257 @@ static int ccp_reqci(fsm *f, u_char *p, int *lenp, int dont_nak) {
     ho->method = (len > 0)? p[0]: 0;
 
     while (len > 0) {
-	newret = CONFACK;
-	if (len < 2 || p[1] < 2 || p[1] > len) {
-	    /* length is bad */
-	    clen = len;
-	    newret = CONFREJ;
+    newret = CONFACK;
+    if (len < 2 || p[1] < 2 || p[1] > len) {
+        /* length is bad */
+        clen = len;
+        newret = CONFREJ;
 
-	} else {
-	    type = p[0];
-	    clen = p[1];
+    } else {
+        type = p[0];
+        clen = p[1];
 
-	    switch (type) {
+        switch (type) {
 #if MPPE_SUPPORT
-	    case CI_MPPE:
-		if (!ao->mppe || clen != CILEN_MPPE) {
-		    newret = CONFREJ;
-		    break;
-		}
-		MPPE_CI_TO_OPTS(&p[2], ho->mppe);
-
-		/* Nak if anything unsupported or unknown are set. */
-		if (ho->mppe & MPPE_OPT_UNSUPPORTED) {
-		    newret = CONFNAK;
-		    ho->mppe &= ~MPPE_OPT_UNSUPPORTED;
-		}
-		if (ho->mppe & MPPE_OPT_UNKNOWN) {
-		    newret = CONFNAK;
-		    ho->mppe &= ~MPPE_OPT_UNKNOWN;
-		}
-
-		/* Check state opt */
-		if (ho->mppe & MPPE_OPT_STATEFUL) {
-		    /*
-		     * We can Nak and request stateless, but it's a
-		     * lot easier to just assume the peer will request
-		     * it if he can do it; stateful mode is bad over
-		     * the Internet -- which is where we expect MPPE.
-		     */
-		   if (pcb->settings.refuse_mppe_stateful) {
-			ppp_error(("Refusing MPPE stateful mode offered by peer"));
-			newret = CONFREJ;
-			break;
-		    }
-		}
-
-		/* Find out which of {S,L} are set. */
-		if ((ho->mppe & MPPE_OPT_128)
-		     && (ho->mppe & MPPE_OPT_40)) {
-		    /* Both are set, negotiate the strongest. */
-		    newret = CONFNAK;
-		    if (ao->mppe & MPPE_OPT_128)
-			ho->mppe &= ~MPPE_OPT_40;
-		    else if (ao->mppe & MPPE_OPT_40)
-			ho->mppe &= ~MPPE_OPT_128;
-		    else {
-			newret = CONFREJ;
-			break;
-		    }
-		} else if (ho->mppe & MPPE_OPT_128) {
-		    if (!(ao->mppe & MPPE_OPT_128)) {
-			newret = CONFREJ;
-			break;
-		    }
-		} else if (ho->mppe & MPPE_OPT_40) {
-		    if (!(ao->mppe & MPPE_OPT_40)) {
-			newret = CONFREJ;
-			break;
-		    }
-		} else {
-		    /* Neither are set. */
-		    /* We cannot accept this.  */
-		    newret = CONFNAK;
-		    /* Give the peer our idea of what can be used,
-		       so it can choose and confirm */
-		    ho->mppe = ao->mppe;
-		}
-
-		/* rebuild the opts */
-		MPPE_OPTS_TO_CI(ho->mppe, &p[2]);
-		if (newret == CONFACK) {
-		    int mtu;
-
-		    mppe_init(pcb, &pcb->mppe_comp, ho->mppe);
-		    /*
-		     * We need to decrease the interface MTU by MPPE_PAD
-		     * because MPPE frames **grow**.  The kernel [must]
-		     * allocate MPPE_PAD extra bytes in xmit buffers.
-		     */
-		    mtu = ppp_netif_get_mtu(pcb);
-		    if (mtu)
-			ppp_netif_set_mtu(pcb, mtu - MPPE_PAD);
-		    else
-			newret = CONFREJ;
-		}
-
-		/*
-		 * We have accepted MPPE or are willing to negotiate
-		 * MPPE parameters.  A CONFREJ is due to subsequent
-		 * (non-MPPE) processing.
-		 */
-		rej_for_ci_mppe = 0;
-		break;
+        case CI_MPPE:
+        if (!ao->mppe || clen != CILEN_MPPE) {
+            newret = CONFREJ;
+            break;
+        }
+        MPPE_CI_TO_OPTS(&p[2], ho->mppe);
+
+        /* Nak if anything unsupported or unknown are set. */
+        if (ho->mppe & MPPE_OPT_UNSUPPORTED) {
+            newret = CONFNAK;
+            ho->mppe &= ~MPPE_OPT_UNSUPPORTED;
+        }
+        if (ho->mppe & MPPE_OPT_UNKNOWN) {
+            newret = CONFNAK;
+            ho->mppe &= ~MPPE_OPT_UNKNOWN;
+        }
+
+        /* Check state opt */
+        if (ho->mppe & MPPE_OPT_STATEFUL) {
+            /*
+             * We can Nak and request stateless, but it's a
+             * lot easier to just assume the peer will request
+             * it if he can do it; stateful mode is bad over
+             * the Internet -- which is where we expect MPPE.
+             */
+           if (pcb->settings.refuse_mppe_stateful) {
+            ppp_error(("Refusing MPPE stateful mode offered by peer"));
+            newret = CONFREJ;
+            break;
+            }
+        }
+
+        /* Find out which of {S,L} are set. */
+        if ((ho->mppe & MPPE_OPT_128)
+             && (ho->mppe & MPPE_OPT_40)) {
+            /* Both are set, negotiate the strongest. */
+            newret = CONFNAK;
+            if (ao->mppe & MPPE_OPT_128)
+            ho->mppe &= ~MPPE_OPT_40;
+            else if (ao->mppe & MPPE_OPT_40)
+            ho->mppe &= ~MPPE_OPT_128;
+            else {
+            newret = CONFREJ;
+            break;
+            }
+        } else if (ho->mppe & MPPE_OPT_128) {
+            if (!(ao->mppe & MPPE_OPT_128)) {
+            newret = CONFREJ;
+            break;
+            }
+        } else if (ho->mppe & MPPE_OPT_40) {
+            if (!(ao->mppe & MPPE_OPT_40)) {
+            newret = CONFREJ;
+            break;
+            }
+        } else {
+            /* Neither are set. */
+            /* We cannot accept this.  */
+            newret = CONFNAK;
+            /* Give the peer our idea of what can be used,
+               so it can choose and confirm */
+            ho->mppe = ao->mppe;
+        }
+
+        /* rebuild the opts */
+        MPPE_OPTS_TO_CI(ho->mppe, &p[2]);
+        if (newret == CONFACK) {
+            int mtu;
+
+            mppe_init(pcb, &pcb->mppe_comp, ho->mppe);
+            /*
+             * We need to decrease the interface MTU by MPPE_PAD
+             * because MPPE frames **grow**.  The kernel [must]
+             * allocate MPPE_PAD extra bytes in xmit buffers.
+             */
+            mtu = ppp_netif_get_mtu(pcb);
+            if (mtu)
+            ppp_netif_set_mtu(pcb, mtu - MPPE_PAD);
+            else
+            newret = CONFREJ;
+        }
+
+        /*
+         * We have accepted MPPE or are willing to negotiate
+         * MPPE parameters.  A CONFREJ is due to subsequent
+         * (non-MPPE) processing.
+         */
+        rej_for_ci_mppe = 0;
+        break;
 #endif /* MPPE_SUPPORT */
 #if DEFLATE_SUPPORT
-	    case CI_DEFLATE:
-	    case CI_DEFLATE_DRAFT:
-		if (!ao->deflate || clen != CILEN_DEFLATE
-		    || (!ao->deflate_correct && type == CI_DEFLATE)
-		    || (!ao->deflate_draft && type == CI_DEFLATE_DRAFT)) {
-		    newret = CONFREJ;
-		    break;
-		}
-
-		ho->deflate = 1;
-		ho->deflate_size = nb = DEFLATE_SIZE(p[2]);
-		if (DEFLATE_METHOD(p[2]) != DEFLATE_METHOD_VAL
-		    || p[3] != DEFLATE_CHK_SEQUENCE
-		    || nb > ao->deflate_size || nb < DEFLATE_MIN_WORKS) {
-		    newret = CONFNAK;
-		    if (!dont_nak) {
-			p[2] = DEFLATE_MAKE_OPT(ao->deflate_size);
-			p[3] = DEFLATE_CHK_SEQUENCE;
-			/* fall through to test this #bits below */
-		    } else
-			break;
-		}
-
-		/*
-		 * Check whether we can do Deflate with the window
-		 * size they want.  If the window is too big, reduce
-		 * it until the kernel can cope and nak with that.
-		 * We only check this for the first option.
-		 */
-		if (p == p0) {
-		    for (;;) {
-			res = ccp_test(pcb, p, CILEN_DEFLATE, 1);
-			if (res > 0)
-			    break;		/* it's OK now */
-			if (res < 0 || nb == DEFLATE_MIN_WORKS || dont_nak) {
-			    newret = CONFREJ;
-			    p[2] = DEFLATE_MAKE_OPT(ho->deflate_size);
-			    break;
-			}
-			newret = CONFNAK;
-			--nb;
-			p[2] = DEFLATE_MAKE_OPT(nb);
-		    }
-		}
-		break;
+        case CI_DEFLATE:
+        case CI_DEFLATE_DRAFT:
+        if (!ao->deflate || clen != CILEN_DEFLATE
+            || (!ao->deflate_correct && type == CI_DEFLATE)
+            || (!ao->deflate_draft && type == CI_DEFLATE_DRAFT)) {
+            newret = CONFREJ;
+            break;
+        }
+
+        ho->deflate = 1;
+        ho->deflate_size = nb = DEFLATE_SIZE(p[2]);
+        if (DEFLATE_METHOD(p[2]) != DEFLATE_METHOD_VAL
+            || p[3] != DEFLATE_CHK_SEQUENCE
+            || nb > ao->deflate_size || nb < DEFLATE_MIN_WORKS) {
+            newret = CONFNAK;
+            if (!dont_nak) {
+            p[2] = DEFLATE_MAKE_OPT(ao->deflate_size);
+            p[3] = DEFLATE_CHK_SEQUENCE;
+            /* fall through to test this #bits below */
+            } else
+            break;
+        }
+
+        /*
+         * Check whether we can do Deflate with the window
+         * size they want.  If the window is too big, reduce
+         * it until the kernel can cope and nak with that.
+         * We only check this for the first option.
+         */
+        if (p == p0) {
+            for (;;) {
+            res = ccp_test(pcb, p, CILEN_DEFLATE, 1);
+            if (res > 0)
+                break;      /* it's OK now */
+            if (res < 0 || nb == DEFLATE_MIN_WORKS || dont_nak) {
+                newret = CONFREJ;
+                p[2] = DEFLATE_MAKE_OPT(ho->deflate_size);
+                break;
+            }
+            newret = CONFNAK;
+            --nb;
+            p[2] = DEFLATE_MAKE_OPT(nb);
+            }
+        }
+        break;
 #endif /* DEFLATE_SUPPORT */
 #if BSDCOMPRESS_SUPPORT
-	    case CI_BSD_COMPRESS:
-		if (!ao->bsd_compress || clen != CILEN_BSD_COMPRESS) {
-		    newret = CONFREJ;
-		    break;
-		}
-
-		ho->bsd_compress = 1;
-		ho->bsd_bits = nb = BSD_NBITS(p[2]);
-		if (BSD_VERSION(p[2]) != BSD_CURRENT_VERSION
-		    || nb > ao->bsd_bits || nb < BSD_MIN_BITS) {
-		    newret = CONFNAK;
-		    if (!dont_nak) {
-			p[2] = BSD_MAKE_OPT(BSD_CURRENT_VERSION, ao->bsd_bits);
-			/* fall through to test this #bits below */
-		    } else
-			break;
-		}
-
-		/*
-		 * Check whether we can do BSD-Compress with the code
-		 * size they want.  If the code size is too big, reduce
-		 * it until the kernel can cope and nak with that.
-		 * We only check this for the first option.
-		 */
-		if (p == p0) {
-		    for (;;) {
-			res = ccp_test(pcb, p, CILEN_BSD_COMPRESS, 1);
-			if (res > 0)
-			    break;
-			if (res < 0 || nb == BSD_MIN_BITS || dont_nak) {
-			    newret = CONFREJ;
-			    p[2] = BSD_MAKE_OPT(BSD_CURRENT_VERSION,
-						ho->bsd_bits);
-			    break;
-			}
-			newret = CONFNAK;
-			--nb;
-			p[2] = BSD_MAKE_OPT(BSD_CURRENT_VERSION, nb);
-		    }
-		}
-		break;
+        case CI_BSD_COMPRESS:
+        if (!ao->bsd_compress || clen != CILEN_BSD_COMPRESS) {
+            newret = CONFREJ;
+            break;
+        }
+
+        ho->bsd_compress = 1;
+        ho->bsd_bits = nb = BSD_NBITS(p[2]);
+        if (BSD_VERSION(p[2]) != BSD_CURRENT_VERSION
+            || nb > ao->bsd_bits || nb < BSD_MIN_BITS) {
+            newret = CONFNAK;
+            if (!dont_nak) {
+            p[2] = BSD_MAKE_OPT(BSD_CURRENT_VERSION, ao->bsd_bits);
+            /* fall through to test this #bits below */
+            } else
+            break;
+        }
+
+        /*
+         * Check whether we can do BSD-Compress with the code
+         * size they want.  If the code size is too big, reduce
+         * it until the kernel can cope and nak with that.
+         * We only check this for the first option.
+         */
+        if (p == p0) {
+            for (;;) {
+            res = ccp_test(pcb, p, CILEN_BSD_COMPRESS, 1);
+            if (res > 0)
+                break;
+            if (res < 0 || nb == BSD_MIN_BITS || dont_nak) {
+                newret = CONFREJ;
+                p[2] = BSD_MAKE_OPT(BSD_CURRENT_VERSION,
+                        ho->bsd_bits);
+                break;
+            }
+            newret = CONFNAK;
+            --nb;
+            p[2] = BSD_MAKE_OPT(BSD_CURRENT_VERSION, nb);
+            }
+        }
+        break;
 #endif /* BSDCOMPRESS_SUPPORT */
 #if PREDICTOR_SUPPORT
-	    case CI_PREDICTOR_1:
-		if (!ao->predictor_1 || clen != CILEN_PREDICTOR_1) {
-		    newret = CONFREJ;
-		    break;
-		}
-
-		ho->predictor_1 = 1;
-		if (p == p0
-		    && ccp_test(pcb, p, CILEN_PREDICTOR_1, 1) <= 0) {
-		    newret = CONFREJ;
-		}
-		break;
-
-	    case CI_PREDICTOR_2:
-		if (!ao->predictor_2 || clen != CILEN_PREDICTOR_2) {
-		    newret = CONFREJ;
-		    break;
-		}
-
-		ho->predictor_2 = 1;
-		if (p == p0
-		    && ccp_test(pcb, p, CILEN_PREDICTOR_2, 1) <= 0) {
-		    newret = CONFREJ;
-		}
-		break;
+        case CI_PREDICTOR_1:
+        if (!ao->predictor_1 || clen != CILEN_PREDICTOR_1) {
+            newret = CONFREJ;
+            break;
+        }
+
+        ho->predictor_1 = 1;
+        if (p == p0
+            && ccp_test(pcb, p, CILEN_PREDICTOR_1, 1) <= 0) {
+            newret = CONFREJ;
+        }
+        break;
+
+        case CI_PREDICTOR_2:
+        if (!ao->predictor_2 || clen != CILEN_PREDICTOR_2) {
+            newret = CONFREJ;
+            break;
+        }
+
+        ho->predictor_2 = 1;
+        if (p == p0
+            && ccp_test(pcb, p, CILEN_PREDICTOR_2, 1) <= 0) {
+            newret = CONFREJ;
+        }
+        break;
 #endif /* PREDICTOR_SUPPORT */
 
-	    default:
-		newret = CONFREJ;
-	    }
-	}
+        default:
+        newret = CONFREJ;
+        }
+    }
 
-	if (newret == CONFNAK && dont_nak)
-	    newret = CONFREJ;
-	if (!(newret == CONFACK || (newret == CONFNAK && ret == CONFREJ))) {
-	    /* we're returning this option */
-	    if (newret == CONFREJ && ret == CONFNAK)
-		retp = p0;
-	    ret = newret;
-	    if (p != retp)
-		MEMCPY(retp, p, clen);
-	    retp += clen;
-	}
+    if (newret == CONFNAK && dont_nak)
+        newret = CONFREJ;
+    if (!(newret == CONFACK || (newret == CONFNAK && ret == CONFREJ))) {
+        /* we're returning this option */
+        if (newret == CONFREJ && ret == CONFNAK)
+        retp = p0;
+        ret = newret;
+        if (p != retp)
+        MEMCPY(retp, p, clen);
+        retp += clen;
+    }
 
-	p += clen;
-	len -= clen;
+    p += clen;
+    len -= clen;
     }
 
     if (ret != CONFACK) {
-	if (ret == CONFREJ && *lenp == retp - p0)
-	    pcb->ccp_all_rejected = 1;
-	else
-	    *lenp = retp - p0;
+    if (ret == CONFREJ && *lenp == retp - p0)
+        pcb->ccp_all_rejected = 1;
+    else
+        *lenp = retp - p0;
     }
 #if MPPE_SUPPORT
     if (ret == CONFREJ && ao->mppe && rej_for_ci_mppe) {
-	ppp_error(("MPPE required but peer negotiation failed"));
-	lcp_close(pcb, "MPPE required but peer negotiation failed");
+    ppp_error(("MPPE required but peer negotiation failed"));
+    lcp_close(pcb, "MPPE required but peer negotiation failed");
     }
 #endif /* MPPE_SUPPORT */
     return ret;
@@ -1392,63 +1392,63 @@ static const char *method_name(ccp_options *opt, ccp_options *opt2) {
 #endif /* !DEFLATE_SUPPORT && !BSDCOMPRESS_SUPPORT */
 
     if (!ccp_anycompress(opt))
-	return "(none)";
+    return "(none)";
     switch (opt->method) {
 #if MPPE_SUPPORT
     case CI_MPPE:
     {
-	char *p = result;
-	char *q = result + sizeof(result); /* 1 past result */
-
-	ppp_slprintf(p, q - p, "MPPE ");
-	p += 5;
-	if (opt->mppe & MPPE_OPT_128) {
-	    ppp_slprintf(p, q - p, "128-bit ");
-	    p += 8;
-	}
-	if (opt->mppe & MPPE_OPT_40) {
-	    ppp_slprintf(p, q - p, "40-bit ");
-	    p += 7;
-	}
-	if (opt->mppe & MPPE_OPT_STATEFUL)
-	    ppp_slprintf(p, q - p, "stateful");
-	else
-	    ppp_slprintf(p, q - p, "stateless");
-
-	break;
+    char *p = result;
+    char *q = result + sizeof(result); /* 1 past result */
+
+    ppp_slprintf(p, q - p, "MPPE ");
+    p += 5;
+    if (opt->mppe & MPPE_OPT_128) {
+        ppp_slprintf(p, q - p, "128-bit ");
+        p += 8;
+    }
+    if (opt->mppe & MPPE_OPT_40) {
+        ppp_slprintf(p, q - p, "40-bit ");
+        p += 7;
+    }
+    if (opt->mppe & MPPE_OPT_STATEFUL)
+        ppp_slprintf(p, q - p, "stateful");
+    else
+        ppp_slprintf(p, q - p, "stateless");
+
+    break;
     }
 #endif /* MPPE_SUPPORT */
 #if DEFLATE_SUPPORT
     case CI_DEFLATE:
     case CI_DEFLATE_DRAFT:
-	if (opt2 != NULL && opt2->deflate_size != opt->deflate_size)
-	    ppp_slprintf(result, sizeof(result), "Deflate%s (%d/%d)",
-		     (opt->method == CI_DEFLATE_DRAFT? "(old#)": ""),
-		     opt->deflate_size, opt2->deflate_size);
-	else
-	    ppp_slprintf(result, sizeof(result), "Deflate%s (%d)",
-		     (opt->method == CI_DEFLATE_DRAFT? "(old#)": ""),
-		     opt->deflate_size);
-	break;
+    if (opt2 != NULL && opt2->deflate_size != opt->deflate_size)
+        ppp_slprintf(result, sizeof(result), "Deflate%s (%d/%d)",
+             (opt->method == CI_DEFLATE_DRAFT? "(old#)": ""),
+             opt->deflate_size, opt2->deflate_size);
+    else
+        ppp_slprintf(result, sizeof(result), "Deflate%s (%d)",
+             (opt->method == CI_DEFLATE_DRAFT? "(old#)": ""),
+             opt->deflate_size);
+    break;
 #endif /* DEFLATE_SUPPORT */
 #if BSDCOMPRESS_SUPPORT
     case CI_BSD_COMPRESS:
-	if (opt2 != NULL && opt2->bsd_bits != opt->bsd_bits)
-	    ppp_slprintf(result, sizeof(result), "BSD-Compress (%d/%d)",
-		     opt->bsd_bits, opt2->bsd_bits);
-	else
-	    ppp_slprintf(result, sizeof(result), "BSD-Compress (%d)",
-		     opt->bsd_bits);
-	break;
+    if (opt2 != NULL && opt2->bsd_bits != opt->bsd_bits)
+        ppp_slprintf(result, sizeof(result), "BSD-Compress (%d/%d)",
+             opt->bsd_bits, opt2->bsd_bits);
+    else
+        ppp_slprintf(result, sizeof(result), "BSD-Compress (%d)",
+             opt->bsd_bits);
+    break;
 #endif /* BSDCOMPRESS_SUPPORT */
 #if PREDICTOR_SUPPORT
     case CI_PREDICTOR_1:
-	return "Predictor 1";
+    return "Predictor 1";
     case CI_PREDICTOR_2:
-	return "Predictor 2";
+    return "Predictor 2";
 #endif /* PREDICTOR_SUPPORT */
     default:
-	ppp_slprintf(result, sizeof(result), "Method %d", opt->method);
+    ppp_slprintf(result, sizeof(result), "Method %d", opt->method);
     }
     return result;
 }
@@ -1464,21 +1464,21 @@ static void ccp_up(fsm *f) {
 
     ccp_set(pcb, 1, 1, go->method, ho->method);
     if (ccp_anycompress(go)) {
-	if (ccp_anycompress(ho)) {
-	    if (go->method == ho->method) {
-		ppp_notice(("%s compression enabled", method_name(go, ho)));
-	    } else {
-		ppp_strlcpy(method1, method_name(go, NULL), sizeof(method1));
-		ppp_notice(("%s / %s compression enabled",
-		       method1, method_name(ho, NULL)));
-	    }
-	} else
-	    ppp_notice(("%s receive compression enabled", method_name(go, NULL)));
+    if (ccp_anycompress(ho)) {
+        if (go->method == ho->method) {
+        ppp_notice(("%s compression enabled", method_name(go, ho)));
+        } else {
+        ppp_strlcpy(method1, method_name(go, NULL), sizeof(method1));
+        ppp_notice(("%s / %s compression enabled",
+               method1, method_name(ho, NULL)));
+        }
+    } else
+        ppp_notice(("%s receive compression enabled", method_name(go, NULL)));
     } else if (ccp_anycompress(ho))
-	ppp_notice(("%s transmit compression enabled", method_name(ho, NULL)));
+    ppp_notice(("%s transmit compression enabled", method_name(ho, NULL)));
 #if MPPE_SUPPORT
     if (go->mppe) {
-	continue_networks(pcb);		/* Bring up IP et al */
+    continue_networks(pcb);     /* Bring up IP et al */
     }
 #endif /* MPPE_SUPPORT */
 }
@@ -1493,17 +1493,17 @@ static void ccp_down(fsm *f) {
 #endif /* MPPE_SUPPORT */
 
     if (pcb->ccp_localstate & RACK_PENDING)
-	UNTIMEOUT(ccp_rack_timeout, f);
+    UNTIMEOUT(ccp_rack_timeout, f);
     pcb->ccp_localstate = 0;
     ccp_set(pcb, 1, 0, 0, 0);
 #if MPPE_SUPPORT
     if (go->mppe) {
-	go->mppe = 0;
-	if (pcb->lcp_fsm.state == PPP_FSM_OPENED) {
-	    /* If LCP is not already going down, make sure it does. */
-	    ppp_error(("MPPE disabled"));
-	    lcp_close(pcb, "MPPE disabled");
-	}
+    go->mppe = 0;
+    if (pcb->lcp_fsm.state == PPP_FSM_OPENED) {
+        /* If LCP is not already going down, make sure it does. */
+        ppp_error(("MPPE disabled"));
+        lcp_close(pcb, "MPPE disabled");
+    }
     }
 #endif /* MPPE_SUPPORT */
 }
@@ -1526,17 +1526,17 @@ static int ccp_printpkt(const u_char *p, int plen, void (*printer) (void *, cons
 
     p0 = p;
     if (plen < HEADERLEN)
-	return 0;
+    return 0;
     code = p[0];
     id = p[1];
     len = (p[2] << 8) + p[3];
     if (len < HEADERLEN || len > plen)
-	return 0;
+    return 0;
 
     if (code >= 1 && code <= (int)LWIP_ARRAYSIZE(ccp_codenames) && ccp_codenames[code-1] != NULL)
-	printer(arg, " %s", ccp_codenames[code-1]);
+    printer(arg, " %s", ccp_codenames[code-1]);
     else
-	printer(arg, " code=0x%x", code);
+    printer(arg, " code=0x%x", code);
     printer(arg, " id=0x%x", id);
     len -= HEADERLEN;
     p += HEADERLEN;
@@ -1546,99 +1546,99 @@ static int ccp_printpkt(const u_char *p, int plen, void (*printer) (void *, cons
     case CONFACK:
     case CONFNAK:
     case CONFREJ:
-	/* print list of possible compression methods */
-	while (len >= 2) {
-	    code = p[0];
-	    optlen = p[1];
-	    if (optlen < 2 || optlen > len)
-		break;
-	    printer(arg, " <");
-	    len -= optlen;
-	    optend = p + optlen;
-	    switch (code) {
+    /* print list of possible compression methods */
+    while (len >= 2) {
+        code = p[0];
+        optlen = p[1];
+        if (optlen < 2 || optlen > len)
+        break;
+        printer(arg, " <");
+        len -= optlen;
+        optend = p + optlen;
+        switch (code) {
 #if MPPE_SUPPORT
-	    case CI_MPPE:
-		if (optlen >= CILEN_MPPE) {
-		    u_char mppe_opts;
-
-		    MPPE_CI_TO_OPTS(&p[2], mppe_opts);
-		    printer(arg, "mppe %s %s %s %s %s %s%s",
-			    (p[2] & MPPE_H_BIT)? "+H": "-H",
-			    (p[5] & MPPE_M_BIT)? "+M": "-M",
-			    (p[5] & MPPE_S_BIT)? "+S": "-S",
-			    (p[5] & MPPE_L_BIT)? "+L": "-L",
-			    (p[5] & MPPE_D_BIT)? "+D": "-D",
-			    (p[5] & MPPE_C_BIT)? "+C": "-C",
-			    (mppe_opts & MPPE_OPT_UNKNOWN)? " +U": "");
-		    if (mppe_opts & MPPE_OPT_UNKNOWN)
-			printer(arg, " (%.2x %.2x %.2x %.2x)",
-				p[2], p[3], p[4], p[5]);
-		    p += CILEN_MPPE;
-		}
-		break;
+        case CI_MPPE:
+        if (optlen >= CILEN_MPPE) {
+            u_char mppe_opts;
+
+            MPPE_CI_TO_OPTS(&p[2], mppe_opts);
+            printer(arg, "mppe %s %s %s %s %s %s%s",
+                (p[2] & MPPE_H_BIT)? "+H": "-H",
+                (p[5] & MPPE_M_BIT)? "+M": "-M",
+                (p[5] & MPPE_S_BIT)? "+S": "-S",
+                (p[5] & MPPE_L_BIT)? "+L": "-L",
+                (p[5] & MPPE_D_BIT)? "+D": "-D",
+                (p[5] & MPPE_C_BIT)? "+C": "-C",
+                (mppe_opts & MPPE_OPT_UNKNOWN)? " +U": "");
+            if (mppe_opts & MPPE_OPT_UNKNOWN)
+            printer(arg, " (%.2x %.2x %.2x %.2x)",
+                p[2], p[3], p[4], p[5]);
+            p += CILEN_MPPE;
+        }
+        break;
 #endif /* MPPE_SUPPORT */
 #if DEFLATE_SUPPORT
-	    case CI_DEFLATE:
-	    case CI_DEFLATE_DRAFT:
-		if (optlen >= CILEN_DEFLATE) {
-		    printer(arg, "deflate%s %d",
-			    (code == CI_DEFLATE_DRAFT? "(old#)": ""),
-			    DEFLATE_SIZE(p[2]));
-		    if (DEFLATE_METHOD(p[2]) != DEFLATE_METHOD_VAL)
-			printer(arg, " method %d", DEFLATE_METHOD(p[2]));
-		    if (p[3] != DEFLATE_CHK_SEQUENCE)
-			printer(arg, " check %d", p[3]);
-		    p += CILEN_DEFLATE;
-		}
-		break;
+        case CI_DEFLATE:
+        case CI_DEFLATE_DRAFT:
+        if (optlen >= CILEN_DEFLATE) {
+            printer(arg, "deflate%s %d",
+                (code == CI_DEFLATE_DRAFT? "(old#)": ""),
+                DEFLATE_SIZE(p[2]));
+            if (DEFLATE_METHOD(p[2]) != DEFLATE_METHOD_VAL)
+            printer(arg, " method %d", DEFLATE_METHOD(p[2]));
+            if (p[3] != DEFLATE_CHK_SEQUENCE)
+            printer(arg, " check %d", p[3]);
+            p += CILEN_DEFLATE;
+        }
+        break;
 #endif /* DEFLATE_SUPPORT */
 #if BSDCOMPRESS_SUPPORT
-	    case CI_BSD_COMPRESS:
-		if (optlen >= CILEN_BSD_COMPRESS) {
-		    printer(arg, "bsd v%d %d", BSD_VERSION(p[2]),
-			    BSD_NBITS(p[2]));
-		    p += CILEN_BSD_COMPRESS;
-		}
-		break;
+        case CI_BSD_COMPRESS:
+        if (optlen >= CILEN_BSD_COMPRESS) {
+            printer(arg, "bsd v%d %d", BSD_VERSION(p[2]),
+                BSD_NBITS(p[2]));
+            p += CILEN_BSD_COMPRESS;
+        }
+        break;
 #endif /* BSDCOMPRESS_SUPPORT */
 #if PREDICTOR_SUPPORT
-	    case CI_PREDICTOR_1:
-		if (optlen >= CILEN_PREDICTOR_1) {
-		    printer(arg, "predictor 1");
-		    p += CILEN_PREDICTOR_1;
-		}
-		break;
-	    case CI_PREDICTOR_2:
-		if (optlen >= CILEN_PREDICTOR_2) {
-		    printer(arg, "predictor 2");
-		    p += CILEN_PREDICTOR_2;
-		}
-		break;
+        case CI_PREDICTOR_1:
+        if (optlen >= CILEN_PREDICTOR_1) {
+            printer(arg, "predictor 1");
+            p += CILEN_PREDICTOR_1;
+        }
+        break;
+        case CI_PREDICTOR_2:
+        if (optlen >= CILEN_PREDICTOR_2) {
+            printer(arg, "predictor 2");
+            p += CILEN_PREDICTOR_2;
+        }
+        break;
 #endif /* PREDICTOR_SUPPORT */
-	    default:
+        default:
                 break;
-	    }
-	    while (p < optend)
-		printer(arg, " %.2x", *p++);
-	    printer(arg, ">");
-	}
-	break;
+        }
+        while (p < optend)
+        printer(arg, " %.2x", *p++);
+        printer(arg, ">");
+    }
+    break;
 
     case TERMACK:
     case TERMREQ:
-	if (len > 0 && *p >= ' ' && *p < 0x7f) {
-	    ppp_print_string(p, len, printer, arg);
-	    p += len;
-	    len = 0;
-	}
-	break;
+    if (len > 0 && *p >= ' ' && *p < 0x7f) {
+        ppp_print_string(p, len, printer, arg);
+        p += len;
+        len = 0;
+    }
+    break;
     default:
         break;
     }
 
     /* dump out the rest of the packet in hex */
     while (--len >= 0)
-	printer(arg, " %.2x", *p++);
+    printer(arg, " %.2x", *p++);
 
     return p - p0;
 }
@@ -1667,34 +1667,34 @@ static void ccp_datainput(ppp_pcb *pcb, u_char *pkt, int len) {
 
     f = &pcb->ccp_fsm;
     if (f->state == PPP_FSM_OPENED) {
-	if (ccp_fatal_error(pcb)) {
-	    /*
-	     * Disable compression by taking CCP down.
-	     */
-	    ppp_error(("Lost compression sync: disabling compression"));
-	    ccp_close(pcb, "Lost compression sync");
+    if (ccp_fatal_error(pcb)) {
+        /*
+         * Disable compression by taking CCP down.
+         */
+        ppp_error(("Lost compression sync: disabling compression"));
+        ccp_close(pcb, "Lost compression sync");
 #if MPPE_SUPPORT
-	    /*
-	     * If we were doing MPPE, we must also take the link down.
-	     */
-	    if (go->mppe) {
-		ppp_error(("Too many MPPE errors, closing LCP"));
-		lcp_close(pcb, "Too many MPPE errors");
-	    }
+        /*
+         * If we were doing MPPE, we must also take the link down.
+         */
+        if (go->mppe) {
+        ppp_error(("Too many MPPE errors, closing LCP"));
+        lcp_close(pcb, "Too many MPPE errors");
+        }
 #endif /* MPPE_SUPPORT */
-	} else {
-	    /*
-	     * Send a reset-request to reset the peer's compressor.
-	     * We don't do that if we are still waiting for an
-	     * acknowledgement to a previous reset-request.
-	     */
-	    if (!(pcb->ccp_localstate & RACK_PENDING)) {
-		fsm_sdata(f, CCP_RESETREQ, f->reqid = ++f->id, NULL, 0);
-		TIMEOUT(ccp_rack_timeout, f, RACKTIMEOUT);
-		pcb->ccp_localstate |= RACK_PENDING;
-	    } else
-		pcb->ccp_localstate |= RREQ_REPEAT;
-	}
+    } else {
+        /*
+         * Send a reset-request to reset the peer's compressor.
+         * We don't do that if we are still waiting for an
+         * acknowledgement to a previous reset-request.
+         */
+        if (!(pcb->ccp_localstate & RACK_PENDING)) {
+        fsm_sdata(f, CCP_RESETREQ, f->reqid = ++f->id, NULL, 0);
+        TIMEOUT(ccp_rack_timeout, f, RACKTIMEOUT);
+        pcb->ccp_localstate |= RACK_PENDING;
+        } else
+        pcb->ccp_localstate |= RREQ_REPEAT;
+    }
     }
 }
 #endif /* PPP_DATAINPUT */
@@ -1707,7 +1707,7 @@ void ccp_resetrequest(ppp_pcb *pcb) {
     fsm *f = &pcb->ccp_fsm;
 
     if (f->state != PPP_FSM_OPENED)
-	return;
+    return;
 
     /*
      * Send a reset-request to reset the peer's compressor.
@@ -1715,11 +1715,11 @@ void ccp_resetrequest(ppp_pcb *pcb) {
      * acknowledgement to a previous reset-request.
      */
     if (!(pcb->ccp_localstate & RACK_PENDING)) {
-	fsm_sdata(f, CCP_RESETREQ, f->reqid = ++f->id, NULL, 0);
-	TIMEOUT(ccp_rack_timeout, f, RACKTIMEOUT);
-	pcb->ccp_localstate |= RACK_PENDING;
+    fsm_sdata(f, CCP_RESETREQ, f->reqid = ++f->id, NULL, 0);
+    TIMEOUT(ccp_rack_timeout, f, RACKTIMEOUT);
+    pcb->ccp_localstate |= RACK_PENDING;
     } else
-	pcb->ccp_localstate |= RREQ_REPEAT;
+    pcb->ccp_localstate |= RREQ_REPEAT;
 }
 
 /*
@@ -1730,11 +1730,11 @@ static void ccp_rack_timeout(void *arg) {
     ppp_pcb *pcb = f->pcb;
 
     if (f->state == PPP_FSM_OPENED && (pcb->ccp_localstate & RREQ_REPEAT)) {
-	fsm_sdata(f, CCP_RESETREQ, f->reqid, NULL, 0);
-	TIMEOUT(ccp_rack_timeout, f, RACKTIMEOUT);
-	pcb->ccp_localstate &= ~RREQ_REPEAT;
+    fsm_sdata(f, CCP_RESETREQ, f->reqid, NULL, 0);
+    TIMEOUT(ccp_rack_timeout, f, RACKTIMEOUT);
+    pcb->ccp_localstate &= ~RREQ_REPEAT;
     } else
-	pcb->ccp_localstate &= ~RACK_PENDING;
+    pcb->ccp_localstate &= ~RACK_PENDING;
 }
 
 #endif /* PPP_SUPPORT && CCP_SUPPORT */
diff --git a/src/netif/ppp/chap-md5.c b/src/netif/ppp/chap-md5.c
index 88f069f0..2b7c9b36 100644
--- a/src/netif/ppp/chap-md5.c
+++ b/src/netif/ppp/chap-md5.c
@@ -43,84 +43,84 @@
 #include "netif/ppp/magic.h"
 #include "netif/ppp/pppcrypt.h"
 
-#define MD5_HASH_SIZE		16
-#define MD5_MIN_CHALLENGE	17
-#define MD5_MAX_CHALLENGE	24
+#define MD5_HASH_SIZE       16
+#define MD5_MIN_CHALLENGE   17
+#define MD5_MAX_CHALLENGE   24
 #define MD5_MIN_MAX_POWER_OF_TWO_CHALLENGE     3   /* 2^3-1 = 7, 17+7 = 24 */
 
 #if PPP_SERVER
 static void chap_md5_generate_challenge(ppp_pcb *pcb, unsigned char *cp) {
-	int clen;
-	LWIP_UNUSED_ARG(pcb);
+    int clen;
+    LWIP_UNUSED_ARG(pcb);
 
-	clen = MD5_MIN_CHALLENGE + magic_pow(MD5_MIN_MAX_POWER_OF_TWO_CHALLENGE);
-	*cp++ = clen;
-	magic_random_bytes(cp, clen);
+    clen = MD5_MIN_CHALLENGE + magic_pow(MD5_MIN_MAX_POWER_OF_TWO_CHALLENGE);
+    *cp++ = clen;
+    magic_random_bytes(cp, clen);
 }
 
 static int chap_md5_verify_response(ppp_pcb *pcb, int id, const char *name,
-			 const unsigned char *secret, int secret_len,
-			 const unsigned char *challenge, const unsigned char *response,
-			 char *message, int message_space) {
-	lwip_md5_context ctx;
-	unsigned char idbyte = id;
-	unsigned char hash[MD5_HASH_SIZE];
-	int challenge_len, response_len;
-	LWIP_UNUSED_ARG(name);
-	LWIP_UNUSED_ARG(pcb);
+             const unsigned char *secret, int secret_len,
+             const unsigned char *challenge, const unsigned char *response,
+             char *message, int message_space) {
+    lwip_md5_context ctx;
+    unsigned char idbyte = id;
+    unsigned char hash[MD5_HASH_SIZE];
+    int challenge_len, response_len;
+    LWIP_UNUSED_ARG(name);
+    LWIP_UNUSED_ARG(pcb);
 
-	challenge_len = *challenge++;
-	response_len = *response++;
-	if (response_len == MD5_HASH_SIZE) {
-		/* Generate hash of ID, secret, challenge */
-		lwip_md5_init(&ctx);
-		lwip_md5_starts(&ctx);
-		lwip_md5_update(&ctx, &idbyte, 1);
-		lwip_md5_update(&ctx, secret, secret_len);
-		lwip_md5_update(&ctx, challenge, challenge_len);
-		lwip_md5_finish(&ctx, hash);
-		lwip_md5_free(&ctx);
+    challenge_len = *challenge++;
+    response_len = *response++;
+    if (response_len == MD5_HASH_SIZE) {
+        /* Generate hash of ID, secret, challenge */
+        lwip_md5_init(&ctx);
+        lwip_md5_starts(&ctx);
+        lwip_md5_update(&ctx, &idbyte, 1);
+        lwip_md5_update(&ctx, secret, secret_len);
+        lwip_md5_update(&ctx, challenge, challenge_len);
+        lwip_md5_finish(&ctx, hash);
+        lwip_md5_free(&ctx);
 
-		/* Test if our hash matches the peer's response */
-		if (memcmp(hash, response, MD5_HASH_SIZE) == 0) {
-			ppp_slprintf(message, message_space, "Access granted");
-			return 1;
-		}
-	}
-	ppp_slprintf(message, message_space, "Access denied");
-	return 0;
+        /* Test if our hash matches the peer's response */
+        if (memcmp(hash, response, MD5_HASH_SIZE) == 0) {
+            ppp_slprintf(message, message_space, "Access granted");
+            return 1;
+        }
+    }
+    ppp_slprintf(message, message_space, "Access denied");
+    return 0;
 }
 #endif /* PPP_SERVER */
 
 static void chap_md5_make_response(ppp_pcb *pcb, unsigned char *response, int id, const char *our_name,
-		       const unsigned char *challenge, const char *secret, int secret_len,
-		       unsigned char *private_) {
-	lwip_md5_context ctx;
-	unsigned char idbyte = id;
-	int challenge_len = *challenge++;
-	LWIP_UNUSED_ARG(our_name);
-	LWIP_UNUSED_ARG(private_);
-	LWIP_UNUSED_ARG(pcb);
+               const unsigned char *challenge, const char *secret, int secret_len,
+               unsigned char *private_) {
+    lwip_md5_context ctx;
+    unsigned char idbyte = id;
+    int challenge_len = *challenge++;
+    LWIP_UNUSED_ARG(our_name);
+    LWIP_UNUSED_ARG(private_);
+    LWIP_UNUSED_ARG(pcb);
 
-	lwip_md5_init(&ctx);
-	lwip_md5_starts(&ctx);
-	lwip_md5_update(&ctx, &idbyte, 1);
-	lwip_md5_update(&ctx, (const u_char *)secret, secret_len);
-	lwip_md5_update(&ctx, challenge, challenge_len);
-	lwip_md5_finish(&ctx, &response[1]);
-	lwip_md5_free(&ctx);
-	response[0] = MD5_HASH_SIZE;
+    lwip_md5_init(&ctx);
+    lwip_md5_starts(&ctx);
+    lwip_md5_update(&ctx, &idbyte, 1);
+    lwip_md5_update(&ctx, (const u_char *)secret, secret_len);
+    lwip_md5_update(&ctx, challenge, challenge_len);
+    lwip_md5_finish(&ctx, &response[1]);
+    lwip_md5_free(&ctx);
+    response[0] = MD5_HASH_SIZE;
 }
 
 const struct chap_digest_type md5_digest = {
-	CHAP_MD5,		/* code */
+    CHAP_MD5,       /* code */
 #if PPP_SERVER
-	chap_md5_generate_challenge,
-	chap_md5_verify_response,
+    chap_md5_generate_challenge,
+    chap_md5_verify_response,
 #endif /* PPP_SERVER */
-	chap_md5_make_response,
-	NULL,			/* check_success */
-	NULL,			/* handle_failure */
+    chap_md5_make_response,
+    NULL,           /* check_success */
+    NULL,           /* handle_failure */
 };
 
 #endif /* PPP_SUPPORT && CHAP_SUPPORT */
diff --git a/src/netif/ppp/chap-new.c b/src/netif/ppp/chap-new.c
index da12430c..33076d3f 100644
--- a/src/netif/ppp/chap-new.c
+++ b/src/netif/ppp/chap-new.c
@@ -52,9 +52,9 @@
 #if 0 /* UNUSED */
 /* Hook for a plugin to validate CHAP challenge */
 int (*chap_verify_hook)(const char *name, const char *ourname, int id,
-			const struct chap_digest_type *digest,
-			const unsigned char *challenge, const unsigned char *response,
-			char *message, int message_space) = NULL;
+            const struct chap_digest_type *digest,
+            const unsigned char *challenge, const unsigned char *response,
+            char *message, int message_space) = NULL;
 #endif /* UNUSED */
 
 #if PPP_OPTIONS
@@ -62,24 +62,24 @@ int (*chap_verify_hook)(const char *name, const char *ourname, int id,
  * Command-line options.
  */
 static option_t chap_option_list[] = {
-	{ "chap-restart", o_int, &chap_timeout_time,
-	  "Set timeout for CHAP", OPT_PRIO },
-	{ "chap-max-challenge", o_int, &pcb->settings.chap_max_transmits,
-	  "Set max #xmits for challenge", OPT_PRIO },
-	{ "chap-interval", o_int, &pcb->settings.chap_rechallenge_time,
-	  "Set interval for rechallenge", OPT_PRIO },
-	{ NULL }
+    { "chap-restart", o_int, &chap_timeout_time,
+      "Set timeout for CHAP", OPT_PRIO },
+    { "chap-max-challenge", o_int, &pcb->settings.chap_max_transmits,
+      "Set max #xmits for challenge", OPT_PRIO },
+    { "chap-interval", o_int, &pcb->settings.chap_rechallenge_time,
+      "Set interval for rechallenge", OPT_PRIO },
+    { NULL }
 };
 #endif /* PPP_OPTIONS */
 
 
 /* Values for flags in chap_client_state and chap_server_state */
-#define LOWERUP			1
-#define AUTH_STARTED		2
-#define AUTH_DONE		4
-#define AUTH_FAILED		8
-#define TIMEOUT_PENDING		0x10
-#define CHALLENGE_VALID		0x20
+#define LOWERUP         1
+#define AUTH_STARTED        2
+#define AUTH_DONE       4
+#define AUTH_FAILED     8
+#define TIMEOUT_PENDING     0x10
+#define CHALLENGE_VALID     0x20
 
 /*
  * Prototypes.
@@ -91,21 +91,21 @@ static void chap_lowerdown(ppp_pcb *pcb);
 static void chap_timeout(void *arg);
 static void chap_generate_challenge(ppp_pcb *pcb);
 static void chap_handle_response(ppp_pcb *pcb, int code,
-		unsigned char *pkt, int len);
+        unsigned char *pkt, int len);
 static int chap_verify_response(ppp_pcb *pcb, const char *name, const char *ourname, int id,
-		const struct chap_digest_type *digest,
-		const unsigned char *challenge, const unsigned char *response,
-		char *message, int message_space);
+        const struct chap_digest_type *digest,
+        const unsigned char *challenge, const unsigned char *response,
+        char *message, int message_space);
 #endif /* PPP_SERVER */
 static void chap_respond(ppp_pcb *pcb, int id,
-		unsigned char *pkt, int len);
+        unsigned char *pkt, int len);
 static void chap_handle_status(ppp_pcb *pcb, int code, int id,
-		unsigned char *pkt, int len);
+        unsigned char *pkt, int len);
 static void chap_protrej(ppp_pcb *pcb);
 static void chap_input(ppp_pcb *pcb, unsigned char *pkt, int pktlen);
 #if PRINTPKT_SUPPORT
 static int chap_print_pkt(const unsigned char *p, int plen,
-		void (*printer) (void *, const char *, ...), void *arg);
+        void (*printer) (void *, const char *, ...), void *arg);
 #endif /* PRINTPKT_SUPPORT */
 
 /* List of digest types that we know about */
@@ -122,12 +122,12 @@ static const struct chap_digest_type* const chap_digests[] = {
  * chap_init - reset to initial state.
  */
 static void chap_init(ppp_pcb *pcb) {
-	LWIP_UNUSED_ARG(pcb);
+    LWIP_UNUSED_ARG(pcb);
 
 #if 0 /* Not necessary, everything is cleared in ppp_new() */
-	memset(&pcb->chap_client, 0, sizeof(chap_client_state));
+    memset(&pcb->chap_client, 0, sizeof(chap_client_state));
 #if PPP_SERVER
-	memset(&pcb->chap_server, 0, sizeof(chap_server_state));
+    memset(&pcb->chap_server, 0, sizeof(chap_server_state));
 #endif /* PPP_SERVER */
 #endif /* 0 */
 }
@@ -137,21 +137,21 @@ static void chap_init(ppp_pcb *pcb) {
  */
 static void chap_lowerup(ppp_pcb *pcb) {
 
-	pcb->chap_client.flags |= LOWERUP;
+    pcb->chap_client.flags |= LOWERUP;
 #if PPP_SERVER
-	pcb->chap_server.flags |= LOWERUP;
-	if (pcb->chap_server.flags & AUTH_STARTED)
-		chap_timeout(pcb);
+    pcb->chap_server.flags |= LOWERUP;
+    if (pcb->chap_server.flags & AUTH_STARTED)
+        chap_timeout(pcb);
 #endif /* PPP_SERVER */
 }
 
 static void chap_lowerdown(ppp_pcb *pcb) {
 
-	pcb->chap_client.flags = 0;
+    pcb->chap_client.flags = 0;
 #if PPP_SERVER
-	if (pcb->chap_server.flags & TIMEOUT_PENDING)
-		UNTIMEOUT(chap_timeout, pcb);
-	pcb->chap_server.flags = 0;
+    if (pcb->chap_server.flags & TIMEOUT_PENDING)
+        UNTIMEOUT(chap_timeout, pcb);
+    pcb->chap_server.flags = 0;
 #endif /* PPP_SERVER */
 }
 
@@ -162,27 +162,27 @@ static void chap_lowerdown(ppp_pcb *pcb) {
  * otherwise we wait for the lower layer to come up.
  */
 void chap_auth_peer(ppp_pcb *pcb, const char *our_name, int digest_code) {
-	const struct chap_digest_type *dp;
-	int i;
-
-	if (pcb->chap_server.flags & AUTH_STARTED) {
-		ppp_error(("CHAP: peer authentication already started!"));
-		return;
-	}
-	for (i = 0; (dp = chap_digests[i]) != NULL; ++i)
-		if (dp->code == digest_code)
-			break;
-	if (dp == NULL)
-		ppp_fatal(("CHAP digest 0x%x requested but not available",
-		      digest_code));
-
-	pcb->chap_server.digest = dp;
-	pcb->chap_server.name = our_name;
-	/* Start with a random ID value */
-	pcb->chap_server.id = magic();
-	pcb->chap_server.flags |= AUTH_STARTED;
-	if (pcb->chap_server.flags & LOWERUP)
-		chap_timeout(pcb);
+    const struct chap_digest_type *dp;
+    int i;
+
+    if (pcb->chap_server.flags & AUTH_STARTED) {
+        ppp_error(("CHAP: peer authentication already started!"));
+        return;
+    }
+    for (i = 0; (dp = chap_digests[i]) != NULL; ++i)
+        if (dp->code == digest_code)
+            break;
+    if (dp == NULL)
+        ppp_fatal(("CHAP digest 0x%x requested but not available",
+              digest_code));
+
+    pcb->chap_server.digest = dp;
+    pcb->chap_server.name = our_name;
+    /* Start with a random ID value */
+    pcb->chap_server.id = magic();
+    pcb->chap_server.flags |= AUTH_STARTED;
+    if (pcb->chap_server.flags & LOWERUP)
+        chap_timeout(pcb);
 }
 #endif /* PPP_SERVER */
 
@@ -191,27 +191,27 @@ void chap_auth_peer(ppp_pcb *pcb, const char *our_name, int digest_code) {
  * There isn't much to do until we receive a challenge.
  */
 void chap_auth_with_peer(ppp_pcb *pcb, const char *our_name, int digest_code) {
-	const struct chap_digest_type *dp;
-	int i;
-
-	if(NULL == our_name)
-		return;
-
-	if (pcb->chap_client.flags & AUTH_STARTED) {
-		ppp_error(("CHAP: authentication with peer already started!"));
-		return;
-	}
-	for (i = 0; (dp = chap_digests[i]) != NULL; ++i)
-		if (dp->code == digest_code)
-			break;
-
-	if (dp == NULL)
-		ppp_fatal(("CHAP digest 0x%x requested but not available",
-		      digest_code));
-
-	pcb->chap_client.digest = dp;
-	pcb->chap_client.name = our_name;
-	pcb->chap_client.flags |= AUTH_STARTED;
+    const struct chap_digest_type *dp;
+    int i;
+
+    if(NULL == our_name)
+        return;
+
+    if (pcb->chap_client.flags & AUTH_STARTED) {
+        ppp_error(("CHAP: authentication with peer already started!"));
+        return;
+    }
+    for (i = 0; (dp = chap_digests[i]) != NULL; ++i)
+        if (dp->code == digest_code)
+            break;
+
+    if (dp == NULL)
+        ppp_fatal(("CHAP digest 0x%x requested but not available",
+              digest_code));
+
+    pcb->chap_client.digest = dp;
+    pcb->chap_client.name = our_name;
+    pcb->chap_client.flags |= AUTH_STARTED;
 }
 
 #if PPP_SERVER
@@ -221,33 +221,33 @@ void chap_auth_with_peer(ppp_pcb *pcb, const char *our_name, int digest_code) {
  * or a new challenge to start re-authentication.
  */
 static void chap_timeout(void *arg) {
-	ppp_pcb *pcb = (ppp_pcb*)arg;
-	struct pbuf *p;
-
-	pcb->chap_server.flags &= ~TIMEOUT_PENDING;
-	if ((pcb->chap_server.flags & CHALLENGE_VALID) == 0) {
-		pcb->chap_server.challenge_xmits = 0;
-		chap_generate_challenge(pcb);
-		pcb->chap_server.flags |= CHALLENGE_VALID;
-	} else if (pcb->chap_server.challenge_xmits >= pcb->settings.chap_max_transmits) {
-		pcb->chap_server.flags &= ~CHALLENGE_VALID;
-		pcb->chap_server.flags |= AUTH_DONE | AUTH_FAILED;
-		auth_peer_fail(pcb, PPP_CHAP);
-		return;
-	}
-
-	p = pbuf_alloc(PBUF_RAW, (u16_t)(pcb->chap_server.challenge_pktlen), PBUF_RAM);
-	if(NULL == p)
-		return;
-	if(p->tot_len != p->len) {
-		pbuf_free(p);
-		return;
-	}
-	MEMCPY(p->payload, pcb->chap_server.challenge, pcb->chap_server.challenge_pktlen);
-	ppp_write(pcb, p);
-	++pcb->chap_server.challenge_xmits;
-	pcb->chap_server.flags |= TIMEOUT_PENDING;
-	TIMEOUT(chap_timeout, arg, pcb->settings.chap_timeout_time);
+    ppp_pcb *pcb = (ppp_pcb*)arg;
+    struct pbuf *p;
+
+    pcb->chap_server.flags &= ~TIMEOUT_PENDING;
+    if ((pcb->chap_server.flags & CHALLENGE_VALID) == 0) {
+        pcb->chap_server.challenge_xmits = 0;
+        chap_generate_challenge(pcb);
+        pcb->chap_server.flags |= CHALLENGE_VALID;
+    } else if (pcb->chap_server.challenge_xmits >= pcb->settings.chap_max_transmits) {
+        pcb->chap_server.flags &= ~CHALLENGE_VALID;
+        pcb->chap_server.flags |= AUTH_DONE | AUTH_FAILED;
+        auth_peer_fail(pcb, PPP_CHAP);
+        return;
+    }
+
+    p = pbuf_alloc(PBUF_RAW, (u16_t)(pcb->chap_server.challenge_pktlen), PBUF_RAM);
+    if(NULL == p)
+        return;
+    if(p->tot_len != p->len) {
+        pbuf_free(p);
+        return;
+    }
+    MEMCPY(p->payload, pcb->chap_server.challenge, pcb->chap_server.challenge_pktlen);
+    ppp_write(pcb, p);
+    ++pcb->chap_server.challenge_xmits;
+    pcb->chap_server.flags |= TIMEOUT_PENDING;
+    TIMEOUT(chap_timeout, arg, pcb->settings.chap_timeout_time);
 }
 
 /*
@@ -255,152 +255,152 @@ static void chap_timeout(void *arg) {
  * the challenge packet in pcb->chap_server.challenge_pkt.
  */
 static void chap_generate_challenge(ppp_pcb *pcb) {
-	int clen = 1, nlen, len;
-	unsigned char *p;
-
-	p = pcb->chap_server.challenge;
-	MAKEHEADER(p, PPP_CHAP);
-	p += CHAP_HDRLEN;
-	pcb->chap_server.digest->generate_challenge(pcb, p);
-	clen = *p;
-	nlen = strlen(pcb->chap_server.name);
-	memcpy(p + 1 + clen, pcb->chap_server.name, nlen);
-
-	len = CHAP_HDRLEN + 1 + clen + nlen;
-	pcb->chap_server.challenge_pktlen = PPP_HDRLEN + len;
-
-	p = pcb->chap_server.challenge + PPP_HDRLEN;
-	p[0] = CHAP_CHALLENGE;
-	p[1] = ++pcb->chap_server.id;
-	p[2] = len >> 8;
-	p[3] = len;
+    int clen = 1, nlen, len;
+    unsigned char *p;
+
+    p = pcb->chap_server.challenge;
+    MAKEHEADER(p, PPP_CHAP);
+    p += CHAP_HDRLEN;
+    pcb->chap_server.digest->generate_challenge(pcb, p);
+    clen = *p;
+    nlen = strlen(pcb->chap_server.name);
+    memcpy(p + 1 + clen, pcb->chap_server.name, nlen);
+
+    len = CHAP_HDRLEN + 1 + clen + nlen;
+    pcb->chap_server.challenge_pktlen = PPP_HDRLEN + len;
+
+    p = pcb->chap_server.challenge + PPP_HDRLEN;
+    p[0] = CHAP_CHALLENGE;
+    p[1] = ++pcb->chap_server.id;
+    p[2] = len >> 8;
+    p[3] = len;
 }
 
 /*
  * chap_handle_response - check the response to our challenge.
  */
 static void  chap_handle_response(ppp_pcb *pcb, int id,
-		     unsigned char *pkt, int len) {
-	int response_len, ok, mlen;
-	const unsigned char *response;
-	unsigned char *outp;
-	struct pbuf *p;
-	const char *name = NULL;	/* initialized to shut gcc up */
+             unsigned char *pkt, int len) {
+    int response_len, ok, mlen;
+    const unsigned char *response;
+    unsigned char *outp;
+    struct pbuf *p;
+    const char *name = NULL;    /* initialized to shut gcc up */
 #if 0 /* UNUSED */
-	int (*verifier)(const char *, const char *, int, const struct chap_digest_type *,
-		const unsigned char *, const unsigned char *, char *, int);
+    int (*verifier)(const char *, const char *, int, const struct chap_digest_type *,
+        const unsigned char *, const unsigned char *, char *, int);
 #endif /* UNUSED */
-	char rname[MAXNAMELEN+1];
-	char message[256];
-
-	if ((pcb->chap_server.flags & LOWERUP) == 0)
-		return;
-	if (id != pcb->chap_server.challenge[PPP_HDRLEN+1] || len < 2)
-		return;
-	if (pcb->chap_server.flags & CHALLENGE_VALID) {
-		response = pkt;
-		GETCHAR(response_len, pkt);
-		len -= response_len + 1;	/* length of name */
-		name = (char *)pkt + response_len;
-		if (len < 0)
-			return;
-
-		if (pcb->chap_server.flags & TIMEOUT_PENDING) {
-			pcb->chap_server.flags &= ~TIMEOUT_PENDING;
-			UNTIMEOUT(chap_timeout, pcb);
-		}
+    char rname[MAXNAMELEN+1];
+    char message[256];
+
+    if ((pcb->chap_server.flags & LOWERUP) == 0)
+        return;
+    if (id != pcb->chap_server.challenge[PPP_HDRLEN+1] || len < 2)
+        return;
+    if (pcb->chap_server.flags & CHALLENGE_VALID) {
+        response = pkt;
+        GETCHAR(response_len, pkt);
+        len -= response_len + 1;    /* length of name */
+        name = (char *)pkt + response_len;
+        if (len < 0)
+            return;
+
+        if (pcb->chap_server.flags & TIMEOUT_PENDING) {
+            pcb->chap_server.flags &= ~TIMEOUT_PENDING;
+            UNTIMEOUT(chap_timeout, pcb);
+        }
 #if PPP_REMOTENAME
-		if (pcb->settings.explicit_remote) {
-			name = pcb->remote_name;
-		} else
+        if (pcb->settings.explicit_remote) {
+            name = pcb->remote_name;
+        } else
 #endif /* PPP_REMOTENAME */
-		{
-			/* Null terminate and clean remote name. */
-			ppp_slprintf(rname, sizeof(rname), "%.*v", len, name);
-			name = rname;
-		}
+        {
+            /* Null terminate and clean remote name. */
+            ppp_slprintf(rname, sizeof(rname), "%.*v", len, name);
+            name = rname;
+        }
 
 #if 0 /* UNUSED */
-		if (chap_verify_hook)
-			verifier = chap_verify_hook;
-		else
-			verifier = chap_verify_response;
-		ok = (*verifier)(name, pcb->chap_server.name, id, pcb->chap_server.digest,
-				 pcb->chap_server.challenge + PPP_HDRLEN + CHAP_HDRLEN,
-				 response, pcb->chap_server.message, sizeof(pcb->chap_server.message));
+        if (chap_verify_hook)
+            verifier = chap_verify_hook;
+        else
+            verifier = chap_verify_response;
+        ok = (*verifier)(name, pcb->chap_server.name, id, pcb->chap_server.digest,
+                 pcb->chap_server.challenge + PPP_HDRLEN + CHAP_HDRLEN,
+                 response, pcb->chap_server.message, sizeof(pcb->chap_server.message));
 #endif /* UNUSED */
-		ok = chap_verify_response(pcb, name, pcb->chap_server.name, id, pcb->chap_server.digest,
+        ok = chap_verify_response(pcb, name, pcb->chap_server.name, id, pcb->chap_server.digest,
                     pcb->chap_server.challenge + PPP_HDRLEN + CHAP_HDRLEN,
                     response, message, sizeof(message));
 #if 0 /* UNUSED */
-		if (!ok || !auth_number()) {
+        if (!ok || !auth_number()) {
 #endif /* UNUSED */
-		if (!ok) {
-			pcb->chap_server.flags |= AUTH_FAILED;
-			ppp_warn(("Peer %q failed CHAP authentication", name));
-		}
-	} else if ((pcb->chap_server.flags & AUTH_DONE) == 0)
-		return;
-
-	/* send the response */
-	mlen = strlen(message);
-	len = CHAP_HDRLEN + mlen;
-	p = pbuf_alloc(PBUF_RAW, (u16_t)(PPP_HDRLEN +len), PBUF_RAM);
-	if(NULL == p)
-		return;
-	if(p->tot_len != p->len) {
-		pbuf_free(p);
-		return;
-	}
-
-	outp = (unsigned char *)p->payload;
-	MAKEHEADER(outp, PPP_CHAP);
-
-	outp[0] = (pcb->chap_server.flags & AUTH_FAILED)? CHAP_FAILURE: CHAP_SUCCESS;
-	outp[1] = id;
-	outp[2] = len >> 8;
-	outp[3] = len;
-	if (mlen > 0)
-		memcpy(outp + CHAP_HDRLEN, message, mlen);
-	ppp_write(pcb, p);
-
-	if (pcb->chap_server.flags & CHALLENGE_VALID) {
-		pcb->chap_server.flags &= ~CHALLENGE_VALID;
-		if (!(pcb->chap_server.flags & AUTH_DONE) && !(pcb->chap_server.flags & AUTH_FAILED)) {
+        if (!ok) {
+            pcb->chap_server.flags |= AUTH_FAILED;
+            ppp_warn(("Peer %q failed CHAP authentication", name));
+        }
+    } else if ((pcb->chap_server.flags & AUTH_DONE) == 0)
+        return;
+
+    /* send the response */
+    mlen = strlen(message);
+    len = CHAP_HDRLEN + mlen;
+    p = pbuf_alloc(PBUF_RAW, (u16_t)(PPP_HDRLEN +len), PBUF_RAM);
+    if(NULL == p)
+        return;
+    if(p->tot_len != p->len) {
+        pbuf_free(p);
+        return;
+    }
+
+    outp = (unsigned char *)p->payload;
+    MAKEHEADER(outp, PPP_CHAP);
+
+    outp[0] = (pcb->chap_server.flags & AUTH_FAILED)? CHAP_FAILURE: CHAP_SUCCESS;
+    outp[1] = id;
+    outp[2] = len >> 8;
+    outp[3] = len;
+    if (mlen > 0)
+        memcpy(outp + CHAP_HDRLEN, message, mlen);
+    ppp_write(pcb, p);
+
+    if (pcb->chap_server.flags & CHALLENGE_VALID) {
+        pcb->chap_server.flags &= ~CHALLENGE_VALID;
+        if (!(pcb->chap_server.flags & AUTH_DONE) && !(pcb->chap_server.flags & AUTH_FAILED)) {
 
 #if 0 /* UNUSED */
-		    /*
-		     * Auth is OK, so now we need to check session restrictions
-		     * to ensure everything is OK, but only if we used a
-		     * plugin, and only if we're configured to check.  This
-		     * allows us to do PAM checks on PPP servers that
-		     * authenticate against ActiveDirectory, and use AD for
-		     * account info (like when using Winbind integrated with
-		     * PAM).
-		     */
-		    if (session_mgmt &&
-			session_check(name, NULL, devnam, NULL) == 0) {
-			pcb->chap_server.flags |= AUTH_FAILED;
-			ppp_warn(("Peer %q failed CHAP Session verification", name));
-		    }
+            /*
+             * Auth is OK, so now we need to check session restrictions
+             * to ensure everything is OK, but only if we used a
+             * plugin, and only if we're configured to check.  This
+             * allows us to do PAM checks on PPP servers that
+             * authenticate against ActiveDirectory, and use AD for
+             * account info (like when using Winbind integrated with
+             * PAM).
+             */
+            if (session_mgmt &&
+            session_check(name, NULL, devnam, NULL) == 0) {
+            pcb->chap_server.flags |= AUTH_FAILED;
+            ppp_warn(("Peer %q failed CHAP Session verification", name));
+            }
 #endif /* UNUSED */
 
-		}
-		if (pcb->chap_server.flags & AUTH_FAILED) {
-			auth_peer_fail(pcb, PPP_CHAP);
-		} else {
-			if ((pcb->chap_server.flags & AUTH_DONE) == 0)
-				auth_peer_success(pcb, PPP_CHAP,
-						  pcb->chap_server.digest->code,
-						  name, strlen(name));
-			if (pcb->settings.chap_rechallenge_time) {
-				pcb->chap_server.flags |= TIMEOUT_PENDING;
-				TIMEOUT(chap_timeout, pcb,
-					pcb->settings.chap_rechallenge_time);
-			}
-		}
-		pcb->chap_server.flags |= AUTH_DONE;
-	}
+        }
+        if (pcb->chap_server.flags & AUTH_FAILED) {
+            auth_peer_fail(pcb, PPP_CHAP);
+        } else {
+            if ((pcb->chap_server.flags & AUTH_DONE) == 0)
+                auth_peer_success(pcb, PPP_CHAP,
+                          pcb->chap_server.digest->code,
+                          name, strlen(name));
+            if (pcb->settings.chap_rechallenge_time) {
+                pcb->chap_server.flags |= TIMEOUT_PENDING;
+                TIMEOUT(chap_timeout, pcb,
+                    pcb->settings.chap_rechallenge_time);
+            }
+        }
+        pcb->chap_server.flags |= AUTH_DONE;
+    }
 }
 
 /*
@@ -409,23 +409,23 @@ static void  chap_handle_response(ppp_pcb *pcb, int id,
  * succeeded), or 0 if it doesn't.
  */
 static int chap_verify_response(ppp_pcb *pcb, const char *name, const char *ourname, int id,
-		     const struct chap_digest_type *digest,
-		     const unsigned char *challenge, const unsigned char *response,
-		     char *message, int message_space) {
-	int ok;
-	unsigned char secret[MAXSECRETLEN];
-	int secret_len;
-
-	/* Get the secret that the peer is supposed to know */
-	if (!get_secret(pcb, name, ourname, (char *)secret, &secret_len, 1)) {
-		ppp_error(("No CHAP secret found for authenticating %q", name));
-		return 0;
-	}
-	ok = digest->verify_response(pcb, id, name, secret, secret_len, challenge,
-				     response, message, message_space);
-	memset(secret, 0, sizeof(secret));
-
-	return ok;
+             const struct chap_digest_type *digest,
+             const unsigned char *challenge, const unsigned char *response,
+             char *message, int message_space) {
+    int ok;
+    unsigned char secret[MAXSECRETLEN];
+    int secret_len;
+
+    /* Get the secret that the peer is supposed to know */
+    if (!get_secret(pcb, name, ourname, (char *)secret, &secret_len, 1)) {
+        ppp_error(("No CHAP secret found for authenticating %q", name));
+        return 0;
+    }
+    ok = digest->verify_response(pcb, id, name, secret, secret_len, challenge,
+                     response, message, message_space);
+    memset(secret, 0, sizeof(secret));
+
+    return ok;
 }
 #endif /* PPP_SERVER */
 
@@ -433,153 +433,153 @@ static int chap_verify_response(ppp_pcb *pcb, const char *name, const char *ourn
  * chap_respond - Generate and send a response to a challenge.
  */
 static void chap_respond(ppp_pcb *pcb, int id,
-	     unsigned char *pkt, int len) {
-	int clen, nlen;
-	int secret_len;
-	struct pbuf *p;
-	u_char *outp;
-	char rname[MAXNAMELEN+1];
-	char secret[MAXSECRETLEN+1];
-
-	p = pbuf_alloc(PBUF_RAW, (u16_t)(RESP_MAX_PKTLEN), PBUF_RAM);
-	if(NULL == p)
-		return;
-	if(p->tot_len != p->len) {
-		pbuf_free(p);
-		return;
-	}
-
-	if ((pcb->chap_client.flags & (LOWERUP | AUTH_STARTED)) != (LOWERUP | AUTH_STARTED))
-		return;		/* not ready */
-	if (len < 2 || len < pkt[0] + 1)
-		return;		/* too short */
-	clen = pkt[0];
-	nlen = len - (clen + 1);
-
-	/* Null terminate and clean remote name. */
-	ppp_slprintf(rname, sizeof(rname), "%.*v", nlen, pkt + clen + 1);
+         unsigned char *pkt, int len) {
+    int clen, nlen;
+    int secret_len;
+    struct pbuf *p;
+    u_char *outp;
+    char rname[MAXNAMELEN+1];
+    char secret[MAXSECRETLEN+1];
+
+    p = pbuf_alloc(PBUF_RAW, (u16_t)(RESP_MAX_PKTLEN), PBUF_RAM);
+    if(NULL == p)
+        return;
+    if(p->tot_len != p->len) {
+        pbuf_free(p);
+        return;
+    }
+
+    if ((pcb->chap_client.flags & (LOWERUP | AUTH_STARTED)) != (LOWERUP | AUTH_STARTED))
+        return;     /* not ready */
+    if (len < 2 || len < pkt[0] + 1)
+        return;     /* too short */
+    clen = pkt[0];
+    nlen = len - (clen + 1);
+
+    /* Null terminate and clean remote name. */
+    ppp_slprintf(rname, sizeof(rname), "%.*v", nlen, pkt + clen + 1);
 
 #if PPP_REMOTENAME
-	/* Microsoft doesn't send their name back in the PPP packet */
-	if (pcb->settings.explicit_remote || (pcb->settings.remote_name[0] != 0 && rname[0] == 0))
-		strlcpy(rname, pcb->settings.remote_name, sizeof(rname));
+    /* Microsoft doesn't send their name back in the PPP packet */
+    if (pcb->settings.explicit_remote || (pcb->settings.remote_name[0] != 0 && rname[0] == 0))
+        strlcpy(rname, pcb->settings.remote_name, sizeof(rname));
 #endif /* PPP_REMOTENAME */
 
-	/* get secret for authenticating ourselves with the specified host */
-	if (!get_secret(pcb, pcb->chap_client.name, rname, secret, &secret_len, 0)) {
-		secret_len = 0;	/* assume null secret if can't find one */
-		ppp_warn(("No CHAP secret found for authenticating us to %q", rname));
-	}
-
-	outp = (u_char*)p->payload;
-	MAKEHEADER(outp, PPP_CHAP);
-	outp += CHAP_HDRLEN;
-
-	pcb->chap_client.digest->make_response(pcb, outp, id, pcb->chap_client.name, pkt,
-				  secret, secret_len, pcb->chap_client.priv);
-	memset(secret, 0, secret_len);
-
-	clen = *outp;
-	nlen = strlen(pcb->chap_client.name);
-	memcpy(outp + clen + 1, pcb->chap_client.name, nlen);
-
-	outp = (u_char*)p->payload + PPP_HDRLEN;
-	len = CHAP_HDRLEN + clen + 1 + nlen;
-	outp[0] = CHAP_RESPONSE;
-	outp[1] = id;
-	outp[2] = len >> 8;
-	outp[3] = len;
-
-	pbuf_realloc(p, PPP_HDRLEN + len);
-	ppp_write(pcb, p);
+    /* get secret for authenticating ourselves with the specified host */
+    if (!get_secret(pcb, pcb->chap_client.name, rname, secret, &secret_len, 0)) {
+        secret_len = 0; /* assume null secret if can't find one */
+        ppp_warn(("No CHAP secret found for authenticating us to %q", rname));
+    }
+
+    outp = (u_char*)p->payload;
+    MAKEHEADER(outp, PPP_CHAP);
+    outp += CHAP_HDRLEN;
+
+    pcb->chap_client.digest->make_response(pcb, outp, id, pcb->chap_client.name, pkt,
+                  secret, secret_len, pcb->chap_client.priv);
+    memset(secret, 0, secret_len);
+
+    clen = *outp;
+    nlen = strlen(pcb->chap_client.name);
+    memcpy(outp + clen + 1, pcb->chap_client.name, nlen);
+
+    outp = (u_char*)p->payload + PPP_HDRLEN;
+    len = CHAP_HDRLEN + clen + 1 + nlen;
+    outp[0] = CHAP_RESPONSE;
+    outp[1] = id;
+    outp[2] = len >> 8;
+    outp[3] = len;
+
+    pbuf_realloc(p, PPP_HDRLEN + len);
+    ppp_write(pcb, p);
 }
 
 static void chap_handle_status(ppp_pcb *pcb, int code, int id,
-		   unsigned char *pkt, int len) {
-	const char *msg = NULL;
-	LWIP_UNUSED_ARG(id);
-
-	if ((pcb->chap_client.flags & (AUTH_DONE|AUTH_STARTED|LOWERUP))
-	    != (AUTH_STARTED|LOWERUP))
-		return;
-	pcb->chap_client.flags |= AUTH_DONE;
-
-	if (code == CHAP_SUCCESS) {
-		/* used for MS-CHAP v2 mutual auth, yuck */
-		if (pcb->chap_client.digest->check_success != NULL) {
-			if (!(*pcb->chap_client.digest->check_success)(pcb, pkt, len, pcb->chap_client.priv))
-				code = CHAP_FAILURE;
-		} else
-			msg = "CHAP authentication succeeded";
-	} else {
-		if (pcb->chap_client.digest->handle_failure != NULL)
-			(*pcb->chap_client.digest->handle_failure)(pcb, pkt, len);
-		else
-			msg = "CHAP authentication failed";
-	}
-	if (msg) {
-		if (len > 0)
-			ppp_info(("%s: %.*v", msg, len, pkt));
-		else
-			ppp_info(("%s", msg));
-	}
-	if (code == CHAP_SUCCESS)
-		auth_withpeer_success(pcb, PPP_CHAP, pcb->chap_client.digest->code);
-	else {
-		pcb->chap_client.flags |= AUTH_FAILED;
-		ppp_error(("CHAP authentication failed"));
-		auth_withpeer_fail(pcb, PPP_CHAP);
-	}
+           unsigned char *pkt, int len) {
+    const char *msg = NULL;
+    LWIP_UNUSED_ARG(id);
+
+    if ((pcb->chap_client.flags & (AUTH_DONE|AUTH_STARTED|LOWERUP))
+        != (AUTH_STARTED|LOWERUP))
+        return;
+    pcb->chap_client.flags |= AUTH_DONE;
+
+    if (code == CHAP_SUCCESS) {
+        /* used for MS-CHAP v2 mutual auth, yuck */
+        if (pcb->chap_client.digest->check_success != NULL) {
+            if (!(*pcb->chap_client.digest->check_success)(pcb, pkt, len, pcb->chap_client.priv))
+                code = CHAP_FAILURE;
+        } else
+            msg = "CHAP authentication succeeded";
+    } else {
+        if (pcb->chap_client.digest->handle_failure != NULL)
+            (*pcb->chap_client.digest->handle_failure)(pcb, pkt, len);
+        else
+            msg = "CHAP authentication failed";
+    }
+    if (msg) {
+        if (len > 0)
+            ppp_info(("%s: %.*v", msg, len, pkt));
+        else
+            ppp_info(("%s", msg));
+    }
+    if (code == CHAP_SUCCESS)
+        auth_withpeer_success(pcb, PPP_CHAP, pcb->chap_client.digest->code);
+    else {
+        pcb->chap_client.flags |= AUTH_FAILED;
+        ppp_error(("CHAP authentication failed"));
+        auth_withpeer_fail(pcb, PPP_CHAP);
+    }
 }
 
 static void chap_input(ppp_pcb *pcb, unsigned char *pkt, int pktlen) {
-	unsigned char code, id;
-	int len;
-
-	if (pktlen < CHAP_HDRLEN)
-		return;
-	GETCHAR(code, pkt);
-	GETCHAR(id, pkt);
-	GETSHORT(len, pkt);
-	if (len < CHAP_HDRLEN || len > pktlen)
-		return;
-	len -= CHAP_HDRLEN;
-
-	switch (code) {
-	case CHAP_CHALLENGE:
-		chap_respond(pcb, id, pkt, len);
-		break;
+    unsigned char code, id;
+    int len;
+
+    if (pktlen < CHAP_HDRLEN)
+        return;
+    GETCHAR(code, pkt);
+    GETCHAR(id, pkt);
+    GETSHORT(len, pkt);
+    if (len < CHAP_HDRLEN || len > pktlen)
+        return;
+    len -= CHAP_HDRLEN;
+
+    switch (code) {
+    case CHAP_CHALLENGE:
+        chap_respond(pcb, id, pkt, len);
+        break;
 #if PPP_SERVER
-	case CHAP_RESPONSE:
-		chap_handle_response(pcb, id, pkt, len);
-		break;
+    case CHAP_RESPONSE:
+        chap_handle_response(pcb, id, pkt, len);
+        break;
 #endif /* PPP_SERVER */
-	case CHAP_FAILURE:
-	case CHAP_SUCCESS:
-		chap_handle_status(pcb, code, id, pkt, len);
-		break;
-	default:
-		break;
-	}
+    case CHAP_FAILURE:
+    case CHAP_SUCCESS:
+        chap_handle_status(pcb, code, id, pkt, len);
+        break;
+    default:
+        break;
+    }
 }
 
 static void chap_protrej(ppp_pcb *pcb) {
 
 #if PPP_SERVER
-	if (pcb->chap_server.flags & TIMEOUT_PENDING) {
-		pcb->chap_server.flags &= ~TIMEOUT_PENDING;
-		UNTIMEOUT(chap_timeout, pcb);
-	}
-	if (pcb->chap_server.flags & AUTH_STARTED) {
-		pcb->chap_server.flags = 0;
-		auth_peer_fail(pcb, PPP_CHAP);
-	}
+    if (pcb->chap_server.flags & TIMEOUT_PENDING) {
+        pcb->chap_server.flags &= ~TIMEOUT_PENDING;
+        UNTIMEOUT(chap_timeout, pcb);
+    }
+    if (pcb->chap_server.flags & AUTH_STARTED) {
+        pcb->chap_server.flags = 0;
+        auth_peer_fail(pcb, PPP_CHAP);
+    }
 #endif /* PPP_SERVER */
-	if ((pcb->chap_client.flags & (AUTH_STARTED|AUTH_DONE)) == AUTH_STARTED) {
-		pcb->chap_client.flags &= ~AUTH_STARTED;
-		ppp_error(("CHAP authentication failed due to protocol-reject"));
-		auth_withpeer_fail(pcb, PPP_CHAP);
-	}
+    if ((pcb->chap_client.flags & (AUTH_STARTED|AUTH_DONE)) == AUTH_STARTED) {
+        pcb->chap_client.flags &= ~AUTH_STARTED;
+        ppp_error(("CHAP authentication failed due to protocol-reject"));
+        auth_withpeer_fail(pcb, PPP_CHAP);
+    }
 }
 
 #if PRINTPKT_SUPPORT
@@ -587,90 +587,90 @@ static void chap_protrej(ppp_pcb *pcb) {
  * chap_print_pkt - print the contents of a CHAP packet.
  */
 static const char* const chap_code_names[] = {
-	"Challenge", "Response", "Success", "Failure"
+    "Challenge", "Response", "Success", "Failure"
 };
 
 static int chap_print_pkt(const unsigned char *p, int plen,
-	       void (*printer) (void *, const char *, ...), void *arg) {
-	int code, id, len;
-	int clen, nlen;
-	unsigned char x;
-
-	if (plen < CHAP_HDRLEN)
-		return 0;
-	GETCHAR(code, p);
-	GETCHAR(id, p);
-	GETSHORT(len, p);
-	if (len < CHAP_HDRLEN || len > plen)
-		return 0;
-
-	if (code >= 1 && code <= (int)LWIP_ARRAYSIZE(chap_code_names))
-		printer(arg, " %s", chap_code_names[code-1]);
-	else
-		printer(arg, " code=0x%x", code);
-	printer(arg, " id=0x%x", id);
-	len -= CHAP_HDRLEN;
-	switch (code) {
-	case CHAP_CHALLENGE:
-	case CHAP_RESPONSE:
-		if (len < 1)
-			break;
-		clen = p[0];
-		if (len < clen + 1)
-			break;
-		++p;
-		nlen = len - clen - 1;
-		printer(arg, " <");
-		for (; clen > 0; --clen) {
-			GETCHAR(x, p);
-			printer(arg, "%.2x", x);
-		}
-		printer(arg, ">, name = ");
-		ppp_print_string(p, nlen, printer, arg);
-		break;
-	case CHAP_FAILURE:
-	case CHAP_SUCCESS:
-		printer(arg, " ");
-		ppp_print_string(p, len, printer, arg);
-		break;
-	default:
-		for (clen = len; clen > 0; --clen) {
-			GETCHAR(x, p);
-			printer(arg, " %.2x", x);
-		}
-		/* no break */
-	}
-
-	return len + CHAP_HDRLEN;
+           void (*printer) (void *, const char *, ...), void *arg) {
+    int code, id, len;
+    int clen, nlen;
+    unsigned char x;
+
+    if (plen < CHAP_HDRLEN)
+        return 0;
+    GETCHAR(code, p);
+    GETCHAR(id, p);
+    GETSHORT(len, p);
+    if (len < CHAP_HDRLEN || len > plen)
+        return 0;
+
+    if (code >= 1 && code <= (int)LWIP_ARRAYSIZE(chap_code_names))
+        printer(arg, " %s", chap_code_names[code-1]);
+    else
+        printer(arg, " code=0x%x", code);
+    printer(arg, " id=0x%x", id);
+    len -= CHAP_HDRLEN;
+    switch (code) {
+    case CHAP_CHALLENGE:
+    case CHAP_RESPONSE:
+        if (len < 1)
+            break;
+        clen = p[0];
+        if (len < clen + 1)
+            break;
+        ++p;
+        nlen = len - clen - 1;
+        printer(arg, " <");
+        for (; clen > 0; --clen) {
+            GETCHAR(x, p);
+            printer(arg, "%.2x", x);
+        }
+        printer(arg, ">, name = ");
+        ppp_print_string(p, nlen, printer, arg);
+        break;
+    case CHAP_FAILURE:
+    case CHAP_SUCCESS:
+        printer(arg, " ");
+        ppp_print_string(p, len, printer, arg);
+        break;
+    default:
+        for (clen = len; clen > 0; --clen) {
+            GETCHAR(x, p);
+            printer(arg, " %.2x", x);
+        }
+        /* no break */
+    }
+
+    return len + CHAP_HDRLEN;
 }
 #endif /* PRINTPKT_SUPPORT */
 
 const struct protent chap_protent = {
-	PPP_CHAP,
-	chap_init,
-	chap_input,
-	chap_protrej,
-	chap_lowerup,
-	chap_lowerdown,
-	NULL,		/* open */
-	NULL,		/* close */
+    PPP_CHAP,
+    chap_init,
+    chap_input,
+    chap_protrej,
+    chap_lowerup,
+    chap_lowerdown,
+    NULL,       /* open */
+    NULL,       /* close */
 #if PRINTPKT_SUPPORT
-	chap_print_pkt,
+    chap_print_pkt,
 #endif /* PRINTPKT_SUPPORT */
 #if PPP_DATAINPUT
-	NULL,		/* datainput */
+    NULL,       /* datainput */
 #endif /* PPP_DATAINPUT */
 #if PRINTPKT_SUPPORT
-	"CHAP",		/* name */
-	NULL,		/* data_name */
+    "CHAP",     /* name */
+    NULL,       /* data_name */
 #endif /* PRINTPKT_SUPPORT */
 #if PPP_OPTIONS
-	chap_option_list,
-	NULL,		/* check_options */
+    chap_option_list,
+    NULL,       /* check_options */
 #endif /* PPP_OPTIONS */
 #if DEMAND_SUPPORT
-	NULL,
-	NULL
+    NULL,
+    NULL
 #endif /* DEMAND_SUPPORT */
 };
 
diff --git a/src/netif/ppp/chap_ms.c b/src/netif/ppp/chap_ms.c
index 0639e7d7..01b8b8ce 100644
--- a/src/netif/ppp/chap_ms.c
+++ b/src/netif/ppp/chap_ms.c
@@ -97,41 +97,41 @@
 #include "netif/ppp/mppe.h" /* For mppe_sha1_pad*, mppe_set_key() */
 #endif /* MPPE_SUPPORT */
 
-#define SHA1_SIGNATURE_SIZE	20
-#define MD4_SIGNATURE_SIZE	16	/* 16 bytes in a MD4 message digest */
-#define MAX_NT_PASSWORD		256	/* Max (Unicode) chars in an NT pass */
+#define SHA1_SIGNATURE_SIZE 20
+#define MD4_SIGNATURE_SIZE  16  /* 16 bytes in a MD4 message digest */
+#define MAX_NT_PASSWORD     256 /* Max (Unicode) chars in an NT pass */
 
-#define MS_CHAP_RESPONSE_LEN	49	/* Response length for MS-CHAP */
-#define MS_CHAP2_RESPONSE_LEN	49	/* Response length for MS-CHAPv2 */
-#define MS_AUTH_RESPONSE_LENGTH	40	/* MS-CHAPv2 authenticator response, */
-					/* as ASCII */
+#define MS_CHAP_RESPONSE_LEN    49  /* Response length for MS-CHAP */
+#define MS_CHAP2_RESPONSE_LEN   49  /* Response length for MS-CHAPv2 */
+#define MS_AUTH_RESPONSE_LENGTH 40  /* MS-CHAPv2 authenticator response, */
+                    /* as ASCII */
 
 /* Error codes for MS-CHAP failure messages. */
-#define MS_CHAP_ERROR_RESTRICTED_LOGON_HOURS	646
-#define MS_CHAP_ERROR_ACCT_DISABLED		647
-#define MS_CHAP_ERROR_PASSWD_EXPIRED		648
-#define MS_CHAP_ERROR_NO_DIALIN_PERMISSION	649
-#define MS_CHAP_ERROR_AUTHENTICATION_FAILURE	691
-#define MS_CHAP_ERROR_CHANGING_PASSWORD		709
+#define MS_CHAP_ERROR_RESTRICTED_LOGON_HOURS    646
+#define MS_CHAP_ERROR_ACCT_DISABLED     647
+#define MS_CHAP_ERROR_PASSWD_EXPIRED        648
+#define MS_CHAP_ERROR_NO_DIALIN_PERMISSION  649
+#define MS_CHAP_ERROR_AUTHENTICATION_FAILURE    691
+#define MS_CHAP_ERROR_CHANGING_PASSWORD     709
 
 /*
  * Offsets within the response field for MS-CHAP
  */
-#define MS_CHAP_LANMANRESP	0
-#define MS_CHAP_LANMANRESP_LEN	24
-#define MS_CHAP_NTRESP		24
-#define MS_CHAP_NTRESP_LEN	24
-#define MS_CHAP_USENT		48
+#define MS_CHAP_LANMANRESP  0
+#define MS_CHAP_LANMANRESP_LEN  24
+#define MS_CHAP_NTRESP      24
+#define MS_CHAP_NTRESP_LEN  24
+#define MS_CHAP_USENT       48
 
 /*
  * Offsets within the response field for MS-CHAP2
  */
-#define MS_CHAP2_PEER_CHALLENGE	0
-#define MS_CHAP2_PEER_CHAL_LEN	16
-#define MS_CHAP2_RESERVED_LEN	8
-#define MS_CHAP2_NTRESP		24
-#define MS_CHAP2_NTRESP_LEN	24
-#define MS_CHAP2_FLAGS		48
+#define MS_CHAP2_PEER_CHALLENGE 0
+#define MS_CHAP2_PEER_CHAL_LEN  16
+#define MS_CHAP2_RESERVED_LEN   8
+#define MS_CHAP2_NTRESP     24
+#define MS_CHAP2_NTRESP_LEN 24
+#define MS_CHAP2_FLAGS      48
 
 #if MPPE_SUPPORT
 #if 0 /* UNUSED */
@@ -150,37 +150,37 @@ extern void set_mppe_enc_types(int, int);
 #define MS_CHAP2_AUTHENTICATEE 0
 #define MS_CHAP2_AUTHENTICATOR 1
 
-static void	ascii2unicode (const char[], int, u_char[]);
-static void	NTPasswordHash (u_char *, int, u_char[MD4_SIGNATURE_SIZE]);
-static void	ChallengeResponse (const u_char *, const u_char *, u_char[24]);
-static void	ChallengeHash (const u_char[16], const u_char *, const char *, u_char[8]);
-static void	ChapMS_NT (const u_char *, const char *, int, u_char[24]);
-static void	ChapMS2_NT (const u_char *, const u_char[16], const char *, const char *, int,
-				u_char[24]);
-static void	GenerateAuthenticatorResponsePlain
-			(const char*, int, u_char[24], const u_char[16], const u_char *,
-			     const char *, u_char[41]);
+static void ascii2unicode (const char[], int, u_char[]);
+static void NTPasswordHash (u_char *, int, u_char[MD4_SIGNATURE_SIZE]);
+static void ChallengeResponse (const u_char *, const u_char *, u_char[24]);
+static void ChallengeHash (const u_char[16], const u_char *, const char *, u_char[8]);
+static void ChapMS_NT (const u_char *, const char *, int, u_char[24]);
+static void ChapMS2_NT (const u_char *, const u_char[16], const char *, const char *, int,
+                u_char[24]);
+static void GenerateAuthenticatorResponsePlain
+            (const char*, int, u_char[24], const u_char[16], const u_char *,
+                 const char *, u_char[41]);
 #ifdef MSLANMAN
-static void	ChapMS_LANMan (u_char *, char *, int, u_char *);
+static void ChapMS_LANMan (u_char *, char *, int, u_char *);
 #endif
 
 static void GenerateAuthenticatorResponse(const u_char PasswordHashHash[MD4_SIGNATURE_SIZE],
-			u_char NTResponse[24], const u_char PeerChallenge[16],
-			const u_char *rchallenge, const char *username,
-			u_char authResponse[MS_AUTH_RESPONSE_LENGTH+1]);
+            u_char NTResponse[24], const u_char PeerChallenge[16],
+            const u_char *rchallenge, const char *username,
+            u_char authResponse[MS_AUTH_RESPONSE_LENGTH+1]);
 
 #if MPPE_SUPPORT
-static void	Set_Start_Key (ppp_pcb *pcb, const u_char *, const char *, int);
-static void	SetMasterKeys (ppp_pcb *pcb, const char *, int, u_char[24], int);
+static void Set_Start_Key (ppp_pcb *pcb, const u_char *, const char *, int);
+static void SetMasterKeys (ppp_pcb *pcb, const char *, int, u_char[24], int);
 #endif /* MPPE_SUPPORT */
 
 static void ChapMS (ppp_pcb *pcb, const u_char *, const char *, int, u_char *);
 static void ChapMS2 (ppp_pcb *pcb, const u_char *, const u_char *, const char *, const char *, int,
-		  u_char *, u_char[MS_AUTH_RESPONSE_LENGTH+1], int);
+          u_char *, u_char[MS_AUTH_RESPONSE_LENGTH+1], int);
 
 #ifdef MSLANMAN
-bool	ms_lanman = 0;    	/* Use LanMan password instead of NT */
-			  	/* Has meaning only with MS-CHAP challenges */
+bool    ms_lanman = 0;      /* Use LanMan password instead of NT */
+                /* Has meaning only with MS-CHAP challenges */
 #endif
 
 #if MPPE_SUPPORT
@@ -192,7 +192,7 @@ static char *mschap_challenge = NULL;
 static char *mschap2_peer_challenge = NULL;
 #endif
 
-#include "netif/ppp/fsm.h"		/* Need to poke MPPE options */
+#include "netif/ppp/fsm.h"      /* Need to poke MPPE options */
 #include "netif/ppp/ccp.h"
 #endif /* MPPE_SUPPORT */
 
@@ -202,16 +202,16 @@ static char *mschap2_peer_challenge = NULL;
  */
 static option_t chapms_option_list[] = {
 #ifdef MSLANMAN
-	{ "ms-lanman", o_bool, &ms_lanman,
-	  "Use LanMan passwd when using MS-CHAP", 1 },
+    { "ms-lanman", o_bool, &ms_lanman,
+      "Use LanMan passwd when using MS-CHAP", 1 },
 #endif
 #ifdef DEBUGMPPEKEY
-	{ "mschap-challenge", o_string, &mschap_challenge,
-	  "specify CHAP challenge" },
-	{ "mschap2-peer-challenge", o_string, &mschap2_peer_challenge,
-	  "specify CHAP peer challenge" },
+    { "mschap-challenge", o_string, &mschap_challenge,
+      "specify CHAP challenge" },
+    { "mschap2-peer-challenge", o_string, &mschap2_peer_challenge,
+      "specify CHAP peer challenge" },
 #endif
-	{ NULL }
+    { NULL }
 };
 #endif /* PPP_OPTIONS */
 
@@ -223,279 +223,279 @@ static option_t chapms_option_list[] = {
  * at challenge[1].
  */
 static void chapms_generate_challenge(ppp_pcb *pcb, unsigned char *challenge) {
-	LWIP_UNUSED_ARG(pcb);
+    LWIP_UNUSED_ARG(pcb);
 
-	*challenge++ = 8;
+    *challenge++ = 8;
 #ifdef DEBUGMPPEKEY
-	if (mschap_challenge && strlen(mschap_challenge) == 8)
-		memcpy(challenge, mschap_challenge, 8);
-	else
+    if (mschap_challenge && strlen(mschap_challenge) == 8)
+        memcpy(challenge, mschap_challenge, 8);
+    else
 #endif
-		magic_random_bytes(challenge, 8);
+        magic_random_bytes(challenge, 8);
 }
 
 static void chapms2_generate_challenge(ppp_pcb *pcb, unsigned char *challenge) {
-	LWIP_UNUSED_ARG(pcb);
+    LWIP_UNUSED_ARG(pcb);
 
-	*challenge++ = 16;
+    *challenge++ = 16;
 #ifdef DEBUGMPPEKEY
-	if (mschap_challenge && strlen(mschap_challenge) == 16)
-		memcpy(challenge, mschap_challenge, 16);
-	else
+    if (mschap_challenge && strlen(mschap_challenge) == 16)
+        memcpy(challenge, mschap_challenge, 16);
+    else
 #endif
-		magic_random_bytes(challenge, 16);
+        magic_random_bytes(challenge, 16);
 }
 
 static int chapms_verify_response(ppp_pcb *pcb, int id, const char *name,
-		       const unsigned char *secret, int secret_len,
-		       const unsigned char *challenge, const unsigned char *response,
-		       char *message, int message_space) {
-	unsigned char md[MS_CHAP_RESPONSE_LEN];
-	int diff;
-	int challenge_len, response_len;
-	LWIP_UNUSED_ARG(id);
-	LWIP_UNUSED_ARG(name);
-
-	challenge_len = *challenge++;	/* skip length, is 8 */
-	response_len = *response++;
-	if (response_len != MS_CHAP_RESPONSE_LEN)
-		goto bad;
+               const unsigned char *secret, int secret_len,
+               const unsigned char *challenge, const unsigned char *response,
+               char *message, int message_space) {
+    unsigned char md[MS_CHAP_RESPONSE_LEN];
+    int diff;
+    int challenge_len, response_len;
+    LWIP_UNUSED_ARG(id);
+    LWIP_UNUSED_ARG(name);
+
+    challenge_len = *challenge++;   /* skip length, is 8 */
+    response_len = *response++;
+    if (response_len != MS_CHAP_RESPONSE_LEN)
+        goto bad;
 
 #ifndef MSLANMAN
-	if (!response[MS_CHAP_USENT]) {
-		/* Should really propagate this into the error packet. */
-		ppp_notice(("Peer request for LANMAN auth not supported"));
-		goto bad;
-	}
+    if (!response[MS_CHAP_USENT]) {
+        /* Should really propagate this into the error packet. */
+        ppp_notice(("Peer request for LANMAN auth not supported"));
+        goto bad;
+    }
 #endif
 
-	/* Generate the expected response. */
-	ChapMS(pcb, (const u_char *)challenge, (const char *)secret, secret_len, md);
+    /* Generate the expected response. */
+    ChapMS(pcb, (const u_char *)challenge, (const char *)secret, secret_len, md);
 
 #ifdef MSLANMAN
-	/* Determine which part of response to verify against */
-	if (!response[MS_CHAP_USENT])
-		diff = memcmp(&response[MS_CHAP_LANMANRESP],
-			      &md[MS_CHAP_LANMANRESP], MS_CHAP_LANMANRESP_LEN);
-	else
+    /* Determine which part of response to verify against */
+    if (!response[MS_CHAP_USENT])
+        diff = memcmp(&response[MS_CHAP_LANMANRESP],
+                  &md[MS_CHAP_LANMANRESP], MS_CHAP_LANMANRESP_LEN);
+    else
 #endif
-		diff = memcmp(&response[MS_CHAP_NTRESP], &md[MS_CHAP_NTRESP],
-			      MS_CHAP_NTRESP_LEN);
+        diff = memcmp(&response[MS_CHAP_NTRESP], &md[MS_CHAP_NTRESP],
+                  MS_CHAP_NTRESP_LEN);
 
-	if (diff == 0) {
-		ppp_slprintf(message, message_space, "Access granted");
-		return 1;
-	}
+    if (diff == 0) {
+        ppp_slprintf(message, message_space, "Access granted");
+        return 1;
+    }
 
  bad:
-	/* See comments below for MS-CHAP V2 */
-	ppp_slprintf(message, message_space, "E=691 R=1 C=%0.*B V=0",
-		 challenge_len, challenge);
-	return 0;
+    /* See comments below for MS-CHAP V2 */
+    ppp_slprintf(message, message_space, "E=691 R=1 C=%0.*B V=0",
+         challenge_len, challenge);
+    return 0;
 }
 
 static int chapms2_verify_response(ppp_pcb *pcb, int id, const char *name,
-			const unsigned char *secret, int secret_len,
-			const unsigned char *challenge, const unsigned char *response,
-			char *message, int message_space) {
-	unsigned char md[MS_CHAP2_RESPONSE_LEN];
-	char saresponse[MS_AUTH_RESPONSE_LENGTH+1];
-	int challenge_len, response_len;
-	LWIP_UNUSED_ARG(id);
-
-	challenge_len = *challenge++;	/* skip length, is 16 */
-	response_len = *response++;
-	if (response_len != MS_CHAP2_RESPONSE_LEN)
-		goto bad;	/* not even the right length */
-
-	/* Generate the expected response and our mutual auth. */
-	ChapMS2(pcb, (const u_char*)challenge, (const u_char*)&response[MS_CHAP2_PEER_CHALLENGE], name,
-		(const char *)secret, secret_len, md,
-		(unsigned char *)saresponse, MS_CHAP2_AUTHENTICATOR);
-
-	/* compare MDs and send the appropriate status */
-	/*
-	 * Per RFC 2759, success message must be formatted as
-	 *     "S=<auth_string> M=<message>"
-	 * where
-	 *     <auth_string> is the Authenticator Response (mutual auth)
-	 *     <message> is a text message
-	 *
-	 * However, some versions of Windows (win98 tested) do not know
-	 * about the M=<message> part (required per RFC 2759) and flag
-	 * it as an error (reported incorrectly as an encryption error
-	 * to the user).  Since the RFC requires it, and it can be
-	 * useful information, we supply it if the peer is a conforming
-	 * system.  Luckily (?), win98 sets the Flags field to 0x04
-	 * (contrary to RFC requirements) so we can use that to
-	 * distinguish between conforming and non-conforming systems.
-	 *
-	 * Special thanks to Alex Swiridov <say@real.kharkov.ua> for
-	 * help debugging this.
-	 */
-	if (memcmp(&md[MS_CHAP2_NTRESP], &response[MS_CHAP2_NTRESP],
-		   MS_CHAP2_NTRESP_LEN) == 0) {
-		if (response[MS_CHAP2_FLAGS])
-			ppp_slprintf(message, message_space, "S=%s", saresponse);
-		else
-			ppp_slprintf(message, message_space, "S=%s M=%s",
-				 saresponse, "Access granted");
-		return 1;
-	}
+            const unsigned char *secret, int secret_len,
+            const unsigned char *challenge, const unsigned char *response,
+            char *message, int message_space) {
+    unsigned char md[MS_CHAP2_RESPONSE_LEN];
+    char saresponse[MS_AUTH_RESPONSE_LENGTH+1];
+    int challenge_len, response_len;
+    LWIP_UNUSED_ARG(id);
+
+    challenge_len = *challenge++;   /* skip length, is 16 */
+    response_len = *response++;
+    if (response_len != MS_CHAP2_RESPONSE_LEN)
+        goto bad;   /* not even the right length */
+
+    /* Generate the expected response and our mutual auth. */
+    ChapMS2(pcb, (const u_char*)challenge, (const u_char*)&response[MS_CHAP2_PEER_CHALLENGE], name,
+        (const char *)secret, secret_len, md,
+        (unsigned char *)saresponse, MS_CHAP2_AUTHENTICATOR);
+
+    /* compare MDs and send the appropriate status */
+    /*
+     * Per RFC 2759, success message must be formatted as
+     *     "S=<auth_string> M=<message>"
+     * where
+     *     <auth_string> is the Authenticator Response (mutual auth)
+     *     <message> is a text message
+     *
+     * However, some versions of Windows (win98 tested) do not know
+     * about the M=<message> part (required per RFC 2759) and flag
+     * it as an error (reported incorrectly as an encryption error
+     * to the user).  Since the RFC requires it, and it can be
+     * useful information, we supply it if the peer is a conforming
+     * system.  Luckily (?), win98 sets the Flags field to 0x04
+     * (contrary to RFC requirements) so we can use that to
+     * distinguish between conforming and non-conforming systems.
+     *
+     * Special thanks to Alex Swiridov <say@real.kharkov.ua> for
+     * help debugging this.
+     */
+    if (memcmp(&md[MS_CHAP2_NTRESP], &response[MS_CHAP2_NTRESP],
+           MS_CHAP2_NTRESP_LEN) == 0) {
+        if (response[MS_CHAP2_FLAGS])
+            ppp_slprintf(message, message_space, "S=%s", saresponse);
+        else
+            ppp_slprintf(message, message_space, "S=%s M=%s",
+                 saresponse, "Access granted");
+        return 1;
+    }
 
  bad:
-	/*
-	 * Failure message must be formatted as
-	 *     "E=e R=r C=c V=v M=m"
-	 * where
-	 *     e = error code (we use 691, ERROR_AUTHENTICATION_FAILURE)
-	 *     r = retry (we use 1, ok to retry)
-	 *     c = challenge to use for next response, we reuse previous
-	 *     v = Change Password version supported, we use 0
-	 *     m = text message
-	 *
-	 * The M=m part is only for MS-CHAPv2.  Neither win2k nor
-	 * win98 (others untested) display the message to the user anyway.
-	 * They also both ignore the E=e code.
-	 *
-	 * Note that it's safe to reuse the same challenge as we don't
-	 * actually accept another response based on the error message
-	 * (and no clients try to resend a response anyway).
-	 *
-	 * Basically, this whole bit is useless code, even the small
-	 * implementation here is only because of overspecification.
-	 */
-	ppp_slprintf(message, message_space, "E=691 R=1 C=%0.*B V=0 M=%s",
-		 challenge_len, challenge, "Access denied");
-	return 0;
+    /*
+     * Failure message must be formatted as
+     *     "E=e R=r C=c V=v M=m"
+     * where
+     *     e = error code (we use 691, ERROR_AUTHENTICATION_FAILURE)
+     *     r = retry (we use 1, ok to retry)
+     *     c = challenge to use for next response, we reuse previous
+     *     v = Change Password version supported, we use 0
+     *     m = text message
+     *
+     * The M=m part is only for MS-CHAPv2.  Neither win2k nor
+     * win98 (others untested) display the message to the user anyway.
+     * They also both ignore the E=e code.
+     *
+     * Note that it's safe to reuse the same challenge as we don't
+     * actually accept another response based on the error message
+     * (and no clients try to resend a response anyway).
+     *
+     * Basically, this whole bit is useless code, even the small
+     * implementation here is only because of overspecification.
+     */
+    ppp_slprintf(message, message_space, "E=691 R=1 C=%0.*B V=0 M=%s",
+         challenge_len, challenge, "Access denied");
+    return 0;
 }
 #endif /* PPP_SERVER */
 
 static void chapms_make_response(ppp_pcb *pcb, unsigned char *response, int id, const char *our_name,
-		     const unsigned char *challenge, const char *secret, int secret_len,
-		     unsigned char *private_) {
-	LWIP_UNUSED_ARG(id);
-	LWIP_UNUSED_ARG(our_name);
-	LWIP_UNUSED_ARG(private_);
-	challenge++;	/* skip length, should be 8 */
-	*response++ = MS_CHAP_RESPONSE_LEN;
-	ChapMS(pcb, challenge, secret, secret_len, response);
+             const unsigned char *challenge, const char *secret, int secret_len,
+             unsigned char *private_) {
+    LWIP_UNUSED_ARG(id);
+    LWIP_UNUSED_ARG(our_name);
+    LWIP_UNUSED_ARG(private_);
+    challenge++;    /* skip length, should be 8 */
+    *response++ = MS_CHAP_RESPONSE_LEN;
+    ChapMS(pcb, challenge, secret, secret_len, response);
 }
 
 static void chapms2_make_response(ppp_pcb *pcb, unsigned char *response, int id, const char *our_name,
-		      const unsigned char *challenge, const char *secret, int secret_len,
-		      unsigned char *private_) {
-	LWIP_UNUSED_ARG(id);
-	challenge++;	/* skip length, should be 16 */
-	*response++ = MS_CHAP2_RESPONSE_LEN;
-	ChapMS2(pcb, challenge,
+              const unsigned char *challenge, const char *secret, int secret_len,
+              unsigned char *private_) {
+    LWIP_UNUSED_ARG(id);
+    challenge++;    /* skip length, should be 16 */
+    *response++ = MS_CHAP2_RESPONSE_LEN;
+    ChapMS2(pcb, challenge,
 #ifdef DEBUGMPPEKEY
-		mschap2_peer_challenge,
+        mschap2_peer_challenge,
 #else
-		NULL,
+        NULL,
 #endif
-		our_name, secret, secret_len, response, private_,
-		MS_CHAP2_AUTHENTICATEE);
+        our_name, secret, secret_len, response, private_,
+        MS_CHAP2_AUTHENTICATEE);
 }
 
 static int chapms2_check_success(ppp_pcb *pcb, unsigned char *msg, int len, unsigned char *private_) {
-	LWIP_UNUSED_ARG(pcb);
-
-	if ((len < MS_AUTH_RESPONSE_LENGTH + 2) ||
-	    strncmp((char *)msg, "S=", 2) != 0) {
-		/* Packet does not start with "S=" */
-		ppp_error(("MS-CHAPv2 Success packet is badly formed."));
-		return 0;
-	}
-	msg += 2;
-	len -= 2;
-	if (len < MS_AUTH_RESPONSE_LENGTH
-	    || memcmp(msg, private_, MS_AUTH_RESPONSE_LENGTH)) {
-		/* Authenticator Response did not match expected. */
-		ppp_error(("MS-CHAPv2 mutual authentication failed."));
-		return 0;
-	}
-	/* Authenticator Response matches. */
-	msg += MS_AUTH_RESPONSE_LENGTH; /* Eat it */
-	len -= MS_AUTH_RESPONSE_LENGTH;
-	if ((len >= 3) && !strncmp((char *)msg, " M=", 3)) {
-		msg += 3; /* Eat the delimiter */
-	} else if (len) {
-		/* Packet has extra text which does not begin " M=" */
-		ppp_error(("MS-CHAPv2 Success packet is badly formed."));
-		return 0;
-	}
-	return 1;
+    LWIP_UNUSED_ARG(pcb);
+
+    if ((len < MS_AUTH_RESPONSE_LENGTH + 2) ||
+        strncmp((char *)msg, "S=", 2) != 0) {
+        /* Packet does not start with "S=" */
+        ppp_error(("MS-CHAPv2 Success packet is badly formed."));
+        return 0;
+    }
+    msg += 2;
+    len -= 2;
+    if (len < MS_AUTH_RESPONSE_LENGTH
+        || memcmp(msg, private_, MS_AUTH_RESPONSE_LENGTH)) {
+        /* Authenticator Response did not match expected. */
+        ppp_error(("MS-CHAPv2 mutual authentication failed."));
+        return 0;
+    }
+    /* Authenticator Response matches. */
+    msg += MS_AUTH_RESPONSE_LENGTH; /* Eat it */
+    len -= MS_AUTH_RESPONSE_LENGTH;
+    if ((len >= 3) && !strncmp((char *)msg, " M=", 3)) {
+        msg += 3; /* Eat the delimiter */
+    } else if (len) {
+        /* Packet has extra text which does not begin " M=" */
+        ppp_error(("MS-CHAPv2 Success packet is badly formed."));
+        return 0;
+    }
+    return 1;
 }
 
 static void chapms_handle_failure(ppp_pcb *pcb, unsigned char *inp, int len) {
-	int err;
-	const char *p;
-	char msg[64];
-	LWIP_UNUSED_ARG(pcb);
-
-	/* We want a null-terminated string for strxxx(). */
-	len = LWIP_MIN(len, 63);
-	MEMCPY(msg, inp, len);
-	msg[len] = 0;
-	p = msg;
-
-	/*
-	 * Deal with MS-CHAP formatted failure messages; just print the
-	 * M=<message> part (if any).  For MS-CHAP we're not really supposed
-	 * to use M=<message>, but it shouldn't hurt.  See
-	 * chapms[2]_verify_response.
-	 */
-	if (!strncmp(p, "E=", 2))
-		err = strtol(p+2, NULL, 10); /* Remember the error code. */
-	else
-		goto print_msg; /* Message is badly formatted. */
-
-	if (len && ((p = strstr(p, " M=")) != NULL)) {
-		/* M=<message> field found. */
-		p += 3;
-	} else {
-		/* No M=<message>; use the error code. */
-		switch (err) {
-		case MS_CHAP_ERROR_RESTRICTED_LOGON_HOURS:
-			p = "E=646 Restricted logon hours";
-			break;
-
-		case MS_CHAP_ERROR_ACCT_DISABLED:
-			p = "E=647 Account disabled";
-			break;
-
-		case MS_CHAP_ERROR_PASSWD_EXPIRED:
-			p = "E=648 Password expired";
-			break;
-
-		case MS_CHAP_ERROR_NO_DIALIN_PERMISSION:
-			p = "E=649 No dialin permission";
-			break;
-
-		case MS_CHAP_ERROR_AUTHENTICATION_FAILURE:
-			p = "E=691 Authentication failure";
-			break;
-
-		case MS_CHAP_ERROR_CHANGING_PASSWORD:
-			/* Should never see this, we don't support Change Password. */
-			p = "E=709 Error changing password";
-			break;
-
-		default:
-			ppp_error(("Unknown MS-CHAP authentication failure: %.*v",
-			      len, inp));
-			return;
-		}
-	}
+    int err;
+    const char *p;
+    char msg[64];
+    LWIP_UNUSED_ARG(pcb);
+
+    /* We want a null-terminated string for strxxx(). */
+    len = LWIP_MIN(len, 63);
+    MEMCPY(msg, inp, len);
+    msg[len] = 0;
+    p = msg;
+
+    /*
+     * Deal with MS-CHAP formatted failure messages; just print the
+     * M=<message> part (if any).  For MS-CHAP we're not really supposed
+     * to use M=<message>, but it shouldn't hurt.  See
+     * chapms[2]_verify_response.
+     */
+    if (!strncmp(p, "E=", 2))
+        err = strtol(p+2, NULL, 10); /* Remember the error code. */
+    else
+        goto print_msg; /* Message is badly formatted. */
+
+    if (len && ((p = strstr(p, " M=")) != NULL)) {
+        /* M=<message> field found. */
+        p += 3;
+    } else {
+        /* No M=<message>; use the error code. */
+        switch (err) {
+        case MS_CHAP_ERROR_RESTRICTED_LOGON_HOURS:
+            p = "E=646 Restricted logon hours";
+            break;
+
+        case MS_CHAP_ERROR_ACCT_DISABLED:
+            p = "E=647 Account disabled";
+            break;
+
+        case MS_CHAP_ERROR_PASSWD_EXPIRED:
+            p = "E=648 Password expired";
+            break;
+
+        case MS_CHAP_ERROR_NO_DIALIN_PERMISSION:
+            p = "E=649 No dialin permission";
+            break;
+
+        case MS_CHAP_ERROR_AUTHENTICATION_FAILURE:
+            p = "E=691 Authentication failure";
+            break;
+
+        case MS_CHAP_ERROR_CHANGING_PASSWORD:
+            /* Should never see this, we don't support Change Password. */
+            p = "E=709 Error changing password";
+            break;
+
+        default:
+            ppp_error(("Unknown MS-CHAP authentication failure: %.*v",
+                  len, inp));
+            return;
+        }
+    }
 print_msg:
-	if (p != NULL)
-		ppp_error(("MS-CHAP authentication failed: %v", p));
+    if (p != NULL)
+        ppp_error(("MS-CHAP authentication failed: %v", p));
 }
 
 static void ChallengeResponse(const u_char *challenge,
-		  const u_char PasswordHash[MD4_SIGNATURE_SIZE],
-		  u_char response[24]) {
+          const u_char PasswordHash[MD4_SIGNATURE_SIZE],
+          u_char response[24]) {
     u_char    ZPasswordHash[21];
     lwip_des_context des;
     u_char des_key[8];
@@ -505,7 +505,7 @@ static void ChallengeResponse(const u_char *challenge,
 
 #if 0
     dbglog("ChallengeResponse - ZPasswordHash %.*B",
-	   sizeof(ZPasswordHash), ZPasswordHash);
+       sizeof(ZPasswordHash), ZPasswordHash);
 #endif
 
     pppcrypt_56_to_64_bit_key(ZPasswordHash + 0, des_key);
@@ -532,16 +532,16 @@ static void ChallengeResponse(const u_char *challenge,
 }
 
 static void ChallengeHash(const u_char PeerChallenge[16], const u_char *rchallenge,
-	      const char *username, u_char Challenge[8]) {
-    lwip_sha1_context	sha1Context;
-    u_char	sha1Hash[SHA1_SIGNATURE_SIZE];
-    const char	*user;
+          const char *username, u_char Challenge[8]) {
+    lwip_sha1_context   sha1Context;
+    u_char  sha1Hash[SHA1_SIGNATURE_SIZE];
+    const char  *user;
 
     /* remove domain from "domain\username" */
     if ((user = strrchr(username, '\\')) != NULL)
-	++user;
+    ++user;
     else
-	user = username;
+    user = username;
 
     lwip_sha1_init(&sha1Context);
     lwip_sha1_starts(&sha1Context);
@@ -566,11 +566,11 @@ static void ascii2unicode(const char ascii[], int ascii_len, u_char unicode[]) {
 
     BZERO(unicode, ascii_len * 2);
     for (i = 0; i < ascii_len; i++)
-	unicode[i * 2] = (u_char) ascii[i];
+    unicode[i * 2] = (u_char) ascii[i];
 }
 
 static void NTPasswordHash(u_char *secret, int secret_len, u_char hash[MD4_SIGNATURE_SIZE]) {
-    lwip_md4_context		md4Context;
+    lwip_md4_context        md4Context;
 
     lwip_md4_init(&md4Context);
     lwip_md4_starts(&md4Context);
@@ -580,9 +580,9 @@ static void NTPasswordHash(u_char *secret, int secret_len, u_char hash[MD4_SIGNA
 }
 
 static void ChapMS_NT(const u_char *rchallenge, const char *secret, int secret_len,
-	  u_char NTResponse[24]) {
-    u_char	unicodePassword[MAX_NT_PASSWORD * 2];
-    u_char	PasswordHash[MD4_SIGNATURE_SIZE];
+      u_char NTResponse[24]) {
+    u_char  unicodePassword[MAX_NT_PASSWORD * 2];
+    u_char  PasswordHash[MD4_SIGNATURE_SIZE];
 
     /* Hash the Unicode version of the secret (== password). */
     ascii2unicode(secret, secret_len, unicodePassword);
@@ -592,10 +592,10 @@ static void ChapMS_NT(const u_char *rchallenge, const char *secret, int secret_l
 }
 
 static void ChapMS2_NT(const u_char *rchallenge, const u_char PeerChallenge[16], const char *username,
-	   const char *secret, int secret_len, u_char NTResponse[24]) {
-    u_char	unicodePassword[MAX_NT_PASSWORD * 2];
-    u_char	PasswordHash[MD4_SIGNATURE_SIZE];
-    u_char	Challenge[8];
+       const char *secret, int secret_len, u_char NTResponse[24]) {
+    u_char  unicodePassword[MAX_NT_PASSWORD * 2];
+    u_char  PasswordHash[MD4_SIGNATURE_SIZE];
+    u_char  Challenge[8];
 
     ChallengeHash(PeerChallenge, rchallenge, username, Challenge);
 
@@ -610,10 +610,10 @@ static void ChapMS2_NT(const u_char *rchallenge, const u_char PeerChallenge[16],
 static u_char *StdText = (u_char *)"KGS!@#$%"; /* key from rasapi32.dll */
 
 static void ChapMS_LANMan(u_char *rchallenge, char *secret, int secret_len,
-	      unsigned char *response) {
-    int			i;
-    u_char		UcasePassword[MAX_NT_PASSWORD]; /* max is actually 14 */
-    u_char		PasswordHash[MD4_SIGNATURE_SIZE];
+          unsigned char *response) {
+    int         i;
+    u_char      UcasePassword[MAX_NT_PASSWORD]; /* max is actually 14 */
+    u_char      PasswordHash[MD4_SIGNATURE_SIZE];
     lwip_des_context des;
     u_char des_key[8];
 
@@ -640,28 +640,28 @@ static void ChapMS_LANMan(u_char *rchallenge, char *secret, int secret_len,
 
 
 static void GenerateAuthenticatorResponse(const u_char PasswordHashHash[MD4_SIGNATURE_SIZE],
-			      u_char NTResponse[24], const u_char PeerChallenge[16],
-			      const u_char *rchallenge, const char *username,
-			      u_char authResponse[MS_AUTH_RESPONSE_LENGTH+1]) {
+                  u_char NTResponse[24], const u_char PeerChallenge[16],
+                  const u_char *rchallenge, const char *username,
+                  u_char authResponse[MS_AUTH_RESPONSE_LENGTH+1]) {
     /*
      * "Magic" constants used in response generation, from RFC 2759.
      */
     static const u_char Magic1[39] = /* "Magic server to client signing constant" */
-	{ 0x4D, 0x61, 0x67, 0x69, 0x63, 0x20, 0x73, 0x65, 0x72, 0x76,
-	  0x65, 0x72, 0x20, 0x74, 0x6F, 0x20, 0x63, 0x6C, 0x69, 0x65,
-	  0x6E, 0x74, 0x20, 0x73, 0x69, 0x67, 0x6E, 0x69, 0x6E, 0x67,
-	  0x20, 0x63, 0x6F, 0x6E, 0x73, 0x74, 0x61, 0x6E, 0x74 };
+    { 0x4D, 0x61, 0x67, 0x69, 0x63, 0x20, 0x73, 0x65, 0x72, 0x76,
+      0x65, 0x72, 0x20, 0x74, 0x6F, 0x20, 0x63, 0x6C, 0x69, 0x65,
+      0x6E, 0x74, 0x20, 0x73, 0x69, 0x67, 0x6E, 0x69, 0x6E, 0x67,
+      0x20, 0x63, 0x6F, 0x6E, 0x73, 0x74, 0x61, 0x6E, 0x74 };
     static const u_char Magic2[41] = /* "Pad to make it do more than one iteration" */
-	{ 0x50, 0x61, 0x64, 0x20, 0x74, 0x6F, 0x20, 0x6D, 0x61, 0x6B,
-	  0x65, 0x20, 0x69, 0x74, 0x20, 0x64, 0x6F, 0x20, 0x6D, 0x6F,
-	  0x72, 0x65, 0x20, 0x74, 0x68, 0x61, 0x6E, 0x20, 0x6F, 0x6E,
-	  0x65, 0x20, 0x69, 0x74, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6F,
-	  0x6E };
+    { 0x50, 0x61, 0x64, 0x20, 0x74, 0x6F, 0x20, 0x6D, 0x61, 0x6B,
+      0x65, 0x20, 0x69, 0x74, 0x20, 0x64, 0x6F, 0x20, 0x6D, 0x6F,
+      0x72, 0x65, 0x20, 0x74, 0x68, 0x61, 0x6E, 0x20, 0x6F, 0x6E,
+      0x65, 0x20, 0x69, 0x74, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6F,
+      0x6E };
 
-    int		i;
-    lwip_sha1_context	sha1Context;
-    u_char	Digest[SHA1_SIGNATURE_SIZE];
-    u_char	Challenge[8];
+    int     i;
+    lwip_sha1_context   sha1Context;
+    u_char  Digest[SHA1_SIGNATURE_SIZE];
+    u_char  Challenge[8];
 
     lwip_sha1_init(&sha1Context);
     lwip_sha1_starts(&sha1Context);
@@ -683,27 +683,27 @@ static void GenerateAuthenticatorResponse(const u_char PasswordHashHash[MD4_SIGN
 
     /* Convert to ASCII hex string. */
     for (i = 0; i < LWIP_MAX((MS_AUTH_RESPONSE_LENGTH / 2), (int)sizeof(Digest)); i++)
-	sprintf((char *)&authResponse[i * 2], "%02X", Digest[i]);
+    sprintf((char *)&authResponse[i * 2], "%02X", Digest[i]);
 }
 
 
 static void GenerateAuthenticatorResponsePlain(
-		 const char *secret, int secret_len,
-		 u_char NTResponse[24], const u_char PeerChallenge[16],
-		 const u_char *rchallenge, const char *username,
-		 u_char authResponse[MS_AUTH_RESPONSE_LENGTH+1]) {
-    u_char	unicodePassword[MAX_NT_PASSWORD * 2];
-    u_char	PasswordHash[MD4_SIGNATURE_SIZE];
-    u_char	PasswordHashHash[MD4_SIGNATURE_SIZE];
+         const char *secret, int secret_len,
+         u_char NTResponse[24], const u_char PeerChallenge[16],
+         const u_char *rchallenge, const char *username,
+         u_char authResponse[MS_AUTH_RESPONSE_LENGTH+1]) {
+    u_char  unicodePassword[MAX_NT_PASSWORD * 2];
+    u_char  PasswordHash[MD4_SIGNATURE_SIZE];
+    u_char  PasswordHashHash[MD4_SIGNATURE_SIZE];
 
     /* Hash (x2) the Unicode version of the secret (== password). */
     ascii2unicode(secret, secret_len, unicodePassword);
     NTPasswordHash(unicodePassword, secret_len * 2, PasswordHash);
     NTPasswordHash(PasswordHash, sizeof(PasswordHash),
-		   PasswordHashHash);
+           PasswordHashHash);
 
     GenerateAuthenticatorResponse(PasswordHashHash, NTResponse, PeerChallenge,
-				  rchallenge, username, authResponse);
+                  rchallenge, username, authResponse);
 }
 
 
@@ -712,11 +712,11 @@ static void GenerateAuthenticatorResponsePlain(
  * Set mppe_xxxx_key from MS-CHAP credentials. (see RFC 3079)
  */
 static void Set_Start_Key(ppp_pcb *pcb, const u_char *rchallenge, const char *secret, int secret_len) {
-    u_char	unicodePassword[MAX_NT_PASSWORD * 2];
-    u_char	PasswordHash[MD4_SIGNATURE_SIZE];
-    u_char	PasswordHashHash[MD4_SIGNATURE_SIZE];
-    lwip_sha1_context	sha1Context;
-    u_char	Digest[SHA1_SIGNATURE_SIZE];	/* >= MPPE_MAX_KEY_LEN */
+    u_char  unicodePassword[MAX_NT_PASSWORD * 2];
+    u_char  PasswordHash[MD4_SIGNATURE_SIZE];
+    u_char  PasswordHashHash[MD4_SIGNATURE_SIZE];
+    lwip_sha1_context   sha1Context;
+    u_char  Digest[SHA1_SIGNATURE_SIZE];    /* >= MPPE_MAX_KEY_LEN */
 
     /* Hash (x2) the Unicode version of the secret (== password). */
     ascii2unicode(secret, secret_len, unicodePassword);
@@ -742,43 +742,43 @@ static void Set_Start_Key(ppp_pcb *pcb, const u_char *rchallenge, const char *se
  * Set mppe_xxxx_key from MS-CHAPv2 credentials. (see RFC 3079)
  */
 static void SetMasterKeys(ppp_pcb *pcb, const char *secret, int secret_len, u_char NTResponse[24], int IsServer) {
-    u_char	unicodePassword[MAX_NT_PASSWORD * 2];
-    u_char	PasswordHash[MD4_SIGNATURE_SIZE];
-    u_char	PasswordHashHash[MD4_SIGNATURE_SIZE];
-    lwip_sha1_context	sha1Context;
-    u_char	MasterKey[SHA1_SIGNATURE_SIZE];	/* >= MPPE_MAX_KEY_LEN */
-    u_char	Digest[SHA1_SIGNATURE_SIZE];	/* >= MPPE_MAX_KEY_LEN */
+    u_char  unicodePassword[MAX_NT_PASSWORD * 2];
+    u_char  PasswordHash[MD4_SIGNATURE_SIZE];
+    u_char  PasswordHashHash[MD4_SIGNATURE_SIZE];
+    lwip_sha1_context   sha1Context;
+    u_char  MasterKey[SHA1_SIGNATURE_SIZE]; /* >= MPPE_MAX_KEY_LEN */
+    u_char  Digest[SHA1_SIGNATURE_SIZE];    /* >= MPPE_MAX_KEY_LEN */
     const u_char *s;
 
     /* "This is the MPPE Master Key" */
     static const u_char Magic1[27] =
-	{ 0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x74,
-	  0x68, 0x65, 0x20, 0x4d, 0x50, 0x50, 0x45, 0x20, 0x4d,
-	  0x61, 0x73, 0x74, 0x65, 0x72, 0x20, 0x4b, 0x65, 0x79 };
+    { 0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x74,
+      0x68, 0x65, 0x20, 0x4d, 0x50, 0x50, 0x45, 0x20, 0x4d,
+      0x61, 0x73, 0x74, 0x65, 0x72, 0x20, 0x4b, 0x65, 0x79 };
     /* "On the client side, this is the send key; "
        "on the server side, it is the receive key." */
     static const u_char Magic2[84] =
-	{ 0x4f, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x63, 0x6c, 0x69,
-	  0x65, 0x6e, 0x74, 0x20, 0x73, 0x69, 0x64, 0x65, 0x2c, 0x20,
-	  0x74, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x74, 0x68,
-	  0x65, 0x20, 0x73, 0x65, 0x6e, 0x64, 0x20, 0x6b, 0x65, 0x79,
-	  0x3b, 0x20, 0x6f, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x73,
-	  0x65, 0x72, 0x76, 0x65, 0x72, 0x20, 0x73, 0x69, 0x64, 0x65,
-	  0x2c, 0x20, 0x69, 0x74, 0x20, 0x69, 0x73, 0x20, 0x74, 0x68,
-	  0x65, 0x20, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x20,
-	  0x6b, 0x65, 0x79, 0x2e };
+    { 0x4f, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x63, 0x6c, 0x69,
+      0x65, 0x6e, 0x74, 0x20, 0x73, 0x69, 0x64, 0x65, 0x2c, 0x20,
+      0x74, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x74, 0x68,
+      0x65, 0x20, 0x73, 0x65, 0x6e, 0x64, 0x20, 0x6b, 0x65, 0x79,
+      0x3b, 0x20, 0x6f, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x73,
+      0x65, 0x72, 0x76, 0x65, 0x72, 0x20, 0x73, 0x69, 0x64, 0x65,
+      0x2c, 0x20, 0x69, 0x74, 0x20, 0x69, 0x73, 0x20, 0x74, 0x68,
+      0x65, 0x20, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x20,
+      0x6b, 0x65, 0x79, 0x2e };
     /* "On the client side, this is the receive key; "
        "on the server side, it is the send key." */
     static const u_char Magic3[84] =
-	{ 0x4f, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x63, 0x6c, 0x69,
-	  0x65, 0x6e, 0x74, 0x20, 0x73, 0x69, 0x64, 0x65, 0x2c, 0x20,
-	  0x74, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x74, 0x68,
-	  0x65, 0x20, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x20,
-	  0x6b, 0x65, 0x79, 0x3b, 0x20, 0x6f, 0x6e, 0x20, 0x74, 0x68,
-	  0x65, 0x20, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x20, 0x73,
-	  0x69, 0x64, 0x65, 0x2c, 0x20, 0x69, 0x74, 0x20, 0x69, 0x73,
-	  0x20, 0x74, 0x68, 0x65, 0x20, 0x73, 0x65, 0x6e, 0x64, 0x20,
-	  0x6b, 0x65, 0x79, 0x2e };
+    { 0x4f, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x63, 0x6c, 0x69,
+      0x65, 0x6e, 0x74, 0x20, 0x73, 0x69, 0x64, 0x65, 0x2c, 0x20,
+      0x74, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x74, 0x68,
+      0x65, 0x20, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x20,
+      0x6b, 0x65, 0x79, 0x3b, 0x20, 0x6f, 0x6e, 0x20, 0x74, 0x68,
+      0x65, 0x20, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x20, 0x73,
+      0x69, 0x64, 0x65, 0x2c, 0x20, 0x69, 0x74, 0x20, 0x69, 0x73,
+      0x20, 0x74, 0x68, 0x65, 0x20, 0x73, 0x65, 0x6e, 0x64, 0x20,
+      0x6b, 0x65, 0x79, 0x2e };
 
     /* Hash (x2) the Unicode version of the secret (== password). */
     ascii2unicode(secret, secret_len, unicodePassword);
@@ -797,9 +797,9 @@ static void SetMasterKeys(ppp_pcb *pcb, const char *secret, int secret_len, u_ch
      * generate send key
      */
     if (IsServer)
-	s = Magic3;
+    s = Magic3;
     else
-	s = Magic2;
+    s = Magic2;
     lwip_sha1_init(&sha1Context);
     lwip_sha1_starts(&sha1Context);
     lwip_sha1_update(&sha1Context, MasterKey, 16);
@@ -815,9 +815,9 @@ static void SetMasterKeys(ppp_pcb *pcb, const char *secret, int secret_len, u_ch
      * generate recv key
      */
     if (IsServer)
-	s = Magic2;
+    s = Magic2;
     else
-	s = Magic3;
+    s = Magic3;
     lwip_sha1_init(&sha1Context);
     lwip_sha1_starts(&sha1Context);
     lwip_sha1_update(&sha1Context, MasterKey, 16);
@@ -846,7 +846,7 @@ static void ChapMS(ppp_pcb *pcb, const u_char *rchallenge, const char *secret, i
 
 #ifdef MSLANMAN
     ChapMS_LANMan(rchallenge, secret, secret_len,
-		  &response[MS_CHAP_LANMANRESP]);
+          &response[MS_CHAP_LANMANRESP]);
 
     /* preferred method is set by option  */
     response[MS_CHAP_USENT] = !ms_lanman;
@@ -871,8 +871,8 @@ static void ChapMS(ppp_pcb *pcb, const u_char *rchallenge, const char *secret, i
  * Authenticator Response.
  */
 static void ChapMS2(ppp_pcb *pcb, const u_char *rchallenge, const u_char *PeerChallenge,
-	const char *user, const char *secret, int secret_len, unsigned char *response,
-	u_char authResponse[], int authenticator) {
+    const char *user, const char *secret, int secret_len, unsigned char *response,
+    u_char authResponse[], int authenticator) {
     /* ARGSUSED */
     LWIP_UNUSED_ARG(authenticator);
 #if !MPPE_SUPPORT
@@ -883,24 +883,24 @@ static void ChapMS2(ppp_pcb *pcb, const u_char *rchallenge, const u_char *PeerCh
 
     /* Generate the Peer-Challenge if requested, or copy it if supplied. */
     if (!PeerChallenge)
-	magic_random_bytes(&response[MS_CHAP2_PEER_CHALLENGE], MS_CHAP2_PEER_CHAL_LEN);
+    magic_random_bytes(&response[MS_CHAP2_PEER_CHALLENGE], MS_CHAP2_PEER_CHAL_LEN);
     else
-	MEMCPY(&response[MS_CHAP2_PEER_CHALLENGE], PeerChallenge,
-	      MS_CHAP2_PEER_CHAL_LEN);
+    MEMCPY(&response[MS_CHAP2_PEER_CHALLENGE], PeerChallenge,
+          MS_CHAP2_PEER_CHAL_LEN);
 
     /* Generate the NT-Response */
     ChapMS2_NT(rchallenge, &response[MS_CHAP2_PEER_CHALLENGE], user,
-	       secret, secret_len, &response[MS_CHAP2_NTRESP]);
+           secret, secret_len, &response[MS_CHAP2_NTRESP]);
 
     /* Generate the Authenticator Response. */
     GenerateAuthenticatorResponsePlain(secret, secret_len,
-				       &response[MS_CHAP2_NTRESP],
-				       &response[MS_CHAP2_PEER_CHALLENGE],
-				       rchallenge, user, authResponse);
+                       &response[MS_CHAP2_NTRESP],
+                       &response[MS_CHAP2_PEER_CHALLENGE],
+                       rchallenge, user, authResponse);
 
 #if MPPE_SUPPORT
     SetMasterKeys(pcb, secret, secret_len,
-		  &response[MS_CHAP2_NTRESP], authenticator);
+          &response[MS_CHAP2_NTRESP], authenticator);
 #endif /* MPPE_SUPPORT */
 }
 
@@ -912,51 +912,51 @@ static void ChapMS2(ppp_pcb *pcb, const u_char *rchallenge, const u_char *PeerCh
 void set_mppe_enc_types(int policy, int types) {
     /* Early exit for unknown policies. */
     if (policy != MPPE_ENC_POL_ENC_ALLOWED ||
-	policy != MPPE_ENC_POL_ENC_REQUIRED)
-	return;
+    policy != MPPE_ENC_POL_ENC_REQUIRED)
+    return;
 
     /* Don't modify MPPE if it's optional and wasn't already configured. */
     if (policy == MPPE_ENC_POL_ENC_ALLOWED && !ccp_wantoptions[0].mppe)
-	return;
+    return;
 
     /*
      * Disable undesirable encryption types.  Note that we don't ENABLE
      * any encryption types, to avoid overriding manual configuration.
      */
     switch(types) {
-	case MPPE_ENC_TYPES_RC4_40:
-	    ccp_wantoptions[0].mppe &= ~MPPE_OPT_128;	/* disable 128-bit */
-	    break;
-	case MPPE_ENC_TYPES_RC4_128:
-	    ccp_wantoptions[0].mppe &= ~MPPE_OPT_40;	/* disable 40-bit */
-	    break;
-	default:
-	    break;
+    case MPPE_ENC_TYPES_RC4_40:
+        ccp_wantoptions[0].mppe &= ~MPPE_OPT_128;   /* disable 128-bit */
+        break;
+    case MPPE_ENC_TYPES_RC4_128:
+        ccp_wantoptions[0].mppe &= ~MPPE_OPT_40;    /* disable 40-bit */
+        break;
+    default:
+        break;
     }
 }
 #endif /* MPPE_SUPPORT */
 #endif /* UNUSED */
 
 const struct chap_digest_type chapms_digest = {
-	CHAP_MICROSOFT,		/* code */
+    CHAP_MICROSOFT,     /* code */
 #if PPP_SERVER
-	chapms_generate_challenge,
-	chapms_verify_response,
+    chapms_generate_challenge,
+    chapms_verify_response,
 #endif /* PPP_SERVER */
-	chapms_make_response,
-	NULL,			/* check_success */
-	chapms_handle_failure,
+    chapms_make_response,
+    NULL,           /* check_success */
+    chapms_handle_failure,
 };
 
 const struct chap_digest_type chapms2_digest = {
-	CHAP_MICROSOFT_V2,	/* code */
+    CHAP_MICROSOFT_V2,  /* code */
 #if PPP_SERVER
-	chapms2_generate_challenge,
-	chapms2_verify_response,
+    chapms2_generate_challenge,
+    chapms2_verify_response,
 #endif /* PPP_SERVER */
-	chapms2_make_response,
-	chapms2_check_success,
-	chapms_handle_failure,
+    chapms2_make_response,
+    chapms2_check_success,
+    chapms_handle_failure,
 };
 
 #endif /* PPP_SUPPORT && MSCHAP_SUPPORT */
diff --git a/src/netif/ppp/demand.c b/src/netif/ppp/demand.c
index 709e5ea1..680988ed 100644
--- a/src/netif/ppp/demand.c
+++ b/src/netif/ppp/demand.c
@@ -87,11 +87,11 @@ demand_conf()
 
 /*    framemax = lcp_allowoptions[0].mru;
     if (framemax < PPP_DEFMRU) */
-	framemax = PPP_DEFMRU;
+    framemax = PPP_DEFMRU;
     framemax += PPP_HDRLEN + PPP_FCSLEN;
     frame = malloc(framemax);
     if (frame == NULL)
-	novm("demand frame");
+    novm("demand frame");
     framelen = 0;
     pend_q = NULL;
     escape_flag = 0;
@@ -100,8 +100,8 @@ demand_conf()
 
     ppp_netif_set_mtu(pcb, LWIP_MIN(lcp_allowoptions[0].mru, PPP_DEFMRU));
     if (ppp_send_config(pcb, PPP_DEFMRU, (u32_t) 0, 0, 0) < 0
-	|| ppp_recv_config(pcb, PPP_DEFMRU, (u32_t) 0, 0, 0) < 0)
-	    fatal("Couldn't set up demand-dialled PPP interface: %m");
+    || ppp_recv_config(pcb, PPP_DEFMRU, (u32_t) 0, 0, 0) < 0)
+        fatal("Couldn't set up demand-dialled PPP interface: %m");
 
 #ifdef PPP_FILTER
     set_filters(&pass_filter, &active_filter);
@@ -111,12 +111,12 @@ demand_conf()
      * Call the demand_conf procedure for each protocol that's got one.
      */
     for (i = 0; (protp = protocols[i]) != NULL; ++i)
-	if (protp->demand_conf != NULL)
-	    ((*protp->demand_conf)(pcb));
+    if (protp->demand_conf != NULL)
+        ((*protp->demand_conf)(pcb));
 /* FIXME: find a way to die() here */
 #if 0
-	    if (!((*protp->demand_conf)(pcb)))
-		die(1);
+        if (!((*protp->demand_conf)(pcb)))
+        die(1);
 #endif
 }
 
@@ -131,8 +131,8 @@ demand_block()
     const struct protent *protp;
 
     for (i = 0; (protp = protocols[i]) != NULL; ++i)
-	if (protp->demand_conf != NULL)
-	    sifnpmode(pcb, protp->protocol & ~0x8000, NPMODE_QUEUE);
+    if (protp->demand_conf != NULL)
+        sifnpmode(pcb, protp->protocol & ~0x8000, NPMODE_QUEUE);
     get_loop_output();
 }
 
@@ -148,14 +148,14 @@ demand_discard()
     const struct protent *protp;
 
     for (i = 0; (protp = protocols[i]) != NULL; ++i)
-	if (protp->demand_conf != NULL)
-	    sifnpmode(pcb, protp->protocol & ~0x8000, NPMODE_ERROR);
+    if (protp->demand_conf != NULL)
+        sifnpmode(pcb, protp->protocol & ~0x8000, NPMODE_ERROR);
     get_loop_output();
 
     /* discard all saved packets */
     for (pkt = pend_q; pkt != NULL; pkt = nextpkt) {
-	nextpkt = pkt->next;
-	free(pkt);
+    nextpkt = pkt->next;
+    free(pkt);
     }
     pend_q = NULL;
     framelen = 0;
@@ -174,46 +174,46 @@ demand_unblock()
     const struct protent *protp;
 
     for (i = 0; (protp = protocols[i]) != NULL; ++i)
-	if (protp->demand_conf != NULL)
-	    sifnpmode(pcb, protp->protocol & ~0x8000, NPMODE_PASS);
+    if (protp->demand_conf != NULL)
+        sifnpmode(pcb, protp->protocol & ~0x8000, NPMODE_PASS);
 }
 
 /*
  * FCS lookup table as calculated by genfcstab.
  */
 static u_short fcstab[256] = {
-	0x0000,	0x1189,	0x2312,	0x329b,	0x4624,	0x57ad,	0x6536,	0x74bf,
-	0x8c48,	0x9dc1,	0xaf5a,	0xbed3,	0xca6c,	0xdbe5,	0xe97e,	0xf8f7,
-	0x1081,	0x0108,	0x3393,	0x221a,	0x56a5,	0x472c,	0x75b7,	0x643e,
-	0x9cc9,	0x8d40,	0xbfdb,	0xae52,	0xdaed,	0xcb64,	0xf9ff,	0xe876,
-	0x2102,	0x308b,	0x0210,	0x1399,	0x6726,	0x76af,	0x4434,	0x55bd,
-	0xad4a,	0xbcc3,	0x8e58,	0x9fd1,	0xeb6e,	0xfae7,	0xc87c,	0xd9f5,
-	0x3183,	0x200a,	0x1291,	0x0318,	0x77a7,	0x662e,	0x54b5,	0x453c,
-	0xbdcb,	0xac42,	0x9ed9,	0x8f50,	0xfbef,	0xea66,	0xd8fd,	0xc974,
-	0x4204,	0x538d,	0x6116,	0x709f,	0x0420,	0x15a9,	0x2732,	0x36bb,
-	0xce4c,	0xdfc5,	0xed5e,	0xfcd7,	0x8868,	0x99e1,	0xab7a,	0xbaf3,
-	0x5285,	0x430c,	0x7197,	0x601e,	0x14a1,	0x0528,	0x37b3,	0x263a,
-	0xdecd,	0xcf44,	0xfddf,	0xec56,	0x98e9,	0x8960,	0xbbfb,	0xaa72,
-	0x6306,	0x728f,	0x4014,	0x519d,	0x2522,	0x34ab,	0x0630,	0x17b9,
-	0xef4e,	0xfec7,	0xcc5c,	0xddd5,	0xa96a,	0xb8e3,	0x8a78,	0x9bf1,
-	0x7387,	0x620e,	0x5095,	0x411c,	0x35a3,	0x242a,	0x16b1,	0x0738,
-	0xffcf,	0xee46,	0xdcdd,	0xcd54,	0xb9eb,	0xa862,	0x9af9,	0x8b70,
-	0x8408,	0x9581,	0xa71a,	0xb693,	0xc22c,	0xd3a5,	0xe13e,	0xf0b7,
-	0x0840,	0x19c9,	0x2b52,	0x3adb,	0x4e64,	0x5fed,	0x6d76,	0x7cff,
-	0x9489,	0x8500,	0xb79b,	0xa612,	0xd2ad,	0xc324,	0xf1bf,	0xe036,
-	0x18c1,	0x0948,	0x3bd3,	0x2a5a,	0x5ee5,	0x4f6c,	0x7df7,	0x6c7e,
-	0xa50a,	0xb483,	0x8618,	0x9791,	0xe32e,	0xf2a7,	0xc03c,	0xd1b5,
-	0x2942,	0x38cb,	0x0a50,	0x1bd9,	0x6f66,	0x7eef,	0x4c74,	0x5dfd,
-	0xb58b,	0xa402,	0x9699,	0x8710,	0xf3af,	0xe226,	0xd0bd,	0xc134,
-	0x39c3,	0x284a,	0x1ad1,	0x0b58,	0x7fe7,	0x6e6e,	0x5cf5,	0x4d7c,
-	0xc60c,	0xd785,	0xe51e,	0xf497,	0x8028,	0x91a1,	0xa33a,	0xb2b3,
-	0x4a44,	0x5bcd,	0x6956,	0x78df,	0x0c60,	0x1de9,	0x2f72,	0x3efb,
-	0xd68d,	0xc704,	0xf59f,	0xe416,	0x90a9,	0x8120,	0xb3bb,	0xa232,
-	0x5ac5,	0x4b4c,	0x79d7,	0x685e,	0x1ce1,	0x0d68,	0x3ff3,	0x2e7a,
-	0xe70e,	0xf687,	0xc41c,	0xd595,	0xa12a,	0xb0a3,	0x8238,	0x93b1,
-	0x6b46,	0x7acf,	0x4854,	0x59dd,	0x2d62,	0x3ceb,	0x0e70,	0x1ff9,
-	0xf78f,	0xe606,	0xd49d,	0xc514,	0xb1ab,	0xa022,	0x92b9,	0x8330,
-	0x7bc7,	0x6a4e,	0x58d5,	0x495c,	0x3de3,	0x2c6a,	0x1ef1,	0x0f78
+    0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf,
+    0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7,
+    0x1081, 0x0108, 0x3393, 0x221a, 0x56a5, 0x472c, 0x75b7, 0x643e,
+    0x9cc9, 0x8d40, 0xbfdb, 0xae52, 0xdaed, 0xcb64, 0xf9ff, 0xe876,
+    0x2102, 0x308b, 0x0210, 0x1399, 0x6726, 0x76af, 0x4434, 0x55bd,
+    0xad4a, 0xbcc3, 0x8e58, 0x9fd1, 0xeb6e, 0xfae7, 0xc87c, 0xd9f5,
+    0x3183, 0x200a, 0x1291, 0x0318, 0x77a7, 0x662e, 0x54b5, 0x453c,
+    0xbdcb, 0xac42, 0x9ed9, 0x8f50, 0xfbef, 0xea66, 0xd8fd, 0xc974,
+    0x4204, 0x538d, 0x6116, 0x709f, 0x0420, 0x15a9, 0x2732, 0x36bb,
+    0xce4c, 0xdfc5, 0xed5e, 0xfcd7, 0x8868, 0x99e1, 0xab7a, 0xbaf3,
+    0x5285, 0x430c, 0x7197, 0x601e, 0x14a1, 0x0528, 0x37b3, 0x263a,
+    0xdecd, 0xcf44, 0xfddf, 0xec56, 0x98e9, 0x8960, 0xbbfb, 0xaa72,
+    0x6306, 0x728f, 0x4014, 0x519d, 0x2522, 0x34ab, 0x0630, 0x17b9,
+    0xef4e, 0xfec7, 0xcc5c, 0xddd5, 0xa96a, 0xb8e3, 0x8a78, 0x9bf1,
+    0x7387, 0x620e, 0x5095, 0x411c, 0x35a3, 0x242a, 0x16b1, 0x0738,
+    0xffcf, 0xee46, 0xdcdd, 0xcd54, 0xb9eb, 0xa862, 0x9af9, 0x8b70,
+    0x8408, 0x9581, 0xa71a, 0xb693, 0xc22c, 0xd3a5, 0xe13e, 0xf0b7,
+    0x0840, 0x19c9, 0x2b52, 0x3adb, 0x4e64, 0x5fed, 0x6d76, 0x7cff,
+    0x9489, 0x8500, 0xb79b, 0xa612, 0xd2ad, 0xc324, 0xf1bf, 0xe036,
+    0x18c1, 0x0948, 0x3bd3, 0x2a5a, 0x5ee5, 0x4f6c, 0x7df7, 0x6c7e,
+    0xa50a, 0xb483, 0x8618, 0x9791, 0xe32e, 0xf2a7, 0xc03c, 0xd1b5,
+    0x2942, 0x38cb, 0x0a50, 0x1bd9, 0x6f66, 0x7eef, 0x4c74, 0x5dfd,
+    0xb58b, 0xa402, 0x9699, 0x8710, 0xf3af, 0xe226, 0xd0bd, 0xc134,
+    0x39c3, 0x284a, 0x1ad1, 0x0b58, 0x7fe7, 0x6e6e, 0x5cf5, 0x4d7c,
+    0xc60c, 0xd785, 0xe51e, 0xf497, 0x8028, 0x91a1, 0xa33a, 0xb2b3,
+    0x4a44, 0x5bcd, 0x6956, 0x78df, 0x0c60, 0x1de9, 0x2f72, 0x3efb,
+    0xd68d, 0xc704, 0xf59f, 0xe416, 0x90a9, 0x8120, 0xb3bb, 0xa232,
+    0x5ac5, 0x4b4c, 0x79d7, 0x685e, 0x1ce1, 0x0d68, 0x3ff3, 0x2e7a,
+    0xe70e, 0xf687, 0xc41c, 0xd595, 0xa12a, 0xb0a3, 0x8238, 0x93b1,
+    0x6b46, 0x7acf, 0x4854, 0x59dd, 0x2d62, 0x3ceb, 0x0e70, 0x1ff9,
+    0xf78f, 0xe606, 0xd49d, 0xc514, 0xb1ab, 0xa022, 0x92b9, 0x8330,
+    0x7bc7, 0x6a4e, 0x58d5, 0x495c, 0x3de3, 0x2c6a, 0x1ef1, 0x0f78
 };
 
 /*
@@ -238,35 +238,35 @@ loop_chars(p, n)
     }
 
     for (; n > 0; --n) {
-	c = *p++;
-	if (c == PPP_FLAG) {
-	    if (!escape_flag && !flush_flag
-		&& framelen > 2 && fcs == PPP_GOODFCS) {
-		framelen -= 2;
-		if (loop_frame((unsigned char *)frame, framelen))
-		    rv = 1;
-	    }
-	    framelen = 0;
-	    flush_flag = 0;
-	    escape_flag = 0;
-	    fcs = PPP_INITFCS;
-	    continue;
-	}
-	if (flush_flag)
-	    continue;
-	if (escape_flag) {
-	    c ^= PPP_TRANS;
-	    escape_flag = 0;
-	} else if (c == PPP_ESCAPE) {
-	    escape_flag = 1;
-	    continue;
-	}
-	if (framelen >= framemax) {
-	    flush_flag = 1;
-	    continue;
-	}
-	frame[framelen++] = c;
-	fcs = PPP_FCS(fcs, c);
+    c = *p++;
+    if (c == PPP_FLAG) {
+        if (!escape_flag && !flush_flag
+        && framelen > 2 && fcs == PPP_GOODFCS) {
+        framelen -= 2;
+        if (loop_frame((unsigned char *)frame, framelen))
+            rv = 1;
+        }
+        framelen = 0;
+        flush_flag = 0;
+        escape_flag = 0;
+        fcs = PPP_INITFCS;
+        continue;
+    }
+    if (flush_flag)
+        continue;
+    if (escape_flag) {
+        c ^= PPP_TRANS;
+        escape_flag = 0;
+    } else if (c == PPP_ESCAPE) {
+        escape_flag = 1;
+        continue;
+    }
+    if (framelen >= framemax) {
+        flush_flag = 1;
+        continue;
+    }
+    frame[framelen++] = c;
+    fcs = PPP_FCS(fcs, c);
     }
     return rv;
 }
@@ -290,22 +290,22 @@ loop_frame(frame, len)
 
     /* dbglog("from loop: %P", frame, len); */
     if (len < PPP_HDRLEN)
-	return 0;
+    return 0;
     if ((PPP_PROTOCOL(frame) & 0x8000) != 0)
-	return 0;		/* shouldn't get any of these anyway */
+    return 0;       /* shouldn't get any of these anyway */
     if (!active_packet(frame, len))
-	return 0;
+    return 0;
 
     pkt = (struct packet *) malloc(sizeof(struct packet) + len);
     if (pkt != NULL) {
-	pkt->length = len;
-	pkt->next = NULL;
-	memcpy(pkt->data, frame, len);
-	if (pend_q == NULL)
-	    pend_q = pkt;
-	else
-	    pend_qtail->next = pkt;
-	pend_qtail = pkt;
+    pkt->length = len;
+    pkt->next = NULL;
+    memcpy(pkt->data, frame, len);
+    if (pend_q == NULL)
+        pend_q = pkt;
+    else
+        pend_qtail->next = pkt;
+    pend_qtail = pkt;
     }
     return 1;
 }
@@ -332,23 +332,23 @@ demand_rexmit(proto, newip)
     pend_q = NULL;
     tv.tv_sec = 1;
     tv.tv_usec = 0;
-    select(0,NULL,NULL,NULL,&tv);	/* Sleep for 1 Seconds */
+    select(0,NULL,NULL,NULL,&tv);   /* Sleep for 1 Seconds */
     for (; pkt != NULL; pkt = nextpkt) {
-	nextpkt = pkt->next;
-	if (PPP_PROTOCOL(pkt->data) == proto) {
+    nextpkt = pkt->next;
+    if (PPP_PROTOCOL(pkt->data) == proto) {
             if ( (proto == PPP_IP) && newip ) {
-		/* Get old checksum */
+        /* Get old checksum */
 
-		iphdr = (pkt->data[4] & 15) << 2;
-		checksum = *((unsigned short *) (pkt->data+14));
+        iphdr = (pkt->data[4] & 15) << 2;
+        checksum = *((unsigned short *) (pkt->data+14));
                 if (checksum == 0xFFFF) {
                     checksum = 0;
                 }
 
- 
+
                 if (pkt->data[13] == 17) {
                     pkt_checksum =  *((unsigned short *) (pkt->data+10+iphdr));
-		    if (pkt_checksum) {
+            if (pkt_checksum) {
                         cv = 1;
                         if (pkt_checksum == 0xFFFF) {
                             pkt_checksum = 0;
@@ -359,71 +359,71 @@ demand_rexmit(proto, newip)
                     }
                 }
 
-		if (pkt->data[13] == 6) {
-		    pkt_checksum = *((unsigned short *) (pkt->data+20+iphdr));
-		    cv = 1;
+        if (pkt->data[13] == 6) {
+            pkt_checksum = *((unsigned short *) (pkt->data+20+iphdr));
+            cv = 1;
                     if (pkt_checksum == 0xFFFF) {
                         pkt_checksum = 0;
                     }
-		}
+        }
 
-		/* Delete old Source-IP-Address */
+        /* Delete old Source-IP-Address */
                 checksum -= *((unsigned short *) (pkt->data+16)) ^ 0xFFFF;
                 checksum -= *((unsigned short *) (pkt->data+18)) ^ 0xFFFF;
 
-		pkt_checksum -= *((unsigned short *) (pkt->data+16)) ^ 0xFFFF;
-		pkt_checksum -= *((unsigned short *) (pkt->data+18)) ^ 0xFFFF;
+        pkt_checksum -= *((unsigned short *) (pkt->data+16)) ^ 0xFFFF;
+        pkt_checksum -= *((unsigned short *) (pkt->data+18)) ^ 0xFFFF;
 
-		/* Change Source-IP-Address */
+        /* Change Source-IP-Address */
                 * ((u32_t *) (pkt->data + 16)) = newip;
 
-		/* Add new Source-IP-Address */
+        /* Add new Source-IP-Address */
                 checksum += *((unsigned short *) (pkt->data+16)) ^ 0xFFFF;
                 checksum += *((unsigned short *) (pkt->data+18)) ^ 0xFFFF;
 
                 pkt_checksum += *((unsigned short *) (pkt->data+16)) ^ 0xFFFF;
                 pkt_checksum += *((unsigned short *) (pkt->data+18)) ^ 0xFFFF;
 
-		/* Write new checksum */
+        /* Write new checksum */
                 if (!checksum) {
                     checksum = 0xFFFF;
                 }
                 *((unsigned short *) (pkt->data+14)) = checksum;
-		if (pkt->data[13] == 6) {
-		    *((unsigned short *) (pkt->data+20+iphdr)) = pkt_checksum;
-		}
-		if (cv && (pkt->data[13] == 17) ) {
-		    *((unsigned short *) (pkt->data+10+iphdr)) = pkt_checksum;
-		}
-
-		/* Log Packet */
-		strcpy(ipstr,inet_ntoa(*( (struct in_addr *) (pkt->data+16))));
-		if (pkt->data[13] == 1) {
-		    syslog(LOG_INFO,"Open ICMP %s -> %s\n",
-			ipstr,
-			inet_ntoa(*( (struct in_addr *) (pkt->data+20))));
-		} else {
-		    syslog(LOG_INFO,"Open %s %s:%d -> %s:%d\n",
-			pkt->data[13] == 6 ? "TCP" : "UDP",
-			ipstr,
-			ntohs(*( (short *) (pkt->data+iphdr+4))),
-			inet_ntoa(*( (struct in_addr *) (pkt->data+20))),
-			ntohs(*( (short *) (pkt->data+iphdr+6))));
+        if (pkt->data[13] == 6) {
+            *((unsigned short *) (pkt->data+20+iphdr)) = pkt_checksum;
+        }
+        if (cv && (pkt->data[13] == 17) ) {
+            *((unsigned short *) (pkt->data+10+iphdr)) = pkt_checksum;
+        }
+
+        /* Log Packet */
+        strcpy(ipstr,inet_ntoa(*( (struct in_addr *) (pkt->data+16))));
+        if (pkt->data[13] == 1) {
+            syslog(LOG_INFO,"Open ICMP %s -> %s\n",
+            ipstr,
+            inet_ntoa(*( (struct in_addr *) (pkt->data+20))));
+        } else {
+            syslog(LOG_INFO,"Open %s %s:%d -> %s:%d\n",
+            pkt->data[13] == 6 ? "TCP" : "UDP",
+            ipstr,
+            ntohs(*( (short *) (pkt->data+iphdr+4))),
+            inet_ntoa(*( (struct in_addr *) (pkt->data+20))),
+            ntohs(*( (short *) (pkt->data+iphdr+6))));
                 }
             }
-	    output(pcb, pkt->data, pkt->length);
-	    free(pkt);
-	} else {
-	    if (prev == NULL)
-		pend_q = pkt;
-	    else
-		prev->next = pkt;
-	    prev = pkt;
-	}
+        output(pcb, pkt->data, pkt->length);
+        free(pkt);
+    } else {
+        if (prev == NULL)
+        pend_q = pkt;
+        else
+        prev->next = pkt;
+        prev = pkt;
+    }
     }
     pend_qtail = prev;
     if (prev != NULL)
-	prev->next = NULL;
+    prev->next = NULL;
 }
 
 /*
@@ -439,27 +439,27 @@ active_packet(p, len)
     const struct protent *protp;
 
     if (len < PPP_HDRLEN)
-	return 0;
+    return 0;
     proto = PPP_PROTOCOL(p);
 #ifdef PPP_FILTER
-    p[0] = 1;		/* outbound packet indicator */
+    p[0] = 1;       /* outbound packet indicator */
     if ((pass_filter.bf_len != 0
-	 && bpf_filter(pass_filter.bf_insns, p, len, len) == 0)
-	|| (active_filter.bf_len != 0
-	    && bpf_filter(active_filter.bf_insns, p, len, len) == 0)) {
-	p[0] = 0xff;
-	return 0;
+     && bpf_filter(pass_filter.bf_insns, p, len, len) == 0)
+    || (active_filter.bf_len != 0
+        && bpf_filter(active_filter.bf_insns, p, len, len) == 0)) {
+    p[0] = 0xff;
+    return 0;
     }
     p[0] = 0xff;
 #endif
     for (i = 0; (protp = protocols[i]) != NULL; ++i) {
-	if (protp->protocol < 0xC000 && (protp->protocol & ~0x8000) == proto) {
-	    if (protp->active_pkt == NULL)
-		return 1;
-	    return (*protp->active_pkt)(p, len);
-	}
+    if (protp->protocol < 0xC000 && (protp->protocol & ~0x8000) == proto) {
+        if (protp->active_pkt == NULL)
+        return 1;
+        return (*protp->active_pkt)(p, len);
+    }
     }
-    return 0;			/* not a supported protocol !!?? */
+    return 0;           /* not a supported protocol !!?? */
 }
 
 #endif /* PPP_SUPPORT && DEMAND_SUPPORT */
diff --git a/src/netif/ppp/eap.c b/src/netif/ppp/eap.c
index ea684bf5..73a1dbb4 100644
--- a/src/netif/ppp/eap.c
+++ b/src/netif/ppp/eap.c
@@ -58,11 +58,11 @@
 #endif /* USE_SRP */
 
 #ifndef SHA_DIGESTSIZE
-#define	SHA_DIGESTSIZE 20
+#define SHA_DIGESTSIZE 20
 #endif
 
 #ifdef USE_SRP
-static char *pn_secret = NULL;		/* Pseudonym generating secret */
+static char *pn_secret = NULL;      /* Pseudonym generating secret */
 #endif
 
 #if PPP_OPTIONS
@@ -106,31 +106,31 @@ static int  eap_printpkt(const u_char *inp, int inlen,
 #endif /* PRINTPKT_SUPPORT */
 
 const struct protent eap_protent = {
-	PPP_EAP,		/* protocol number */
-	eap_init,		/* initialization procedure */
-	eap_input,		/* process a received packet */
-	eap_protrej,		/* process a received protocol-reject */
-	eap_lowerup,		/* lower layer has gone up */
-	eap_lowerdown,		/* lower layer has gone down */
-	NULL,			/* open the protocol */
-	NULL,			/* close the protocol */
+    PPP_EAP,        /* protocol number */
+    eap_init,       /* initialization procedure */
+    eap_input,      /* process a received packet */
+    eap_protrej,        /* process a received protocol-reject */
+    eap_lowerup,        /* lower layer has gone up */
+    eap_lowerdown,      /* lower layer has gone down */
+    NULL,           /* open the protocol */
+    NULL,           /* close the protocol */
 #if PRINTPKT_SUPPORT
-	eap_printpkt,		/* print a packet in readable form */
+    eap_printpkt,       /* print a packet in readable form */
 #endif /* PRINTPKT_SUPPORT */
 #if PPP_DATAINPUT
-	NULL,			/* process a received data packet */
+    NULL,           /* process a received data packet */
 #endif /* PPP_DATAINPUT */
 #if PRINTPKT_SUPPORT
-	"EAP",			/* text name of protocol */
-	NULL,			/* text name of corresponding data protocol */
+    "EAP",          /* text name of protocol */
+    NULL,           /* text name of corresponding data protocol */
 #endif /* PRINTPKT_SUPPORT */
 #if PPP_OPTIONS
-	eap_option_list,	/* list of command-line options */
-	NULL,			/* check requested options; assign defaults */
+    eap_option_list,    /* list of command-line options */
+    NULL,           /* check requested options; assign defaults */
 #endif /* PPP_OPTIONS */
 #if DEMAND_SUPPORT
-	NULL,			/* configure interface for demand-dial */
-	NULL			/* say whether to bring up link for this pkt */
+    NULL,           /* configure interface for demand-dial */
+    NULL            /* say whether to bring up link for this pkt */
 #endif /* DEMAND_SUPPORT */
 };
 
@@ -139,38 +139,38 @@ const struct protent eap_protent = {
  * A well-known 2048 bit modulus.
  */
 static const u_char wkmodulus[] = {
-	0xAC, 0x6B, 0xDB, 0x41, 0x32, 0x4A, 0x9A, 0x9B,
-	0xF1, 0x66, 0xDE, 0x5E, 0x13, 0x89, 0x58, 0x2F,
-	0xAF, 0x72, 0xB6, 0x65, 0x19, 0x87, 0xEE, 0x07,
-	0xFC, 0x31, 0x92, 0x94, 0x3D, 0xB5, 0x60, 0x50,
-	0xA3, 0x73, 0x29, 0xCB, 0xB4, 0xA0, 0x99, 0xED,
-	0x81, 0x93, 0xE0, 0x75, 0x77, 0x67, 0xA1, 0x3D,
-	0xD5, 0x23, 0x12, 0xAB, 0x4B, 0x03, 0x31, 0x0D,
-	0xCD, 0x7F, 0x48, 0xA9, 0xDA, 0x04, 0xFD, 0x50,
-	0xE8, 0x08, 0x39, 0x69, 0xED, 0xB7, 0x67, 0xB0,
-	0xCF, 0x60, 0x95, 0x17, 0x9A, 0x16, 0x3A, 0xB3,
-	0x66, 0x1A, 0x05, 0xFB, 0xD5, 0xFA, 0xAA, 0xE8,
-	0x29, 0x18, 0xA9, 0x96, 0x2F, 0x0B, 0x93, 0xB8,
-	0x55, 0xF9, 0x79, 0x93, 0xEC, 0x97, 0x5E, 0xEA,
-	0xA8, 0x0D, 0x74, 0x0A, 0xDB, 0xF4, 0xFF, 0x74,
-	0x73, 0x59, 0xD0, 0x41, 0xD5, 0xC3, 0x3E, 0xA7,
-	0x1D, 0x28, 0x1E, 0x44, 0x6B, 0x14, 0x77, 0x3B,
-	0xCA, 0x97, 0xB4, 0x3A, 0x23, 0xFB, 0x80, 0x16,
-	0x76, 0xBD, 0x20, 0x7A, 0x43, 0x6C, 0x64, 0x81,
-	0xF1, 0xD2, 0xB9, 0x07, 0x87, 0x17, 0x46, 0x1A,
-	0x5B, 0x9D, 0x32, 0xE6, 0x88, 0xF8, 0x77, 0x48,
-	0x54, 0x45, 0x23, 0xB5, 0x24, 0xB0, 0xD5, 0x7D,
-	0x5E, 0xA7, 0x7A, 0x27, 0x75, 0xD2, 0xEC, 0xFA,
-	0x03, 0x2C, 0xFB, 0xDB, 0xF5, 0x2F, 0xB3, 0x78,
-	0x61, 0x60, 0x27, 0x90, 0x04, 0xE5, 0x7A, 0xE6,
-	0xAF, 0x87, 0x4E, 0x73, 0x03, 0xCE, 0x53, 0x29,
-	0x9C, 0xCC, 0x04, 0x1C, 0x7B, 0xC3, 0x08, 0xD8,
-	0x2A, 0x56, 0x98, 0xF3, 0xA8, 0xD0, 0xC3, 0x82,
-	0x71, 0xAE, 0x35, 0xF8, 0xE9, 0xDB, 0xFB, 0xB6,
-	0x94, 0xB5, 0xC8, 0x03, 0xD8, 0x9F, 0x7A, 0xE4,
-	0x35, 0xDE, 0x23, 0x6D, 0x52, 0x5F, 0x54, 0x75,
-	0x9B, 0x65, 0xE3, 0x72, 0xFC, 0xD6, 0x8E, 0xF2,
-	0x0F, 0xA7, 0x11, 0x1F, 0x9E, 0x4A, 0xFF, 0x73
+    0xAC, 0x6B, 0xDB, 0x41, 0x32, 0x4A, 0x9A, 0x9B,
+    0xF1, 0x66, 0xDE, 0x5E, 0x13, 0x89, 0x58, 0x2F,
+    0xAF, 0x72, 0xB6, 0x65, 0x19, 0x87, 0xEE, 0x07,
+    0xFC, 0x31, 0x92, 0x94, 0x3D, 0xB5, 0x60, 0x50,
+    0xA3, 0x73, 0x29, 0xCB, 0xB4, 0xA0, 0x99, 0xED,
+    0x81, 0x93, 0xE0, 0x75, 0x77, 0x67, 0xA1, 0x3D,
+    0xD5, 0x23, 0x12, 0xAB, 0x4B, 0x03, 0x31, 0x0D,
+    0xCD, 0x7F, 0x48, 0xA9, 0xDA, 0x04, 0xFD, 0x50,
+    0xE8, 0x08, 0x39, 0x69, 0xED, 0xB7, 0x67, 0xB0,
+    0xCF, 0x60, 0x95, 0x17, 0x9A, 0x16, 0x3A, 0xB3,
+    0x66, 0x1A, 0x05, 0xFB, 0xD5, 0xFA, 0xAA, 0xE8,
+    0x29, 0x18, 0xA9, 0x96, 0x2F, 0x0B, 0x93, 0xB8,
+    0x55, 0xF9, 0x79, 0x93, 0xEC, 0x97, 0x5E, 0xEA,
+    0xA8, 0x0D, 0x74, 0x0A, 0xDB, 0xF4, 0xFF, 0x74,
+    0x73, 0x59, 0xD0, 0x41, 0xD5, 0xC3, 0x3E, 0xA7,
+    0x1D, 0x28, 0x1E, 0x44, 0x6B, 0x14, 0x77, 0x3B,
+    0xCA, 0x97, 0xB4, 0x3A, 0x23, 0xFB, 0x80, 0x16,
+    0x76, 0xBD, 0x20, 0x7A, 0x43, 0x6C, 0x64, 0x81,
+    0xF1, 0xD2, 0xB9, 0x07, 0x87, 0x17, 0x46, 0x1A,
+    0x5B, 0x9D, 0x32, 0xE6, 0x88, 0xF8, 0x77, 0x48,
+    0x54, 0x45, 0x23, 0xB5, 0x24, 0xB0, 0xD5, 0x7D,
+    0x5E, 0xA7, 0x7A, 0x27, 0x75, 0xD2, 0xEC, 0xFA,
+    0x03, 0x2C, 0xFB, 0xDB, 0xF5, 0x2F, 0xB3, 0x78,
+    0x61, 0x60, 0x27, 0x90, 0x04, 0xE5, 0x7A, 0xE6,
+    0xAF, 0x87, 0x4E, 0x73, 0x03, 0xCE, 0x53, 0x29,
+    0x9C, 0xCC, 0x04, 0x1C, 0x7B, 0xC3, 0x08, 0xD8,
+    0x2A, 0x56, 0x98, 0xF3, 0xA8, 0xD0, 0xC3, 0x82,
+    0x71, 0xAE, 0x35, 0xF8, 0xE9, 0xDB, 0xFB, 0xB6,
+    0x94, 0xB5, 0xC8, 0x03, 0xD8, 0x9F, 0x7A, 0xE4,
+    0x35, 0xDE, 0x23, 0x6D, 0x52, 0x5F, 0x54, 0x75,
+    0x9B, 0x65, 0xE3, 0x72, 0xFC, 0xD6, 0x8E, 0xF2,
+    0x0F, 0xA7, 0x11, 0x1F, 0x9E, 0x4A, 0xFF, 0x73
 };
 #endif
 
@@ -184,9 +184,9 @@ static void eap_server_timeout(void *arg);
  */
 static const char * eap_state_name(enum eap_state_code esc)
 {
-	static const char *state_names[] = { EAP_STATES };
+    static const char *state_names[] = { EAP_STATES };
 
-	return (state_names[(int)esc]);
+    return (state_names[(int)esc]);
 }
 
 /*
@@ -195,9 +195,9 @@ static const char * eap_state_name(enum eap_state_code esc)
  */
 static void eap_init(ppp_pcb *pcb) {
 
-	BZERO(&pcb->eap, sizeof(eap_state));
+    BZERO(&pcb->eap, sizeof(eap_state));
 #if PPP_SERVER
-	pcb->eap.es_server.ea_id = magic();
+    pcb->eap.es_server.ea_id = magic();
 #endif /* PPP_SERVER */
 }
 
@@ -206,14 +206,14 @@ static void eap_init(ppp_pcb *pcb) {
  * Request messages.
  */
 static void eap_client_timeout(void *arg) {
-	ppp_pcb *pcb = (ppp_pcb*)arg;
+    ppp_pcb *pcb = (ppp_pcb*)arg;
 
-	if (!eap_client_active(pcb))
-		return;
+    if (!eap_client_active(pcb))
+        return;
 
-	ppp_error(("EAP: timeout waiting for Request from peer"));
-	auth_withpeer_fail(pcb, PPP_EAP);
-	pcb->eap.es_client.ea_state = eapBadAuth;
+    ppp_error(("EAP: timeout waiting for Request from peer"));
+    auth_withpeer_fail(pcb, PPP_EAP);
+    pcb->eap.es_client.ea_state = eapBadAuth;
 }
 
 /*
@@ -224,22 +224,22 @@ static void eap_client_timeout(void *arg) {
  */
 void eap_authwithpeer(ppp_pcb *pcb, const char *localname) {
 
-	if(NULL == localname)
-		return;
+    if(NULL == localname)
+        return;
 
-	/* Save the peer name we're given */
-	pcb->eap.es_client.ea_name = localname;
-	pcb->eap.es_client.ea_namelen = strlen(localname);
+    /* Save the peer name we're given */
+    pcb->eap.es_client.ea_name = localname;
+    pcb->eap.es_client.ea_namelen = strlen(localname);
 
-	pcb->eap.es_client.ea_state = eapListen;
+    pcb->eap.es_client.ea_state = eapListen;
 
-	/*
-	 * Start a timer so that if the other end just goes
-	 * silent, we don't sit here waiting forever.
-	 */
-	if (pcb->settings.eap_req_time > 0)
-		TIMEOUT(eap_client_timeout, pcb,
-		    pcb->settings.eap_req_time);
+    /*
+     * Start a timer so that if the other end just goes
+     * silent, we don't sit here waiting forever.
+     */
+    if (pcb->settings.eap_req_time > 0)
+        TIMEOUT(eap_client_timeout, pcb,
+            pcb->settings.eap_req_time);
 }
 
 #if PPP_SERVER
@@ -248,30 +248,30 @@ void eap_authwithpeer(ppp_pcb *pcb, const char *localname) {
  * (Server operation)
  */
 static void eap_send_failure(ppp_pcb *pcb) {
-	struct pbuf *p;
-	u_char *outp;
+    struct pbuf *p;
+    u_char *outp;
 
-	p = pbuf_alloc(PBUF_RAW, (u16_t)(PPP_HDRLEN + EAP_HEADERLEN), PBUF_RAM);
-	if(NULL == p)
-		return;
-	if(p->tot_len != p->len) {
-		pbuf_free(p);
-		return;
-	}
+    p = pbuf_alloc(PBUF_RAW, (u16_t)(PPP_HDRLEN + EAP_HEADERLEN), PBUF_RAM);
+    if(NULL == p)
+        return;
+    if(p->tot_len != p->len) {
+        pbuf_free(p);
+        return;
+    }
 
-	outp = (u_char*)p->payload;
+    outp = (u_char*)p->payload;
 
-	MAKEHEADER(outp, PPP_EAP);
+    MAKEHEADER(outp, PPP_EAP);
 
-	PUTCHAR(EAP_FAILURE, outp);
-	pcb->eap.es_server.ea_id++;
-	PUTCHAR(pcb->eap.es_server.ea_id, outp);
-	PUTSHORT(EAP_HEADERLEN, outp);
+    PUTCHAR(EAP_FAILURE, outp);
+    pcb->eap.es_server.ea_id++;
+    PUTCHAR(pcb->eap.es_server.ea_id, outp);
+    PUTSHORT(EAP_HEADERLEN, outp);
 
-	ppp_write(pcb, p);
+    ppp_write(pcb, p);
 
-	pcb->eap.es_server.ea_state = eapBadAuth;
-	auth_peer_fail(pcb, PPP_EAP);
+    pcb->eap.es_server.ea_state = eapBadAuth;
+    auth_peer_fail(pcb, PPP_EAP);
 }
 
 /*
@@ -279,30 +279,30 @@ static void eap_send_failure(ppp_pcb *pcb) {
  * (Server operation)
  */
 static void eap_send_success(ppp_pcb *pcb) {
-	struct pbuf *p;
-	u_char *outp;
-
-	p = pbuf_alloc(PBUF_RAW, (u16_t)(PPP_HDRLEN + EAP_HEADERLEN), PBUF_RAM);
-	if(NULL == p)
-		return;
-	if(p->tot_len != p->len) {
-		pbuf_free(p);
-		return;
-	}
-
-	outp = (u_char*)p->payload;
-    
-	MAKEHEADER(outp, PPP_EAP);
-
-	PUTCHAR(EAP_SUCCESS, outp);
-	pcb->eap.es_server.ea_id++;
-	PUTCHAR(pcb->eap.es_server.ea_id, outp);
-	PUTSHORT(EAP_HEADERLEN, outp);
-
-	ppp_write(pcb, p);
-
-	auth_peer_success(pcb, PPP_EAP, 0,
-	    pcb->eap.es_server.ea_peer, pcb->eap.es_server.ea_peerlen);
+    struct pbuf *p;
+    u_char *outp;
+
+    p = pbuf_alloc(PBUF_RAW, (u16_t)(PPP_HDRLEN + EAP_HEADERLEN), PBUF_RAM);
+    if(NULL == p)
+        return;
+    if(p->tot_len != p->len) {
+        pbuf_free(p);
+        return;
+    }
+
+    outp = (u_char*)p->payload;
+
+    MAKEHEADER(outp, PPP_EAP);
+
+    PUTCHAR(EAP_SUCCESS, outp);
+    pcb->eap.es_server.ea_id++;
+    PUTCHAR(pcb->eap.es_server.ea_id, outp);
+    PUTSHORT(EAP_HEADERLEN, outp);
+
+    ppp_write(pcb, p);
+
+    auth_peer_success(pcb, PPP_EAP, 0,
+        pcb->eap.es_server.ea_peer, pcb->eap.es_server.ea_peerlen);
 }
 #endif /* PPP_SERVER */
 
@@ -314,31 +314,31 @@ static void eap_send_success(ppp_pcb *pcb) {
 static bool
 pncrypt_setkey(int timeoffs)
 {
-	struct tm *tp;
-	char tbuf[9];
-	SHA1_CTX ctxt;
-	u_char dig[SHA_DIGESTSIZE];
-	time_t reftime;
-
-	if (pn_secret == NULL)
-		return (0);
-	reftime = time(NULL) + timeoffs;
-	tp = localtime(&reftime);
-	SHA1Init(&ctxt);
-	SHA1Update(&ctxt, pn_secret, strlen(pn_secret));
-	strftime(tbuf, sizeof (tbuf), "%Y%m%d", tp);
-	SHA1Update(&ctxt, tbuf, strlen(tbuf));
-	SHA1Final(dig, &ctxt);
-	/* FIXME: if we want to do SRP, we need to find a way to pass the PolarSSL des_context instead of using static memory */
-	return (DesSetkey(dig));
+    struct tm *tp;
+    char tbuf[9];
+    SHA1_CTX ctxt;
+    u_char dig[SHA_DIGESTSIZE];
+    time_t reftime;
+
+    if (pn_secret == NULL)
+        return (0);
+    reftime = time(NULL) + timeoffs;
+    tp = localtime(&reftime);
+    SHA1Init(&ctxt);
+    SHA1Update(&ctxt, pn_secret, strlen(pn_secret));
+    strftime(tbuf, sizeof (tbuf), "%Y%m%d", tp);
+    SHA1Update(&ctxt, tbuf, strlen(tbuf));
+    SHA1Final(dig, &ctxt);
+    /* FIXME: if we want to do SRP, we need to find a way to pass the PolarSSL des_context instead of using static memory */
+    return (DesSetkey(dig));
 }
 
 static char base64[] =
 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
 
 struct b64state {
-	u32_t bs_bits;
-	int bs_offs;
+    u32_t bs_bits;
+    int bs_offs;
 };
 
 static int
@@ -348,23 +348,23 @@ u_char *inp;
 int inlen;
 u_char *outp;
 {
-	int outlen = 0;
-
-	while (inlen > 0) {
-		bs->bs_bits = (bs->bs_bits << 8) | *inp++;
-		inlen--;
-		bs->bs_offs += 8;
-		if (bs->bs_offs >= 24) {
-			*outp++ = base64[(bs->bs_bits >> 18) & 0x3F];
-			*outp++ = base64[(bs->bs_bits >> 12) & 0x3F];
-			*outp++ = base64[(bs->bs_bits >> 6) & 0x3F];
-			*outp++ = base64[bs->bs_bits & 0x3F];
-			outlen += 4;
-			bs->bs_offs = 0;
-			bs->bs_bits = 0;
-		}
-	}
-	return (outlen);
+    int outlen = 0;
+
+    while (inlen > 0) {
+        bs->bs_bits = (bs->bs_bits << 8) | *inp++;
+        inlen--;
+        bs->bs_offs += 8;
+        if (bs->bs_offs >= 24) {
+            *outp++ = base64[(bs->bs_bits >> 18) & 0x3F];
+            *outp++ = base64[(bs->bs_bits >> 12) & 0x3F];
+            *outp++ = base64[(bs->bs_bits >> 6) & 0x3F];
+            *outp++ = base64[bs->bs_bits & 0x3F];
+            outlen += 4;
+            bs->bs_offs = 0;
+            bs->bs_bits = 0;
+        }
+    }
+    return (outlen);
 }
 
 static int
@@ -372,21 +372,21 @@ b64flush(bs, outp)
 struct b64state *bs;
 u_char *outp;
 {
-	int outlen = 0;
-
-	if (bs->bs_offs == 8) {
-		*outp++ = base64[(bs->bs_bits >> 2) & 0x3F];
-		*outp++ = base64[(bs->bs_bits << 4) & 0x3F];
-		outlen = 2;
-	} else if (bs->bs_offs == 16) {
-		*outp++ = base64[(bs->bs_bits >> 10) & 0x3F];
-		*outp++ = base64[(bs->bs_bits >> 4) & 0x3F];
-		*outp++ = base64[(bs->bs_bits << 2) & 0x3F];
-		outlen = 3;
-	}
-	bs->bs_offs = 0;
-	bs->bs_bits = 0;
-	return (outlen);
+    int outlen = 0;
+
+    if (bs->bs_offs == 8) {
+        *outp++ = base64[(bs->bs_bits >> 2) & 0x3F];
+        *outp++ = base64[(bs->bs_bits << 4) & 0x3F];
+        outlen = 2;
+    } else if (bs->bs_offs == 16) {
+        *outp++ = base64[(bs->bs_bits >> 10) & 0x3F];
+        *outp++ = base64[(bs->bs_bits >> 4) & 0x3F];
+        *outp++ = base64[(bs->bs_bits << 2) & 0x3F];
+        outlen = 3;
+    }
+    bs->bs_offs = 0;
+    bs->bs_bits = 0;
+    return (outlen);
 }
 
 static int
@@ -396,22 +396,22 @@ u_char *inp;
 int inlen;
 u_char *outp;
 {
-	int outlen = 0;
-	char *cp;
-
-	while (inlen > 0) {
-		if ((cp = strchr(base64, *inp++)) == NULL)
-			break;
-		bs->bs_bits = (bs->bs_bits << 6) | (cp - base64);
-		inlen--;
-		bs->bs_offs += 6;
-		if (bs->bs_offs >= 8) {
-			*outp++ = bs->bs_bits >> (bs->bs_offs - 8);
-			outlen++;
-			bs->bs_offs -= 8;
-		}
-	}
-	return (outlen);
+    int outlen = 0;
+    char *cp;
+
+    while (inlen > 0) {
+        if ((cp = strchr(base64, *inp++)) == NULL)
+            break;
+        bs->bs_bits = (bs->bs_bits << 6) | (cp - base64);
+        inlen--;
+        bs->bs_offs += 6;
+        if (bs->bs_offs >= 8) {
+            *outp++ = bs->bs_bits >> (bs->bs_offs - 8);
+            outlen++;
+            bs->bs_offs -= 8;
+        }
+    }
+    return (outlen);
 }
 #endif /* USE_SRP */
 
@@ -424,211 +424,211 @@ u_char *outp;
  */
 static void eap_figure_next_state(ppp_pcb *pcb, int status) {
 #ifdef USE_SRP
-	unsigned char secbuf[MAXSECRETLEN], clear[8], *sp, *dp;
-	struct t_pw tpw;
-	struct t_confent *tce, mytce;
-	char *cp, *cp2;
-	struct t_server *ts;
-	int id, i, plen, toffs;
-	u_char vals[2];
-	struct b64state bs;
+    unsigned char secbuf[MAXSECRETLEN], clear[8], *sp, *dp;
+    struct t_pw tpw;
+    struct t_confent *tce, mytce;
+    char *cp, *cp2;
+    struct t_server *ts;
+    int id, i, plen, toffs;
+    u_char vals[2];
+    struct b64state bs;
 #endif /* USE_SRP */
 
-	pcb->settings.eap_timeout_time = pcb->eap.es_savedtime;
-	switch (pcb->eap.es_server.ea_state) {
-	case eapBadAuth:
-		return;
+    pcb->settings.eap_timeout_time = pcb->eap.es_savedtime;
+    switch (pcb->eap.es_server.ea_state) {
+    case eapBadAuth:
+        return;
 
-	case eapIdentify:
+    case eapIdentify:
 #ifdef USE_SRP
-		/* Discard any previous session. */
-		ts = (struct t_server *)pcb->eap.es_server.ea_session;
-		if (ts != NULL) {
-			t_serverclose(ts);
-			pcb->eap.es_server.ea_session = NULL;
-			pcb->eap.es_server.ea_skey = NULL;
-		}
+        /* Discard any previous session. */
+        ts = (struct t_server *)pcb->eap.es_server.ea_session;
+        if (ts != NULL) {
+            t_serverclose(ts);
+            pcb->eap.es_server.ea_session = NULL;
+            pcb->eap.es_server.ea_skey = NULL;
+        }
 #endif /* USE_SRP */
-		if (status != 0) {
-			pcb->eap.es_server.ea_state = eapBadAuth;
-			break;
-		}
+        if (status != 0) {
+            pcb->eap.es_server.ea_state = eapBadAuth;
+            break;
+        }
 #ifdef USE_SRP
-		/* If we've got a pseudonym, try to decode to real name. */
-		if (pcb->eap.es_server.ea_peerlen > SRP_PSEUDO_LEN &&
-		    strncmp(pcb->eap.es_server.ea_peer, SRP_PSEUDO_ID,
-			SRP_PSEUDO_LEN) == 0 &&
-		    (pcb->eap.es_server.ea_peerlen - SRP_PSEUDO_LEN) * 3 / 4 <
-		    sizeof (secbuf)) {
-			BZERO(&bs, sizeof (bs));
-			plen = b64dec(&bs,
-			    pcb->eap.es_server.ea_peer + SRP_PSEUDO_LEN,
-			    pcb->eap.es_server.ea_peerlen - SRP_PSEUDO_LEN,
-			    secbuf);
-			toffs = 0;
-			for (i = 0; i < 5; i++) {
-				pncrypt_setkey(toffs);
-				toffs -= 86400;
-				/* FIXME: if we want to do SRP, we need to find a way to pass the PolarSSL des_context instead of using static memory */
-				if (!DesDecrypt(secbuf, clear)) {
-					ppp_dbglog(("no DES here; cannot decode "
-					    "pseudonym"));
-					return;
-				}
-				id = *(unsigned char *)clear;
-				if (id + 1 <= plen && id + 9 > plen)
-					break;
-			}
-			if (plen % 8 == 0 && i < 5) {
-				/*
-				 * Note that this is always shorter than the
-				 * original stored string, so there's no need
-				 * to realloc.
-				 */
-				if ((i = plen = *(unsigned char *)clear) > 7)
-					i = 7;
-				pcb->eap.es_server.ea_peerlen = plen;
-				dp = (unsigned char *)pcb->eap.es_server.ea_peer;
-				MEMCPY(dp, clear + 1, i);
-				plen -= i;
-				dp += i;
-				sp = secbuf + 8;
-				while (plen > 0) {
-					/* FIXME: if we want to do SRP, we need to find a way to pass the PolarSSL des_context instead of using static memory */
-					(void) DesDecrypt(sp, dp);
-					sp += 8;
-					dp += 8;
-					plen -= 8;
-				}
-				pcb->eap.es_server.ea_peer[
-					pcb->eap.es_server.ea_peerlen] = '\0';
-				ppp_dbglog(("decoded pseudonym to \"%.*q\"",
-				    pcb->eap.es_server.ea_peerlen,
-				    pcb->eap.es_server.ea_peer));
-			} else {
-				ppp_dbglog(("failed to decode real name"));
-				/* Stay in eapIdentfy state; requery */
-				break;
-			}
-		}
-		/* Look up user in secrets database. */
-		if (get_srp_secret(pcb->eap.es_unit, pcb->eap.es_server.ea_peer,
-		    pcb->eap.es_server.ea_name, (char *)secbuf, 1) != 0) {
-			/* Set up default in case SRP entry is bad */
-			pcb->eap.es_server.ea_state = eapMD5Chall;
-			/* Get t_confent based on index in srp-secrets */
-			id = strtol((char *)secbuf, &cp, 10);
-			if (*cp++ != ':' || id < 0)
-				break;
-			if (id == 0) {
-				mytce.index = 0;
-				mytce.modulus.data = (u_char *)wkmodulus;
-				mytce.modulus.len = sizeof (wkmodulus);
-				mytce.generator.data = (u_char *)"\002";
-				mytce.generator.len = 1;
-				tce = &mytce;
-			} else if ((tce = gettcid(id)) != NULL) {
-				/*
-				 * Client will have to verify this modulus/
-				 * generator combination, and that will take
-				 * a while.  Lengthen the timeout here.
-				 */
-				if (pcb->settings.eap_timeout_time > 0 &&
-				    pcb->settings.eap_timeout_time < 30)
-					pcb->settings.eap_timeout_time = 30;
-			} else {
-				break;
-			}
-			if ((cp2 = strchr(cp, ':')) == NULL)
-				break;
-			*cp2++ = '\0';
-			tpw.pebuf.name = pcb->eap.es_server.ea_peer;
-			tpw.pebuf.password.len = t_fromb64((char *)tpw.pwbuf,
-			    cp);
-			tpw.pebuf.password.data = tpw.pwbuf;
-			tpw.pebuf.salt.len = t_fromb64((char *)tpw.saltbuf,
-			    cp2);
-			tpw.pebuf.salt.data = tpw.saltbuf;
-			if ((ts = t_serveropenraw(&tpw.pebuf, tce)) == NULL)
-				break;
-			pcb->eap.es_server.ea_session = (void *)ts;
-			pcb->eap.es_server.ea_state = eapSRP1;
-			vals[0] = pcb->eap.es_server.ea_id + 1;
-			vals[1] = EAPT_SRP;
-			t_serveraddexdata(ts, vals, 2);
-			/* Generate B; must call before t_servergetkey() */
-			t_servergenexp(ts);
-			break;
-		}
+        /* If we've got a pseudonym, try to decode to real name. */
+        if (pcb->eap.es_server.ea_peerlen > SRP_PSEUDO_LEN &&
+            strncmp(pcb->eap.es_server.ea_peer, SRP_PSEUDO_ID,
+            SRP_PSEUDO_LEN) == 0 &&
+            (pcb->eap.es_server.ea_peerlen - SRP_PSEUDO_LEN) * 3 / 4 <
+            sizeof (secbuf)) {
+            BZERO(&bs, sizeof (bs));
+            plen = b64dec(&bs,
+                pcb->eap.es_server.ea_peer + SRP_PSEUDO_LEN,
+                pcb->eap.es_server.ea_peerlen - SRP_PSEUDO_LEN,
+                secbuf);
+            toffs = 0;
+            for (i = 0; i < 5; i++) {
+                pncrypt_setkey(toffs);
+                toffs -= 86400;
+                /* FIXME: if we want to do SRP, we need to find a way to pass the PolarSSL des_context instead of using static memory */
+                if (!DesDecrypt(secbuf, clear)) {
+                    ppp_dbglog(("no DES here; cannot decode "
+                        "pseudonym"));
+                    return;
+                }
+                id = *(unsigned char *)clear;
+                if (id + 1 <= plen && id + 9 > plen)
+                    break;
+            }
+            if (plen % 8 == 0 && i < 5) {
+                /*
+                 * Note that this is always shorter than the
+                 * original stored string, so there's no need
+                 * to realloc.
+                 */
+                if ((i = plen = *(unsigned char *)clear) > 7)
+                    i = 7;
+                pcb->eap.es_server.ea_peerlen = plen;
+                dp = (unsigned char *)pcb->eap.es_server.ea_peer;
+                MEMCPY(dp, clear + 1, i);
+                plen -= i;
+                dp += i;
+                sp = secbuf + 8;
+                while (plen > 0) {
+                    /* FIXME: if we want to do SRP, we need to find a way to pass the PolarSSL des_context instead of using static memory */
+                    (void) DesDecrypt(sp, dp);
+                    sp += 8;
+                    dp += 8;
+                    plen -= 8;
+                }
+                pcb->eap.es_server.ea_peer[
+                    pcb->eap.es_server.ea_peerlen] = '\0';
+                ppp_dbglog(("decoded pseudonym to \"%.*q\"",
+                    pcb->eap.es_server.ea_peerlen,
+                    pcb->eap.es_server.ea_peer));
+            } else {
+                ppp_dbglog(("failed to decode real name"));
+                /* Stay in eapIdentfy state; requery */
+                break;
+            }
+        }
+        /* Look up user in secrets database. */
+        if (get_srp_secret(pcb->eap.es_unit, pcb->eap.es_server.ea_peer,
+            pcb->eap.es_server.ea_name, (char *)secbuf, 1) != 0) {
+            /* Set up default in case SRP entry is bad */
+            pcb->eap.es_server.ea_state = eapMD5Chall;
+            /* Get t_confent based on index in srp-secrets */
+            id = strtol((char *)secbuf, &cp, 10);
+            if (*cp++ != ':' || id < 0)
+                break;
+            if (id == 0) {
+                mytce.index = 0;
+                mytce.modulus.data = (u_char *)wkmodulus;
+                mytce.modulus.len = sizeof (wkmodulus);
+                mytce.generator.data = (u_char *)"\002";
+                mytce.generator.len = 1;
+                tce = &mytce;
+            } else if ((tce = gettcid(id)) != NULL) {
+                /*
+                 * Client will have to verify this modulus/
+                 * generator combination, and that will take
+                 * a while.  Lengthen the timeout here.
+                 */
+                if (pcb->settings.eap_timeout_time > 0 &&
+                    pcb->settings.eap_timeout_time < 30)
+                    pcb->settings.eap_timeout_time = 30;
+            } else {
+                break;
+            }
+            if ((cp2 = strchr(cp, ':')) == NULL)
+                break;
+            *cp2++ = '\0';
+            tpw.pebuf.name = pcb->eap.es_server.ea_peer;
+            tpw.pebuf.password.len = t_fromb64((char *)tpw.pwbuf,
+                cp);
+            tpw.pebuf.password.data = tpw.pwbuf;
+            tpw.pebuf.salt.len = t_fromb64((char *)tpw.saltbuf,
+                cp2);
+            tpw.pebuf.salt.data = tpw.saltbuf;
+            if ((ts = t_serveropenraw(&tpw.pebuf, tce)) == NULL)
+                break;
+            pcb->eap.es_server.ea_session = (void *)ts;
+            pcb->eap.es_server.ea_state = eapSRP1;
+            vals[0] = pcb->eap.es_server.ea_id + 1;
+            vals[1] = EAPT_SRP;
+            t_serveraddexdata(ts, vals, 2);
+            /* Generate B; must call before t_servergetkey() */
+            t_servergenexp(ts);
+            break;
+        }
 #endif /* USE_SRP */
-		pcb->eap.es_server.ea_state = eapMD5Chall;
-		break;
+        pcb->eap.es_server.ea_state = eapMD5Chall;
+        break;
 
-	case eapSRP1:
+    case eapSRP1:
 #ifdef USE_SRP
-		ts = (struct t_server *)pcb->eap.es_server.ea_session;
-		if (ts != NULL && status != 0) {
-			t_serverclose(ts);
-			pcb->eap.es_server.ea_session = NULL;
-			pcb->eap.es_server.ea_skey = NULL;
-		}
+        ts = (struct t_server *)pcb->eap.es_server.ea_session;
+        if (ts != NULL && status != 0) {
+            t_serverclose(ts);
+            pcb->eap.es_server.ea_session = NULL;
+            pcb->eap.es_server.ea_skey = NULL;
+        }
 #endif /* USE_SRP */
-		if (status == 1) {
-			pcb->eap.es_server.ea_state = eapMD5Chall;
-		} else if (status != 0 || pcb->eap.es_server.ea_session == NULL) {
-			pcb->eap.es_server.ea_state = eapBadAuth;
-		} else {
-			pcb->eap.es_server.ea_state = eapSRP2;
-		}
-		break;
-
-	case eapSRP2:
+        if (status == 1) {
+            pcb->eap.es_server.ea_state = eapMD5Chall;
+        } else if (status != 0 || pcb->eap.es_server.ea_session == NULL) {
+            pcb->eap.es_server.ea_state = eapBadAuth;
+        } else {
+            pcb->eap.es_server.ea_state = eapSRP2;
+        }
+        break;
+
+    case eapSRP2:
 #ifdef USE_SRP
-		ts = (struct t_server *)pcb->eap.es_server.ea_session;
-		if (ts != NULL && status != 0) {
-			t_serverclose(ts);
-			pcb->eap.es_server.ea_session = NULL;
-			pcb->eap.es_server.ea_skey = NULL;
-		}
+        ts = (struct t_server *)pcb->eap.es_server.ea_session;
+        if (ts != NULL && status != 0) {
+            t_serverclose(ts);
+            pcb->eap.es_server.ea_session = NULL;
+            pcb->eap.es_server.ea_skey = NULL;
+        }
 #endif /* USE_SRP */
-		if (status != 0 || pcb->eap.es_server.ea_session == NULL) {
-			pcb->eap.es_server.ea_state = eapBadAuth;
-		} else {
-			pcb->eap.es_server.ea_state = eapSRP3;
-		}
-		break;
-
-	case eapSRP3:
-	case eapSRP4:
+        if (status != 0 || pcb->eap.es_server.ea_session == NULL) {
+            pcb->eap.es_server.ea_state = eapBadAuth;
+        } else {
+            pcb->eap.es_server.ea_state = eapSRP3;
+        }
+        break;
+
+    case eapSRP3:
+    case eapSRP4:
 #ifdef USE_SRP
-		ts = (struct t_server *)pcb->eap.es_server.ea_session;
-		if (ts != NULL && status != 0) {
-			t_serverclose(ts);
-			pcb->eap.es_server.ea_session = NULL;
-			pcb->eap.es_server.ea_skey = NULL;
-		}
+        ts = (struct t_server *)pcb->eap.es_server.ea_session;
+        if (ts != NULL && status != 0) {
+            t_serverclose(ts);
+            pcb->eap.es_server.ea_session = NULL;
+            pcb->eap.es_server.ea_skey = NULL;
+        }
 #endif /* USE_SRP */
-		if (status != 0 || pcb->eap.es_server.ea_session == NULL) {
-			pcb->eap.es_server.ea_state = eapBadAuth;
-		} else {
-			pcb->eap.es_server.ea_state = eapOpen;
-		}
-		break;
-
-	case eapMD5Chall:
-		if (status != 0) {
-			pcb->eap.es_server.ea_state = eapBadAuth;
-		} else {
-			pcb->eap.es_server.ea_state = eapOpen;
-		}
-		break;
-
-	default:
-		pcb->eap.es_server.ea_state = eapBadAuth;
-		break;
-	}
-	if (pcb->eap.es_server.ea_state == eapBadAuth)
-		eap_send_failure(pcb);
+        if (status != 0 || pcb->eap.es_server.ea_session == NULL) {
+            pcb->eap.es_server.ea_state = eapBadAuth;
+        } else {
+            pcb->eap.es_server.ea_state = eapOpen;
+        }
+        break;
+
+    case eapMD5Chall:
+        if (status != 0) {
+            pcb->eap.es_server.ea_state = eapBadAuth;
+        } else {
+            pcb->eap.es_server.ea_state = eapOpen;
+        }
+        break;
+
+    default:
+        pcb->eap.es_server.ea_state = eapBadAuth;
+        break;
+    }
+    if (pcb->eap.es_server.ea_state == eapBadAuth)
+        eap_send_failure(pcb);
 }
 
 /*
@@ -636,235 +636,235 @@ static void eap_figure_next_state(ppp_pcb *pcb, int status) {
  * type depends on current state.  (Server operation)
  */
 static void eap_send_request(ppp_pcb *pcb) {
-	struct pbuf *p;
-	u_char *outp;
-	u_char *lenloc;
-	int outlen;
-	int len;
-	const char *str;
+    struct pbuf *p;
+    u_char *outp;
+    u_char *lenloc;
+    int outlen;
+    int len;
+    const char *str;
 #ifdef USE_SRP
-	struct t_server *ts;
-	u_char clear[8], cipher[8], dig[SHA_DIGESTSIZE], *optr, *cp;
-	int i, j;
-	struct b64state b64;
-	SHA1_CTX ctxt;
+    struct t_server *ts;
+    u_char clear[8], cipher[8], dig[SHA_DIGESTSIZE], *optr, *cp;
+    int i, j;
+    struct b64state b64;
+    SHA1_CTX ctxt;
 #endif /* USE_SRP */
 
-	/* Handle both initial auth and restart */
-	if (pcb->eap.es_server.ea_state < eapIdentify &&
-	    pcb->eap.es_server.ea_state != eapInitial) {
-		pcb->eap.es_server.ea_state = eapIdentify;
+    /* Handle both initial auth and restart */
+    if (pcb->eap.es_server.ea_state < eapIdentify &&
+        pcb->eap.es_server.ea_state != eapInitial) {
+        pcb->eap.es_server.ea_state = eapIdentify;
 #if PPP_REMOTENAME
-		if (pcb->settings.explicit_remote && pcb->remote_name) {
-			/*
-			 * If we already know the peer's
-			 * unauthenticated name, then there's no
-			 * reason to ask.  Go to next state instead.
-			 */
-			int len = (int)strlen(pcb->remote_name);
-			if (len > MAXNAMELEN) {
-				len = MAXNAMELEN;
-			}
-			MEMCPY(pcb->eap.es_server.ea_peer, pcb->remote_name, len);
-			pcb->eap.es_server.ea_peer[len] = '\0';
-			pcb->eap.es_server.ea_peerlen = len;
-			eap_figure_next_state(pcb, 0);
-		}
+        if (pcb->settings.explicit_remote && pcb->remote_name) {
+            /*
+             * If we already know the peer's
+             * unauthenticated name, then there's no
+             * reason to ask.  Go to next state instead.
+             */
+            int len = (int)strlen(pcb->remote_name);
+            if (len > MAXNAMELEN) {
+                len = MAXNAMELEN;
+            }
+            MEMCPY(pcb->eap.es_server.ea_peer, pcb->remote_name, len);
+            pcb->eap.es_server.ea_peer[len] = '\0';
+            pcb->eap.es_server.ea_peerlen = len;
+            eap_figure_next_state(pcb, 0);
+        }
 #endif /* PPP_REMOTENAME */
-	}
-
-	if (pcb->settings.eap_max_transmits > 0 &&
-	    pcb->eap.es_server.ea_requests >= pcb->settings.eap_max_transmits) {
-		if (pcb->eap.es_server.ea_responses > 0)
-			ppp_error(("EAP: too many Requests sent"));
-		else
-			ppp_error(("EAP: no response to Requests"));
-		eap_send_failure(pcb);
-		return;
-	}
-
-	p = pbuf_alloc(PBUF_RAW, (u16_t)(PPP_CTRL_PBUF_UNKNOWN_SIZE), PBUF_RAM);
-	if(NULL == p)
-		return;
-	if(p->tot_len != p->len) {
-		pbuf_free(p);
-		return;
-	}
-
-	outp = (u_char*)p->payload;
-    
-	MAKEHEADER(outp, PPP_EAP);
-
-	PUTCHAR(EAP_REQUEST, outp);
-	PUTCHAR(pcb->eap.es_server.ea_id, outp);
-	lenloc = outp;
-	INCPTR(2, outp);
-
-	switch (pcb->eap.es_server.ea_state) {
-	case eapIdentify:
-		PUTCHAR(EAPT_IDENTITY, outp);
-		str = "Name";
-		len = strlen(str);
-		MEMCPY(outp, str, len);
-		INCPTR(len, outp);
-		break;
-
-	case eapMD5Chall:
-		PUTCHAR(EAPT_MD5CHAP, outp);
-		/*
-		 * pick a random challenge length between
-		 * EAP_MIN_CHALLENGE_LENGTH and EAP_MAX_CHALLENGE_LENGTH
-		 */
-		pcb->eap.es_challen = EAP_MIN_CHALLENGE_LENGTH +
-		    magic_pow(EAP_MIN_MAX_POWER_OF_TWO_CHALLENGE_LENGTH);
-		PUTCHAR(pcb->eap.es_challen, outp);
-		magic_random_bytes(pcb->eap.es_challenge, pcb->eap.es_challen);
-		MEMCPY(outp, pcb->eap.es_challenge, pcb->eap.es_challen);
-		INCPTR(pcb->eap.es_challen, outp);
-		MEMCPY(outp, pcb->eap.es_server.ea_name, pcb->eap.es_server.ea_namelen);
-		INCPTR(pcb->eap.es_server.ea_namelen, outp);
-		break;
+    }
+
+    if (pcb->settings.eap_max_transmits > 0 &&
+        pcb->eap.es_server.ea_requests >= pcb->settings.eap_max_transmits) {
+        if (pcb->eap.es_server.ea_responses > 0)
+            ppp_error(("EAP: too many Requests sent"));
+        else
+            ppp_error(("EAP: no response to Requests"));
+        eap_send_failure(pcb);
+        return;
+    }
+
+    p = pbuf_alloc(PBUF_RAW, (u16_t)(PPP_CTRL_PBUF_UNKNOWN_SIZE), PBUF_RAM);
+    if(NULL == p)
+        return;
+    if(p->tot_len != p->len) {
+        pbuf_free(p);
+        return;
+    }
+
+    outp = (u_char*)p->payload;
+
+    MAKEHEADER(outp, PPP_EAP);
+
+    PUTCHAR(EAP_REQUEST, outp);
+    PUTCHAR(pcb->eap.es_server.ea_id, outp);
+    lenloc = outp;
+    INCPTR(2, outp);
+
+    switch (pcb->eap.es_server.ea_state) {
+    case eapIdentify:
+        PUTCHAR(EAPT_IDENTITY, outp);
+        str = "Name";
+        len = strlen(str);
+        MEMCPY(outp, str, len);
+        INCPTR(len, outp);
+        break;
+
+    case eapMD5Chall:
+        PUTCHAR(EAPT_MD5CHAP, outp);
+        /*
+         * pick a random challenge length between
+         * EAP_MIN_CHALLENGE_LENGTH and EAP_MAX_CHALLENGE_LENGTH
+         */
+        pcb->eap.es_challen = EAP_MIN_CHALLENGE_LENGTH +
+            magic_pow(EAP_MIN_MAX_POWER_OF_TWO_CHALLENGE_LENGTH);
+        PUTCHAR(pcb->eap.es_challen, outp);
+        magic_random_bytes(pcb->eap.es_challenge, pcb->eap.es_challen);
+        MEMCPY(outp, pcb->eap.es_challenge, pcb->eap.es_challen);
+        INCPTR(pcb->eap.es_challen, outp);
+        MEMCPY(outp, pcb->eap.es_server.ea_name, pcb->eap.es_server.ea_namelen);
+        INCPTR(pcb->eap.es_server.ea_namelen, outp);
+        break;
 
 #ifdef USE_SRP
-	case eapSRP1:
-		PUTCHAR(EAPT_SRP, outp);
-		PUTCHAR(EAPSRP_CHALLENGE, outp);
-
-		PUTCHAR(pcb->eap.es_server.ea_namelen, outp);
-		MEMCPY(outp, pcb->eap.es_server.ea_name, pcb->eap.es_server.ea_namelen);
-		INCPTR(pcb->eap.es_server.ea_namelen, outp);
-
-		ts = (struct t_server *)pcb->eap.es_server.ea_session;
-		assert(ts != NULL);
-		PUTCHAR(ts->s.len, outp);
-		MEMCPY(outp, ts->s.data, ts->s.len);
-		INCPTR(ts->s.len, outp);
-
-		if (ts->g.len == 1 && ts->g.data[0] == 2) {
-			PUTCHAR(0, outp);
-		} else {
-			PUTCHAR(ts->g.len, outp);
-			MEMCPY(outp, ts->g.data, ts->g.len);
-			INCPTR(ts->g.len, outp);
-		}
-
-		if (ts->n.len != sizeof (wkmodulus) ||
-		    BCMP(ts->n.data, wkmodulus, sizeof (wkmodulus)) != 0) {
-			MEMCPY(outp, ts->n.data, ts->n.len);
-			INCPTR(ts->n.len, outp);
-		}
-		break;
-
-	case eapSRP2:
-		PUTCHAR(EAPT_SRP, outp);
-		PUTCHAR(EAPSRP_SKEY, outp);
-
-		ts = (struct t_server *)pcb->eap.es_server.ea_session;
-		assert(ts != NULL);
-		MEMCPY(outp, ts->B.data, ts->B.len);
-		INCPTR(ts->B.len, outp);
-		break;
-
-	case eapSRP3:
-		PUTCHAR(EAPT_SRP, outp);
-		PUTCHAR(EAPSRP_SVALIDATOR, outp);
-		PUTLONG(SRPVAL_EBIT, outp);
-		ts = (struct t_server *)pcb->eap.es_server.ea_session;
-		assert(ts != NULL);
-		MEMCPY(outp, t_serverresponse(ts), SHA_DIGESTSIZE);
-		INCPTR(SHA_DIGESTSIZE, outp);
-
-		if (pncrypt_setkey(0)) {
-			/* Generate pseudonym */
-			optr = outp;
-			cp = (unsigned char *)pcb->eap.es_server.ea_peer;
-			if ((j = i = pcb->eap.es_server.ea_peerlen) > 7)
-				j = 7;
-			clear[0] = i;
-			MEMCPY(clear + 1, cp, j);
-			i -= j;
-			cp += j;
-			/* FIXME: if we want to do SRP, we need to find a way to pass the PolarSSL des_context instead of using static memory */
-			if (!DesEncrypt(clear, cipher)) {
-				ppp_dbglog(("no DES here; not generating pseudonym"));
-				break;
-			}
-			BZERO(&b64, sizeof (b64));
-			outp++;		/* space for pseudonym length */
-			outp += b64enc(&b64, cipher, 8, outp);
-			while (i >= 8) {
-				/* FIXME: if we want to do SRP, we need to find a way to pass the PolarSSL des_context instead of using static memory */
-				(void) DesEncrypt(cp, cipher);
-				outp += b64enc(&b64, cipher, 8, outp);
-				cp += 8;
-				i -= 8;
-			}
-			if (i > 0) {
-				MEMCPY(clear, cp, i);
-				cp += i;
-				magic_random_bytes(cp, 8-i);
-				/* FIXME: if we want to do SRP, we need to find a way to pass the PolarSSL des_context instead of using static memory */
-				(void) DesEncrypt(clear, cipher);
-				outp += b64enc(&b64, cipher, 8, outp);
-			}
-			outp += b64flush(&b64, outp);
-
-			/* Set length and pad out to next 20 octet boundary */
-			i = outp - optr - 1;
-			*optr = i;
-			i %= SHA_DIGESTSIZE;
-			if (i != 0) {
-				magic_random_bytes(outp, SHA_DIGESTSIZE-i);
-				INCPTR(SHA_DIGESTSIZE-i, outp);
-			}
-
-			/* Obscure the pseudonym with SHA1 hash */
-			SHA1Init(&ctxt);
-			SHA1Update(&ctxt, &pcb->eap.es_server.ea_id, 1);
-			SHA1Update(&ctxt, pcb->eap.es_server.ea_skey,
-			    SESSION_KEY_LEN);
-			SHA1Update(&ctxt, pcb->eap.es_server.ea_peer,
-			    pcb->eap.es_server.ea_peerlen);
-			while (optr < outp) {
-				SHA1Final(dig, &ctxt);
-				cp = dig;
-				while (cp < dig + SHA_DIGESTSIZE)
-					*optr++ ^= *cp++;
-				SHA1Init(&ctxt);
-				SHA1Update(&ctxt, &pcb->eap.es_server.ea_id, 1);
-				SHA1Update(&ctxt, pcb->eap.es_server.ea_skey,
-				    SESSION_KEY_LEN);
-				SHA1Update(&ctxt, optr - SHA_DIGESTSIZE,
-				    SHA_DIGESTSIZE);
-			}
-		}
-		break;
-
-	case eapSRP4:
-		PUTCHAR(EAPT_SRP, outp);
-		PUTCHAR(EAPSRP_LWRECHALLENGE, outp);
-		pcb->eap.es_challen = EAP_MIN_CHALLENGE_LENGTH +
-		    magic_pow(EAP_MIN_MAX_POWER_OF_TWO_CHALLENGE_LENGTH);
-		magic_random_bytes(pcb->eap.es_challenge, pcb->eap.es_challen);
-		MEMCPY(outp, pcb->eap.es_challenge, pcb->eap.es_challen);
-		INCPTR(pcb->eap.es_challen, outp);
-		break;
+    case eapSRP1:
+        PUTCHAR(EAPT_SRP, outp);
+        PUTCHAR(EAPSRP_CHALLENGE, outp);
+
+        PUTCHAR(pcb->eap.es_server.ea_namelen, outp);
+        MEMCPY(outp, pcb->eap.es_server.ea_name, pcb->eap.es_server.ea_namelen);
+        INCPTR(pcb->eap.es_server.ea_namelen, outp);
+
+        ts = (struct t_server *)pcb->eap.es_server.ea_session;
+        assert(ts != NULL);
+        PUTCHAR(ts->s.len, outp);
+        MEMCPY(outp, ts->s.data, ts->s.len);
+        INCPTR(ts->s.len, outp);
+
+        if (ts->g.len == 1 && ts->g.data[0] == 2) {
+            PUTCHAR(0, outp);
+        } else {
+            PUTCHAR(ts->g.len, outp);
+            MEMCPY(outp, ts->g.data, ts->g.len);
+            INCPTR(ts->g.len, outp);
+        }
+
+        if (ts->n.len != sizeof (wkmodulus) ||
+            BCMP(ts->n.data, wkmodulus, sizeof (wkmodulus)) != 0) {
+            MEMCPY(outp, ts->n.data, ts->n.len);
+            INCPTR(ts->n.len, outp);
+        }
+        break;
+
+    case eapSRP2:
+        PUTCHAR(EAPT_SRP, outp);
+        PUTCHAR(EAPSRP_SKEY, outp);
+
+        ts = (struct t_server *)pcb->eap.es_server.ea_session;
+        assert(ts != NULL);
+        MEMCPY(outp, ts->B.data, ts->B.len);
+        INCPTR(ts->B.len, outp);
+        break;
+
+    case eapSRP3:
+        PUTCHAR(EAPT_SRP, outp);
+        PUTCHAR(EAPSRP_SVALIDATOR, outp);
+        PUTLONG(SRPVAL_EBIT, outp);
+        ts = (struct t_server *)pcb->eap.es_server.ea_session;
+        assert(ts != NULL);
+        MEMCPY(outp, t_serverresponse(ts), SHA_DIGESTSIZE);
+        INCPTR(SHA_DIGESTSIZE, outp);
+
+        if (pncrypt_setkey(0)) {
+            /* Generate pseudonym */
+            optr = outp;
+            cp = (unsigned char *)pcb->eap.es_server.ea_peer;
+            if ((j = i = pcb->eap.es_server.ea_peerlen) > 7)
+                j = 7;
+            clear[0] = i;
+            MEMCPY(clear + 1, cp, j);
+            i -= j;
+            cp += j;
+            /* FIXME: if we want to do SRP, we need to find a way to pass the PolarSSL des_context instead of using static memory */
+            if (!DesEncrypt(clear, cipher)) {
+                ppp_dbglog(("no DES here; not generating pseudonym"));
+                break;
+            }
+            BZERO(&b64, sizeof (b64));
+            outp++;     /* space for pseudonym length */
+            outp += b64enc(&b64, cipher, 8, outp);
+            while (i >= 8) {
+                /* FIXME: if we want to do SRP, we need to find a way to pass the PolarSSL des_context instead of using static memory */
+                (void) DesEncrypt(cp, cipher);
+                outp += b64enc(&b64, cipher, 8, outp);
+                cp += 8;
+                i -= 8;
+            }
+            if (i > 0) {
+                MEMCPY(clear, cp, i);
+                cp += i;
+                magic_random_bytes(cp, 8-i);
+                /* FIXME: if we want to do SRP, we need to find a way to pass the PolarSSL des_context instead of using static memory */
+                (void) DesEncrypt(clear, cipher);
+                outp += b64enc(&b64, cipher, 8, outp);
+            }
+            outp += b64flush(&b64, outp);
+
+            /* Set length and pad out to next 20 octet boundary */
+            i = outp - optr - 1;
+            *optr = i;
+            i %= SHA_DIGESTSIZE;
+            if (i != 0) {
+                magic_random_bytes(outp, SHA_DIGESTSIZE-i);
+                INCPTR(SHA_DIGESTSIZE-i, outp);
+            }
+
+            /* Obscure the pseudonym with SHA1 hash */
+            SHA1Init(&ctxt);
+            SHA1Update(&ctxt, &pcb->eap.es_server.ea_id, 1);
+            SHA1Update(&ctxt, pcb->eap.es_server.ea_skey,
+                SESSION_KEY_LEN);
+            SHA1Update(&ctxt, pcb->eap.es_server.ea_peer,
+                pcb->eap.es_server.ea_peerlen);
+            while (optr < outp) {
+                SHA1Final(dig, &ctxt);
+                cp = dig;
+                while (cp < dig + SHA_DIGESTSIZE)
+                    *optr++ ^= *cp++;
+                SHA1Init(&ctxt);
+                SHA1Update(&ctxt, &pcb->eap.es_server.ea_id, 1);
+                SHA1Update(&ctxt, pcb->eap.es_server.ea_skey,
+                    SESSION_KEY_LEN);
+                SHA1Update(&ctxt, optr - SHA_DIGESTSIZE,
+                    SHA_DIGESTSIZE);
+            }
+        }
+        break;
+
+    case eapSRP4:
+        PUTCHAR(EAPT_SRP, outp);
+        PUTCHAR(EAPSRP_LWRECHALLENGE, outp);
+        pcb->eap.es_challen = EAP_MIN_CHALLENGE_LENGTH +
+            magic_pow(EAP_MIN_MAX_POWER_OF_TWO_CHALLENGE_LENGTH);
+        magic_random_bytes(pcb->eap.es_challenge, pcb->eap.es_challen);
+        MEMCPY(outp, pcb->eap.es_challenge, pcb->eap.es_challen);
+        INCPTR(pcb->eap.es_challen, outp);
+        break;
 #endif /* USE_SRP */
 
-	default:
-		return;
-	}
+    default:
+        return;
+    }
 
-	outlen = (outp - (unsigned char*)p->payload) - PPP_HDRLEN;
-	PUTSHORT(outlen, lenloc);
+    outlen = (outp - (unsigned char*)p->payload) - PPP_HDRLEN;
+    PUTSHORT(outlen, lenloc);
 
-	pbuf_realloc(p, outlen + PPP_HDRLEN);
-	ppp_write(pcb, p);
+    pbuf_realloc(p, outlen + PPP_HDRLEN);
+    ppp_write(pcb, p);
 
-	pcb->eap.es_server.ea_requests++;
+    pcb->eap.es_server.ea_requests++;
 
-	if (pcb->settings.eap_timeout_time > 0)
-		TIMEOUT(eap_server_timeout, pcb, pcb->settings.eap_timeout_time);
+    if (pcb->settings.eap_timeout_time > 0)
+        TIMEOUT(eap_server_timeout, pcb, pcb->settings.eap_timeout_time);
 }
 
 /*
@@ -875,23 +875,23 @@ static void eap_send_request(ppp_pcb *pcb) {
  */
 void eap_authpeer(ppp_pcb *pcb, const char *localname) {
 
-	/* Save the name we're given. */
-	pcb->eap.es_server.ea_name = localname;
-	pcb->eap.es_server.ea_namelen = strlen(localname);
+    /* Save the name we're given. */
+    pcb->eap.es_server.ea_name = localname;
+    pcb->eap.es_server.ea_namelen = strlen(localname);
 
-	pcb->eap.es_savedtime = pcb->settings.eap_timeout_time;
+    pcb->eap.es_savedtime = pcb->settings.eap_timeout_time;
 
-	/* Lower layer up yet? */
-	if (pcb->eap.es_server.ea_state == eapInitial ||
-	    pcb->eap.es_server.ea_state == eapPending) {
-		pcb->eap.es_server.ea_state = eapPending;
-		return;
-	}
+    /* Lower layer up yet? */
+    if (pcb->eap.es_server.ea_state == eapInitial ||
+        pcb->eap.es_server.ea_state == eapPending) {
+        pcb->eap.es_server.ea_state = eapPending;
+        return;
+    }
 
-	pcb->eap.es_server.ea_state = eapPending;
+    pcb->eap.es_server.ea_state = eapPending;
 
-	/* ID number not updated here intentionally; hashed into M1 */
-	eap_send_request(pcb);
+    /* ID number not updated here intentionally; hashed into M1 */
+    eap_send_request(pcb);
 }
 
 /*
@@ -899,13 +899,13 @@ void eap_authpeer(ppp_pcb *pcb, const char *localname) {
  * expired.
  */
 static void eap_server_timeout(void *arg) {
-	ppp_pcb *pcb = (ppp_pcb*)arg;
+    ppp_pcb *pcb = (ppp_pcb*)arg;
 
-	if (!eap_server_active(pcb))
-		return;
+    if (!eap_server_active(pcb))
+        return;
 
-	/* EAP ID number must not change on timeout. */
-	eap_send_request(pcb);
+    /* EAP ID number must not change on timeout. */
+    eap_send_request(pcb);
 }
 
 /*
@@ -914,30 +914,30 @@ static void eap_server_timeout(void *arg) {
  * will restart the timer.  If it fails, then the link is dropped.
  */
 static void eap_rechallenge(void *arg) {
-	ppp_pcb *pcb = (ppp_pcb*)arg;
+    ppp_pcb *pcb = (ppp_pcb*)arg;
 
-	if (pcb->eap.es_server.ea_state != eapOpen &&
-	    pcb->eap.es_server.ea_state != eapSRP4)
-		return;
+    if (pcb->eap.es_server.ea_state != eapOpen &&
+        pcb->eap.es_server.ea_state != eapSRP4)
+        return;
 
-	pcb->eap.es_server.ea_requests = 0;
-	pcb->eap.es_server.ea_state = eapIdentify;
-	eap_figure_next_state(pcb, 0);
-	pcb->eap.es_server.ea_id++;
-	eap_send_request(pcb);
+    pcb->eap.es_server.ea_requests = 0;
+    pcb->eap.es_server.ea_state = eapIdentify;
+    eap_figure_next_state(pcb, 0);
+    pcb->eap.es_server.ea_id++;
+    eap_send_request(pcb);
 }
 
 static void srp_lwrechallenge(void *arg) {
-	ppp_pcb *pcb = (ppp_pcb*)arg;
+    ppp_pcb *pcb = (ppp_pcb*)arg;
 
-	if (pcb->eap.es_server.ea_state != eapOpen ||
-	    pcb->eap.es_server.ea_type != EAPT_SRP)
-		return;
+    if (pcb->eap.es_server.ea_state != eapOpen ||
+        pcb->eap.es_server.ea_type != EAPT_SRP)
+        return;
 
-	pcb->eap.es_server.ea_requests = 0;
-	pcb->eap.es_server.ea_state = eapSRP4;
-	pcb->eap.es_server.ea_id++;
-	eap_send_request(pcb);
+    pcb->eap.es_server.ea_requests = 0;
+    pcb->eap.es_server.ea_state = eapSRP4;
+    pcb->eap.es_server.ea_id++;
+    eap_send_request(pcb);
 }
 #endif /* PPP_SERVER */
 
@@ -950,9 +950,9 @@ static void srp_lwrechallenge(void *arg) {
  * thing.
  */
 static void eap_lowerup(ppp_pcb *pcb) {
-	pcb->eap.es_client.ea_state = eapClosed;
+    pcb->eap.es_client.ea_state = eapClosed;
 #if PPP_SERVER
-	pcb->eap.es_server.ea_state = eapClosed;
+    pcb->eap.es_server.ea_state = eapClosed;
 #endif /* PPP_SERVER */
 }
 
@@ -963,28 +963,28 @@ static void eap_lowerup(ppp_pcb *pcb) {
  */
 static void eap_lowerdown(ppp_pcb *pcb) {
 
-	if (eap_client_active(pcb) && pcb->settings.eap_req_time > 0) {
-		UNTIMEOUT(eap_client_timeout, pcb);
-	}
+    if (eap_client_active(pcb) && pcb->settings.eap_req_time > 0) {
+        UNTIMEOUT(eap_client_timeout, pcb);
+    }
 #if PPP_SERVER
-	if (eap_server_active(pcb)) {
-		if (pcb->settings.eap_timeout_time > 0) {
-			UNTIMEOUT(eap_server_timeout, pcb);
-		}
-	} else {
-		if ((pcb->eap.es_server.ea_state == eapOpen ||
-		    pcb->eap.es_server.ea_state == eapSRP4) &&
-		    pcb->eap.es_rechallenge > 0) {
-			UNTIMEOUT(eap_rechallenge, (void *)pcb);
-		}
-		if (pcb->eap.es_server.ea_state == eapOpen &&
-		    pcb->eap.es_lwrechallenge > 0) {
-			UNTIMEOUT(srp_lwrechallenge, (void *)pcb);
-		}
-	}
-
-	pcb->eap.es_client.ea_state = pcb->eap.es_server.ea_state = eapInitial;
-	pcb->eap.es_client.ea_requests = pcb->eap.es_server.ea_requests = 0;
+    if (eap_server_active(pcb)) {
+        if (pcb->settings.eap_timeout_time > 0) {
+            UNTIMEOUT(eap_server_timeout, pcb);
+        }
+    } else {
+        if ((pcb->eap.es_server.ea_state == eapOpen ||
+            pcb->eap.es_server.ea_state == eapSRP4) &&
+            pcb->eap.es_rechallenge > 0) {
+            UNTIMEOUT(eap_rechallenge, (void *)pcb);
+        }
+        if (pcb->eap.es_server.ea_state == eapOpen &&
+            pcb->eap.es_lwrechallenge > 0) {
+            UNTIMEOUT(srp_lwrechallenge, (void *)pcb);
+        }
+    }
+
+    pcb->eap.es_client.ea_state = pcb->eap.es_server.ea_state = eapInitial;
+    pcb->eap.es_client.ea_requests = pcb->eap.es_server.ea_requests = 0;
 #endif /* PPP_SERVER */
 }
 
@@ -996,87 +996,87 @@ static void eap_lowerdown(ppp_pcb *pcb) {
  */
 static void eap_protrej(ppp_pcb *pcb) {
 
-	if (eap_client_active(pcb)) {
-		ppp_error(("EAP authentication failed due to Protocol-Reject"));
-		auth_withpeer_fail(pcb, PPP_EAP);
-	}
+    if (eap_client_active(pcb)) {
+        ppp_error(("EAP authentication failed due to Protocol-Reject"));
+        auth_withpeer_fail(pcb, PPP_EAP);
+    }
 #if PPP_SERVER
-	if (eap_server_active(pcb)) {
-		ppp_error(("EAP authentication of peer failed on Protocol-Reject"));
-		auth_peer_fail(pcb, PPP_EAP);
-	}
+    if (eap_server_active(pcb)) {
+        ppp_error(("EAP authentication of peer failed on Protocol-Reject"));
+        auth_peer_fail(pcb, PPP_EAP);
+    }
 #endif /* PPP_SERVER */
-	eap_lowerdown(pcb);
+    eap_lowerdown(pcb);
 }
 
 /*
  * Format and send a regular EAP Response message.
  */
 static void eap_send_response(ppp_pcb *pcb, u_char id, u_char typenum, const u_char *str, int lenstr) {
-	struct pbuf *p;
-	u_char *outp;
-	int msglen;
-
-	msglen = EAP_HEADERLEN + sizeof (u_char) + lenstr;
-	p = pbuf_alloc(PBUF_RAW, (u16_t)(PPP_HDRLEN + msglen), PBUF_RAM);
-	if(NULL == p)
-		return;
-	if(p->tot_len != p->len) {
-		pbuf_free(p);
-		return;
-	}
-
-	outp = (u_char*)p->payload;
-
-	MAKEHEADER(outp, PPP_EAP);
-
-	PUTCHAR(EAP_RESPONSE, outp);
-	PUTCHAR(id, outp);
-	pcb->eap.es_client.ea_id = id;
-	PUTSHORT(msglen, outp);
-	PUTCHAR(typenum, outp);
-	if (lenstr > 0) {
-		MEMCPY(outp, str, lenstr);
-	}
-
-	ppp_write(pcb, p);
+    struct pbuf *p;
+    u_char *outp;
+    int msglen;
+
+    msglen = EAP_HEADERLEN + sizeof (u_char) + lenstr;
+    p = pbuf_alloc(PBUF_RAW, (u16_t)(PPP_HDRLEN + msglen), PBUF_RAM);
+    if(NULL == p)
+        return;
+    if(p->tot_len != p->len) {
+        pbuf_free(p);
+        return;
+    }
+
+    outp = (u_char*)p->payload;
+
+    MAKEHEADER(outp, PPP_EAP);
+
+    PUTCHAR(EAP_RESPONSE, outp);
+    PUTCHAR(id, outp);
+    pcb->eap.es_client.ea_id = id;
+    PUTSHORT(msglen, outp);
+    PUTCHAR(typenum, outp);
+    if (lenstr > 0) {
+        MEMCPY(outp, str, lenstr);
+    }
+
+    ppp_write(pcb, p);
 }
 
 /*
  * Format and send an MD5-Challenge EAP Response message.
  */
 static void eap_chap_response(ppp_pcb *pcb, u_char id, u_char *hash, const char *name, int namelen) {
-	struct pbuf *p;
-	u_char *outp;
-	int msglen;
-
-	msglen = EAP_HEADERLEN + 2 * sizeof (u_char) + MD5_SIGNATURE_SIZE +
-	    namelen;
-	p = pbuf_alloc(PBUF_RAW, (u16_t)(PPP_HDRLEN + msglen), PBUF_RAM);
-	if(NULL == p)
-		return;
-	if(p->tot_len != p->len) {
-		pbuf_free(p);
-		return;
-	}
-
-	outp = (u_char*)p->payload;
-    
-	MAKEHEADER(outp, PPP_EAP);
-
-	PUTCHAR(EAP_RESPONSE, outp);
-	PUTCHAR(id, outp);
-	pcb->eap.es_client.ea_id = id;
-	PUTSHORT(msglen, outp);
-	PUTCHAR(EAPT_MD5CHAP, outp);
-	PUTCHAR(MD5_SIGNATURE_SIZE, outp);
-	MEMCPY(outp, hash, MD5_SIGNATURE_SIZE);
-	INCPTR(MD5_SIGNATURE_SIZE, outp);
-	if (namelen > 0) {
-		MEMCPY(outp, name, namelen);
-	}
-
-	ppp_write(pcb, p);
+    struct pbuf *p;
+    u_char *outp;
+    int msglen;
+
+    msglen = EAP_HEADERLEN + 2 * sizeof (u_char) + MD5_SIGNATURE_SIZE +
+        namelen;
+    p = pbuf_alloc(PBUF_RAW, (u16_t)(PPP_HDRLEN + msglen), PBUF_RAM);
+    if(NULL == p)
+        return;
+    if(p->tot_len != p->len) {
+        pbuf_free(p);
+        return;
+    }
+
+    outp = (u_char*)p->payload;
+
+    MAKEHEADER(outp, PPP_EAP);
+
+    PUTCHAR(EAP_RESPONSE, outp);
+    PUTCHAR(id, outp);
+    pcb->eap.es_client.ea_id = id;
+    PUTSHORT(msglen, outp);
+    PUTCHAR(EAPT_MD5CHAP, outp);
+    PUTCHAR(MD5_SIGNATURE_SIZE, outp);
+    MEMCPY(outp, hash, MD5_SIGNATURE_SIZE);
+    INCPTR(MD5_SIGNATURE_SIZE, outp);
+    if (namelen > 0) {
+        MEMCPY(outp, name, namelen);
+    }
+
+    ppp_write(pcb, p);
 }
 
 #ifdef USE_SRP
@@ -1091,35 +1091,35 @@ u_char subtypenum;
 u_char *str;
 int lenstr;
 {
-	ppp_pcb *pcb = &ppp_pcb_list[pcb->eap.es_unit];
-	struct pbuf *p;
-	u_char *outp;
-	int msglen;
-
-	msglen = EAP_HEADERLEN + 2 * sizeof (u_char) + lenstr;
-	p = pbuf_alloc(PBUF_RAW, (u16_t)(PPP_HDRLEN + msglen), PBUF_RAM);
-	if(NULL == p)
-		return;
-	if(p->tot_len != p->len) {
-		pbuf_free(p);
-		return;
-	}
-
-	outp = p->payload;
-
-	MAKEHEADER(outp, PPP_EAP);
-
-	PUTCHAR(EAP_RESPONSE, outp);
-	PUTCHAR(id, outp);
-	pcb->eap.es_client.ea_id = id;
-	PUTSHORT(msglen, outp);
-	PUTCHAR(EAPT_SRP, outp);
-	PUTCHAR(subtypenum, outp);
-	if (lenstr > 0) {
-		MEMCPY(outp, str, lenstr);
-	}
-
-	ppp_write(pcb, p);
+    ppp_pcb *pcb = &ppp_pcb_list[pcb->eap.es_unit];
+    struct pbuf *p;
+    u_char *outp;
+    int msglen;
+
+    msglen = EAP_HEADERLEN + 2 * sizeof (u_char) + lenstr;
+    p = pbuf_alloc(PBUF_RAW, (u16_t)(PPP_HDRLEN + msglen), PBUF_RAM);
+    if(NULL == p)
+        return;
+    if(p->tot_len != p->len) {
+        pbuf_free(p);
+        return;
+    }
+
+    outp = p->payload;
+
+    MAKEHEADER(outp, PPP_EAP);
+
+    PUTCHAR(EAP_RESPONSE, outp);
+    PUTCHAR(id, outp);
+    pcb->eap.es_client.ea_id = id;
+    PUTSHORT(msglen, outp);
+    PUTCHAR(EAPT_SRP, outp);
+    PUTCHAR(subtypenum, outp);
+    if (lenstr > 0) {
+        MEMCPY(outp, str, lenstr);
+    }
+
+    ppp_write(pcb, p);
 }
 
 /*
@@ -1132,118 +1132,118 @@ u_char id;
 u32_t flags;
 u_char *str;
 {
-	ppp_pcb *pcb = &ppp_pcb_list[pcb->eap.es_unit];
-	struct pbuf *p;
-	u_char *outp;
-	int msglen;
-
-	msglen = EAP_HEADERLEN + 2 * sizeof (u_char) + sizeof (u32_t) +
-	    SHA_DIGESTSIZE;
-	p = pbuf_alloc(PBUF_RAW, (u16_t)(PPP_HDRLEN + msglen), PBUF_RAM);
-	if(NULL == p)
-		return;
-	if(p->tot_len != p->len) {
-		pbuf_free(p);
-		return;
-	}
-
-	outp = p->payload;
-
-	MAKEHEADER(outp, PPP_EAP);
-
-	PUTCHAR(EAP_RESPONSE, outp);
-	PUTCHAR(id, outp);
-	pcb->eap.es_client.ea_id = id;
-	PUTSHORT(msglen, outp);
-	PUTCHAR(EAPT_SRP, outp);
-	PUTCHAR(EAPSRP_CVALIDATOR, outp);
-	PUTLONG(flags, outp);
-	MEMCPY(outp, str, SHA_DIGESTSIZE);
-
-	ppp_write(pcb, p);
+    ppp_pcb *pcb = &ppp_pcb_list[pcb->eap.es_unit];
+    struct pbuf *p;
+    u_char *outp;
+    int msglen;
+
+    msglen = EAP_HEADERLEN + 2 * sizeof (u_char) + sizeof (u32_t) +
+        SHA_DIGESTSIZE;
+    p = pbuf_alloc(PBUF_RAW, (u16_t)(PPP_HDRLEN + msglen), PBUF_RAM);
+    if(NULL == p)
+        return;
+    if(p->tot_len != p->len) {
+        pbuf_free(p);
+        return;
+    }
+
+    outp = p->payload;
+
+    MAKEHEADER(outp, PPP_EAP);
+
+    PUTCHAR(EAP_RESPONSE, outp);
+    PUTCHAR(id, outp);
+    pcb->eap.es_client.ea_id = id;
+    PUTSHORT(msglen, outp);
+    PUTCHAR(EAPT_SRP, outp);
+    PUTCHAR(EAPSRP_CVALIDATOR, outp);
+    PUTLONG(flags, outp);
+    MEMCPY(outp, str, SHA_DIGESTSIZE);
+
+    ppp_write(pcb, p);
 }
 #endif /* USE_SRP */
 
 static void eap_send_nak(ppp_pcb *pcb, u_char id, u_char type) {
-	struct pbuf *p;
-	u_char *outp;
-	int msglen;
-
-	msglen = EAP_HEADERLEN + 2 * sizeof (u_char);
-	p = pbuf_alloc(PBUF_RAW, (u16_t)(PPP_HDRLEN + msglen), PBUF_RAM);
-	if(NULL == p)
-		return;
-	if(p->tot_len != p->len) {
-		pbuf_free(p);
-		return;
-	}
-
-	outp = (u_char*)p->payload;
-
-	MAKEHEADER(outp, PPP_EAP);
-
-	PUTCHAR(EAP_RESPONSE, outp);
-	PUTCHAR(id, outp);
-	pcb->eap.es_client.ea_id = id;
-	PUTSHORT(msglen, outp);
-	PUTCHAR(EAPT_NAK, outp);
-	PUTCHAR(type, outp);
-
-	ppp_write(pcb, p);
+    struct pbuf *p;
+    u_char *outp;
+    int msglen;
+
+    msglen = EAP_HEADERLEN + 2 * sizeof (u_char);
+    p = pbuf_alloc(PBUF_RAW, (u16_t)(PPP_HDRLEN + msglen), PBUF_RAM);
+    if(NULL == p)
+        return;
+    if(p->tot_len != p->len) {
+        pbuf_free(p);
+        return;
+    }
+
+    outp = (u_char*)p->payload;
+
+    MAKEHEADER(outp, PPP_EAP);
+
+    PUTCHAR(EAP_RESPONSE, outp);
+    PUTCHAR(id, outp);
+    pcb->eap.es_client.ea_id = id;
+    PUTSHORT(msglen, outp);
+    PUTCHAR(EAPT_NAK, outp);
+    PUTCHAR(type, outp);
+
+    ppp_write(pcb, p);
 }
 
 #ifdef USE_SRP
 static char *
 name_of_pn_file()
 {
-	char *user, *path, *file;
-	struct passwd *pw;
-	size_t pl;
-	static bool pnlogged = 0;
-
-	pw = getpwuid(getuid());
-	if (pw == NULL || (user = pw->pw_dir) == NULL || user[0] == 0) {
-		errno = EINVAL;
-		return (NULL);
-	}
-	file = _PATH_PSEUDONYM;
-	pl = strlen(user) + strlen(file) + 2;
-	path = malloc(pl);
-	if (path == NULL)
-		return (NULL);
-	(void) slprintf(path, pl, "%s/%s", user, file);
-	if (!pnlogged) {
-		ppp_dbglog(("pseudonym file: %s", path));
-		pnlogged = 1;
-	}
-	return (path);
+    char *user, *path, *file;
+    struct passwd *pw;
+    size_t pl;
+    static bool pnlogged = 0;
+
+    pw = getpwuid(getuid());
+    if (pw == NULL || (user = pw->pw_dir) == NULL || user[0] == 0) {
+        errno = EINVAL;
+        return (NULL);
+    }
+    file = _PATH_PSEUDONYM;
+    pl = strlen(user) + strlen(file) + 2;
+    path = malloc(pl);
+    if (path == NULL)
+        return (NULL);
+    (void) slprintf(path, pl, "%s/%s", user, file);
+    if (!pnlogged) {
+        ppp_dbglog(("pseudonym file: %s", path));
+        pnlogged = 1;
+    }
+    return (path);
 }
 
 static int
 open_pn_file(modebits)
 mode_t modebits;
 {
-	char *path;
-	int fd, err;
-
-	if ((path = name_of_pn_file()) == NULL)
-		return (-1);
-	fd = open(path, modebits, S_IRUSR | S_IWUSR);
-	err = errno;
-	free(path);
-	errno = err;
-	return (fd);
+    char *path;
+    int fd, err;
+
+    if ((path = name_of_pn_file()) == NULL)
+        return (-1);
+    fd = open(path, modebits, S_IRUSR | S_IWUSR);
+    err = errno;
+    free(path);
+    errno = err;
+    return (fd);
 }
 
 static void
 remove_pn_file()
 {
-	char *path;
+    char *path;
 
-	if ((path = name_of_pn_file()) != NULL) {
-		(void) unlink(path);
-		(void) free(path);
-	}
+    if ((path = name_of_pn_file()) != NULL) {
+        (void) unlink(path);
+        (void) free(path);
+    }
 }
 
 static void
@@ -1252,56 +1252,56 @@ eap_state *esp;
 u_char *inp;
 int len, id;
 {
-	u_char val;
-	u_char *datp, *digp;
-	SHA1_CTX ctxt;
-	u_char dig[SHA_DIGESTSIZE];
-	int dsize, fd, olen = len;
-
-	/*
-	 * Do the decoding by working backwards.  This eliminates the need
-	 * to save the decoded output in a separate buffer.
-	 */
-	val = id;
-	while (len > 0) {
-		if ((dsize = len % SHA_DIGESTSIZE) == 0)
-			dsize = SHA_DIGESTSIZE;
-		len -= dsize;
-		datp = inp + len;
-		SHA1Init(&ctxt);
-		SHA1Update(&ctxt, &val, 1);
-		SHA1Update(&ctxt, pcb->eap.es_client.ea_skey, SESSION_KEY_LEN);
-		if (len > 0) {
-			SHA1Update(&ctxt, datp, SHA_DIGESTSIZE);
-		} else {
-			SHA1Update(&ctxt, pcb->eap.es_client.ea_name,
-			    pcb->eap.es_client.ea_namelen);
-		}
-		SHA1Final(dig, &ctxt);
-		for (digp = dig; digp < dig + SHA_DIGESTSIZE; digp++)
-			*datp++ ^= *digp;
-	}
-
-	/* Now check that the result is sane */
-	if (olen <= 0 || *inp + 1 > olen) {
-		ppp_dbglog(("EAP: decoded pseudonym is unusable <%.*B>", olen, inp));
-		return;
-	}
-
-	/* Save it away */
-	fd = open_pn_file(O_WRONLY | O_CREAT | O_TRUNC);
-	if (fd < 0) {
-		ppp_dbglog(("EAP: error saving pseudonym: %m"));
-		return;
-	}
-	len = write(fd, inp + 1, *inp);
-	if (close(fd) != -1 && len == *inp) {
-		ppp_dbglog(("EAP: saved pseudonym"));
-		pcb->eap.es_usedpseudo = 0;
-	} else {
-		ppp_dbglog(("EAP: failed to save pseudonym"));
-		remove_pn_file();
-	}
+    u_char val;
+    u_char *datp, *digp;
+    SHA1_CTX ctxt;
+    u_char dig[SHA_DIGESTSIZE];
+    int dsize, fd, olen = len;
+
+    /*
+     * Do the decoding by working backwards.  This eliminates the need
+     * to save the decoded output in a separate buffer.
+     */
+    val = id;
+    while (len > 0) {
+        if ((dsize = len % SHA_DIGESTSIZE) == 0)
+            dsize = SHA_DIGESTSIZE;
+        len -= dsize;
+        datp = inp + len;
+        SHA1Init(&ctxt);
+        SHA1Update(&ctxt, &val, 1);
+        SHA1Update(&ctxt, pcb->eap.es_client.ea_skey, SESSION_KEY_LEN);
+        if (len > 0) {
+            SHA1Update(&ctxt, datp, SHA_DIGESTSIZE);
+        } else {
+            SHA1Update(&ctxt, pcb->eap.es_client.ea_name,
+                pcb->eap.es_client.ea_namelen);
+        }
+        SHA1Final(dig, &ctxt);
+        for (digp = dig; digp < dig + SHA_DIGESTSIZE; digp++)
+            *datp++ ^= *digp;
+    }
+
+    /* Now check that the result is sane */
+    if (olen <= 0 || *inp + 1 > olen) {
+        ppp_dbglog(("EAP: decoded pseudonym is unusable <%.*B>", olen, inp));
+        return;
+    }
+
+    /* Save it away */
+    fd = open_pn_file(O_WRONLY | O_CREAT | O_TRUNC);
+    if (fd < 0) {
+        ppp_dbglog(("EAP: error saving pseudonym: %m"));
+        return;
+    }
+    len = write(fd, inp + 1, *inp);
+    if (close(fd) != -1 && len == *inp) {
+        ppp_dbglog(("EAP: saved pseudonym"));
+        pcb->eap.es_usedpseudo = 0;
+    } else {
+        ppp_dbglog(("EAP: failed to save pseudonym"));
+        remove_pn_file();
+    }
 }
 #endif /* USE_SRP */
 
@@ -1309,418 +1309,418 @@ int len, id;
  * eap_request - Receive EAP Request message (client mode).
  */
 static void eap_request(ppp_pcb *pcb, u_char *inp, int id, int len) {
-	u_char typenum;
-	u_char vallen;
-	int secret_len;
-	char secret[MAXSECRETLEN];
-	char rhostname[MAXNAMELEN];
-	lwip_md5_context mdContext;
-	u_char hash[MD5_SIGNATURE_SIZE];
+    u_char typenum;
+    u_char vallen;
+    int secret_len;
+    char secret[MAXSECRETLEN];
+    char rhostname[MAXNAMELEN];
+    lwip_md5_context mdContext;
+    u_char hash[MD5_SIGNATURE_SIZE];
 #ifdef USE_SRP
-	struct t_client *tc;
-	struct t_num sval, gval, Nval, *Ap, Bval;
-	u_char vals[2];
-	SHA1_CTX ctxt;
-	u_char dig[SHA_DIGESTSIZE];
-	int fd;
+    struct t_client *tc;
+    struct t_num sval, gval, Nval, *Ap, Bval;
+    u_char vals[2];
+    SHA1_CTX ctxt;
+    u_char dig[SHA_DIGESTSIZE];
+    int fd;
 #endif /* USE_SRP */
 
-	/*
-	 * Ignore requests if we're not open
-	 */
-	if (pcb->eap.es_client.ea_state <= eapClosed)
-		return;
-
-	/*
-	 * Note: we update es_client.ea_id *only if* a Response
-	 * message is being generated.  Otherwise, we leave it the
-	 * same for duplicate detection purposes.
-	 */
-
-	pcb->eap.es_client.ea_requests++;
-	if (pcb->settings.eap_allow_req != 0 &&
-	    pcb->eap.es_client.ea_requests > pcb->settings.eap_allow_req) {
-		ppp_info(("EAP: received too many Request messages"));
-		if (pcb->settings.eap_req_time > 0) {
-			UNTIMEOUT(eap_client_timeout, pcb);
-		}
-		auth_withpeer_fail(pcb, PPP_EAP);
-		return;
-	}
-
-	if (len <= 0) {
-		ppp_error(("EAP: empty Request message discarded"));
-		return;
-	}
-
-	GETCHAR(typenum, inp);
-	len--;
-
-	switch (typenum) {
-	case EAPT_IDENTITY:
-		if (len > 0)
-			ppp_info(("EAP: Identity prompt \"%.*q\"", len, inp));
+    /*
+     * Ignore requests if we're not open
+     */
+    if (pcb->eap.es_client.ea_state <= eapClosed)
+        return;
+
+    /*
+     * Note: we update es_client.ea_id *only if* a Response
+     * message is being generated.  Otherwise, we leave it the
+     * same for duplicate detection purposes.
+     */
+
+    pcb->eap.es_client.ea_requests++;
+    if (pcb->settings.eap_allow_req != 0 &&
+        pcb->eap.es_client.ea_requests > pcb->settings.eap_allow_req) {
+        ppp_info(("EAP: received too many Request messages"));
+        if (pcb->settings.eap_req_time > 0) {
+            UNTIMEOUT(eap_client_timeout, pcb);
+        }
+        auth_withpeer_fail(pcb, PPP_EAP);
+        return;
+    }
+
+    if (len <= 0) {
+        ppp_error(("EAP: empty Request message discarded"));
+        return;
+    }
+
+    GETCHAR(typenum, inp);
+    len--;
+
+    switch (typenum) {
+    case EAPT_IDENTITY:
+        if (len > 0)
+            ppp_info(("EAP: Identity prompt \"%.*q\"", len, inp));
 #ifdef USE_SRP
-		if (pcb->eap.es_usepseudo &&
-		    (pcb->eap.es_usedpseudo == 0 ||
-			(pcb->eap.es_usedpseudo == 1 &&
-			    id == pcb->eap.es_client.ea_id))) {
-			pcb->eap.es_usedpseudo = 1;
-			/* Try to get a pseudonym */
-			if ((fd = open_pn_file(O_RDONLY)) >= 0) {
-				strcpy(rhostname, SRP_PSEUDO_ID);
-				len = read(fd, rhostname + SRP_PSEUDO_LEN,
-				    sizeof (rhostname) - SRP_PSEUDO_LEN);
-				/* XXX NAI unsupported */
-				if (len > 0) {
-					eap_send_response(pcb, id, typenum,
-					    rhostname, len + SRP_PSEUDO_LEN);
-				}
-				(void) close(fd);
-				if (len > 0)
-					break;
-			}
-		}
-		/* Stop using pseudonym now. */
-		if (pcb->eap.es_usepseudo && pcb->eap.es_usedpseudo != 2) {
-			remove_pn_file();
-			pcb->eap.es_usedpseudo = 2;
-		}
+        if (pcb->eap.es_usepseudo &&
+            (pcb->eap.es_usedpseudo == 0 ||
+            (pcb->eap.es_usedpseudo == 1 &&
+                id == pcb->eap.es_client.ea_id))) {
+            pcb->eap.es_usedpseudo = 1;
+            /* Try to get a pseudonym */
+            if ((fd = open_pn_file(O_RDONLY)) >= 0) {
+                strcpy(rhostname, SRP_PSEUDO_ID);
+                len = read(fd, rhostname + SRP_PSEUDO_LEN,
+                    sizeof (rhostname) - SRP_PSEUDO_LEN);
+                /* XXX NAI unsupported */
+                if (len > 0) {
+                    eap_send_response(pcb, id, typenum,
+                        rhostname, len + SRP_PSEUDO_LEN);
+                }
+                (void) close(fd);
+                if (len > 0)
+                    break;
+            }
+        }
+        /* Stop using pseudonym now. */
+        if (pcb->eap.es_usepseudo && pcb->eap.es_usedpseudo != 2) {
+            remove_pn_file();
+            pcb->eap.es_usedpseudo = 2;
+        }
 #endif /* USE_SRP */
-		eap_send_response(pcb, id, typenum, (const u_char*)pcb->eap.es_client.ea_name,
-		    pcb->eap.es_client.ea_namelen);
-		break;
-
-	case EAPT_NOTIFICATION:
-		if (len > 0)
-			ppp_info(("EAP: Notification \"%.*q\"", len, inp));
-		eap_send_response(pcb, id, typenum, NULL, 0);
-		break;
-
-	case EAPT_NAK:
-		/*
-		 * Avoid the temptation to send Response Nak in reply
-		 * to Request Nak here.  It can only lead to trouble.
-		 */
-		ppp_warn(("EAP: unexpected Nak in Request; ignored"));
-		/* Return because we're waiting for something real. */
-		return;
-
-	case EAPT_MD5CHAP:
-		if (len < 1) {
-			ppp_error(("EAP: received MD5-Challenge with no data"));
-			/* Bogus request; wait for something real. */
-			return;
-		}
-		GETCHAR(vallen, inp);
-		len--;
-		if (vallen < 8 || vallen > len) {
-			ppp_error(("EAP: MD5-Challenge with bad length %d (8..%d)",
-			    vallen, len));
-			/* Try something better. */
-			eap_send_nak(pcb, id, EAPT_SRP);
-			break;
-		}
-
-		/* Not so likely to happen. */
-		if (len - vallen >= (int)sizeof (rhostname)) {
-			ppp_dbglog(("EAP: trimming really long peer name down"));
-			MEMCPY(rhostname, inp + vallen, sizeof (rhostname) - 1);
-			rhostname[sizeof (rhostname) - 1] = '\0';
-		} else {
-			MEMCPY(rhostname, inp + vallen, len - vallen);
-			rhostname[len - vallen] = '\0';
-		}
+        eap_send_response(pcb, id, typenum, (const u_char*)pcb->eap.es_client.ea_name,
+            pcb->eap.es_client.ea_namelen);
+        break;
+
+    case EAPT_NOTIFICATION:
+        if (len > 0)
+            ppp_info(("EAP: Notification \"%.*q\"", len, inp));
+        eap_send_response(pcb, id, typenum, NULL, 0);
+        break;
+
+    case EAPT_NAK:
+        /*
+         * Avoid the temptation to send Response Nak in reply
+         * to Request Nak here.  It can only lead to trouble.
+         */
+        ppp_warn(("EAP: unexpected Nak in Request; ignored"));
+        /* Return because we're waiting for something real. */
+        return;
+
+    case EAPT_MD5CHAP:
+        if (len < 1) {
+            ppp_error(("EAP: received MD5-Challenge with no data"));
+            /* Bogus request; wait for something real. */
+            return;
+        }
+        GETCHAR(vallen, inp);
+        len--;
+        if (vallen < 8 || vallen > len) {
+            ppp_error(("EAP: MD5-Challenge with bad length %d (8..%d)",
+                vallen, len));
+            /* Try something better. */
+            eap_send_nak(pcb, id, EAPT_SRP);
+            break;
+        }
+
+        /* Not so likely to happen. */
+        if (len - vallen >= (int)sizeof (rhostname)) {
+            ppp_dbglog(("EAP: trimming really long peer name down"));
+            MEMCPY(rhostname, inp + vallen, sizeof (rhostname) - 1);
+            rhostname[sizeof (rhostname) - 1] = '\0';
+        } else {
+            MEMCPY(rhostname, inp + vallen, len - vallen);
+            rhostname[len - vallen] = '\0';
+        }
 
 #if PPP_REMOTENAME
-		/* In case the remote doesn't give us his name. */
-		if (pcb->settings.explicit_remote ||
-		    (pcb->settings.remote_name[0] != '\0' && vallen == len))
-			strlcpy(rhostname, pcb->settings.remote_name, sizeof (rhostname));
+        /* In case the remote doesn't give us his name. */
+        if (pcb->settings.explicit_remote ||
+            (pcb->settings.remote_name[0] != '\0' && vallen == len))
+            strlcpy(rhostname, pcb->settings.remote_name, sizeof (rhostname));
 #endif /* PPP_REMOTENAME */
 
-		/*
-		 * Get the secret for authenticating ourselves with
-		 * the specified host.
-		 */
-		if (!get_secret(pcb, pcb->eap.es_client.ea_name,
-		    rhostname, secret, &secret_len, 0)) {
-			ppp_dbglog(("EAP: no MD5 secret for auth to %q", rhostname));
-			eap_send_nak(pcb, id, EAPT_SRP);
-			break;
-		}
-		lwip_md5_init(&mdContext);
-		lwip_md5_starts(&mdContext);
-		typenum = id;
-		lwip_md5_update(&mdContext, &typenum, 1);
-		lwip_md5_update(&mdContext, (u_char *)secret, secret_len);
-		BZERO(secret, sizeof (secret));
-		lwip_md5_update(&mdContext, inp, vallen);
-		lwip_md5_finish(&mdContext, hash);
-		lwip_md5_free(&mdContext);
-		eap_chap_response(pcb, id, hash, pcb->eap.es_client.ea_name,
-		    pcb->eap.es_client.ea_namelen);
-		break;
+        /*
+         * Get the secret for authenticating ourselves with
+         * the specified host.
+         */
+        if (!get_secret(pcb, pcb->eap.es_client.ea_name,
+            rhostname, secret, &secret_len, 0)) {
+            ppp_dbglog(("EAP: no MD5 secret for auth to %q", rhostname));
+            eap_send_nak(pcb, id, EAPT_SRP);
+            break;
+        }
+        lwip_md5_init(&mdContext);
+        lwip_md5_starts(&mdContext);
+        typenum = id;
+        lwip_md5_update(&mdContext, &typenum, 1);
+        lwip_md5_update(&mdContext, (u_char *)secret, secret_len);
+        BZERO(secret, sizeof (secret));
+        lwip_md5_update(&mdContext, inp, vallen);
+        lwip_md5_finish(&mdContext, hash);
+        lwip_md5_free(&mdContext);
+        eap_chap_response(pcb, id, hash, pcb->eap.es_client.ea_name,
+            pcb->eap.es_client.ea_namelen);
+        break;
 
 #ifdef USE_SRP
-	case EAPT_SRP:
-		if (len < 1) {
-			ppp_error(("EAP: received empty SRP Request"));
-			/* Bogus request; wait for something real. */
-			return;
-		}
-
-		/* Get subtype */
-		GETCHAR(vallen, inp);
-		len--;
-		switch (vallen) {
-		case EAPSRP_CHALLENGE:
-			tc = NULL;
-			if (pcb->eap.es_client.ea_session != NULL) {
-				tc = (struct t_client *)pcb->eap.es_client.
-				    ea_session;
-				/*
-				 * If this is a new challenge, then start
-				 * over with a new client session context.
-				 * Otherwise, just resend last response.
-				 */
-				if (id != pcb->eap.es_client.ea_id) {
-					t_clientclose(tc);
-					pcb->eap.es_client.ea_session = NULL;
-					tc = NULL;
-				}
-			}
-			/* No session key just yet */
-			pcb->eap.es_client.ea_skey = NULL;
-			if (tc == NULL) {
-				int rhostnamelen;
-
-				GETCHAR(vallen, inp);
-				len--;
-				if (vallen >= len) {
-					ppp_error(("EAP: badly-formed SRP Challenge"
-					    " (name)"));
-					/* Ignore badly-formed messages */
-					return;
-				}
-				MEMCPY(rhostname, inp, vallen);
-				rhostname[vallen] = '\0';
-				INCPTR(vallen, inp);
-				len -= vallen;
-
-				/*
-				 * In case the remote doesn't give us his name,
-				 * use configured name.
-				 */
-				if (explicit_remote ||
-				    (remote_name[0] != '\0' && vallen == 0)) {
-					strlcpy(rhostname, remote_name,
-					    sizeof (rhostname));
-				}
-
-				rhostnamelen = (int)strlen(rhostname);
-				if (rhostnamelen > MAXNAMELEN) {
-					rhostnamelen = MAXNAMELEN;
-				}
-				MEMCPY(pcb->eap.es_client.ea_peer, rhostname, rhostnamelen);
-				pcb->eap.es_client.ea_peer[rhostnamelen] = '\0';
-				pcb->eap.es_client.ea_peerlen = rhostnamelen;
-
-				GETCHAR(vallen, inp);
-				len--;
-				if (vallen >= len) {
-					ppp_error(("EAP: badly-formed SRP Challenge"
-					    " (s)"));
-					/* Ignore badly-formed messages */
-					return;
-				}
-				sval.data = inp;
-				sval.len = vallen;
-				INCPTR(vallen, inp);
-				len -= vallen;
-
-				GETCHAR(vallen, inp);
-				len--;
-				if (vallen > len) {
-					ppp_error(("EAP: badly-formed SRP Challenge"
-					    " (g)"));
-					/* Ignore badly-formed messages */
-					return;
-				}
-				/* If no generator present, then use value 2 */
-				if (vallen == 0) {
-					gval.data = (u_char *)"\002";
-					gval.len = 1;
-				} else {
-					gval.data = inp;
-					gval.len = vallen;
-				}
-				INCPTR(vallen, inp);
-				len -= vallen;
-
-				/*
-				 * If no modulus present, then use well-known
-				 * value.
-				 */
-				if (len == 0) {
-					Nval.data = (u_char *)wkmodulus;
-					Nval.len = sizeof (wkmodulus);
-				} else {
-					Nval.data = inp;
-					Nval.len = len;
-				}
-				tc = t_clientopen(pcb->eap.es_client.ea_name,
-				    &Nval, &gval, &sval);
-				if (tc == NULL) {
-					eap_send_nak(pcb, id, EAPT_MD5CHAP);
-					break;
-				}
-				pcb->eap.es_client.ea_session = (void *)tc;
-
-				/* Add Challenge ID & type to verifier */
-				vals[0] = id;
-				vals[1] = EAPT_SRP;
-				t_clientaddexdata(tc, vals, 2);
-			}
-			Ap = t_clientgenexp(tc);
-			eap_srp_response(esp, id, EAPSRP_CKEY, Ap->data,
-			    Ap->len);
-			break;
-
-		case EAPSRP_SKEY:
-			tc = (struct t_client *)pcb->eap.es_client.ea_session;
-			if (tc == NULL) {
-				ppp_warn(("EAP: peer sent Subtype 2 without 1"));
-				eap_send_nak(pcb, id, EAPT_MD5CHAP);
-				break;
-			}
-			if (pcb->eap.es_client.ea_skey != NULL) {
-				/*
-				 * ID number should not change here.  Warn
-				 * if it does (but otherwise ignore).
-				 */
-				if (id != pcb->eap.es_client.ea_id) {
-					ppp_warn(("EAP: ID changed from %d to %d "
-					    "in SRP Subtype 2 rexmit",
-					    pcb->eap.es_client.ea_id, id));
-				}
-			} else {
-				if (get_srp_secret(pcb->eap.es_unit,
-				    pcb->eap.es_client.ea_name,
-				    pcb->eap.es_client.ea_peer, secret, 0) == 0) {
-					/*
-					 * Can't work with this peer because
-					 * the secret is missing.  Just give
-					 * up.
-					 */
-					eap_send_nak(pcb, id, EAPT_MD5CHAP);
-					break;
-				}
-				Bval.data = inp;
-				Bval.len = len;
-				t_clientpasswd(tc, secret);
-				BZERO(secret, sizeof (secret));
-				pcb->eap.es_client.ea_skey =
-				    t_clientgetkey(tc, &Bval);
-				if (pcb->eap.es_client.ea_skey == NULL) {
-					/* Server is rogue; stop now */
-					ppp_error(("EAP: SRP server is rogue"));
-					goto client_failure;
-				}
-			}
-			eap_srpval_response(esp, id, SRPVAL_EBIT,
-			    t_clientresponse(tc));
-			break;
-
-		case EAPSRP_SVALIDATOR:
-			tc = (struct t_client *)pcb->eap.es_client.ea_session;
-			if (tc == NULL || pcb->eap.es_client.ea_skey == NULL) {
-				ppp_warn(("EAP: peer sent Subtype 3 without 1/2"));
-				eap_send_nak(pcb, id, EAPT_MD5CHAP);
-				break;
-			}
-			/*
-			 * If we're already open, then this ought to be a
-			 * duplicate.  Otherwise, check that the server is
-			 * who we think it is.
-			 */
-			if (pcb->eap.es_client.ea_state == eapOpen) {
-				if (id != pcb->eap.es_client.ea_id) {
-					ppp_warn(("EAP: ID changed from %d to %d "
-					    "in SRP Subtype 3 rexmit",
-					    pcb->eap.es_client.ea_id, id));
-				}
-			} else {
-				len -= sizeof (u32_t) + SHA_DIGESTSIZE;
-				if (len < 0 || t_clientverify(tc, inp +
-					sizeof (u32_t)) != 0) {
-					ppp_error(("EAP: SRP server verification "
-					    "failed"));
-					goto client_failure;
-				}
-				GETLONG(pcb->eap.es_client.ea_keyflags, inp);
-				/* Save pseudonym if user wants it. */
-				if (len > 0 && pcb->eap.es_usepseudo) {
-					INCPTR(SHA_DIGESTSIZE, inp);
-					write_pseudonym(esp, inp, len, id);
-				}
-			}
-			/*
-			 * We've verified our peer.  We're now mostly done,
-			 * except for waiting on the regular EAP Success
-			 * message.
-			 */
-			eap_srp_response(esp, id, EAPSRP_ACK, NULL, 0);
-			break;
-
-		case EAPSRP_LWRECHALLENGE:
-			if (len < 4) {
-				ppp_warn(("EAP: malformed Lightweight rechallenge"));
-				return;
-			}
-			SHA1Init(&ctxt);
-			vals[0] = id;
-			SHA1Update(&ctxt, vals, 1);
-			SHA1Update(&ctxt, pcb->eap.es_client.ea_skey,
-			    SESSION_KEY_LEN);
-			SHA1Update(&ctxt, inp, len);
-			SHA1Update(&ctxt, pcb->eap.es_client.ea_name,
-			    pcb->eap.es_client.ea_namelen);
-			SHA1Final(dig, &ctxt);
-			eap_srp_response(esp, id, EAPSRP_LWRECHALLENGE, dig,
-			    SHA_DIGESTSIZE);
-			break;
-
-		default:
-			ppp_error(("EAP: unknown SRP Subtype %d", vallen));
-			eap_send_nak(pcb, id, EAPT_MD5CHAP);
-			break;
-		}
-		break;
+    case EAPT_SRP:
+        if (len < 1) {
+            ppp_error(("EAP: received empty SRP Request"));
+            /* Bogus request; wait for something real. */
+            return;
+        }
+
+        /* Get subtype */
+        GETCHAR(vallen, inp);
+        len--;
+        switch (vallen) {
+        case EAPSRP_CHALLENGE:
+            tc = NULL;
+            if (pcb->eap.es_client.ea_session != NULL) {
+                tc = (struct t_client *)pcb->eap.es_client.
+                    ea_session;
+                /*
+                 * If this is a new challenge, then start
+                 * over with a new client session context.
+                 * Otherwise, just resend last response.
+                 */
+                if (id != pcb->eap.es_client.ea_id) {
+                    t_clientclose(tc);
+                    pcb->eap.es_client.ea_session = NULL;
+                    tc = NULL;
+                }
+            }
+            /* No session key just yet */
+            pcb->eap.es_client.ea_skey = NULL;
+            if (tc == NULL) {
+                int rhostnamelen;
+
+                GETCHAR(vallen, inp);
+                len--;
+                if (vallen >= len) {
+                    ppp_error(("EAP: badly-formed SRP Challenge"
+                        " (name)"));
+                    /* Ignore badly-formed messages */
+                    return;
+                }
+                MEMCPY(rhostname, inp, vallen);
+                rhostname[vallen] = '\0';
+                INCPTR(vallen, inp);
+                len -= vallen;
+
+                /*
+                 * In case the remote doesn't give us his name,
+                 * use configured name.
+                 */
+                if (explicit_remote ||
+                    (remote_name[0] != '\0' && vallen == 0)) {
+                    strlcpy(rhostname, remote_name,
+                        sizeof (rhostname));
+                }
+
+                rhostnamelen = (int)strlen(rhostname);
+                if (rhostnamelen > MAXNAMELEN) {
+                    rhostnamelen = MAXNAMELEN;
+                }
+                MEMCPY(pcb->eap.es_client.ea_peer, rhostname, rhostnamelen);
+                pcb->eap.es_client.ea_peer[rhostnamelen] = '\0';
+                pcb->eap.es_client.ea_peerlen = rhostnamelen;
+
+                GETCHAR(vallen, inp);
+                len--;
+                if (vallen >= len) {
+                    ppp_error(("EAP: badly-formed SRP Challenge"
+                        " (s)"));
+                    /* Ignore badly-formed messages */
+                    return;
+                }
+                sval.data = inp;
+                sval.len = vallen;
+                INCPTR(vallen, inp);
+                len -= vallen;
+
+                GETCHAR(vallen, inp);
+                len--;
+                if (vallen > len) {
+                    ppp_error(("EAP: badly-formed SRP Challenge"
+                        " (g)"));
+                    /* Ignore badly-formed messages */
+                    return;
+                }
+                /* If no generator present, then use value 2 */
+                if (vallen == 0) {
+                    gval.data = (u_char *)"\002";
+                    gval.len = 1;
+                } else {
+                    gval.data = inp;
+                    gval.len = vallen;
+                }
+                INCPTR(vallen, inp);
+                len -= vallen;
+
+                /*
+                 * If no modulus present, then use well-known
+                 * value.
+                 */
+                if (len == 0) {
+                    Nval.data = (u_char *)wkmodulus;
+                    Nval.len = sizeof (wkmodulus);
+                } else {
+                    Nval.data = inp;
+                    Nval.len = len;
+                }
+                tc = t_clientopen(pcb->eap.es_client.ea_name,
+                    &Nval, &gval, &sval);
+                if (tc == NULL) {
+                    eap_send_nak(pcb, id, EAPT_MD5CHAP);
+                    break;
+                }
+                pcb->eap.es_client.ea_session = (void *)tc;
+
+                /* Add Challenge ID & type to verifier */
+                vals[0] = id;
+                vals[1] = EAPT_SRP;
+                t_clientaddexdata(tc, vals, 2);
+            }
+            Ap = t_clientgenexp(tc);
+            eap_srp_response(esp, id, EAPSRP_CKEY, Ap->data,
+                Ap->len);
+            break;
+
+        case EAPSRP_SKEY:
+            tc = (struct t_client *)pcb->eap.es_client.ea_session;
+            if (tc == NULL) {
+                ppp_warn(("EAP: peer sent Subtype 2 without 1"));
+                eap_send_nak(pcb, id, EAPT_MD5CHAP);
+                break;
+            }
+            if (pcb->eap.es_client.ea_skey != NULL) {
+                /*
+                 * ID number should not change here.  Warn
+                 * if it does (but otherwise ignore).
+                 */
+                if (id != pcb->eap.es_client.ea_id) {
+                    ppp_warn(("EAP: ID changed from %d to %d "
+                        "in SRP Subtype 2 rexmit",
+                        pcb->eap.es_client.ea_id, id));
+                }
+            } else {
+                if (get_srp_secret(pcb->eap.es_unit,
+                    pcb->eap.es_client.ea_name,
+                    pcb->eap.es_client.ea_peer, secret, 0) == 0) {
+                    /*
+                     * Can't work with this peer because
+                     * the secret is missing.  Just give
+                     * up.
+                     */
+                    eap_send_nak(pcb, id, EAPT_MD5CHAP);
+                    break;
+                }
+                Bval.data = inp;
+                Bval.len = len;
+                t_clientpasswd(tc, secret);
+                BZERO(secret, sizeof (secret));
+                pcb->eap.es_client.ea_skey =
+                    t_clientgetkey(tc, &Bval);
+                if (pcb->eap.es_client.ea_skey == NULL) {
+                    /* Server is rogue; stop now */
+                    ppp_error(("EAP: SRP server is rogue"));
+                    goto client_failure;
+                }
+            }
+            eap_srpval_response(esp, id, SRPVAL_EBIT,
+                t_clientresponse(tc));
+            break;
+
+        case EAPSRP_SVALIDATOR:
+            tc = (struct t_client *)pcb->eap.es_client.ea_session;
+            if (tc == NULL || pcb->eap.es_client.ea_skey == NULL) {
+                ppp_warn(("EAP: peer sent Subtype 3 without 1/2"));
+                eap_send_nak(pcb, id, EAPT_MD5CHAP);
+                break;
+            }
+            /*
+             * If we're already open, then this ought to be a
+             * duplicate.  Otherwise, check that the server is
+             * who we think it is.
+             */
+            if (pcb->eap.es_client.ea_state == eapOpen) {
+                if (id != pcb->eap.es_client.ea_id) {
+                    ppp_warn(("EAP: ID changed from %d to %d "
+                        "in SRP Subtype 3 rexmit",
+                        pcb->eap.es_client.ea_id, id));
+                }
+            } else {
+                len -= sizeof (u32_t) + SHA_DIGESTSIZE;
+                if (len < 0 || t_clientverify(tc, inp +
+                    sizeof (u32_t)) != 0) {
+                    ppp_error(("EAP: SRP server verification "
+                        "failed"));
+                    goto client_failure;
+                }
+                GETLONG(pcb->eap.es_client.ea_keyflags, inp);
+                /* Save pseudonym if user wants it. */
+                if (len > 0 && pcb->eap.es_usepseudo) {
+                    INCPTR(SHA_DIGESTSIZE, inp);
+                    write_pseudonym(esp, inp, len, id);
+                }
+            }
+            /*
+             * We've verified our peer.  We're now mostly done,
+             * except for waiting on the regular EAP Success
+             * message.
+             */
+            eap_srp_response(esp, id, EAPSRP_ACK, NULL, 0);
+            break;
+
+        case EAPSRP_LWRECHALLENGE:
+            if (len < 4) {
+                ppp_warn(("EAP: malformed Lightweight rechallenge"));
+                return;
+            }
+            SHA1Init(&ctxt);
+            vals[0] = id;
+            SHA1Update(&ctxt, vals, 1);
+            SHA1Update(&ctxt, pcb->eap.es_client.ea_skey,
+                SESSION_KEY_LEN);
+            SHA1Update(&ctxt, inp, len);
+            SHA1Update(&ctxt, pcb->eap.es_client.ea_name,
+                pcb->eap.es_client.ea_namelen);
+            SHA1Final(dig, &ctxt);
+            eap_srp_response(esp, id, EAPSRP_LWRECHALLENGE, dig,
+                SHA_DIGESTSIZE);
+            break;
+
+        default:
+            ppp_error(("EAP: unknown SRP Subtype %d", vallen));
+            eap_send_nak(pcb, id, EAPT_MD5CHAP);
+            break;
+        }
+        break;
 #endif /* USE_SRP */
 
-	default:
-		ppp_info(("EAP: unknown authentication type %d; Naking", typenum));
-		eap_send_nak(pcb, id, EAPT_SRP);
-		break;
-	}
+    default:
+        ppp_info(("EAP: unknown authentication type %d; Naking", typenum));
+        eap_send_nak(pcb, id, EAPT_SRP);
+        break;
+    }
 
-	if (pcb->settings.eap_req_time > 0) {
-		UNTIMEOUT(eap_client_timeout, pcb);
-		TIMEOUT(eap_client_timeout, pcb,
-		    pcb->settings.eap_req_time);
-	}
-	return;
+    if (pcb->settings.eap_req_time > 0) {
+        UNTIMEOUT(eap_client_timeout, pcb);
+        TIMEOUT(eap_client_timeout, pcb,
+            pcb->settings.eap_req_time);
+    }
+    return;
 
 #ifdef USE_SRP
 client_failure:
-	pcb->eap.es_client.ea_state = eapBadAuth;
-	if (pcb->settings.eap_req_time > 0) {
-		UNTIMEOUT(eap_client_timeout, (void *)esp);
-	}
-	pcb->eap.es_client.ea_session = NULL;
-	t_clientclose(tc);
-	auth_withpeer_fail(pcb, PPP_EAP);
+    pcb->eap.es_client.ea_state = eapBadAuth;
+    if (pcb->settings.eap_req_time > 0) {
+        UNTIMEOUT(eap_client_timeout, (void *)esp);
+    }
+    pcb->eap.es_client.ea_session = NULL;
+    t_clientclose(tc);
+    auth_withpeer_fail(pcb, PPP_EAP);
 #endif /* USE_SRP */
 }
 
@@ -1729,297 +1729,297 @@ client_failure:
  * eap_response - Receive EAP Response message (server mode).
  */
 static void eap_response(ppp_pcb *pcb, u_char *inp, int id, int len) {
-	u_char typenum;
-	u_char vallen;
-	int secret_len;
-	char secret[MAXSECRETLEN];
-	char rhostname[MAXNAMELEN];
-	lwip_md5_context mdContext;
-	u_char hash[MD5_SIGNATURE_SIZE];
+    u_char typenum;
+    u_char vallen;
+    int secret_len;
+    char secret[MAXSECRETLEN];
+    char rhostname[MAXNAMELEN];
+    lwip_md5_context mdContext;
+    u_char hash[MD5_SIGNATURE_SIZE];
 #ifdef USE_SRP
-	struct t_server *ts;
-	struct t_num A;
-	SHA1_CTX ctxt;
-	u_char dig[SHA_DIGESTSIZE];
+    struct t_server *ts;
+    struct t_num A;
+    SHA1_CTX ctxt;
+    u_char dig[SHA_DIGESTSIZE];
 #endif /* USE_SRP */
 
-	/*
-	 * Ignore responses if we're not open
-	 */
-	if (pcb->eap.es_server.ea_state <= eapClosed)
-		return;
-
-	if (pcb->eap.es_server.ea_id != id) {
-		ppp_dbglog(("EAP: discarding Response %d; expected ID %d", id,
-		    pcb->eap.es_server.ea_id));
-		return;
-	}
-
-	pcb->eap.es_server.ea_responses++;
-
-	if (len <= 0) {
-		ppp_error(("EAP: empty Response message discarded"));
-		return;
-	}
-
-	GETCHAR(typenum, inp);
-	len--;
-
-	switch (typenum) {
-	case EAPT_IDENTITY:
-		if (pcb->eap.es_server.ea_state != eapIdentify) {
-			ppp_dbglog(("EAP discarding unwanted Identify \"%.q\"", len,
-			    inp));
-			break;
-		}
-		ppp_info(("EAP: unauthenticated peer name \"%.*q\"", len, inp));
-		if (len > MAXNAMELEN) {
-		  len = MAXNAMELEN;
-		}
-		MEMCPY(pcb->eap.es_server.ea_peer, inp, len);
-		pcb->eap.es_server.ea_peer[len] = '\0';
-		pcb->eap.es_server.ea_peerlen = len;
-		eap_figure_next_state(pcb, 0);
-		break;
-
-	case EAPT_NOTIFICATION:
-		ppp_dbglog(("EAP unexpected Notification; response discarded"));
-		break;
-
-	case EAPT_NAK:
-		if (len < 1) {
-			ppp_info(("EAP: Nak Response with no suggested protocol"));
-			eap_figure_next_state(pcb, 1);
-			break;
-		}
-
-		GETCHAR(vallen, inp);
-		len--;
-
-		if (
+    /*
+     * Ignore responses if we're not open
+     */
+    if (pcb->eap.es_server.ea_state <= eapClosed)
+        return;
+
+    if (pcb->eap.es_server.ea_id != id) {
+        ppp_dbglog(("EAP: discarding Response %d; expected ID %d", id,
+            pcb->eap.es_server.ea_id));
+        return;
+    }
+
+    pcb->eap.es_server.ea_responses++;
+
+    if (len <= 0) {
+        ppp_error(("EAP: empty Response message discarded"));
+        return;
+    }
+
+    GETCHAR(typenum, inp);
+    len--;
+
+    switch (typenum) {
+    case EAPT_IDENTITY:
+        if (pcb->eap.es_server.ea_state != eapIdentify) {
+            ppp_dbglog(("EAP discarding unwanted Identify \"%.q\"", len,
+                inp));
+            break;
+        }
+        ppp_info(("EAP: unauthenticated peer name \"%.*q\"", len, inp));
+        if (len > MAXNAMELEN) {
+          len = MAXNAMELEN;
+        }
+        MEMCPY(pcb->eap.es_server.ea_peer, inp, len);
+        pcb->eap.es_server.ea_peer[len] = '\0';
+        pcb->eap.es_server.ea_peerlen = len;
+        eap_figure_next_state(pcb, 0);
+        break;
+
+    case EAPT_NOTIFICATION:
+        ppp_dbglog(("EAP unexpected Notification; response discarded"));
+        break;
+
+    case EAPT_NAK:
+        if (len < 1) {
+            ppp_info(("EAP: Nak Response with no suggested protocol"));
+            eap_figure_next_state(pcb, 1);
+            break;
+        }
+
+        GETCHAR(vallen, inp);
+        len--;
+
+        if (
 #if PPP_REMOTENAME
-		!pcb->explicit_remote &&
+        !pcb->explicit_remote &&
 #endif /* PPP_REMOTENAME */
-		pcb->eap.es_server.ea_state == eapIdentify){
-			/* Peer cannot Nak Identify Request */
-			eap_figure_next_state(pcb, 1);
-			break;
-		}
-
-		switch (vallen) {
-		case EAPT_SRP:
-			/* Run through SRP validator selection again. */
-			pcb->eap.es_server.ea_state = eapIdentify;
-			eap_figure_next_state(pcb, 0);
-			break;
-
-		case EAPT_MD5CHAP:
-			pcb->eap.es_server.ea_state = eapMD5Chall;
-			break;
-
-		default:
-			ppp_dbglog(("EAP: peer requesting unknown Type %d", vallen));
-			switch (pcb->eap.es_server.ea_state) {
-			case eapSRP1:
-			case eapSRP2:
-			case eapSRP3:
-				pcb->eap.es_server.ea_state = eapMD5Chall;
-				break;
-			case eapMD5Chall:
-			case eapSRP4:
-				pcb->eap.es_server.ea_state = eapIdentify;
-				eap_figure_next_state(pcb, 0);
-				break;
-			default:
-				break;
-			}
-			break;
-		}
-		break;
-
-	case EAPT_MD5CHAP:
-		if (pcb->eap.es_server.ea_state != eapMD5Chall) {
-			ppp_error(("EAP: unexpected MD5-Response"));
-			eap_figure_next_state(pcb, 1);
-			break;
-		}
-		if (len < 1) {
-			ppp_error(("EAP: received MD5-Response with no data"));
-			eap_figure_next_state(pcb, 1);
-			break;
-		}
-		GETCHAR(vallen, inp);
-		len--;
-		if (vallen != 16 || vallen > len) {
-			ppp_error(("EAP: MD5-Response with bad length %d", vallen));
-			eap_figure_next_state(pcb, 1);
-			break;
-		}
-
-		/* Not so likely to happen. */
-		if (len - vallen >= (int)sizeof (rhostname)) {
-			ppp_dbglog(("EAP: trimming really long peer name down"));
-			MEMCPY(rhostname, inp + vallen, sizeof (rhostname) - 1);
-			rhostname[sizeof (rhostname) - 1] = '\0';
-		} else {
-			MEMCPY(rhostname, inp + vallen, len - vallen);
-			rhostname[len - vallen] = '\0';
-		}
+        pcb->eap.es_server.ea_state == eapIdentify){
+            /* Peer cannot Nak Identify Request */
+            eap_figure_next_state(pcb, 1);
+            break;
+        }
+
+        switch (vallen) {
+        case EAPT_SRP:
+            /* Run through SRP validator selection again. */
+            pcb->eap.es_server.ea_state = eapIdentify;
+            eap_figure_next_state(pcb, 0);
+            break;
+
+        case EAPT_MD5CHAP:
+            pcb->eap.es_server.ea_state = eapMD5Chall;
+            break;
+
+        default:
+            ppp_dbglog(("EAP: peer requesting unknown Type %d", vallen));
+            switch (pcb->eap.es_server.ea_state) {
+            case eapSRP1:
+            case eapSRP2:
+            case eapSRP3:
+                pcb->eap.es_server.ea_state = eapMD5Chall;
+                break;
+            case eapMD5Chall:
+            case eapSRP4:
+                pcb->eap.es_server.ea_state = eapIdentify;
+                eap_figure_next_state(pcb, 0);
+                break;
+            default:
+                break;
+            }
+            break;
+        }
+        break;
+
+    case EAPT_MD5CHAP:
+        if (pcb->eap.es_server.ea_state != eapMD5Chall) {
+            ppp_error(("EAP: unexpected MD5-Response"));
+            eap_figure_next_state(pcb, 1);
+            break;
+        }
+        if (len < 1) {
+            ppp_error(("EAP: received MD5-Response with no data"));
+            eap_figure_next_state(pcb, 1);
+            break;
+        }
+        GETCHAR(vallen, inp);
+        len--;
+        if (vallen != 16 || vallen > len) {
+            ppp_error(("EAP: MD5-Response with bad length %d", vallen));
+            eap_figure_next_state(pcb, 1);
+            break;
+        }
+
+        /* Not so likely to happen. */
+        if (len - vallen >= (int)sizeof (rhostname)) {
+            ppp_dbglog(("EAP: trimming really long peer name down"));
+            MEMCPY(rhostname, inp + vallen, sizeof (rhostname) - 1);
+            rhostname[sizeof (rhostname) - 1] = '\0';
+        } else {
+            MEMCPY(rhostname, inp + vallen, len - vallen);
+            rhostname[len - vallen] = '\0';
+        }
 
 #if PPP_REMOTENAME
-		/* In case the remote doesn't give us his name. */
-		if (explicit_remote ||
-		    (remote_name[0] != '\0' && vallen == len))
-			strlcpy(rhostname, remote_name, sizeof (rhostname));
+        /* In case the remote doesn't give us his name. */
+        if (explicit_remote ||
+            (remote_name[0] != '\0' && vallen == len))
+            strlcpy(rhostname, remote_name, sizeof (rhostname));
 #endif /* PPP_REMOTENAME */
 
-		/*
-		 * Get the secret for authenticating the specified
-		 * host.
-		 */
-		if (!get_secret(pcb, rhostname,
-		    pcb->eap.es_server.ea_name, secret, &secret_len, 1)) {
-			ppp_dbglog(("EAP: no MD5 secret for auth of %q", rhostname));
-			eap_send_failure(pcb);
-			break;
-		}
-		lwip_md5_init(&mdContext);
-		lwip_md5_starts(&mdContext);
-		lwip_md5_update(&mdContext, &pcb->eap.es_server.ea_id, 1);
-		lwip_md5_update(&mdContext, (u_char *)secret, secret_len);
-		BZERO(secret, sizeof (secret));
-		lwip_md5_update(&mdContext, pcb->eap.es_challenge, pcb->eap.es_challen);
-		lwip_md5_finish(&mdContext, hash);
-		lwip_md5_free(&mdContext);
-		if (BCMP(hash, inp, MD5_SIGNATURE_SIZE) != 0) {
-			eap_send_failure(pcb);
-			break;
-		}
-		pcb->eap.es_server.ea_type = EAPT_MD5CHAP;
-		eap_send_success(pcb);
-		eap_figure_next_state(pcb, 0);
-		if (pcb->eap.es_rechallenge != 0)
-			TIMEOUT(eap_rechallenge, pcb, pcb->eap.es_rechallenge);
-		break;
+        /*
+         * Get the secret for authenticating the specified
+         * host.
+         */
+        if (!get_secret(pcb, rhostname,
+            pcb->eap.es_server.ea_name, secret, &secret_len, 1)) {
+            ppp_dbglog(("EAP: no MD5 secret for auth of %q", rhostname));
+            eap_send_failure(pcb);
+            break;
+        }
+        lwip_md5_init(&mdContext);
+        lwip_md5_starts(&mdContext);
+        lwip_md5_update(&mdContext, &pcb->eap.es_server.ea_id, 1);
+        lwip_md5_update(&mdContext, (u_char *)secret, secret_len);
+        BZERO(secret, sizeof (secret));
+        lwip_md5_update(&mdContext, pcb->eap.es_challenge, pcb->eap.es_challen);
+        lwip_md5_finish(&mdContext, hash);
+        lwip_md5_free(&mdContext);
+        if (BCMP(hash, inp, MD5_SIGNATURE_SIZE) != 0) {
+            eap_send_failure(pcb);
+            break;
+        }
+        pcb->eap.es_server.ea_type = EAPT_MD5CHAP;
+        eap_send_success(pcb);
+        eap_figure_next_state(pcb, 0);
+        if (pcb->eap.es_rechallenge != 0)
+            TIMEOUT(eap_rechallenge, pcb, pcb->eap.es_rechallenge);
+        break;
 
 #ifdef USE_SRP
-	case EAPT_SRP:
-		if (len < 1) {
-			ppp_error(("EAP: empty SRP Response"));
-			eap_figure_next_state(pcb, 1);
-			break;
-		}
-		GETCHAR(typenum, inp);
-		len--;
-		switch (typenum) {
-		case EAPSRP_CKEY:
-			if (pcb->eap.es_server.ea_state != eapSRP1) {
-				ppp_error(("EAP: unexpected SRP Subtype 1 Response"));
-				eap_figure_next_state(pcb, 1);
-				break;
-			}
-			A.data = inp;
-			A.len = len;
-			ts = (struct t_server *)pcb->eap.es_server.ea_session;
-			assert(ts != NULL);
-			pcb->eap.es_server.ea_skey = t_servergetkey(ts, &A);
-			if (pcb->eap.es_server.ea_skey == NULL) {
-				/* Client's A value is bogus; terminate now */
-				ppp_error(("EAP: bogus A value from client"));
-				eap_send_failure(pcb);
-			} else {
-				eap_figure_next_state(pcb, 0);
-			}
-			break;
-
-		case EAPSRP_CVALIDATOR:
-			if (pcb->eap.es_server.ea_state != eapSRP2) {
-				ppp_error(("EAP: unexpected SRP Subtype 2 Response"));
-				eap_figure_next_state(pcb, 1);
-				break;
-			}
-			if (len < sizeof (u32_t) + SHA_DIGESTSIZE) {
-				ppp_error(("EAP: M1 length %d < %d", len,
-				    sizeof (u32_t) + SHA_DIGESTSIZE));
-				eap_figure_next_state(pcb, 1);
-				break;
-			}
-			GETLONG(pcb->eap.es_server.ea_keyflags, inp);
-			ts = (struct t_server *)pcb->eap.es_server.ea_session;
-			assert(ts != NULL);
-			if (t_serververify(ts, inp)) {
-				ppp_info(("EAP: unable to validate client identity"));
-				eap_send_failure(pcb);
-				break;
-			}
-			eap_figure_next_state(pcb, 0);
-			break;
-
-		case EAPSRP_ACK:
-			if (pcb->eap.es_server.ea_state != eapSRP3) {
-				ppp_error(("EAP: unexpected SRP Subtype 3 Response"));
-				eap_send_failure(esp);
-				break;
-			}
-			pcb->eap.es_server.ea_type = EAPT_SRP;
-			eap_send_success(pcb, esp);
-			eap_figure_next_state(pcb, 0);
-			if (pcb->eap.es_rechallenge != 0)
-				TIMEOUT(eap_rechallenge, pcb,
-				    pcb->eap.es_rechallenge);
-			if (pcb->eap.es_lwrechallenge != 0)
-				TIMEOUT(srp_lwrechallenge, pcb,
-				    pcb->eap.es_lwrechallenge);
-			break;
-
-		case EAPSRP_LWRECHALLENGE:
-			if (pcb->eap.es_server.ea_state != eapSRP4) {
-				ppp_info(("EAP: unexpected SRP Subtype 4 Response"));
-				return;
-			}
-			if (len != SHA_DIGESTSIZE) {
-				ppp_error(("EAP: bad Lightweight rechallenge "
-				    "response"));
-				return;
-			}
-			SHA1Init(&ctxt);
-			vallen = id;
-			SHA1Update(&ctxt, &vallen, 1);
-			SHA1Update(&ctxt, pcb->eap.es_server.ea_skey,
-			    SESSION_KEY_LEN);
-			SHA1Update(&ctxt, pcb->eap.es_challenge, pcb->eap.es_challen);
-			SHA1Update(&ctxt, pcb->eap.es_server.ea_peer,
-			    pcb->eap.es_server.ea_peerlen);
-			SHA1Final(dig, &ctxt);
-			if (BCMP(dig, inp, SHA_DIGESTSIZE) != 0) {
-				ppp_error(("EAP: failed Lightweight rechallenge"));
-				eap_send_failure(pcb);
-				break;
-			}
-			pcb->eap.es_server.ea_state = eapOpen;
-			if (pcb->eap.es_lwrechallenge != 0)
-				TIMEOUT(srp_lwrechallenge, esp,
-				    pcb->eap.es_lwrechallenge);
-			break;
-		}
-		break;
+    case EAPT_SRP:
+        if (len < 1) {
+            ppp_error(("EAP: empty SRP Response"));
+            eap_figure_next_state(pcb, 1);
+            break;
+        }
+        GETCHAR(typenum, inp);
+        len--;
+        switch (typenum) {
+        case EAPSRP_CKEY:
+            if (pcb->eap.es_server.ea_state != eapSRP1) {
+                ppp_error(("EAP: unexpected SRP Subtype 1 Response"));
+                eap_figure_next_state(pcb, 1);
+                break;
+            }
+            A.data = inp;
+            A.len = len;
+            ts = (struct t_server *)pcb->eap.es_server.ea_session;
+            assert(ts != NULL);
+            pcb->eap.es_server.ea_skey = t_servergetkey(ts, &A);
+            if (pcb->eap.es_server.ea_skey == NULL) {
+                /* Client's A value is bogus; terminate now */
+                ppp_error(("EAP: bogus A value from client"));
+                eap_send_failure(pcb);
+            } else {
+                eap_figure_next_state(pcb, 0);
+            }
+            break;
+
+        case EAPSRP_CVALIDATOR:
+            if (pcb->eap.es_server.ea_state != eapSRP2) {
+                ppp_error(("EAP: unexpected SRP Subtype 2 Response"));
+                eap_figure_next_state(pcb, 1);
+                break;
+            }
+            if (len < sizeof (u32_t) + SHA_DIGESTSIZE) {
+                ppp_error(("EAP: M1 length %d < %d", len,
+                    sizeof (u32_t) + SHA_DIGESTSIZE));
+                eap_figure_next_state(pcb, 1);
+                break;
+            }
+            GETLONG(pcb->eap.es_server.ea_keyflags, inp);
+            ts = (struct t_server *)pcb->eap.es_server.ea_session;
+            assert(ts != NULL);
+            if (t_serververify(ts, inp)) {
+                ppp_info(("EAP: unable to validate client identity"));
+                eap_send_failure(pcb);
+                break;
+            }
+            eap_figure_next_state(pcb, 0);
+            break;
+
+        case EAPSRP_ACK:
+            if (pcb->eap.es_server.ea_state != eapSRP3) {
+                ppp_error(("EAP: unexpected SRP Subtype 3 Response"));
+                eap_send_failure(esp);
+                break;
+            }
+            pcb->eap.es_server.ea_type = EAPT_SRP;
+            eap_send_success(pcb, esp);
+            eap_figure_next_state(pcb, 0);
+            if (pcb->eap.es_rechallenge != 0)
+                TIMEOUT(eap_rechallenge, pcb,
+                    pcb->eap.es_rechallenge);
+            if (pcb->eap.es_lwrechallenge != 0)
+                TIMEOUT(srp_lwrechallenge, pcb,
+                    pcb->eap.es_lwrechallenge);
+            break;
+
+        case EAPSRP_LWRECHALLENGE:
+            if (pcb->eap.es_server.ea_state != eapSRP4) {
+                ppp_info(("EAP: unexpected SRP Subtype 4 Response"));
+                return;
+            }
+            if (len != SHA_DIGESTSIZE) {
+                ppp_error(("EAP: bad Lightweight rechallenge "
+                    "response"));
+                return;
+            }
+            SHA1Init(&ctxt);
+            vallen = id;
+            SHA1Update(&ctxt, &vallen, 1);
+            SHA1Update(&ctxt, pcb->eap.es_server.ea_skey,
+                SESSION_KEY_LEN);
+            SHA1Update(&ctxt, pcb->eap.es_challenge, pcb->eap.es_challen);
+            SHA1Update(&ctxt, pcb->eap.es_server.ea_peer,
+                pcb->eap.es_server.ea_peerlen);
+            SHA1Final(dig, &ctxt);
+            if (BCMP(dig, inp, SHA_DIGESTSIZE) != 0) {
+                ppp_error(("EAP: failed Lightweight rechallenge"));
+                eap_send_failure(pcb);
+                break;
+            }
+            pcb->eap.es_server.ea_state = eapOpen;
+            if (pcb->eap.es_lwrechallenge != 0)
+                TIMEOUT(srp_lwrechallenge, esp,
+                    pcb->eap.es_lwrechallenge);
+            break;
+        }
+        break;
 #endif /* USE_SRP */
 
-	default:
-		/* This can't happen. */
-		ppp_error(("EAP: unknown Response type %d; ignored", typenum));
-		return;
-	}
-
-	if (pcb->settings.eap_timeout_time > 0) {
-		UNTIMEOUT(eap_server_timeout, pcb);
-	}
-
-	if (pcb->eap.es_server.ea_state != eapBadAuth &&
-	    pcb->eap.es_server.ea_state != eapOpen) {
-		pcb->eap.es_server.ea_id++;
-		eap_send_request(pcb);
-	}
+    default:
+        /* This can't happen. */
+        ppp_error(("EAP: unknown Response type %d; ignored", typenum));
+        return;
+    }
+
+    if (pcb->settings.eap_timeout_time > 0) {
+        UNTIMEOUT(eap_server_timeout, pcb);
+    }
+
+    if (pcb->eap.es_server.ea_state != eapBadAuth &&
+        pcb->eap.es_server.ea_state != eapOpen) {
+        pcb->eap.es_server.ea_id++;
+        eap_send_request(pcb);
+    }
 }
 #endif /* PPP_SERVER */
 
@@ -2027,111 +2027,111 @@ static void eap_response(ppp_pcb *pcb, u_char *inp, int id, int len) {
  * eap_success - Receive EAP Success message (client mode).
  */
 static void eap_success(ppp_pcb *pcb, u_char *inp, int id, int len) {
-	LWIP_UNUSED_ARG(id);
-
-	if (pcb->eap.es_client.ea_state != eapOpen && !eap_client_active(pcb)) {
-		ppp_dbglog(("EAP unexpected success message in state %s (%d)",
-		    eap_state_name(pcb->eap.es_client.ea_state),
-		    pcb->eap.es_client.ea_state));
-		return;
-	}
-
-	if (pcb->settings.eap_req_time > 0) {
-		UNTIMEOUT(eap_client_timeout, pcb);
-	}
-
-	if (len > 0) {
-		/* This is odd.  The spec doesn't allow for this. */
-		PRINTMSG(inp, len);
-	}
-
-	pcb->eap.es_client.ea_state = eapOpen;
-	auth_withpeer_success(pcb, PPP_EAP, 0);
+    LWIP_UNUSED_ARG(id);
+
+    if (pcb->eap.es_client.ea_state != eapOpen && !eap_client_active(pcb)) {
+        ppp_dbglog(("EAP unexpected success message in state %s (%d)",
+            eap_state_name(pcb->eap.es_client.ea_state),
+            pcb->eap.es_client.ea_state));
+        return;
+    }
+
+    if (pcb->settings.eap_req_time > 0) {
+        UNTIMEOUT(eap_client_timeout, pcb);
+    }
+
+    if (len > 0) {
+        /* This is odd.  The spec doesn't allow for this. */
+        PRINTMSG(inp, len);
+    }
+
+    pcb->eap.es_client.ea_state = eapOpen;
+    auth_withpeer_success(pcb, PPP_EAP, 0);
 }
 
 /*
  * eap_failure - Receive EAP Failure message (client mode).
  */
 static void eap_failure(ppp_pcb *pcb, u_char *inp, int id, int len) {
-	LWIP_UNUSED_ARG(id);
+    LWIP_UNUSED_ARG(id);
 
-	/*
-	 * Ignore failure messages if we're not open
-	 */
-	if (pcb->eap.es_client.ea_state <= eapClosed)
-		return;
+    /*
+     * Ignore failure messages if we're not open
+     */
+    if (pcb->eap.es_client.ea_state <= eapClosed)
+        return;
 
-	if (!eap_client_active(pcb)) {
-		ppp_dbglog(("EAP unexpected failure message in state %s (%d)",
-		    eap_state_name(pcb->eap.es_client.ea_state),
-		    pcb->eap.es_client.ea_state));
-	}
+    if (!eap_client_active(pcb)) {
+        ppp_dbglog(("EAP unexpected failure message in state %s (%d)",
+            eap_state_name(pcb->eap.es_client.ea_state),
+            pcb->eap.es_client.ea_state));
+    }
 
-	if (pcb->settings.eap_req_time > 0) {
-		UNTIMEOUT(eap_client_timeout, pcb);
-	}
+    if (pcb->settings.eap_req_time > 0) {
+        UNTIMEOUT(eap_client_timeout, pcb);
+    }
 
-	if (len > 0) {
-		/* This is odd.  The spec doesn't allow for this. */
-		PRINTMSG(inp, len);
-	}
+    if (len > 0) {
+        /* This is odd.  The spec doesn't allow for this. */
+        PRINTMSG(inp, len);
+    }
 
-	pcb->eap.es_client.ea_state = eapBadAuth;
+    pcb->eap.es_client.ea_state = eapBadAuth;
 
-	ppp_error(("EAP: peer reports authentication failure"));
-	auth_withpeer_fail(pcb, PPP_EAP);
+    ppp_error(("EAP: peer reports authentication failure"));
+    auth_withpeer_fail(pcb, PPP_EAP);
 }
 
 /*
  * eap_input - Handle received EAP message.
  */
 static void eap_input(ppp_pcb *pcb, u_char *inp, int inlen) {
-	u_char code, id;
-	int len;
-
-	/*
-	 * Parse header (code, id and length).  If packet too short,
-	 * drop it.
-	 */
-	if (inlen < EAP_HEADERLEN) {
-		ppp_error(("EAP: packet too short: %d < %d", inlen, EAP_HEADERLEN));
-		return;
-	}
-	GETCHAR(code, inp);
-	GETCHAR(id, inp);
-	GETSHORT(len, inp);
-	if (len < EAP_HEADERLEN || len > inlen) {
-		ppp_error(("EAP: packet has illegal length field %d (%d..%d)", len,
-		    EAP_HEADERLEN, inlen));
-		return;
-	}
-	len -= EAP_HEADERLEN;
-
-	/* Dispatch based on message code */
-	switch (code) {
-	case EAP_REQUEST:
-		eap_request(pcb, inp, id, len);
-		break;
+    u_char code, id;
+    int len;
+
+    /*
+     * Parse header (code, id and length).  If packet too short,
+     * drop it.
+     */
+    if (inlen < EAP_HEADERLEN) {
+        ppp_error(("EAP: packet too short: %d < %d", inlen, EAP_HEADERLEN));
+        return;
+    }
+    GETCHAR(code, inp);
+    GETCHAR(id, inp);
+    GETSHORT(len, inp);
+    if (len < EAP_HEADERLEN || len > inlen) {
+        ppp_error(("EAP: packet has illegal length field %d (%d..%d)", len,
+            EAP_HEADERLEN, inlen));
+        return;
+    }
+    len -= EAP_HEADERLEN;
+
+    /* Dispatch based on message code */
+    switch (code) {
+    case EAP_REQUEST:
+        eap_request(pcb, inp, id, len);
+        break;
 
 #if PPP_SERVER
-	case EAP_RESPONSE:
-		eap_response(pcb, inp, id, len);
-		break;
+    case EAP_RESPONSE:
+        eap_response(pcb, inp, id, len);
+        break;
 #endif /* PPP_SERVER */
 
-	case EAP_SUCCESS:
-		eap_success(pcb, inp, id, len);
-		break;
+    case EAP_SUCCESS:
+        eap_success(pcb, inp, id, len);
+        break;
 
-	case EAP_FAILURE:
-		eap_failure(pcb, inp, id, len);
-		break;
+    case EAP_FAILURE:
+        eap_failure(pcb, inp, id, len);
+        break;
 
-	default:				/* XXX Need code reject */
-		/* Note: it's not legal to send EAP Nak here. */
-		ppp_warn(("EAP: unknown code %d received", code));
-		break;
-	}
+    default:                /* XXX Need code reject */
+        /* Note: it's not legal to send EAP Nak here. */
+        ppp_warn(("EAP: unknown code %d received", code));
+        break;
+    }
 }
 
 #if PRINTPKT_SUPPORT
@@ -2139,302 +2139,302 @@ static void eap_input(ppp_pcb *pcb, u_char *inp, int inlen) {
  * eap_printpkt - print the contents of an EAP packet.
  */
 static const char* const eap_codenames[] = {
-	"Request", "Response", "Success", "Failure"
+    "Request", "Response", "Success", "Failure"
 };
 
 static const char* const eap_typenames[] = {
-	"Identity", "Notification", "Nak", "MD5-Challenge",
-	"OTP", "Generic-Token", NULL, NULL,
-	"RSA", "DSS", "KEA", "KEA-Validate",
-	"TLS", "Defender", "Windows 2000", "Arcot",
-	"Cisco", "Nokia", "SRP"
+    "Identity", "Notification", "Nak", "MD5-Challenge",
+    "OTP", "Generic-Token", NULL, NULL,
+    "RSA", "DSS", "KEA", "KEA-Validate",
+    "TLS", "Defender", "Windows 2000", "Arcot",
+    "Cisco", "Nokia", "SRP"
 };
 
 static int eap_printpkt(const u_char *inp, int inlen, void (*printer) (void *, const char *, ...), void *arg) {
-	int code, id, len, rtype, vallen;
-	const u_char *pstart;
-	u32_t uval;
-
-	if (inlen < EAP_HEADERLEN)
-		return (0);
-	pstart = inp;
-	GETCHAR(code, inp);
-	GETCHAR(id, inp);
-	GETSHORT(len, inp);
-	if (len < EAP_HEADERLEN || len > inlen)
-		return (0);
-
-	if (code >= 1 && code <= (int)LWIP_ARRAYSIZE(eap_codenames))
-		printer(arg, " %s", eap_codenames[code-1]);
-	else
-		printer(arg, " code=0x%x", code);
-	printer(arg, " id=0x%x", id);
-	len -= EAP_HEADERLEN;
-	switch (code) {
-	case EAP_REQUEST:
-		if (len < 1) {
-			printer(arg, " <missing type>");
-			break;
-		}
-		GETCHAR(rtype, inp);
-		len--;
-		if (rtype >= 1 && rtype <= (int)LWIP_ARRAYSIZE(eap_typenames))
-			printer(arg, " %s", eap_typenames[rtype-1]);
-		else
-			printer(arg, " type=0x%x", rtype);
-		switch (rtype) {
-		case EAPT_IDENTITY:
-		case EAPT_NOTIFICATION:
-			if (len > 0) {
-				printer(arg, " <Message ");
-				ppp_print_string(inp, len, printer, arg);
-				printer(arg, ">");
-				INCPTR(len, inp);
-				len = 0;
-			} else {
-				printer(arg, " <No message>");
-			}
-			break;
-
-		case EAPT_MD5CHAP:
-			if (len <= 0)
-				break;
-			GETCHAR(vallen, inp);
-			len--;
-			if (vallen > len)
-				goto truncated;
-			printer(arg, " <Value%.*B>", vallen, inp);
-			INCPTR(vallen, inp);
-			len -= vallen;
-			if (len > 0) {
-				printer(arg, " <Name ");
-				ppp_print_string(inp, len, printer, arg);
-				printer(arg, ">");
-				INCPTR(len, inp);
-				len = 0;
-			} else {
-				printer(arg, " <No name>");
-			}
-			break;
-
-		case EAPT_SRP:
-			if (len < 3)
-				goto truncated;
-			GETCHAR(vallen, inp);
-			len--;
-			printer(arg, "-%d", vallen);
-			switch (vallen) {
-			case EAPSRP_CHALLENGE:
-				GETCHAR(vallen, inp);
-				len--;
-				if (vallen >= len)
-					goto truncated;
-				if (vallen > 0) {
-					printer(arg, " <Name ");
-					ppp_print_string(inp, vallen, printer,
-					    arg);
-					printer(arg, ">");
-				} else {
-					printer(arg, " <No name>");
-				}
-				INCPTR(vallen, inp);
-				len -= vallen;
-				GETCHAR(vallen, inp);
-				len--;
-				if (vallen >= len)
-					goto truncated;
-				printer(arg, " <s%.*B>", vallen, inp);
-				INCPTR(vallen, inp);
-				len -= vallen;
-				GETCHAR(vallen, inp);
-				len--;
-				if (vallen > len)
-					goto truncated;
-				if (vallen == 0) {
-					printer(arg, " <Default g=2>");
-				} else {
-					printer(arg, " <g%.*B>", vallen, inp);
-				}
-				INCPTR(vallen, inp);
-				len -= vallen;
-				if (len == 0) {
-					printer(arg, " <Default N>");
-				} else {
-					printer(arg, " <N%.*B>", len, inp);
-					INCPTR(len, inp);
-					len = 0;
-				}
-				break;
-
-			case EAPSRP_SKEY:
-				printer(arg, " <B%.*B>", len, inp);
-				INCPTR(len, inp);
-				len = 0;
-				break;
-
-			case EAPSRP_SVALIDATOR:
-				if (len < (int)sizeof (u32_t))
-					break;
-				GETLONG(uval, inp);
-				len -= sizeof (u32_t);
-				if (uval & SRPVAL_EBIT) {
-					printer(arg, " E");
-					uval &= ~SRPVAL_EBIT;
-				}
-				if (uval != 0) {
-					printer(arg, " f<%X>", uval);
-				}
-				if ((vallen = len) > SHA_DIGESTSIZE)
-					vallen = SHA_DIGESTSIZE;
-				printer(arg, " <M2%.*B%s>", len, inp,
-				    len < SHA_DIGESTSIZE ? "?" : "");
-				INCPTR(vallen, inp);
-				len -= vallen;
-				if (len > 0) {
-					printer(arg, " <PN%.*B>", len, inp);
-					INCPTR(len, inp);
-					len = 0;
-				}
-				break;
-
-			case EAPSRP_LWRECHALLENGE:
-				printer(arg, " <Challenge%.*B>", len, inp);
-				INCPTR(len, inp);
-				len = 0;
-				break;
-			default:
-				break;
-			}
-			break;
-		default:
-			break;
-		}
-		break;
-
-	case EAP_RESPONSE:
-		if (len < 1)
-			break;
-		GETCHAR(rtype, inp);
-		len--;
-		if (rtype >= 1 && rtype <= (int)LWIP_ARRAYSIZE(eap_typenames))
-			printer(arg, " %s", eap_typenames[rtype-1]);
-		else
-			printer(arg, " type=0x%x", rtype);
-		switch (rtype) {
-		case EAPT_IDENTITY:
-			if (len > 0) {
-				printer(arg, " <Name ");
-				ppp_print_string(inp, len, printer, arg);
-				printer(arg, ">");
-				INCPTR(len, inp);
-				len = 0;
-			}
-			break;
-
-		case EAPT_NAK:
-			if (len <= 0) {
-				printer(arg, " <missing hint>");
-				break;
-			}
-			GETCHAR(rtype, inp);
-			len--;
-			printer(arg, " <Suggested-type %02X", rtype);
-			if (rtype >= 1 && rtype < (int)LWIP_ARRAYSIZE(eap_typenames))
-				printer(arg, " (%s)", eap_typenames[rtype-1]);
-			printer(arg, ">");
-			break;
-
-		case EAPT_MD5CHAP:
-			if (len <= 0) {
-				printer(arg, " <missing length>");
-				break;
-			}
-			GETCHAR(vallen, inp);
-			len--;
-			if (vallen > len)
-				goto truncated;
-			printer(arg, " <Value%.*B>", vallen, inp);
-			INCPTR(vallen, inp);
-			len -= vallen;
-			if (len > 0) {
-				printer(arg, " <Name ");
-				ppp_print_string(inp, len, printer, arg);
-				printer(arg, ">");
-				INCPTR(len, inp);
-				len = 0;
-			} else {
-				printer(arg, " <No name>");
-			}
-			break;
-
-		case EAPT_SRP:
-			if (len < 1)
-				goto truncated;
-			GETCHAR(vallen, inp);
-			len--;
-			printer(arg, "-%d", vallen);
-			switch (vallen) {
-			case EAPSRP_CKEY:
-				printer(arg, " <A%.*B>", len, inp);
-				INCPTR(len, inp);
-				len = 0;
-				break;
-
-			case EAPSRP_CVALIDATOR:
-				if (len < (int)sizeof (u32_t))
-					break;
-				GETLONG(uval, inp);
-				len -= sizeof (u32_t);
-				if (uval & SRPVAL_EBIT) {
-					printer(arg, " E");
-					uval &= ~SRPVAL_EBIT;
-				}
-				if (uval != 0) {
-					printer(arg, " f<%X>", uval);
-				}
-				printer(arg, " <M1%.*B%s>", len, inp,
-				    len == SHA_DIGESTSIZE ? "" : "?");
-				INCPTR(len, inp);
-				len = 0;
-				break;
-
-			case EAPSRP_ACK:
-				break;
-
-			case EAPSRP_LWRECHALLENGE:
-				printer(arg, " <Response%.*B%s>", len, inp,
-				    len == SHA_DIGESTSIZE ? "" : "?");
-				if ((vallen = len) > SHA_DIGESTSIZE)
-					vallen = SHA_DIGESTSIZE;
-				INCPTR(vallen, inp);
-				len -= vallen;
-				break;
-			default:
-				break;
-			}
-			break;
-		default:
-			break;
-		}
-		break;
-
-	case EAP_SUCCESS:	/* No payload expected for these! */
-	case EAP_FAILURE:
-	default:
-		break;
-
-	truncated:
-		printer(arg, " <truncated>");
-		break;
-	}
-
-	if (len > 8)
-		printer(arg, "%8B...", inp);
-	else if (len > 0)
-		printer(arg, "%.*B", len, inp);
-	INCPTR(len, inp);
-
-	return (inp - pstart);
+    int code, id, len, rtype, vallen;
+    const u_char *pstart;
+    u32_t uval;
+
+    if (inlen < EAP_HEADERLEN)
+        return (0);
+    pstart = inp;
+    GETCHAR(code, inp);
+    GETCHAR(id, inp);
+    GETSHORT(len, inp);
+    if (len < EAP_HEADERLEN || len > inlen)
+        return (0);
+
+    if (code >= 1 && code <= (int)LWIP_ARRAYSIZE(eap_codenames))
+        printer(arg, " %s", eap_codenames[code-1]);
+    else
+        printer(arg, " code=0x%x", code);
+    printer(arg, " id=0x%x", id);
+    len -= EAP_HEADERLEN;
+    switch (code) {
+    case EAP_REQUEST:
+        if (len < 1) {
+            printer(arg, " <missing type>");
+            break;
+        }
+        GETCHAR(rtype, inp);
+        len--;
+        if (rtype >= 1 && rtype <= (int)LWIP_ARRAYSIZE(eap_typenames))
+            printer(arg, " %s", eap_typenames[rtype-1]);
+        else
+            printer(arg, " type=0x%x", rtype);
+        switch (rtype) {
+        case EAPT_IDENTITY:
+        case EAPT_NOTIFICATION:
+            if (len > 0) {
+                printer(arg, " <Message ");
+                ppp_print_string(inp, len, printer, arg);
+                printer(arg, ">");
+                INCPTR(len, inp);
+                len = 0;
+            } else {
+                printer(arg, " <No message>");
+            }
+            break;
+
+        case EAPT_MD5CHAP:
+            if (len <= 0)
+                break;
+            GETCHAR(vallen, inp);
+            len--;
+            if (vallen > len)
+                goto truncated;
+            printer(arg, " <Value%.*B>", vallen, inp);
+            INCPTR(vallen, inp);
+            len -= vallen;
+            if (len > 0) {
+                printer(arg, " <Name ");
+                ppp_print_string(inp, len, printer, arg);
+                printer(arg, ">");
+                INCPTR(len, inp);
+                len = 0;
+            } else {
+                printer(arg, " <No name>");
+            }
+            break;
+
+        case EAPT_SRP:
+            if (len < 3)
+                goto truncated;
+            GETCHAR(vallen, inp);
+            len--;
+            printer(arg, "-%d", vallen);
+            switch (vallen) {
+            case EAPSRP_CHALLENGE:
+                GETCHAR(vallen, inp);
+                len--;
+                if (vallen >= len)
+                    goto truncated;
+                if (vallen > 0) {
+                    printer(arg, " <Name ");
+                    ppp_print_string(inp, vallen, printer,
+                        arg);
+                    printer(arg, ">");
+                } else {
+                    printer(arg, " <No name>");
+                }
+                INCPTR(vallen, inp);
+                len -= vallen;
+                GETCHAR(vallen, inp);
+                len--;
+                if (vallen >= len)
+                    goto truncated;
+                printer(arg, " <s%.*B>", vallen, inp);
+                INCPTR(vallen, inp);
+                len -= vallen;
+                GETCHAR(vallen, inp);
+                len--;
+                if (vallen > len)
+                    goto truncated;
+                if (vallen == 0) {
+                    printer(arg, " <Default g=2>");
+                } else {
+                    printer(arg, " <g%.*B>", vallen, inp);
+                }
+                INCPTR(vallen, inp);
+                len -= vallen;
+                if (len == 0) {
+                    printer(arg, " <Default N>");
+                } else {
+                    printer(arg, " <N%.*B>", len, inp);
+                    INCPTR(len, inp);
+                    len = 0;
+                }
+                break;
+
+            case EAPSRP_SKEY:
+                printer(arg, " <B%.*B>", len, inp);
+                INCPTR(len, inp);
+                len = 0;
+                break;
+
+            case EAPSRP_SVALIDATOR:
+                if (len < (int)sizeof (u32_t))
+                    break;
+                GETLONG(uval, inp);
+                len -= sizeof (u32_t);
+                if (uval & SRPVAL_EBIT) {
+                    printer(arg, " E");
+                    uval &= ~SRPVAL_EBIT;
+                }
+                if (uval != 0) {
+                    printer(arg, " f<%X>", uval);
+                }
+                if ((vallen = len) > SHA_DIGESTSIZE)
+                    vallen = SHA_DIGESTSIZE;
+                printer(arg, " <M2%.*B%s>", len, inp,
+                    len < SHA_DIGESTSIZE ? "?" : "");
+                INCPTR(vallen, inp);
+                len -= vallen;
+                if (len > 0) {
+                    printer(arg, " <PN%.*B>", len, inp);
+                    INCPTR(len, inp);
+                    len = 0;
+                }
+                break;
+
+            case EAPSRP_LWRECHALLENGE:
+                printer(arg, " <Challenge%.*B>", len, inp);
+                INCPTR(len, inp);
+                len = 0;
+                break;
+            default:
+                break;
+            }
+            break;
+        default:
+            break;
+        }
+        break;
+
+    case EAP_RESPONSE:
+        if (len < 1)
+            break;
+        GETCHAR(rtype, inp);
+        len--;
+        if (rtype >= 1 && rtype <= (int)LWIP_ARRAYSIZE(eap_typenames))
+            printer(arg, " %s", eap_typenames[rtype-1]);
+        else
+            printer(arg, " type=0x%x", rtype);
+        switch (rtype) {
+        case EAPT_IDENTITY:
+            if (len > 0) {
+                printer(arg, " <Name ");
+                ppp_print_string(inp, len, printer, arg);
+                printer(arg, ">");
+                INCPTR(len, inp);
+                len = 0;
+            }
+            break;
+
+        case EAPT_NAK:
+            if (len <= 0) {
+                printer(arg, " <missing hint>");
+                break;
+            }
+            GETCHAR(rtype, inp);
+            len--;
+            printer(arg, " <Suggested-type %02X", rtype);
+            if (rtype >= 1 && rtype < (int)LWIP_ARRAYSIZE(eap_typenames))
+                printer(arg, " (%s)", eap_typenames[rtype-1]);
+            printer(arg, ">");
+            break;
+
+        case EAPT_MD5CHAP:
+            if (len <= 0) {
+                printer(arg, " <missing length>");
+                break;
+            }
+            GETCHAR(vallen, inp);
+            len--;
+            if (vallen > len)
+                goto truncated;
+            printer(arg, " <Value%.*B>", vallen, inp);
+            INCPTR(vallen, inp);
+            len -= vallen;
+            if (len > 0) {
+                printer(arg, " <Name ");
+                ppp_print_string(inp, len, printer, arg);
+                printer(arg, ">");
+                INCPTR(len, inp);
+                len = 0;
+            } else {
+                printer(arg, " <No name>");
+            }
+            break;
+
+        case EAPT_SRP:
+            if (len < 1)
+                goto truncated;
+            GETCHAR(vallen, inp);
+            len--;
+            printer(arg, "-%d", vallen);
+            switch (vallen) {
+            case EAPSRP_CKEY:
+                printer(arg, " <A%.*B>", len, inp);
+                INCPTR(len, inp);
+                len = 0;
+                break;
+
+            case EAPSRP_CVALIDATOR:
+                if (len < (int)sizeof (u32_t))
+                    break;
+                GETLONG(uval, inp);
+                len -= sizeof (u32_t);
+                if (uval & SRPVAL_EBIT) {
+                    printer(arg, " E");
+                    uval &= ~SRPVAL_EBIT;
+                }
+                if (uval != 0) {
+                    printer(arg, " f<%X>", uval);
+                }
+                printer(arg, " <M1%.*B%s>", len, inp,
+                    len == SHA_DIGESTSIZE ? "" : "?");
+                INCPTR(len, inp);
+                len = 0;
+                break;
+
+            case EAPSRP_ACK:
+                break;
+
+            case EAPSRP_LWRECHALLENGE:
+                printer(arg, " <Response%.*B%s>", len, inp,
+                    len == SHA_DIGESTSIZE ? "" : "?");
+                if ((vallen = len) > SHA_DIGESTSIZE)
+                    vallen = SHA_DIGESTSIZE;
+                INCPTR(vallen, inp);
+                len -= vallen;
+                break;
+            default:
+                break;
+            }
+            break;
+        default:
+            break;
+        }
+        break;
+
+    case EAP_SUCCESS:   /* No payload expected for these! */
+    case EAP_FAILURE:
+    default:
+        break;
+
+    truncated:
+        printer(arg, " <truncated>");
+        break;
+    }
+
+    if (len > 8)
+        printer(arg, "%8B...", inp);
+    else if (len > 0)
+        printer(arg, "%.*B", len, inp);
+    INCPTR(len, inp);
+
+    return (inp - pstart);
 }
 #endif /* PRINTPKT_SUPPORT */
 
diff --git a/src/netif/ppp/ecp.c b/src/netif/ppp/ecp.c
index 4d84f609..5b3b3315 100644
--- a/src/netif/ppp/ecp.c
+++ b/src/netif/ppp/ecp.c
@@ -92,8 +92,8 @@ static void ecp_protrej (int unit);
 */
 #if PRINTPKT_SUPPORT
 static int  ecp_printpkt (const u_char *pkt, int len,
-			      void (*printer) (void *, char *, ...),
-			      void *arg);
+                  void (*printer) (void *, char *, ...),
+                  void *arg);
 #endif /* PRINTPKT_SUPPORT */
 /*
 static void ecp_datainput (int unit, u_char *pkt, int len);
@@ -129,10 +129,10 @@ const struct protent ecp_protent = {
 };
 
 fsm ecp_fsm[NUM_PPP];
-ecp_options ecp_wantoptions[NUM_PPP];	/* what to request the peer to use */
-ecp_options ecp_gotoptions[NUM_PPP];	/* what the peer agreed to do */
-ecp_options ecp_allowoptions[NUM_PPP];	/* what we'll agree to do */
-ecp_options ecp_hisoptions[NUM_PPP];	/* what we agreed to do */
+ecp_options ecp_wantoptions[NUM_PPP];   /* what to request the peer to use */
+ecp_options ecp_gotoptions[NUM_PPP];    /* what the peer agreed to do */
+ecp_options ecp_allowoptions[NUM_PPP];  /* what we'll agree to do */
+ecp_options ecp_hisoptions[NUM_PPP];    /* what we agreed to do */
 
 static const fsm_callbacks ecp_callbacks = {
     NULL, /* ecp_resetci, */
diff --git a/src/netif/ppp/eui64.c b/src/netif/ppp/eui64.c
index 01493bc1..9e25fc4c 100644
--- a/src/netif/ppp/eui64.c
+++ b/src/netif/ppp/eui64.c
@@ -48,8 +48,8 @@ char *eui64_ntoa(eui64_t e) {
     static char buf[20];
 
     sprintf(buf, "%02x%02x:%02x%02x:%02x%02x:%02x%02x",
-	     e.e8[0], e.e8[1], e.e8[2], e.e8[3], 
-	     e.e8[4], e.e8[5], e.e8[6], e.e8[7]);
+         e.e8[0], e.e8[1], e.e8[2], e.e8[3],
+         e.e8[4], e.e8[5], e.e8[6], e.e8[7]);
     return buf;
 }
 
diff --git a/src/netif/ppp/fsm.c b/src/netif/ppp/fsm.c
index 2ba1207b..6c0ce0a2 100644
--- a/src/netif/ppp/fsm.c
+++ b/src/netif/ppp/fsm.c
@@ -68,7 +68,7 @@ static void fsm_rtermack(fsm *f);
 static void fsm_rcoderej(fsm *f, u_char *inp, int len);
 static void fsm_sconfreq(fsm *f, int retransmit);
 
-#define PROTO_NAME(f)	((f)->callbacks->proto_name)
+#define PROTO_NAME(f)   ((f)->callbacks->proto_name)
 
 /*
  * fsm_init - Initialize fsm.
@@ -79,7 +79,7 @@ void fsm_init(fsm *f) {
     ppp_pcb *pcb = f->pcb;
     f->state = PPP_FSM_INITIAL;
     f->flags = 0;
-    f->id = 0;				/* XXX Start with random id? */
+    f->id = 0;              /* XXX Start with random id? */
     f->maxnakloops = pcb->settings.fsm_max_nak_loops;
     f->term_reason_len = 0;
 }
@@ -91,22 +91,22 @@ void fsm_init(fsm *f) {
 void fsm_lowerup(fsm *f) {
     switch( f->state ){
     case PPP_FSM_INITIAL:
-	f->state = PPP_FSM_CLOSED;
-	break;
+    f->state = PPP_FSM_CLOSED;
+    break;
 
     case PPP_FSM_STARTING:
-	if( f->flags & OPT_SILENT )
-	    f->state = PPP_FSM_STOPPED;
-	else {
-	    /* Send an initial configure-request */
-	    fsm_sconfreq(f, 0);
-	    f->state = PPP_FSM_REQSENT;
-	}
-	break;
+    if( f->flags & OPT_SILENT )
+        f->state = PPP_FSM_STOPPED;
+    else {
+        /* Send an initial configure-request */
+        fsm_sconfreq(f, 0);
+        f->state = PPP_FSM_REQSENT;
+    }
+    break;
 
     default:
-	FSMDEBUG(("%s: Up event in state %d!", PROTO_NAME(f), f->state));
-	/* no break */
+    FSMDEBUG(("%s: Up event in state %d!", PROTO_NAME(f), f->state));
+    /* no break */
     }
 }
 
@@ -119,37 +119,37 @@ void fsm_lowerup(fsm *f) {
 void fsm_lowerdown(fsm *f) {
     switch( f->state ){
     case PPP_FSM_CLOSED:
-	f->state = PPP_FSM_INITIAL;
-	break;
+    f->state = PPP_FSM_INITIAL;
+    break;
 
     case PPP_FSM_STOPPED:
-	f->state = PPP_FSM_STARTING;
-	if( f->callbacks->starting )
-	    (*f->callbacks->starting)(f);
-	break;
+    f->state = PPP_FSM_STARTING;
+    if( f->callbacks->starting )
+        (*f->callbacks->starting)(f);
+    break;
 
     case PPP_FSM_CLOSING:
-	f->state = PPP_FSM_INITIAL;
-	UNTIMEOUT(fsm_timeout, f);	/* Cancel timeout */
-	break;
+    f->state = PPP_FSM_INITIAL;
+    UNTIMEOUT(fsm_timeout, f);  /* Cancel timeout */
+    break;
 
     case PPP_FSM_STOPPING:
     case PPP_FSM_REQSENT:
     case PPP_FSM_ACKRCVD:
     case PPP_FSM_ACKSENT:
-	f->state = PPP_FSM_STARTING;
-	UNTIMEOUT(fsm_timeout, f);	/* Cancel timeout */
-	break;
+    f->state = PPP_FSM_STARTING;
+    UNTIMEOUT(fsm_timeout, f);  /* Cancel timeout */
+    break;
 
     case PPP_FSM_OPENED:
-	if( f->callbacks->down )
-	    (*f->callbacks->down)(f);
-	f->state = PPP_FSM_STARTING;
-	break;
+    if( f->callbacks->down )
+        (*f->callbacks->down)(f);
+    f->state = PPP_FSM_STARTING;
+    break;
 
     default:
-	FSMDEBUG(("%s: Down event in state %d!", PROTO_NAME(f), f->state));
-	/* no break */
+    FSMDEBUG(("%s: Down event in state %d!", PROTO_NAME(f), f->state));
+    /* no break */
     }
 }
 
@@ -160,34 +160,34 @@ void fsm_lowerdown(fsm *f) {
 void fsm_open(fsm *f) {
     switch( f->state ){
     case PPP_FSM_INITIAL:
-	f->state = PPP_FSM_STARTING;
-	if( f->callbacks->starting )
-	    (*f->callbacks->starting)(f);
-	break;
+    f->state = PPP_FSM_STARTING;
+    if( f->callbacks->starting )
+        (*f->callbacks->starting)(f);
+    break;
 
     case PPP_FSM_CLOSED:
-	if( f->flags & OPT_SILENT )
-	    f->state = PPP_FSM_STOPPED;
-	else {
-	    /* Send an initial configure-request */
-	    fsm_sconfreq(f, 0);
-	    f->state = PPP_FSM_REQSENT;
-	}
-	break;
+    if( f->flags & OPT_SILENT )
+        f->state = PPP_FSM_STOPPED;
+    else {
+        /* Send an initial configure-request */
+        fsm_sconfreq(f, 0);
+        f->state = PPP_FSM_REQSENT;
+    }
+    break;
 
     case PPP_FSM_CLOSING:
-	f->state = PPP_FSM_STOPPING;
-	/* fall through */
-	/* no break */
+    f->state = PPP_FSM_STOPPING;
+    /* fall through */
+    /* no break */
     case PPP_FSM_STOPPED:
     case PPP_FSM_OPENED:
-	if( f->flags & OPT_RESTART ){
-	    fsm_lowerdown(f);
-	    fsm_lowerup(f);
-	}
-	break;
+    if( f->flags & OPT_RESTART ){
+        fsm_lowerdown(f);
+        fsm_lowerup(f);
+    }
+    break;
     default:
-	break;
+    break;
     }
 }
 
@@ -201,25 +201,25 @@ static void terminate_layer(fsm *f, int nextstate) {
     ppp_pcb *pcb = f->pcb;
 
     if( f->state != PPP_FSM_OPENED )
-	UNTIMEOUT(fsm_timeout, f);	/* Cancel timeout */
+    UNTIMEOUT(fsm_timeout, f);  /* Cancel timeout */
     else if( f->callbacks->down )
-	(*f->callbacks->down)(f);	/* Inform upper layers we're down */
+    (*f->callbacks->down)(f);   /* Inform upper layers we're down */
 
     /* Init restart counter and send Terminate-Request */
     f->retransmits = pcb->settings.fsm_max_term_transmits;
     fsm_sdata(f, TERMREQ, f->reqid = ++f->id,
-	      (const u_char *) f->term_reason, f->term_reason_len);
+          (const u_char *) f->term_reason, f->term_reason_len);
 
     if (f->retransmits == 0) {
-	/*
-	 * User asked for no terminate requests at all; just close it.
-	 * We've already fired off one Terminate-Request just to be nice
-	 * to the peer, but we're not going to wait for a reply.
-	 */
-	f->state = nextstate == PPP_FSM_CLOSING ? PPP_FSM_CLOSED : PPP_FSM_STOPPED;
-	if( f->callbacks->finished )
-	    (*f->callbacks->finished)(f);
-	return;
+    /*
+     * User asked for no terminate requests at all; just close it.
+     * We've already fired off one Terminate-Request just to be nice
+     * to the peer, but we're not going to wait for a reply.
+     */
+    f->state = nextstate == PPP_FSM_CLOSING ? PPP_FSM_CLOSED : PPP_FSM_STOPPED;
+    if( f->callbacks->finished )
+        (*f->callbacks->finished)(f);
+    return;
     }
 
     TIMEOUT(fsm_timeout, f, pcb->settings.fsm_timeout_time);
@@ -239,23 +239,23 @@ void fsm_close(fsm *f, const char *reason) {
     f->term_reason_len = (reason == NULL? 0: (u8_t)LWIP_MIN(strlen(reason), 0xFF) );
     switch( f->state ){
     case PPP_FSM_STARTING:
-	f->state = PPP_FSM_INITIAL;
-	break;
+    f->state = PPP_FSM_INITIAL;
+    break;
     case PPP_FSM_STOPPED:
-	f->state = PPP_FSM_CLOSED;
-	break;
+    f->state = PPP_FSM_CLOSED;
+    break;
     case PPP_FSM_STOPPING:
-	f->state = PPP_FSM_CLOSING;
-	break;
+    f->state = PPP_FSM_CLOSING;
+    break;
 
     case PPP_FSM_REQSENT:
     case PPP_FSM_ACKRCVD:
     case PPP_FSM_ACKSENT:
     case PPP_FSM_OPENED:
-	terminate_layer(f, PPP_FSM_CLOSING);
-	break;
+    terminate_layer(f, PPP_FSM_CLOSING);
+    break;
     default:
-	break;
+    break;
     }
 }
 
@@ -270,44 +270,44 @@ static void fsm_timeout(void *arg) {
     switch (f->state) {
     case PPP_FSM_CLOSING:
     case PPP_FSM_STOPPING:
-	if( f->retransmits <= 0 ){
-	    /*
-	     * We've waited for an ack long enough.  Peer probably heard us.
-	     */
-	    f->state = (f->state == PPP_FSM_CLOSING)? PPP_FSM_CLOSED: PPP_FSM_STOPPED;
-	    if( f->callbacks->finished )
-		(*f->callbacks->finished)(f);
-	} else {
-	    /* Send Terminate-Request */
-	    fsm_sdata(f, TERMREQ, f->reqid = ++f->id,
-		      (const u_char *) f->term_reason, f->term_reason_len);
-	    TIMEOUT(fsm_timeout, f, pcb->settings.fsm_timeout_time);
-	    --f->retransmits;
-	}
-	break;
+    if( f->retransmits <= 0 ){
+        /*
+         * We've waited for an ack long enough.  Peer probably heard us.
+         */
+        f->state = (f->state == PPP_FSM_CLOSING)? PPP_FSM_CLOSED: PPP_FSM_STOPPED;
+        if( f->callbacks->finished )
+        (*f->callbacks->finished)(f);
+    } else {
+        /* Send Terminate-Request */
+        fsm_sdata(f, TERMREQ, f->reqid = ++f->id,
+              (const u_char *) f->term_reason, f->term_reason_len);
+        TIMEOUT(fsm_timeout, f, pcb->settings.fsm_timeout_time);
+        --f->retransmits;
+    }
+    break;
 
     case PPP_FSM_REQSENT:
     case PPP_FSM_ACKRCVD:
     case PPP_FSM_ACKSENT:
-	if (f->retransmits <= 0) {
-	    ppp_warn(("%s: timeout sending Config-Requests", PROTO_NAME(f)));
-	    f->state = PPP_FSM_STOPPED;
-	    if( (f->flags & OPT_PASSIVE) == 0 && f->callbacks->finished )
-		(*f->callbacks->finished)(f);
-
-	} else {
-	    /* Retransmit the configure-request */
-	    if (f->callbacks->retransmit)
-		(*f->callbacks->retransmit)(f);
-	    fsm_sconfreq(f, 1);		/* Re-send Configure-Request */
-	    if( f->state == PPP_FSM_ACKRCVD )
-		f->state = PPP_FSM_REQSENT;
-	}
-	break;
+    if (f->retransmits <= 0) {
+        ppp_warn(("%s: timeout sending Config-Requests", PROTO_NAME(f)));
+        f->state = PPP_FSM_STOPPED;
+        if( (f->flags & OPT_PASSIVE) == 0 && f->callbacks->finished )
+        (*f->callbacks->finished)(f);
+
+    } else {
+        /* Retransmit the configure-request */
+        if (f->callbacks->retransmit)
+        (*f->callbacks->retransmit)(f);
+        fsm_sconfreq(f, 1);     /* Re-send Configure-Request */
+        if( f->state == PPP_FSM_ACKRCVD )
+        f->state = PPP_FSM_REQSENT;
+    }
+    break;
 
     default:
-	FSMDEBUG(("%s: Timeout event in state %d!", PROTO_NAME(f), f->state));
-	/* no break */
+    FSMDEBUG(("%s: Timeout event in state %d!", PROTO_NAME(f), f->state));
+    /* no break */
     }
 }
 
@@ -326,26 +326,26 @@ void fsm_input(fsm *f, u_char *inpacket, int l) {
      */
     inp = inpacket;
     if (l < HEADERLEN) {
-	FSMDEBUG(("fsm_input(%x): Rcvd short header.", f->protocol));
-	return;
+    FSMDEBUG(("fsm_input(%x): Rcvd short header.", f->protocol));
+    return;
     }
     GETCHAR(code, inp);
     GETCHAR(id, inp);
     GETSHORT(len, inp);
     if (len < HEADERLEN) {
-	FSMDEBUG(("fsm_input(%x): Rcvd illegal length.", f->protocol));
-	return;
+    FSMDEBUG(("fsm_input(%x): Rcvd illegal length.", f->protocol));
+    return;
     }
     if (len > l) {
-	FSMDEBUG(("fsm_input(%x): Rcvd short packet.", f->protocol));
-	return;
+    FSMDEBUG(("fsm_input(%x): Rcvd short packet.", f->protocol));
+    return;
     }
-    len -= HEADERLEN;		/* subtract header length */
+    len -= HEADERLEN;       /* subtract header length */
 
     if( f->state == PPP_FSM_INITIAL || f->state == PPP_FSM_STARTING ){
-	FSMDEBUG(("fsm_input(%x): Rcvd packet in state %d.",
-		  f->protocol, f->state));
-	return;
+    FSMDEBUG(("fsm_input(%x): Rcvd packet in state %d.",
+          f->protocol, f->state));
+    return;
     }
 
     /*
@@ -353,35 +353,35 @@ void fsm_input(fsm *f, u_char *inpacket, int l) {
      */
     switch (code) {
     case CONFREQ:
-	fsm_rconfreq(f, id, inp, len);
-	break;
-    
+    fsm_rconfreq(f, id, inp, len);
+    break;
+
     case CONFACK:
-	fsm_rconfack(f, id, inp, len);
-	break;
-    
+    fsm_rconfack(f, id, inp, len);
+    break;
+
     case CONFNAK:
     case CONFREJ:
-	fsm_rconfnakrej(f, code, id, inp, len);
-	break;
-    
+    fsm_rconfnakrej(f, code, id, inp, len);
+    break;
+
     case TERMREQ:
-	fsm_rtermreq(f, id, inp, len);
-	break;
-    
+    fsm_rtermreq(f, id, inp, len);
+    break;
+
     case TERMACK:
-	fsm_rtermack(f);
-	break;
-    
+    fsm_rtermack(f);
+    break;
+
     case CODEREJ:
-	fsm_rcoderej(f, inp, len);
-	break;
-    
+    fsm_rcoderej(f, inp, len);
+    break;
+
     default:
-	if( !f->callbacks->extcode
-	   || !(*f->callbacks->extcode)(f, code, id, inp, len) )
-	    fsm_sdata(f, CODEREJ, ++f->id, inpacket, len + HEADERLEN);
-	break;
+    if( !f->callbacks->extcode
+       || !(*f->callbacks->extcode)(f, code, id, inp, len) )
+        fsm_sdata(f, CODEREJ, ++f->id, inpacket, len + HEADERLEN);
+    break;
     }
 }
 
@@ -394,61 +394,61 @@ static void fsm_rconfreq(fsm *f, u_char id, u_char *inp, int len) {
 
     switch( f->state ){
     case PPP_FSM_CLOSED:
-	/* Go away, we're closed */
-	fsm_sdata(f, TERMACK, id, NULL, 0);
-	return;
+    /* Go away, we're closed */
+    fsm_sdata(f, TERMACK, id, NULL, 0);
+    return;
     case PPP_FSM_CLOSING:
     case PPP_FSM_STOPPING:
-	return;
+    return;
 
     case PPP_FSM_OPENED:
-	/* Go down and restart negotiation */
-	if( f->callbacks->down )
-	    (*f->callbacks->down)(f);	/* Inform upper layers */
-	fsm_sconfreq(f, 0);		/* Send initial Configure-Request */
-	f->state = PPP_FSM_REQSENT;
-	break;
+    /* Go down and restart negotiation */
+    if( f->callbacks->down )
+        (*f->callbacks->down)(f);   /* Inform upper layers */
+    fsm_sconfreq(f, 0);     /* Send initial Configure-Request */
+    f->state = PPP_FSM_REQSENT;
+    break;
 
     case PPP_FSM_STOPPED:
-	/* Negotiation started by our peer */
-	fsm_sconfreq(f, 0);		/* Send initial Configure-Request */
-	f->state = PPP_FSM_REQSENT;
-	break;
+    /* Negotiation started by our peer */
+    fsm_sconfreq(f, 0);     /* Send initial Configure-Request */
+    f->state = PPP_FSM_REQSENT;
+    break;
     default:
-	break;
+    break;
     }
 
     /*
      * Pass the requested configuration options
      * to protocol-specific code for checking.
      */
-    if (f->callbacks->reqci){		/* Check CI */
-	reject_if_disagree = (f->nakloops >= f->maxnakloops);
-	code = (*f->callbacks->reqci)(f, inp, &len, reject_if_disagree);
+    if (f->callbacks->reqci){       /* Check CI */
+    reject_if_disagree = (f->nakloops >= f->maxnakloops);
+    code = (*f->callbacks->reqci)(f, inp, &len, reject_if_disagree);
     } else if (len)
-	code = CONFREJ;			/* Reject all CI */
+    code = CONFREJ;         /* Reject all CI */
     else
-	code = CONFACK;
+    code = CONFACK;
 
     /* send the Ack, Nak or Rej to the peer */
     fsm_sdata(f, code, id, inp, len);
 
     if (code == CONFACK) {
-	if (f->state == PPP_FSM_ACKRCVD) {
-	    UNTIMEOUT(fsm_timeout, f);	/* Cancel timeout */
-	    f->state = PPP_FSM_OPENED;
-	    if (f->callbacks->up)
-		(*f->callbacks->up)(f);	/* Inform upper layers */
-	} else
-	    f->state = PPP_FSM_ACKSENT;
-	f->nakloops = 0;
+    if (f->state == PPP_FSM_ACKRCVD) {
+        UNTIMEOUT(fsm_timeout, f);  /* Cancel timeout */
+        f->state = PPP_FSM_OPENED;
+        if (f->callbacks->up)
+        (*f->callbacks->up)(f); /* Inform upper layers */
+    } else
+        f->state = PPP_FSM_ACKSENT;
+    f->nakloops = 0;
 
     } else {
-	/* we sent CONFACK or CONFREJ */
-	if (f->state != PPP_FSM_ACKRCVD)
-	    f->state = PPP_FSM_REQSENT;
-	if( code == CONFNAK )
-	    ++f->nakloops;
+    /* we sent CONFACK or CONFREJ */
+    if (f->state != PPP_FSM_ACKRCVD)
+        f->state = PPP_FSM_REQSENT;
+    if( code == CONFNAK )
+        ++f->nakloops;
     }
 }
 
@@ -459,13 +459,13 @@ static void fsm_rconfreq(fsm *f, u_char id, u_char *inp, int len) {
 static void fsm_rconfack(fsm *f, int id, u_char *inp, int len) {
     ppp_pcb *pcb = f->pcb;
 
-    if (id != f->reqid || f->seen_ack)		/* Expected id? */
-	return;					/* Nope, toss... */
+    if (id != f->reqid || f->seen_ack)      /* Expected id? */
+    return;                 /* Nope, toss... */
     if( !(f->callbacks->ackci? (*f->callbacks->ackci)(f, inp, len):
-	  (len == 0)) ){
-	/* Ack is bad - ignore it */
-	ppp_error(("Received bad configure-ack: %P", inp, len));
-	return;
+      (len == 0)) ){
+    /* Ack is bad - ignore it */
+    ppp_error(("Received bad configure-ack: %P", inp, len));
+    return;
     }
     f->seen_ack = 1;
     f->rnakloops = 0;
@@ -473,38 +473,38 @@ static void fsm_rconfack(fsm *f, int id, u_char *inp, int len) {
     switch (f->state) {
     case PPP_FSM_CLOSED:
     case PPP_FSM_STOPPED:
-	fsm_sdata(f, TERMACK, id, NULL, 0);
-	break;
+    fsm_sdata(f, TERMACK, id, NULL, 0);
+    break;
 
     case PPP_FSM_REQSENT:
-	f->state = PPP_FSM_ACKRCVD;
-	f->retransmits = pcb->settings.fsm_max_conf_req_transmits;
-	break;
+    f->state = PPP_FSM_ACKRCVD;
+    f->retransmits = pcb->settings.fsm_max_conf_req_transmits;
+    break;
 
     case PPP_FSM_ACKRCVD:
-	/* Huh? an extra valid Ack? oh well... */
-	UNTIMEOUT(fsm_timeout, f);	/* Cancel timeout */
-	fsm_sconfreq(f, 0);
-	f->state = PPP_FSM_REQSENT;
-	break;
+    /* Huh? an extra valid Ack? oh well... */
+    UNTIMEOUT(fsm_timeout, f);  /* Cancel timeout */
+    fsm_sconfreq(f, 0);
+    f->state = PPP_FSM_REQSENT;
+    break;
 
     case PPP_FSM_ACKSENT:
-	UNTIMEOUT(fsm_timeout, f);	/* Cancel timeout */
-	f->state = PPP_FSM_OPENED;
-	f->retransmits = pcb->settings.fsm_max_conf_req_transmits;
-	if (f->callbacks->up)
-	    (*f->callbacks->up)(f);	/* Inform upper layers */
-	break;
+    UNTIMEOUT(fsm_timeout, f);  /* Cancel timeout */
+    f->state = PPP_FSM_OPENED;
+    f->retransmits = pcb->settings.fsm_max_conf_req_transmits;
+    if (f->callbacks->up)
+        (*f->callbacks->up)(f); /* Inform upper layers */
+    break;
 
     case PPP_FSM_OPENED:
-	/* Go down and restart negotiation */
-	if (f->callbacks->down)
-	    (*f->callbacks->down)(f);	/* Inform upper layers */
-	fsm_sconfreq(f, 0);		/* Send initial Configure-Request */
-	f->state = PPP_FSM_REQSENT;
-	break;
+    /* Go down and restart negotiation */
+    if (f->callbacks->down)
+        (*f->callbacks->down)(f);   /* Inform upper layers */
+    fsm_sconfreq(f, 0);     /* Send initial Configure-Request */
+    f->state = PPP_FSM_REQSENT;
+    break;
     default:
-	break;
+    break;
     }
 }
 
@@ -516,24 +516,24 @@ static void fsm_rconfnakrej(fsm *f, int code, int id, u_char *inp, int len) {
     int ret;
     int treat_as_reject;
 
-    if (id != f->reqid || f->seen_ack)	/* Expected id? */
-	return;				/* Nope, toss... */
+    if (id != f->reqid || f->seen_ack)  /* Expected id? */
+    return;             /* Nope, toss... */
 
     if (code == CONFNAK) {
-	++f->rnakloops;
-	treat_as_reject = (f->rnakloops >= f->maxnakloops);
-	if (f->callbacks->nakci == NULL
-	    || !(ret = f->callbacks->nakci(f, inp, len, treat_as_reject))) {
-	    ppp_error(("Received bad configure-nak: %P", inp, len));
-	    return;
-	}
+    ++f->rnakloops;
+    treat_as_reject = (f->rnakloops >= f->maxnakloops);
+    if (f->callbacks->nakci == NULL
+        || !(ret = f->callbacks->nakci(f, inp, len, treat_as_reject))) {
+        ppp_error(("Received bad configure-nak: %P", inp, len));
+        return;
+    }
     } else {
-	f->rnakloops = 0;
-	if (f->callbacks->rejci == NULL
-	    || !(ret = f->callbacks->rejci(f, inp, len))) {
-	    ppp_error(("Received bad configure-rej: %P", inp, len));
-	    return;
-	}
+    f->rnakloops = 0;
+    if (f->callbacks->rejci == NULL
+        || !(ret = f->callbacks->rejci(f, inp, len))) {
+        ppp_error(("Received bad configure-rej: %P", inp, len));
+        return;
+    }
     }
 
     f->seen_ack = 1;
@@ -541,35 +541,35 @@ static void fsm_rconfnakrej(fsm *f, int code, int id, u_char *inp, int len) {
     switch (f->state) {
     case PPP_FSM_CLOSED:
     case PPP_FSM_STOPPED:
-	fsm_sdata(f, TERMACK, id, NULL, 0);
-	break;
+    fsm_sdata(f, TERMACK, id, NULL, 0);
+    break;
 
     case PPP_FSM_REQSENT:
     case PPP_FSM_ACKSENT:
-	/* They didn't agree to what we wanted - try another request */
-	UNTIMEOUT(fsm_timeout, f);	/* Cancel timeout */
-	if (ret < 0)
-	    f->state = PPP_FSM_STOPPED;		/* kludge for stopping CCP */
-	else
-	    fsm_sconfreq(f, 0);		/* Send Configure-Request */
-	break;
+    /* They didn't agree to what we wanted - try another request */
+    UNTIMEOUT(fsm_timeout, f);  /* Cancel timeout */
+    if (ret < 0)
+        f->state = PPP_FSM_STOPPED;     /* kludge for stopping CCP */
+    else
+        fsm_sconfreq(f, 0);     /* Send Configure-Request */
+    break;
 
     case PPP_FSM_ACKRCVD:
-	/* Got a Nak/reject when we had already had an Ack?? oh well... */
-	UNTIMEOUT(fsm_timeout, f);	/* Cancel timeout */
-	fsm_sconfreq(f, 0);
-	f->state = PPP_FSM_REQSENT;
-	break;
+    /* Got a Nak/reject when we had already had an Ack?? oh well... */
+    UNTIMEOUT(fsm_timeout, f);  /* Cancel timeout */
+    fsm_sconfreq(f, 0);
+    f->state = PPP_FSM_REQSENT;
+    break;
 
     case PPP_FSM_OPENED:
-	/* Go down and restart negotiation */
-	if (f->callbacks->down)
-	    (*f->callbacks->down)(f);	/* Inform upper layers */
-	fsm_sconfreq(f, 0);		/* Send initial Configure-Request */
-	f->state = PPP_FSM_REQSENT;
-	break;
+    /* Go down and restart negotiation */
+    if (f->callbacks->down)
+        (*f->callbacks->down)(f);   /* Inform upper layers */
+    fsm_sconfreq(f, 0);     /* Send initial Configure-Request */
+    f->state = PPP_FSM_REQSENT;
+    break;
     default:
-	break;
+    break;
     }
 }
 
@@ -583,22 +583,22 @@ static void fsm_rtermreq(fsm *f, int id, u_char *p, int len) {
     switch (f->state) {
     case PPP_FSM_ACKRCVD:
     case PPP_FSM_ACKSENT:
-	f->state = PPP_FSM_REQSENT;		/* Start over but keep trying */
-	break;
+    f->state = PPP_FSM_REQSENT;     /* Start over but keep trying */
+    break;
 
     case PPP_FSM_OPENED:
-	if (len > 0) {
-	    ppp_info(("%s terminated by peer (%0.*v)", PROTO_NAME(f), len, p));
-	} else
-	    ppp_info(("%s terminated by peer", PROTO_NAME(f)));
-	f->retransmits = 0;
-	f->state = PPP_FSM_STOPPING;
-	if (f->callbacks->down)
-	    (*f->callbacks->down)(f);	/* Inform upper layers */
-	TIMEOUT(fsm_timeout, f, pcb->settings.fsm_timeout_time);
-	break;
+    if (len > 0) {
+        ppp_info(("%s terminated by peer (%0.*v)", PROTO_NAME(f), len, p));
+    } else
+        ppp_info(("%s terminated by peer", PROTO_NAME(f)));
+    f->retransmits = 0;
+    f->state = PPP_FSM_STOPPING;
+    if (f->callbacks->down)
+        (*f->callbacks->down)(f);   /* Inform upper layers */
+    TIMEOUT(fsm_timeout, f, pcb->settings.fsm_timeout_time);
+    break;
     default:
-	break;
+    break;
     }
 
     fsm_sdata(f, TERMACK, id, NULL, 0);
@@ -611,30 +611,30 @@ static void fsm_rtermreq(fsm *f, int id, u_char *p, int len) {
 static void fsm_rtermack(fsm *f) {
     switch (f->state) {
     case PPP_FSM_CLOSING:
-	UNTIMEOUT(fsm_timeout, f);
-	f->state = PPP_FSM_CLOSED;
-	if( f->callbacks->finished )
-	    (*f->callbacks->finished)(f);
-	break;
+    UNTIMEOUT(fsm_timeout, f);
+    f->state = PPP_FSM_CLOSED;
+    if( f->callbacks->finished )
+        (*f->callbacks->finished)(f);
+    break;
     case PPP_FSM_STOPPING:
-	UNTIMEOUT(fsm_timeout, f);
-	f->state = PPP_FSM_STOPPED;
-	if( f->callbacks->finished )
-	    (*f->callbacks->finished)(f);
-	break;
+    UNTIMEOUT(fsm_timeout, f);
+    f->state = PPP_FSM_STOPPED;
+    if( f->callbacks->finished )
+        (*f->callbacks->finished)(f);
+    break;
 
     case PPP_FSM_ACKRCVD:
-	f->state = PPP_FSM_REQSENT;
-	break;
+    f->state = PPP_FSM_REQSENT;
+    break;
 
     case PPP_FSM_OPENED:
-	if (f->callbacks->down)
-	    (*f->callbacks->down)(f);	/* Inform upper layers */
-	fsm_sconfreq(f, 0);
-	f->state = PPP_FSM_REQSENT;
-	break;
+    if (f->callbacks->down)
+        (*f->callbacks->down)(f);   /* Inform upper layers */
+    fsm_sconfreq(f, 0);
+    f->state = PPP_FSM_REQSENT;
+    break;
     default:
-	break;
+    break;
     }
 }
 
@@ -646,15 +646,15 @@ static void fsm_rcoderej(fsm *f, u_char *inp, int len) {
     u_char code, id;
 
     if (len < HEADERLEN) {
-	FSMDEBUG(("fsm_rcoderej: Rcvd short Code-Reject packet!"));
-	return;
+    FSMDEBUG(("fsm_rcoderej: Rcvd short Code-Reject packet!"));
+    return;
     }
     GETCHAR(code, inp);
     GETCHAR(id, inp);
     ppp_warn(("%s: Rcvd Code-Reject for code %d, id %d", PROTO_NAME(f), code, id));
 
     if( f->state == PPP_FSM_ACKRCVD )
-	f->state = PPP_FSM_REQSENT;
+    f->state = PPP_FSM_REQSENT;
 }
 
 
@@ -666,36 +666,36 @@ static void fsm_rcoderej(fsm *f, u_char *inp, int len) {
 void fsm_protreject(fsm *f) {
     switch( f->state ){
     case PPP_FSM_CLOSING:
-	UNTIMEOUT(fsm_timeout, f);	/* Cancel timeout */
-	/* fall through */
-	/* no break */
+    UNTIMEOUT(fsm_timeout, f);  /* Cancel timeout */
+    /* fall through */
+    /* no break */
     case PPP_FSM_CLOSED:
-	f->state = PPP_FSM_CLOSED;
-	if( f->callbacks->finished )
-	    (*f->callbacks->finished)(f);
-	break;
+    f->state = PPP_FSM_CLOSED;
+    if( f->callbacks->finished )
+        (*f->callbacks->finished)(f);
+    break;
 
     case PPP_FSM_STOPPING:
     case PPP_FSM_REQSENT:
     case PPP_FSM_ACKRCVD:
     case PPP_FSM_ACKSENT:
-	UNTIMEOUT(fsm_timeout, f);	/* Cancel timeout */
-	/* fall through */
-	/* no break */
+    UNTIMEOUT(fsm_timeout, f);  /* Cancel timeout */
+    /* fall through */
+    /* no break */
     case PPP_FSM_STOPPED:
-	f->state = PPP_FSM_STOPPED;
-	if( f->callbacks->finished )
-	    (*f->callbacks->finished)(f);
-	break;
+    f->state = PPP_FSM_STOPPED;
+    if( f->callbacks->finished )
+        (*f->callbacks->finished)(f);
+    break;
 
     case PPP_FSM_OPENED:
-	terminate_layer(f, PPP_FSM_STOPPING);
-	break;
+    terminate_layer(f, PPP_FSM_STOPPING);
+    break;
 
     default:
-	FSMDEBUG(("%s: Protocol-reject event in state %d!",
-		  PROTO_NAME(f), f->state));
-	/* no break */
+    FSMDEBUG(("%s: Protocol-reject event in state %d!",
+          PROTO_NAME(f), f->state));
+    /* no break */
     }
 }
 
@@ -710,17 +710,17 @@ static void fsm_sconfreq(fsm *f, int retransmit) {
     int cilen;
 
     if( f->state != PPP_FSM_REQSENT && f->state != PPP_FSM_ACKRCVD && f->state != PPP_FSM_ACKSENT ){
-	/* Not currently negotiating - reset options */
-	if( f->callbacks->resetci )
-	    (*f->callbacks->resetci)(f);
-	f->nakloops = 0;
-	f->rnakloops = 0;
+    /* Not currently negotiating - reset options */
+    if( f->callbacks->resetci )
+        (*f->callbacks->resetci)(f);
+    f->nakloops = 0;
+    f->rnakloops = 0;
     }
 
     if( !retransmit ){
-	/* New request - reset retransmission counter, use new ID */
-	f->retransmits = pcb->settings.fsm_max_conf_req_transmits;
-	f->reqid = ++f->id;
+    /* New request - reset retransmission counter, use new ID */
+    f->retransmits = pcb->settings.fsm_max_conf_req_transmits;
+    f->reqid = ++f->id;
     }
 
     f->seen_ack = 0;
@@ -729,11 +729,11 @@ static void fsm_sconfreq(fsm *f, int retransmit) {
      * Make up the request packet
      */
     if( f->callbacks->cilen && f->callbacks->addci ){
-	cilen = (*f->callbacks->cilen)(f);
-	if( cilen > pcb->peer_mru - HEADERLEN )
-	    cilen = pcb->peer_mru - HEADERLEN;
+    cilen = (*f->callbacks->cilen)(f);
+    if( cilen > pcb->peer_mru - HEADERLEN )
+        cilen = pcb->peer_mru - HEADERLEN;
     } else
-	cilen = 0;
+    cilen = 0;
 
     p = pbuf_alloc(PBUF_RAW, (u16_t)(cilen + HEADERLEN + PPP_HDRLEN), PBUF_RAM);
     if(NULL == p)
@@ -750,8 +750,8 @@ static void fsm_sconfreq(fsm *f, int retransmit) {
     PUTCHAR(f->reqid, outp);
     PUTSHORT(cilen + HEADERLEN, outp);
     if (cilen != 0) {
-	(*f->callbacks->addci)(f, outp, &cilen);
-	LWIP_ASSERT("cilen == p->len - HEADERLEN - PPP_HDRLEN", cilen == p->len - HEADERLEN - PPP_HDRLEN);
+    (*f->callbacks->addci)(f, outp, &cilen);
+    LWIP_ASSERT("cilen == p->len - HEADERLEN - PPP_HDRLEN", cilen == p->len - HEADERLEN - PPP_HDRLEN);
     }
 
     ppp_write(pcb, p);
@@ -775,7 +775,7 @@ void fsm_sdata(fsm *f, u_char code, u_char id, const u_char *data, int datalen)
 
     /* Adjust length to be smaller than MTU */
     if (datalen > pcb->peer_mru - HEADERLEN)
-	datalen = pcb->peer_mru - HEADERLEN;
+    datalen = pcb->peer_mru - HEADERLEN;
     outlen = datalen + HEADERLEN;
 
     p = pbuf_alloc(PBUF_RAW, (u16_t)(outlen + PPP_HDRLEN), PBUF_RAM);
@@ -788,7 +788,7 @@ void fsm_sdata(fsm *f, u_char code, u_char id, const u_char *data, int datalen)
 
     outp = (u_char*)p->payload;
     if (datalen) /* && data != outp + PPP_HDRLEN + HEADERLEN)  -- was only for fsm_sconfreq() */
-	MEMCPY(outp + PPP_HDRLEN + HEADERLEN, data, datalen);
+    MEMCPY(outp + PPP_HDRLEN + HEADERLEN, data, datalen);
     MAKEHEADER(outp, f->protocol);
     PUTCHAR(code, outp);
     PUTCHAR(id, outp);
diff --git a/src/netif/ppp/ipcp.c b/src/netif/ppp/ipcp.c
index b033cde0..e0d7ac2a 100644
--- a/src/netif/ppp/ipcp.c
+++ b/src/netif/ppp/ipcp.c
@@ -66,15 +66,15 @@
 
 #if 0 /* UNUSED */
 /* global vars */
-u32_t netmask = 0;		/* IP netmask to set on interface */
+u32_t netmask = 0;      /* IP netmask to set on interface */
 #endif /* UNUSED */
 
 #if 0 /* UNUSED */
-bool	disable_defaultip = 0;	/* Don't use hostname for default IP adrs */
+bool    disable_defaultip = 0;  /* Don't use hostname for default IP adrs */
 #endif /* UNUSED */
 
 #if 0 /* moved to ppp_settings */
-bool	noremoteip = 0;		/* Let him have no IP address */
+bool    noremoteip = 0;     /* Let him have no IP address */
 #endif /* moved to ppp_setting */
 
 #if 0 /* UNUSED */
@@ -96,47 +96,47 @@ struct notifier *ip_down_notifier = NULL;
 
 /* local vars */
 #if 0 /* moved to ppp_pcb */
-static int default_route_set[NUM_PPP];	/* Have set up a default route */
-static int proxy_arp_set[NUM_PPP];	/* Have created proxy arp entry */
-static int ipcp_is_up;			/* have called np_up() */
-static int ipcp_is_open;		/* haven't called np_finished() */
-static bool ask_for_local;		/* request our address from peer */
+static int default_route_set[NUM_PPP];  /* Have set up a default route */
+static int proxy_arp_set[NUM_PPP];  /* Have created proxy arp entry */
+static int ipcp_is_up;          /* have called np_up() */
+static int ipcp_is_open;        /* haven't called np_finished() */
+static bool ask_for_local;      /* request our address from peer */
 #endif /* moved to ppp_pcb */
 #if 0 /* UNUSED */
-static char vj_value[8];		/* string form of vj option value */
-static char netmask_str[20];		/* string form of netmask value */
+static char vj_value[8];        /* string form of vj option value */
+static char netmask_str[20];        /* string form of netmask value */
 #endif /* UNUSED */
 
 /*
  * Callbacks for fsm code.  (CI = Configuration Information)
  */
-static void ipcp_resetci(fsm *f);	/* Reset our CI */
-static int  ipcp_cilen(fsm *f);	        /* Return length of our CI */
+static void ipcp_resetci(fsm *f);   /* Reset our CI */
+static int  ipcp_cilen(fsm *f);         /* Return length of our CI */
 static void ipcp_addci(fsm *f, u_char *ucp, int *lenp); /* Add our CI */
-static int  ipcp_ackci(fsm *f, u_char *p, int len);	/* Peer ack'd our CI */
+static int  ipcp_ackci(fsm *f, u_char *p, int len); /* Peer ack'd our CI */
 static int  ipcp_nakci(fsm *f, u_char *p, int len, int treat_as_reject);/* Peer nak'd our CI */
-static int  ipcp_rejci(fsm *f, u_char *p, int len);	/* Peer rej'd our CI */
+static int  ipcp_rejci(fsm *f, u_char *p, int len); /* Peer rej'd our CI */
 static int  ipcp_reqci(fsm *f, u_char *inp, int *len, int reject_if_disagree); /* Rcv CI */
-static void ipcp_up(fsm *f);		/* We're UP */
-static void ipcp_down(fsm *f);		/* We're DOWN */
-static void ipcp_finished(fsm *f);	/* Don't need lower layer */
+static void ipcp_up(fsm *f);        /* We're UP */
+static void ipcp_down(fsm *f);      /* We're DOWN */
+static void ipcp_finished(fsm *f);  /* Don't need lower layer */
 
 static const fsm_callbacks ipcp_callbacks = { /* IPCP callback routines */
-    ipcp_resetci,		/* Reset our Configuration Information */
-    ipcp_cilen,			/* Length of our Configuration Information */
-    ipcp_addci,			/* Add our Configuration Information */
-    ipcp_ackci,			/* ACK our Configuration Information */
-    ipcp_nakci,			/* NAK our Configuration Information */
-    ipcp_rejci,			/* Reject our Configuration Information */
-    ipcp_reqci,			/* Request peer's Configuration Information */
-    ipcp_up,			/* Called when fsm reaches OPENED state */
-    ipcp_down,			/* Called when fsm leaves OPENED state */
-    NULL,			/* Called when we want the lower layer up */
-    ipcp_finished,		/* Called when we want the lower layer down */
-    NULL,			/* Called when Protocol-Reject received */
-    NULL,			/* Retransmission is necessary */
-    NULL,			/* Called to handle protocol-specific codes */
-    "IPCP"			/* String name of protocol */
+    ipcp_resetci,       /* Reset our Configuration Information */
+    ipcp_cilen,         /* Length of our Configuration Information */
+    ipcp_addci,         /* Add our Configuration Information */
+    ipcp_ackci,         /* ACK our Configuration Information */
+    ipcp_nakci,         /* NAK our Configuration Information */
+    ipcp_rejci,         /* Reject our Configuration Information */
+    ipcp_reqci,         /* Request peer's Configuration Information */
+    ipcp_up,            /* Called when fsm reaches OPENED state */
+    ipcp_down,          /* Called when fsm leaves OPENED state */
+    NULL,           /* Called when we want the lower layer up */
+    ipcp_finished,      /* Called when we want the lower layer down */
+    NULL,           /* Called when Protocol-Reject received */
+    NULL,           /* Retransmission is necessary */
+    NULL,           /* Called to handle protocol-specific codes */
+    "IPCP"          /* String name of protocol */
 };
 
 /*
@@ -209,13 +209,13 @@ static option_t ipcp_option_list[] = {
       &ipcp_wantoptions[0].default_route },
 
     { "replacedefaultroute", o_bool,
-				&ipcp_wantoptions[0].replace_default_route,
+                &ipcp_wantoptions[0].replace_default_route,
       "Replace default route", 1
     },
     { "noreplacedefaultroute", o_bool,
-				&ipcp_allowoptions[0].replace_default_route,
+                &ipcp_allowoptions[0].replace_default_route,
       "Never replace default route", OPT_A2COPY,
-				&ipcp_wantoptions[0].replace_default_route },
+                &ipcp_wantoptions[0].replace_default_route },
     { "proxyarp", o_bool, &ipcp_wantoptions[0].proxy_arp,
       "Add proxy ARP entry", OPT_ENABLE|1, &ipcp_allowoptions[0].proxy_arp },
     { "noproxyarp", o_bool, &ipcp_allowoptions[0].proxy_arp,
@@ -265,7 +265,7 @@ static void ipcp_input(ppp_pcb *pcb, u_char *p, int len);
 static void ipcp_protrej(ppp_pcb *pcb);
 #if PRINTPKT_SUPPORT
 static int ipcp_printpkt(const u_char *p, int plen,
-		void (*printer) (void *, const char *, ...), void *arg);
+        void (*printer) (void *, const char *, ...), void *arg);
 #endif /* PRINTPKT_SUPPORT */
 #if PPP_OPTIONS
 static void ip_check_options (void);
@@ -312,15 +312,15 @@ static void ipcp_clear_addrs(ppp_pcb *pcb, u32_t ouraddr, u32_t hisaddr, u8_t re
 /*
  * Lengths of configuration options.
  */
-#define CILEN_VOID	2
-#define CILEN_COMPRESS	4	/* min length for compression protocol opt. */
-#define CILEN_VJ	6	/* length for RFC1332 Van-Jacobson opt. */
-#define CILEN_ADDR	6	/* new-style single address option */
-#define CILEN_ADDRS	10	/* old-style dual address option */
+#define CILEN_VOID  2
+#define CILEN_COMPRESS  4   /* min length for compression protocol opt. */
+#define CILEN_VJ    6   /* length for RFC1332 Van-Jacobson opt. */
+#define CILEN_ADDR  6   /* new-style single address option */
+#define CILEN_ADDRS 10  /* old-style dual address option */
 
 
-#define CODENAME(x)	((x) == CONFACK ? "ACK" : \
-			 (x) == CONFNAK ? "NAK" : "REJ")
+#define CODENAME(x) ((x) == CONFACK ? "ACK" : \
+             (x) == CONFNAK ? "NAK" : "REJ")
 
 #if 0 /* UNUSED, already defined by lwIP */
 /*
@@ -351,11 +351,11 @@ setvjslots(argv)
     int value;
 
     if (!int_option(*argv, &value))
-	return 0;
+    return 0;
 
     if (value < 2 || value > 16) {
-	option_error("vj-max-slots value must be between 2 and 16");
-	return 0;
+    option_error("vj-max-slots value must be between 2 and 16");
+    return 0;
     }
     ipcp_wantoptions [0].maxslotindex =
         ipcp_allowoptions[0].maxslotindex = value - 1;
@@ -375,21 +375,21 @@ setdnsaddr(argv)
 
     dns = inet_addr(*argv);
     if (dns == (u32_t) -1) {
-	if ((hp = gethostbyname(*argv)) == NULL) {
-	    option_error("invalid address parameter '%s' for ms-dns option",
-			 *argv);
-	    return 0;
-	}
-	dns = *(u32_t *)hp->h_addr;
+    if ((hp = gethostbyname(*argv)) == NULL) {
+        option_error("invalid address parameter '%s' for ms-dns option",
+             *argv);
+        return 0;
+    }
+    dns = *(u32_t *)hp->h_addr;
     }
 
     /* We take the last 2 values given, the 2nd-last as the primary
        and the last as the secondary.  If only one is given it
        becomes both primary and secondary. */
     if (ipcp_allowoptions[0].dnsaddr[1] == 0)
-	ipcp_allowoptions[0].dnsaddr[0] = dns;
+    ipcp_allowoptions[0].dnsaddr[0] = dns;
     else
-	ipcp_allowoptions[0].dnsaddr[0] = ipcp_allowoptions[0].dnsaddr[1];
+    ipcp_allowoptions[0].dnsaddr[0] = ipcp_allowoptions[0].dnsaddr[1];
 
     /* always set the secondary address value. */
     ipcp_allowoptions[0].dnsaddr[1] = dns;
@@ -411,21 +411,21 @@ setwinsaddr(argv)
 
     wins = inet_addr(*argv);
     if (wins == (u32_t) -1) {
-	if ((hp = gethostbyname(*argv)) == NULL) {
-	    option_error("invalid address parameter '%s' for ms-wins option",
-			 *argv);
-	    return 0;
-	}
-	wins = *(u32_t *)hp->h_addr;
+    if ((hp = gethostbyname(*argv)) == NULL) {
+        option_error("invalid address parameter '%s' for ms-wins option",
+             *argv);
+        return 0;
+    }
+    wins = *(u32_t *)hp->h_addr;
     }
 
     /* We take the last 2 values given, the 2nd-last as the primary
        and the last as the secondary.  If only one is given it
        becomes both primary and secondary. */
     if (ipcp_allowoptions[0].winsaddr[1] == 0)
-	ipcp_allowoptions[0].winsaddr[0] = wins;
+    ipcp_allowoptions[0].winsaddr[0] = wins;
     else
-	ipcp_allowoptions[0].winsaddr[0] = ipcp_allowoptions[0].winsaddr[1];
+    ipcp_allowoptions[0].winsaddr[0] = ipcp_allowoptions[0].winsaddr[1];
 
     /* always set the secondary address value. */
     ipcp_allowoptions[0].winsaddr[1] = wins;
@@ -455,52 +455,52 @@ setipaddr(arg, argv, doit)
      * IP address pair separated by ":".
      */
     if ((colon = strchr(arg, ':')) == NULL)
-	return 0;
+    return 0;
     if (!doit)
-	return 1;
-  
+    return 1;
+
     /*
      * If colon first character, then no local addr.
      */
     if (colon != arg && option_priority >= prio_local) {
-	*colon = '\0';
-	if ((local = inet_addr(arg)) == (u32_t) -1) {
-	    if ((hp = gethostbyname(arg)) == NULL) {
-		option_error("unknown host: %s", arg);
-		return 0;
-	    }
-	    local = *(u32_t *)hp->h_addr;
-	}
-	if (bad_ip_adrs(local)) {
-	    option_error("bad local IP address %s", ip_ntoa(local));
-	    return 0;
-	}
-	if (local != 0)
-	    wo->ouraddr = local;
-	*colon = ':';
-	prio_local = option_priority;
-    }
-  
+    *colon = '\0';
+    if ((local = inet_addr(arg)) == (u32_t) -1) {
+        if ((hp = gethostbyname(arg)) == NULL) {
+        option_error("unknown host: %s", arg);
+        return 0;
+        }
+        local = *(u32_t *)hp->h_addr;
+    }
+    if (bad_ip_adrs(local)) {
+        option_error("bad local IP address %s", ip_ntoa(local));
+        return 0;
+    }
+    if (local != 0)
+        wo->ouraddr = local;
+    *colon = ':';
+    prio_local = option_priority;
+    }
+
     /*
      * If colon last character, then no remote addr.
      */
     if (*++colon != '\0' && option_priority >= prio_remote) {
-	if ((remote = inet_addr(colon)) == (u32_t) -1) {
-	    if ((hp = gethostbyname(colon)) == NULL) {
-		option_error("unknown host: %s", colon);
-		return 0;
-	    }
-	    remote = *(u32_t *)hp->h_addr;
-	    if (remote_name[0] == 0)
-		strlcpy(remote_name, colon, sizeof(remote_name));
-	}
-	if (bad_ip_adrs(remote)) {
-	    option_error("bad remote IP address %s", ip_ntoa(remote));
-	    return 0;
-	}
-	if (remote != 0)
-	    wo->hisaddr = remote;
-	prio_remote = option_priority;
+    if ((remote = inet_addr(colon)) == (u32_t) -1) {
+        if ((hp = gethostbyname(colon)) == NULL) {
+        option_error("unknown host: %s", colon);
+        return 0;
+        }
+        remote = *(u32_t *)hp->h_addr;
+        if (remote_name[0] == 0)
+        strlcpy(remote_name, colon, sizeof(remote_name));
+    }
+    if (bad_ip_adrs(remote)) {
+        option_error("bad remote IP address %s", ip_ntoa(remote));
+        return 0;
+    }
+    if (remote != 0)
+        wo->hisaddr = remote;
+    prio_remote = option_priority;
     }
 
     return 1;
@@ -512,13 +512,13 @@ printipaddr(opt, printer, arg)
     void (*printer) (void *, char *, ...);
     void *arg;
 {
-	ipcp_options *wo = &ipcp_wantoptions[0];
+    ipcp_options *wo = &ipcp_wantoptions[0];
 
-	if (wo->ouraddr != 0)
-		printer(arg, "%I", wo->ouraddr);
-	printer(arg, ":");
-	if (wo->hisaddr != 0)
-		printer(arg, "%I", wo->hisaddr);
+    if (wo->ouraddr != 0)
+        printer(arg, "%I", wo->ouraddr);
+    printer(arg, ":");
+    if (wo->hisaddr != 0)
+        printer(arg, "%I", wo->hisaddr);
 }
 
 /*
@@ -542,8 +542,8 @@ setnetmask(argv)
     mask = lwip_htonl(mask);
 
     if (n == 0 || p[n] != 0 || (netmask & ~mask) != 0) {
-	option_error("invalid netmask value '%s'", *argv);
-	return 0;
+    option_error("invalid netmask value '%s'", *argv);
+    return 0;
     }
 
     netmask = mask;
@@ -563,23 +563,23 @@ parse_dotted_ip(p, vp)
 
     v = 0;
     for (n = 3;; --n) {
-	b = strtoul(p, &endp, 0);
-	if (endp == p)
-	    return 0;
-	if (b > 255) {
-	    if (n < 3)
-		return 0;
-	    /* accept e.g. 0xffffff00 */
-	    *vp = b;
-	    return endp - p0;
-	}
-	v |= b << (n * 8);
-	p = endp;
-	if (n == 0)
-	    break;
-	if (*p != '.')
-	    return 0;
-	++p;
+    b = strtoul(p, &endp, 0);
+    if (endp == p)
+        return 0;
+    if (b > 255) {
+        if (n < 3)
+        return 0;
+        /* accept e.g. 0xffffff00 */
+        *vp = b;
+        return endp - p0;
+    }
+    v |= b << (n * 8);
+    p = endp;
+    if (n == 0)
+        break;
+    if (*p != '.')
+        return 0;
+    ++p;
     }
     *vp = v;
     return p - p0;
@@ -716,23 +716,23 @@ static void ipcp_resetci(fsm *f) {
     ipcp_options *ao = &pcb->ipcp_allowoptions;
 
     wo->req_addr = (wo->neg_addr || wo->old_addrs) &&
-	(ao->neg_addr || ao->old_addrs);
+    (ao->neg_addr || ao->old_addrs);
     if (wo->ouraddr == 0)
-	wo->accept_local = 1;
+    wo->accept_local = 1;
     if (wo->hisaddr == 0)
-	wo->accept_remote = 1;
+    wo->accept_remote = 1;
 #if LWIP_DNS
-    wo->req_dns1 = wo->req_dns2 = pcb->settings.usepeerdns;	/* Request DNS addresses from the peer */
+    wo->req_dns1 = wo->req_dns2 = pcb->settings.usepeerdns; /* Request DNS addresses from the peer */
 #endif /* LWIP_DNS */
     *go = *wo;
     if (!pcb->ask_for_local)
-	go->ouraddr = 0;
+    go->ouraddr = 0;
 #if 0 /* UNUSED */
     if (ip_choose_hook) {
-	ip_choose_hook(&wo->hisaddr);
-	if (wo->hisaddr) {
-	    wo->accept_remote = 0;
-	}
+    ip_choose_hook(&wo->hisaddr);
+    if (wo->hisaddr) {
+        wo->accept_remote = 0;
+    }
     }
 #endif /* UNUSED */
     BZERO(&pcb->ipcp_hisoptions, sizeof(ipcp_options));
@@ -751,16 +751,16 @@ static int ipcp_cilen(fsm *f) {
 #endif /* VJ_SUPPORT */
     ipcp_options *ho = &pcb->ipcp_hisoptions;
 
-#define LENCIADDRS(neg)		(neg ? CILEN_ADDRS : 0)
+#define LENCIADDRS(neg)     (neg ? CILEN_ADDRS : 0)
 #if VJ_SUPPORT
-#define LENCIVJ(neg, old)	(neg ? (old? CILEN_COMPRESS : CILEN_VJ) : 0)
+#define LENCIVJ(neg, old)   (neg ? (old? CILEN_COMPRESS : CILEN_VJ) : 0)
 #endif /* VJ_SUPPORT */
-#define LENCIADDR(neg)		(neg ? CILEN_ADDR : 0)
+#define LENCIADDR(neg)      (neg ? CILEN_ADDR : 0)
 #if LWIP_DNS
-#define LENCIDNS(neg)		LENCIADDR(neg)
+#define LENCIDNS(neg)       LENCIADDR(neg)
 #endif /* LWIP_DNS */
 #if 0 /* UNUSED - WINS */
-#define LENCIWINS(neg)		LENCIADDR(neg)
+#define LENCIWINS(neg)      LENCIADDR(neg)
 #endif /* UNUSED - WINS */
 
     /*
@@ -768,34 +768,34 @@ static int ipcp_cilen(fsm *f) {
      * forms because we have received old forms from the peer.
      */
     if (go->neg_addr && go->old_addrs && !ho->neg_addr && ho->old_addrs)
-	go->neg_addr = 0;
+    go->neg_addr = 0;
 
 #if VJ_SUPPORT
     if (wo->neg_vj && !go->neg_vj && !go->old_vj) {
-	/* try an older style of VJ negotiation */
-	/* use the old style only if the peer did */
-	if (ho->neg_vj && ho->old_vj) {
-	    go->neg_vj = 1;
-	    go->old_vj = 1;
-	    go->vj_protocol = ho->vj_protocol;
-	}
+    /* try an older style of VJ negotiation */
+    /* use the old style only if the peer did */
+    if (ho->neg_vj && ho->old_vj) {
+        go->neg_vj = 1;
+        go->old_vj = 1;
+        go->vj_protocol = ho->vj_protocol;
+    }
     }
 #endif /* VJ_SUPPORT */
 
     return (LENCIADDRS(!go->neg_addr && go->old_addrs) +
 #if VJ_SUPPORT
-	    LENCIVJ(go->neg_vj, go->old_vj) +
+        LENCIVJ(go->neg_vj, go->old_vj) +
 #endif /* VJ_SUPPORT */
-	    LENCIADDR(go->neg_addr) +
+        LENCIADDR(go->neg_addr) +
 #if LWIP_DNS
-	    LENCIDNS(go->req_dns1) +
-	    LENCIDNS(go->req_dns2) +
+        LENCIDNS(go->req_dns1) +
+        LENCIDNS(go->req_dns2) +
 #endif /* LWIP_DNS */
 #if 0 /* UNUSED - WINS */
-	    LENCIWINS(go->winsaddr[0]) +
-	    LENCIWINS(go->winsaddr[1]) +
+        LENCIWINS(go->winsaddr[0]) +
+        LENCIWINS(go->winsaddr[1]) +
 #endif /* UNUSED - WINS */
-	    0);
+        0);
 }
 
 
@@ -810,86 +810,86 @@ static void ipcp_addci(fsm *f, u_char *ucp, int *lenp) {
 
 #define ADDCIADDRS(opt, neg, val1, val2) \
     if (neg) { \
-	if (len >= CILEN_ADDRS) { \
-	    u32_t l; \
-	    PUTCHAR(opt, ucp); \
-	    PUTCHAR(CILEN_ADDRS, ucp); \
-	    l = lwip_ntohl(val1); \
-	    PUTLONG(l, ucp); \
-	    l = lwip_ntohl(val2); \
-	    PUTLONG(l, ucp); \
-	    len -= CILEN_ADDRS; \
-	} else \
-	    go->old_addrs = 0; \
+    if (len >= CILEN_ADDRS) { \
+        u32_t l; \
+        PUTCHAR(opt, ucp); \
+        PUTCHAR(CILEN_ADDRS, ucp); \
+        l = lwip_ntohl(val1); \
+        PUTLONG(l, ucp); \
+        l = lwip_ntohl(val2); \
+        PUTLONG(l, ucp); \
+        len -= CILEN_ADDRS; \
+    } else \
+        go->old_addrs = 0; \
     }
 
 #if VJ_SUPPORT
 #define ADDCIVJ(opt, neg, val, old, maxslotindex, cflag) \
     if (neg) { \
-	int vjlen = old? CILEN_COMPRESS : CILEN_VJ; \
-	if (len >= vjlen) { \
-	    PUTCHAR(opt, ucp); \
-	    PUTCHAR(vjlen, ucp); \
-	    PUTSHORT(val, ucp); \
-	    if (!old) { \
-		PUTCHAR(maxslotindex, ucp); \
-		PUTCHAR(cflag, ucp); \
-	    } \
-	    len -= vjlen; \
-	} else \
-	    neg = 0; \
+    int vjlen = old? CILEN_COMPRESS : CILEN_VJ; \
+    if (len >= vjlen) { \
+        PUTCHAR(opt, ucp); \
+        PUTCHAR(vjlen, ucp); \
+        PUTSHORT(val, ucp); \
+        if (!old) { \
+        PUTCHAR(maxslotindex, ucp); \
+        PUTCHAR(cflag, ucp); \
+        } \
+        len -= vjlen; \
+    } else \
+        neg = 0; \
     }
 #endif /* VJ_SUPPORT */
 
 #define ADDCIADDR(opt, neg, val) \
     if (neg) { \
-	if (len >= CILEN_ADDR) { \
-	    u32_t l; \
-	    PUTCHAR(opt, ucp); \
-	    PUTCHAR(CILEN_ADDR, ucp); \
-	    l = lwip_ntohl(val); \
-	    PUTLONG(l, ucp); \
-	    len -= CILEN_ADDR; \
-	} else \
-	    neg = 0; \
+    if (len >= CILEN_ADDR) { \
+        u32_t l; \
+        PUTCHAR(opt, ucp); \
+        PUTCHAR(CILEN_ADDR, ucp); \
+        l = lwip_ntohl(val); \
+        PUTLONG(l, ucp); \
+        len -= CILEN_ADDR; \
+    } else \
+        neg = 0; \
     }
 
 #if LWIP_DNS
 #define ADDCIDNS(opt, neg, addr) \
     if (neg) { \
-	if (len >= CILEN_ADDR) { \
-	    u32_t l; \
-	    PUTCHAR(opt, ucp); \
-	    PUTCHAR(CILEN_ADDR, ucp); \
-	    l = lwip_ntohl(addr); \
-	    PUTLONG(l, ucp); \
-	    len -= CILEN_ADDR; \
-	} else \
-	    neg = 0; \
+    if (len >= CILEN_ADDR) { \
+        u32_t l; \
+        PUTCHAR(opt, ucp); \
+        PUTCHAR(CILEN_ADDR, ucp); \
+        l = lwip_ntohl(addr); \
+        PUTLONG(l, ucp); \
+        len -= CILEN_ADDR; \
+    } else \
+        neg = 0; \
     }
 #endif /* LWIP_DNS */
 
 #if 0 /* UNUSED - WINS */
 #define ADDCIWINS(opt, addr) \
     if (addr) { \
-	if (len >= CILEN_ADDR) { \
-	    u32_t l; \
-	    PUTCHAR(opt, ucp); \
-	    PUTCHAR(CILEN_ADDR, ucp); \
-	    l = lwip_ntohl(addr); \
-	    PUTLONG(l, ucp); \
-	    len -= CILEN_ADDR; \
-	} else \
-	    addr = 0; \
+    if (len >= CILEN_ADDR) { \
+        u32_t l; \
+        PUTCHAR(opt, ucp); \
+        PUTCHAR(CILEN_ADDR, ucp); \
+        l = lwip_ntohl(addr); \
+        PUTLONG(l, ucp); \
+        len -= CILEN_ADDR; \
+    } else \
+        addr = 0; \
     }
 #endif /* UNUSED - WINS */
 
     ADDCIADDRS(CI_ADDRS, !go->neg_addr && go->old_addrs, go->ouraddr,
-	       go->hisaddr);
+           go->hisaddr);
 
 #if VJ_SUPPORT
     ADDCIVJ(CI_COMPRESSTYPE, go->neg_vj, go->vj_protocol, go->old_vj,
-	    go->maxslotindex, go->cflag);
+        go->maxslotindex, go->cflag);
 #endif /* VJ_SUPPORT */
 
     ADDCIADDR(CI_ADDR, go->neg_addr, go->ouraddr);
@@ -905,7 +905,7 @@ static void ipcp_addci(fsm *f, u_char *ucp, int *lenp) {
 
     ADDCIWINS(CI_MS_WINS2, go->winsaddr[1]);
 #endif /* UNUSED - WINS */
-    
+
     *lenp -= len;
 }
 
@@ -915,8 +915,8 @@ static void ipcp_addci(fsm *f, u_char *ucp, int *lenp) {
  * Called by fsm_rconfack, Receive Configure ACK.
  *
  * Returns:
- *	0 - Ack was bad.
- *	1 - Ack was good.
+ *  0 - Ack was bad.
+ *  1 - Ack was good.
  */
 static int ipcp_ackci(fsm *f, u_char *p, int len) {
     ppp_pcb *pcb = f->pcb;
@@ -936,105 +936,105 @@ static int ipcp_ackci(fsm *f, u_char *p, int len) {
 
 #define ACKCIADDRS(opt, neg, val1, val2) \
     if (neg) { \
-	u32_t l; \
-	if ((len -= CILEN_ADDRS) < 0) \
-	    goto bad; \
-	GETCHAR(citype, p); \
-	GETCHAR(cilen, p); \
-	if (cilen != CILEN_ADDRS || \
-	    citype != opt) \
-	    goto bad; \
-	GETLONG(l, p); \
-	cilong = lwip_htonl(l); \
-	if (val1 != cilong) \
-	    goto bad; \
-	GETLONG(l, p); \
-	cilong = lwip_htonl(l); \
-	if (val2 != cilong) \
-	    goto bad; \
+    u32_t l; \
+    if ((len -= CILEN_ADDRS) < 0) \
+        goto bad; \
+    GETCHAR(citype, p); \
+    GETCHAR(cilen, p); \
+    if (cilen != CILEN_ADDRS || \
+        citype != opt) \
+        goto bad; \
+    GETLONG(l, p); \
+    cilong = lwip_htonl(l); \
+    if (val1 != cilong) \
+        goto bad; \
+    GETLONG(l, p); \
+    cilong = lwip_htonl(l); \
+    if (val2 != cilong) \
+        goto bad; \
     }
 
 #if VJ_SUPPORT
 #define ACKCIVJ(opt, neg, val, old, maxslotindex, cflag) \
     if (neg) { \
-	int vjlen = old? CILEN_COMPRESS : CILEN_VJ; \
-	if ((len -= vjlen) < 0) \
-	    goto bad; \
-	GETCHAR(citype, p); \
-	GETCHAR(cilen, p); \
-	if (cilen != vjlen || \
-	    citype != opt)  \
-	    goto bad; \
-	GETSHORT(cishort, p); \
-	if (cishort != val) \
-	    goto bad; \
-	if (!old) { \
-	    GETCHAR(cimaxslotindex, p); \
-	    if (cimaxslotindex != maxslotindex) \
-		goto bad; \
-	    GETCHAR(cicflag, p); \
-	    if (cicflag != cflag) \
-		goto bad; \
-	} \
+    int vjlen = old? CILEN_COMPRESS : CILEN_VJ; \
+    if ((len -= vjlen) < 0) \
+        goto bad; \
+    GETCHAR(citype, p); \
+    GETCHAR(cilen, p); \
+    if (cilen != vjlen || \
+        citype != opt)  \
+        goto bad; \
+    GETSHORT(cishort, p); \
+    if (cishort != val) \
+        goto bad; \
+    if (!old) { \
+        GETCHAR(cimaxslotindex, p); \
+        if (cimaxslotindex != maxslotindex) \
+        goto bad; \
+        GETCHAR(cicflag, p); \
+        if (cicflag != cflag) \
+        goto bad; \
+    } \
     }
 #endif /* VJ_SUPPORT */
 
 #define ACKCIADDR(opt, neg, val) \
     if (neg) { \
-	u32_t l; \
-	if ((len -= CILEN_ADDR) < 0) \
-	    goto bad; \
-	GETCHAR(citype, p); \
-	GETCHAR(cilen, p); \
-	if (cilen != CILEN_ADDR || \
-	    citype != opt) \
-	    goto bad; \
-	GETLONG(l, p); \
-	cilong = lwip_htonl(l); \
-	if (val != cilong) \
-	    goto bad; \
+    u32_t l; \
+    if ((len -= CILEN_ADDR) < 0) \
+        goto bad; \
+    GETCHAR(citype, p); \
+    GETCHAR(cilen, p); \
+    if (cilen != CILEN_ADDR || \
+        citype != opt) \
+        goto bad; \
+    GETLONG(l, p); \
+    cilong = lwip_htonl(l); \
+    if (val != cilong) \
+        goto bad; \
     }
 
 #if LWIP_DNS
 #define ACKCIDNS(opt, neg, addr) \
     if (neg) { \
-	u32_t l; \
-	if ((len -= CILEN_ADDR) < 0) \
-	    goto bad; \
-	GETCHAR(citype, p); \
-	GETCHAR(cilen, p); \
-	if (cilen != CILEN_ADDR || citype != opt) \
-	    goto bad; \
-	GETLONG(l, p); \
-	cilong = lwip_htonl(l); \
-	if (addr != cilong) \
-	    goto bad; \
+    u32_t l; \
+    if ((len -= CILEN_ADDR) < 0) \
+        goto bad; \
+    GETCHAR(citype, p); \
+    GETCHAR(cilen, p); \
+    if (cilen != CILEN_ADDR || citype != opt) \
+        goto bad; \
+    GETLONG(l, p); \
+    cilong = lwip_htonl(l); \
+    if (addr != cilong) \
+        goto bad; \
     }
 #endif /* LWIP_DNS */
 
 #if 0 /* UNUSED - WINS */
 #define ACKCIWINS(opt, addr) \
     if (addr) { \
-	u32_t l; \
-	if ((len -= CILEN_ADDR) < 0) \
-	    goto bad; \
-	GETCHAR(citype, p); \
-	GETCHAR(cilen, p); \
-	if (cilen != CILEN_ADDR || citype != opt) \
-	    goto bad; \
-	GETLONG(l, p); \
-	cilong = lwip_htonl(l); \
-	if (addr != cilong) \
-	    goto bad; \
+    u32_t l; \
+    if ((len -= CILEN_ADDR) < 0) \
+        goto bad; \
+    GETCHAR(citype, p); \
+    GETCHAR(cilen, p); \
+    if (cilen != CILEN_ADDR || citype != opt) \
+        goto bad; \
+    GETLONG(l, p); \
+    cilong = lwip_htonl(l); \
+    if (addr != cilong) \
+        goto bad; \
     }
 #endif /* UNUSED - WINS */
 
     ACKCIADDRS(CI_ADDRS, !go->neg_addr && go->old_addrs, go->ouraddr,
-	       go->hisaddr);
+           go->hisaddr);
 
 #if VJ_SUPPORT
     ACKCIVJ(CI_COMPRESSTYPE, go->neg_vj, go->vj_protocol, go->old_vj,
-	    go->maxslotindex, go->cflag);
+        go->maxslotindex, go->cflag);
 #endif /* VJ_SUPPORT */
 
     ACKCIADDR(CI_ADDR, go->neg_addr, go->ouraddr);
@@ -1055,7 +1055,7 @@ static int ipcp_ackci(fsm *f, u_char *p, int len) {
      * If there are any remaining CIs, then this packet is bad.
      */
     if (len != 0)
-	goto bad;
+    goto bad;
     return (1);
 
 bad:
@@ -1070,8 +1070,8 @@ bad:
  * Callback from fsm_rconfnakrej - Receive Configure-Nak or Configure-Reject.
  *
  * Returns:
- *	0 - Nak was bad.
- *	1 - Nak was good.
+ *  0 - Nak was bad.
+ *  1 - Nak was good.
  */
 static int ipcp_nakci(fsm *f, u_char *p, int len, int treat_as_reject) {
     ppp_pcb *pcb = f->pcb;
@@ -1085,8 +1085,8 @@ static int ipcp_nakci(fsm *f, u_char *p, int len, int treat_as_reject) {
 #if LWIP_DNS
     u32_t cidnsaddr;
 #endif /* LWIP_DNS */
-    ipcp_options no;		/* options we've seen Naks for */
-    ipcp_options try_;		/* options to request next time */
+    ipcp_options no;        /* options we've seen Naks for */
+    ipcp_options try_;      /* options to request next time */
 
     BZERO(&no, sizeof(no));
     try_ = *go;
@@ -1098,58 +1098,58 @@ static int ipcp_nakci(fsm *f, u_char *p, int len, int treat_as_reject) {
      */
 #define NAKCIADDRS(opt, neg, code) \
     if ((neg) && \
-	(cilen = p[1]) == CILEN_ADDRS && \
-	len >= cilen && \
-	p[0] == opt) { \
-	len -= cilen; \
-	INCPTR(2, p); \
-	GETLONG(l, p); \
-	ciaddr1 = lwip_htonl(l); \
-	GETLONG(l, p); \
-	ciaddr2 = lwip_htonl(l); \
-	no.old_addrs = 1; \
-	code \
+    (cilen = p[1]) == CILEN_ADDRS && \
+    len >= cilen && \
+    p[0] == opt) { \
+    len -= cilen; \
+    INCPTR(2, p); \
+    GETLONG(l, p); \
+    ciaddr1 = lwip_htonl(l); \
+    GETLONG(l, p); \
+    ciaddr2 = lwip_htonl(l); \
+    no.old_addrs = 1; \
+    code \
     }
 
 #if VJ_SUPPORT
 #define NAKCIVJ(opt, neg, code) \
     if (go->neg && \
-	((cilen = p[1]) == CILEN_COMPRESS || cilen == CILEN_VJ) && \
-	len >= cilen && \
-	p[0] == opt) { \
-	len -= cilen; \
-	INCPTR(2, p); \
-	GETSHORT(cishort, p); \
-	no.neg = 1; \
+    ((cilen = p[1]) == CILEN_COMPRESS || cilen == CILEN_VJ) && \
+    len >= cilen && \
+    p[0] == opt) { \
+    len -= cilen; \
+    INCPTR(2, p); \
+    GETSHORT(cishort, p); \
+    no.neg = 1; \
         code \
     }
 #endif /* VJ_SUPPORT */
 
 #define NAKCIADDR(opt, neg, code) \
     if (go->neg && \
-	(cilen = p[1]) == CILEN_ADDR && \
-	len >= cilen && \
-	p[0] == opt) { \
-	len -= cilen; \
-	INCPTR(2, p); \
-	GETLONG(l, p); \
-	ciaddr1 = lwip_htonl(l); \
-	no.neg = 1; \
-	code \
+    (cilen = p[1]) == CILEN_ADDR && \
+    len >= cilen && \
+    p[0] == opt) { \
+    len -= cilen; \
+    INCPTR(2, p); \
+    GETLONG(l, p); \
+    ciaddr1 = lwip_htonl(l); \
+    no.neg = 1; \
+    code \
     }
 
 #if LWIP_DNS
 #define NAKCIDNS(opt, neg, code) \
     if (go->neg && \
-	((cilen = p[1]) == CILEN_ADDR) && \
-	len >= cilen && \
-	p[0] == opt) { \
-	len -= cilen; \
-	INCPTR(2, p); \
-	GETLONG(l, p); \
-	cidnsaddr = lwip_htonl(l); \
-	no.neg = 1; \
-	code \
+    ((cilen = p[1]) == CILEN_ADDR) && \
+    len >= cilen && \
+    p[0] == opt) { \
+    len -= cilen; \
+    INCPTR(2, p); \
+    GETLONG(l, p); \
+    cidnsaddr = lwip_htonl(l); \
+    no.neg = 1; \
+    code \
     }
 #endif /* LWIP_DNS */
 
@@ -1158,19 +1158,19 @@ static int ipcp_nakci(fsm *f, u_char *p, int len, int treat_as_reject) {
      * from our idea, only if the accept_{local,remote} flag is set.
      */
     NAKCIADDRS(CI_ADDRS, !go->neg_addr && go->old_addrs,
-	       if (treat_as_reject) {
-		   try_.old_addrs = 0;
-	       } else {
-		   if (go->accept_local && ciaddr1) {
-		       /* take his idea of our address */
-		       try_.ouraddr = ciaddr1;
-		   }
-		   if (go->accept_remote && ciaddr2) {
-		       /* take his idea of his address */
-		       try_.hisaddr = ciaddr2;
-		   }
-	       }
-	);
+           if (treat_as_reject) {
+           try_.old_addrs = 0;
+           } else {
+           if (go->accept_local && ciaddr1) {
+               /* take his idea of our address */
+               try_.ouraddr = ciaddr1;
+           }
+           if (go->accept_remote && ciaddr2) {
+               /* take his idea of his address */
+               try_.hisaddr = ciaddr2;
+           }
+           }
+    );
 
 #if VJ_SUPPORT
     /*
@@ -1180,57 +1180,57 @@ static int ipcp_nakci(fsm *f, u_char *p, int len, int treat_as_reject) {
      * the peer wants.
      */
     NAKCIVJ(CI_COMPRESSTYPE, neg_vj,
-	    if (treat_as_reject) {
-		try_.neg_vj = 0;
-	    } else if (cilen == CILEN_VJ) {
-		GETCHAR(cimaxslotindex, p);
-		GETCHAR(cicflag, p);
-		if (cishort == IPCP_VJ_COMP) {
-		    try_.old_vj = 0;
-		    if (cimaxslotindex < go->maxslotindex)
-			try_.maxslotindex = cimaxslotindex;
-		    if (!cicflag)
-			try_.cflag = 0;
-		} else {
-		    try_.neg_vj = 0;
-		}
-	    } else {
-		if (cishort == IPCP_VJ_COMP || cishort == IPCP_VJ_COMP_OLD) {
-		    try_.old_vj = 1;
-		    try_.vj_protocol = cishort;
-		} else {
-		    try_.neg_vj = 0;
-		}
-	    }
-	    );
+        if (treat_as_reject) {
+        try_.neg_vj = 0;
+        } else if (cilen == CILEN_VJ) {
+        GETCHAR(cimaxslotindex, p);
+        GETCHAR(cicflag, p);
+        if (cishort == IPCP_VJ_COMP) {
+            try_.old_vj = 0;
+            if (cimaxslotindex < go->maxslotindex)
+            try_.maxslotindex = cimaxslotindex;
+            if (!cicflag)
+            try_.cflag = 0;
+        } else {
+            try_.neg_vj = 0;
+        }
+        } else {
+        if (cishort == IPCP_VJ_COMP || cishort == IPCP_VJ_COMP_OLD) {
+            try_.old_vj = 1;
+            try_.vj_protocol = cishort;
+        } else {
+            try_.neg_vj = 0;
+        }
+        }
+        );
 #endif /* VJ_SUPPORT */
 
     NAKCIADDR(CI_ADDR, neg_addr,
-	      if (treat_as_reject) {
-		  try_.neg_addr = 0;
-		  try_.old_addrs = 0;
-	      } else if (go->accept_local && ciaddr1) {
-		  /* take his idea of our address */
-		  try_.ouraddr = ciaddr1;
-	      }
-	      );
+          if (treat_as_reject) {
+          try_.neg_addr = 0;
+          try_.old_addrs = 0;
+          } else if (go->accept_local && ciaddr1) {
+          /* take his idea of our address */
+          try_.ouraddr = ciaddr1;
+          }
+          );
 
 #if LWIP_DNS
     NAKCIDNS(CI_MS_DNS1, req_dns1,
-	     if (treat_as_reject) {
-		 try_.req_dns1 = 0;
-	     } else {
-		 try_.dnsaddr[0] = cidnsaddr;
-	     }
-	     );
+         if (treat_as_reject) {
+         try_.req_dns1 = 0;
+         } else {
+         try_.dnsaddr[0] = cidnsaddr;
+         }
+         );
 
     NAKCIDNS(CI_MS_DNS2, req_dns2,
-	     if (treat_as_reject) {
-		 try_.req_dns2 = 0;
-	     } else {
-		 try_.dnsaddr[1] = cidnsaddr;
-	     }
-	     );
+         if (treat_as_reject) {
+         try_.req_dns2 = 0;
+         } else {
+         try_.dnsaddr[1] = cidnsaddr;
+         }
+         );
 #endif /* #if LWIP_DNS */
 
     /*
@@ -1242,81 +1242,81 @@ static int ipcp_nakci(fsm *f, u_char *p, int len, int treat_as_reject) {
      * peers get huffy if we don't.
      */
     while (len >= CILEN_VOID) {
-	GETCHAR(citype, p);
-	GETCHAR(cilen, p);
-	if ( cilen < CILEN_VOID || (len -= cilen) < 0 )
-	    goto bad;
-	next = p + cilen - 2;
+    GETCHAR(citype, p);
+    GETCHAR(cilen, p);
+    if ( cilen < CILEN_VOID || (len -= cilen) < 0 )
+        goto bad;
+    next = p + cilen - 2;
 
-	switch (citype) {
+    switch (citype) {
 #if VJ_SUPPORT
-	case CI_COMPRESSTYPE:
-	    if (go->neg_vj || no.neg_vj ||
-		(cilen != CILEN_VJ && cilen != CILEN_COMPRESS))
-		goto bad;
-	    no.neg_vj = 1;
-	    break;
+    case CI_COMPRESSTYPE:
+        if (go->neg_vj || no.neg_vj ||
+        (cilen != CILEN_VJ && cilen != CILEN_COMPRESS))
+        goto bad;
+        no.neg_vj = 1;
+        break;
 #endif /* VJ_SUPPORT */
-	case CI_ADDRS:
-	    if ((!go->neg_addr && go->old_addrs) || no.old_addrs
-		|| cilen != CILEN_ADDRS)
-		goto bad;
-	    try_.neg_addr = 0;
-	    GETLONG(l, p);
-	    ciaddr1 = lwip_htonl(l);
-	    if (ciaddr1 && go->accept_local)
-		try_.ouraddr = ciaddr1;
-	    GETLONG(l, p);
-	    ciaddr2 = lwip_htonl(l);
-	    if (ciaddr2 && go->accept_remote)
-		try_.hisaddr = ciaddr2;
-	    no.old_addrs = 1;
-	    break;
-	case CI_ADDR:
-	    if (go->neg_addr || no.neg_addr || cilen != CILEN_ADDR)
-		goto bad;
-	    try_.old_addrs = 0;
-	    GETLONG(l, p);
-	    ciaddr1 = lwip_htonl(l);
-	    if (ciaddr1 && go->accept_local)
-		try_.ouraddr = ciaddr1;
-	    if (try_.ouraddr != 0)
-		try_.neg_addr = 1;
-	    no.neg_addr = 1;
-	    break;
+    case CI_ADDRS:
+        if ((!go->neg_addr && go->old_addrs) || no.old_addrs
+        || cilen != CILEN_ADDRS)
+        goto bad;
+        try_.neg_addr = 0;
+        GETLONG(l, p);
+        ciaddr1 = lwip_htonl(l);
+        if (ciaddr1 && go->accept_local)
+        try_.ouraddr = ciaddr1;
+        GETLONG(l, p);
+        ciaddr2 = lwip_htonl(l);
+        if (ciaddr2 && go->accept_remote)
+        try_.hisaddr = ciaddr2;
+        no.old_addrs = 1;
+        break;
+    case CI_ADDR:
+        if (go->neg_addr || no.neg_addr || cilen != CILEN_ADDR)
+        goto bad;
+        try_.old_addrs = 0;
+        GETLONG(l, p);
+        ciaddr1 = lwip_htonl(l);
+        if (ciaddr1 && go->accept_local)
+        try_.ouraddr = ciaddr1;
+        if (try_.ouraddr != 0)
+        try_.neg_addr = 1;
+        no.neg_addr = 1;
+        break;
 #if LWIP_DNS
-	case CI_MS_DNS1:
-	    if (go->req_dns1 || no.req_dns1 || cilen != CILEN_ADDR)
-		goto bad;
-	    GETLONG(l, p);
-	    try_.dnsaddr[0] = lwip_htonl(l);
-	    try_.req_dns1 = 1;
-	    no.req_dns1 = 1;
-	    break;
-	case CI_MS_DNS2:
-	    if (go->req_dns2 || no.req_dns2 || cilen != CILEN_ADDR)
-		goto bad;
-	    GETLONG(l, p);
-	    try_.dnsaddr[1] = lwip_htonl(l);
-	    try_.req_dns2 = 1;
-	    no.req_dns2 = 1;
-	    break;
+    case CI_MS_DNS1:
+        if (go->req_dns1 || no.req_dns1 || cilen != CILEN_ADDR)
+        goto bad;
+        GETLONG(l, p);
+        try_.dnsaddr[0] = lwip_htonl(l);
+        try_.req_dns1 = 1;
+        no.req_dns1 = 1;
+        break;
+    case CI_MS_DNS2:
+        if (go->req_dns2 || no.req_dns2 || cilen != CILEN_ADDR)
+        goto bad;
+        GETLONG(l, p);
+        try_.dnsaddr[1] = lwip_htonl(l);
+        try_.req_dns2 = 1;
+        no.req_dns2 = 1;
+        break;
 #endif /* LWIP_DNS */
 #if 0 /* UNUSED - WINS */
-	case CI_MS_WINS1:
-	case CI_MS_WINS2:
-	    if (cilen != CILEN_ADDR)
-		goto bad;
-	    GETLONG(l, p);
-	    ciaddr1 = lwip_htonl(l);
-	    if (ciaddr1)
-		try_.winsaddr[citype == CI_MS_WINS2] = ciaddr1;
-	    break;
+    case CI_MS_WINS1:
+    case CI_MS_WINS2:
+        if (cilen != CILEN_ADDR)
+        goto bad;
+        GETLONG(l, p);
+        ciaddr1 = lwip_htonl(l);
+        if (ciaddr1)
+        try_.winsaddr[citype == CI_MS_WINS2] = ciaddr1;
+        break;
 #endif /* UNUSED - WINS */
-	default:
-	    break;
-	}
-	p = next;
+    default:
+        break;
+    }
+    p = next;
     }
 
     /*
@@ -1324,7 +1324,7 @@ static int ipcp_nakci(fsm *f, u_char *p, int len, int treat_as_reject) {
      * If there are any remaining options, we ignore them.
      */
     if (f->state != PPP_FSM_OPENED)
-	*go = try_;
+    *go = try_;
 
     return 1;
 
@@ -1347,7 +1347,7 @@ static int ipcp_rejci(fsm *f, u_char *p, int len) {
     u_short cishort;
 #endif /* VJ_SUPPORT */
     u32_t cilong;
-    ipcp_options try_;		/* options to request next time */
+    ipcp_options try_;      /* options to request next time */
 
     try_ = *go;
     /*
@@ -1357,107 +1357,107 @@ static int ipcp_rejci(fsm *f, u_char *p, int len) {
      */
 #define REJCIADDRS(opt, neg, val1, val2) \
     if ((neg) && \
-	(cilen = p[1]) == CILEN_ADDRS && \
-	len >= cilen && \
-	p[0] == opt) { \
-	u32_t l; \
-	len -= cilen; \
-	INCPTR(2, p); \
-	GETLONG(l, p); \
-	cilong = lwip_htonl(l); \
-	/* Check rejected value. */ \
-	if (cilong != val1) \
-	    goto bad; \
-	GETLONG(l, p); \
-	cilong = lwip_htonl(l); \
-	/* Check rejected value. */ \
-	if (cilong != val2) \
-	    goto bad; \
-	try_.old_addrs = 0; \
+    (cilen = p[1]) == CILEN_ADDRS && \
+    len >= cilen && \
+    p[0] == opt) { \
+    u32_t l; \
+    len -= cilen; \
+    INCPTR(2, p); \
+    GETLONG(l, p); \
+    cilong = lwip_htonl(l); \
+    /* Check rejected value. */ \
+    if (cilong != val1) \
+        goto bad; \
+    GETLONG(l, p); \
+    cilong = lwip_htonl(l); \
+    /* Check rejected value. */ \
+    if (cilong != val2) \
+        goto bad; \
+    try_.old_addrs = 0; \
     }
 
 #if VJ_SUPPORT
 #define REJCIVJ(opt, neg, val, old, maxslot, cflag) \
     if (go->neg && \
-	p[1] == (old? CILEN_COMPRESS : CILEN_VJ) && \
-	len >= p[1] && \
-	p[0] == opt) { \
-	len -= p[1]; \
-	INCPTR(2, p); \
-	GETSHORT(cishort, p); \
-	/* Check rejected value. */  \
-	if (cishort != val) \
-	    goto bad; \
-	if (!old) { \
-	   GETCHAR(cimaxslotindex, p); \
-	   if (cimaxslotindex != maxslot) \
-	     goto bad; \
-	   GETCHAR(ciflag, p); \
-	   if (ciflag != cflag) \
-	     goto bad; \
+    p[1] == (old? CILEN_COMPRESS : CILEN_VJ) && \
+    len >= p[1] && \
+    p[0] == opt) { \
+    len -= p[1]; \
+    INCPTR(2, p); \
+    GETSHORT(cishort, p); \
+    /* Check rejected value. */  \
+    if (cishort != val) \
+        goto bad; \
+    if (!old) { \
+       GETCHAR(cimaxslotindex, p); \
+       if (cimaxslotindex != maxslot) \
+         goto bad; \
+       GETCHAR(ciflag, p); \
+       if (ciflag != cflag) \
+         goto bad; \
         } \
-	try_.neg = 0; \
+    try_.neg = 0; \
      }
 #endif /* VJ_SUPPORT */
 
 #define REJCIADDR(opt, neg, val) \
     if (go->neg && \
-	(cilen = p[1]) == CILEN_ADDR && \
-	len >= cilen && \
-	p[0] == opt) { \
-	u32_t l; \
-	len -= cilen; \
-	INCPTR(2, p); \
-	GETLONG(l, p); \
-	cilong = lwip_htonl(l); \
-	/* Check rejected value. */ \
-	if (cilong != val) \
-	    goto bad; \
-	try_.neg = 0; \
+    (cilen = p[1]) == CILEN_ADDR && \
+    len >= cilen && \
+    p[0] == opt) { \
+    u32_t l; \
+    len -= cilen; \
+    INCPTR(2, p); \
+    GETLONG(l, p); \
+    cilong = lwip_htonl(l); \
+    /* Check rejected value. */ \
+    if (cilong != val) \
+        goto bad; \
+    try_.neg = 0; \
     }
 
 #if LWIP_DNS
 #define REJCIDNS(opt, neg, dnsaddr) \
     if (go->neg && \
-	((cilen = p[1]) == CILEN_ADDR) && \
-	len >= cilen && \
-	p[0] == opt) { \
-	u32_t l; \
-	len -= cilen; \
-	INCPTR(2, p); \
-	GETLONG(l, p); \
-	cilong = lwip_htonl(l); \
-	/* Check rejected value. */ \
-	if (cilong != dnsaddr) \
-	    goto bad; \
-	try_.neg = 0; \
+    ((cilen = p[1]) == CILEN_ADDR) && \
+    len >= cilen && \
+    p[0] == opt) { \
+    u32_t l; \
+    len -= cilen; \
+    INCPTR(2, p); \
+    GETLONG(l, p); \
+    cilong = lwip_htonl(l); \
+    /* Check rejected value. */ \
+    if (cilong != dnsaddr) \
+        goto bad; \
+    try_.neg = 0; \
     }
 #endif /* LWIP_DNS */
 
 #if 0 /* UNUSED - WINS */
 #define REJCIWINS(opt, addr) \
     if (addr && \
-	((cilen = p[1]) == CILEN_ADDR) && \
-	len >= cilen && \
-	p[0] == opt) { \
-	u32_t l; \
-	len -= cilen; \
-	INCPTR(2, p); \
-	GETLONG(l, p); \
-	cilong = lwip_htonl(l); \
-	/* Check rejected value. */ \
-	if (cilong != addr) \
-	    goto bad; \
-	try_.winsaddr[opt == CI_MS_WINS2] = 0; \
+    ((cilen = p[1]) == CILEN_ADDR) && \
+    len >= cilen && \
+    p[0] == opt) { \
+    u32_t l; \
+    len -= cilen; \
+    INCPTR(2, p); \
+    GETLONG(l, p); \
+    cilong = lwip_htonl(l); \
+    /* Check rejected value. */ \
+    if (cilong != addr) \
+        goto bad; \
+    try_.winsaddr[opt == CI_MS_WINS2] = 0; \
     }
 #endif /* UNUSED - WINS */
 
     REJCIADDRS(CI_ADDRS, !go->neg_addr && go->old_addrs,
-	       go->ouraddr, go->hisaddr);
+           go->ouraddr, go->hisaddr);
 
 #if VJ_SUPPORT
     REJCIVJ(CI_COMPRESSTYPE, neg_vj, go->vj_protocol, go->old_vj,
-	    go->maxslotindex, go->cflag);
+        go->maxslotindex, go->cflag);
 #endif /* VJ_SUPPORT */
 
     REJCIADDR(CI_ADDR, neg_addr, go->ouraddr);
@@ -1478,12 +1478,12 @@ static int ipcp_rejci(fsm *f, u_char *p, int len) {
      * If there are any remaining CIs, then this packet is bad.
      */
     if (len != 0)
-	goto bad;
+    goto bad;
     /*
      * Now we can update state.
      */
     if (f->state != PPP_FSM_OPENED)
-	*go = try_;
+    *go = try_;
     return 1;
 
 bad:
@@ -1508,17 +1508,17 @@ static int ipcp_reqci(fsm *f, u_char *inp, int *len, int reject_if_disagree) {
     ipcp_options *wo = &pcb->ipcp_wantoptions;
     ipcp_options *ho = &pcb->ipcp_hisoptions;
     ipcp_options *ao = &pcb->ipcp_allowoptions;
-    u_char *cip, *next;		/* Pointer to current and next CIs */
-    u_short cilen, citype;	/* Parsed len, type */
+    u_char *cip, *next;     /* Pointer to current and next CIs */
+    u_short cilen, citype;  /* Parsed len, type */
 #if VJ_SUPPORT
-    u_short cishort;		/* Parsed short value */
+    u_short cishort;        /* Parsed short value */
 #endif /* VJ_SUPPORT */
     u32_t tl, ciaddr1, ciaddr2;/* Parsed address values */
-    int rc = CONFACK;		/* Final packet return code */
-    int orc;			/* Individual option return code */
-    u_char *p;			/* Pointer to next char to parse */
-    u_char *ucp = inp;		/* Pointer to current output char */
-    int l = *len;		/* Length left */
+    int rc = CONFACK;       /* Final packet return code */
+    int orc;            /* Individual option return code */
+    u_char *p;          /* Pointer to next char to parse */
+    u_char *ucp = inp;      /* Pointer to current output char */
+    int l = *len;       /* Length left */
 #if VJ_SUPPORT
     u_char maxslotindex, cflag;
 #endif /* VJ_SUPPORT */
@@ -1530,243 +1530,243 @@ static int ipcp_reqci(fsm *f, u_char *inp, int *len, int reject_if_disagree) {
      * Reset all his options.
      */
     BZERO(ho, sizeof(*ho));
-    
+
     /*
      * Process all his options.
      */
     next = inp;
     while (l) {
-	orc = CONFACK;			/* Assume success */
-	cip = p = next;			/* Remember beginning of CI */
-	if (l < 2 ||			/* Not enough data for CI header or */
-	    p[1] < 2 ||			/*  CI length too small or */
-	    p[1] > l) {			/*  CI length too big? */
-	    IPCPDEBUG(("ipcp_reqci: bad CI length!"));
-	    orc = CONFREJ;		/* Reject bad CI */
-	    cilen = l;			/* Reject till end of packet */
-	    l = 0;			/* Don't loop again */
-	    goto endswitch;
-	}
-	GETCHAR(citype, p);		/* Parse CI type */
-	GETCHAR(cilen, p);		/* Parse CI length */
-	l -= cilen;			/* Adjust remaining length */
-	next += cilen;			/* Step to next CI */
-
-	switch (citype) {		/* Check CI type */
-	case CI_ADDRS:
-	    if (!ao->old_addrs || ho->neg_addr ||
-		cilen != CILEN_ADDRS) {	/* Check CI length */
-		orc = CONFREJ;		/* Reject CI */
-		break;
-	    }
-
-	    /*
-	     * If he has no address, or if we both have his address but
-	     * disagree about it, then NAK it with our idea.
-	     * In particular, if we don't know his address, but he does,
-	     * then accept it.
-	     */
-	    GETLONG(tl, p);		/* Parse source address (his) */
-	    ciaddr1 = lwip_htonl(tl);
-	    if (ciaddr1 != wo->hisaddr
-		&& (ciaddr1 == 0 || !wo->accept_remote)) {
-		orc = CONFNAK;
-		if (!reject_if_disagree) {
-		    DECPTR(sizeof(u32_t), p);
-		    tl = lwip_ntohl(wo->hisaddr);
-		    PUTLONG(tl, p);
-		}
-	    } else if (ciaddr1 == 0 && wo->hisaddr == 0) {
-		/*
-		 * If neither we nor he knows his address, reject the option.
-		 */
-		orc = CONFREJ;
-		wo->req_addr = 0;	/* don't NAK with 0.0.0.0 later */
-		break;
-	    }
-
-	    /*
-	     * If he doesn't know our address, or if we both have our address
-	     * but disagree about it, then NAK it with our idea.
-	     */
-	    GETLONG(tl, p);		/* Parse destination address (ours) */
-	    ciaddr2 = lwip_htonl(tl);
-	    if (ciaddr2 != wo->ouraddr) {
-		if (ciaddr2 == 0 || !wo->accept_local) {
-		    orc = CONFNAK;
-		    if (!reject_if_disagree) {
-			DECPTR(sizeof(u32_t), p);
-			tl = lwip_ntohl(wo->ouraddr);
-			PUTLONG(tl, p);
-		    }
-		} else {
-		    wo->ouraddr = ciaddr2;	/* accept peer's idea */
-		}
-	    }
-
-	    ho->old_addrs = 1;
-	    ho->hisaddr = ciaddr1;
-	    ho->ouraddr = ciaddr2;
-	    break;
-
-	case CI_ADDR:
-	    if (!ao->neg_addr || ho->old_addrs ||
-		cilen != CILEN_ADDR) {	/* Check CI length */
-		orc = CONFREJ;		/* Reject CI */
-		break;
-	    }
-
-	    /*
-	     * If he has no address, or if we both have his address but
-	     * disagree about it, then NAK it with our idea.
-	     * In particular, if we don't know his address, but he does,
-	     * then accept it.
-	     */
-	    GETLONG(tl, p);	/* Parse source address (his) */
-	    ciaddr1 = lwip_htonl(tl);
-	    if (ciaddr1 != wo->hisaddr
-		&& (ciaddr1 == 0 || !wo->accept_remote)) {
-		orc = CONFNAK;
-		if (!reject_if_disagree) {
-		    DECPTR(sizeof(u32_t), p);
-		    tl = lwip_ntohl(wo->hisaddr);
-		    PUTLONG(tl, p);
-		}
-	    } else if (ciaddr1 == 0 && wo->hisaddr == 0) {
-		/*
-		 * Don't ACK an address of 0.0.0.0 - reject it instead.
-		 */
-		orc = CONFREJ;
-		wo->req_addr = 0;	/* don't NAK with 0.0.0.0 later */
-		break;
-	    }
-	
-	    ho->neg_addr = 1;
-	    ho->hisaddr = ciaddr1;
-	    break;
+    orc = CONFACK;          /* Assume success */
+    cip = p = next;         /* Remember beginning of CI */
+    if (l < 2 ||            /* Not enough data for CI header or */
+        p[1] < 2 ||         /*  CI length too small or */
+        p[1] > l) {         /*  CI length too big? */
+        IPCPDEBUG(("ipcp_reqci: bad CI length!"));
+        orc = CONFREJ;      /* Reject bad CI */
+        cilen = l;          /* Reject till end of packet */
+        l = 0;          /* Don't loop again */
+        goto endswitch;
+    }
+    GETCHAR(citype, p);     /* Parse CI type */
+    GETCHAR(cilen, p);      /* Parse CI length */
+    l -= cilen;         /* Adjust remaining length */
+    next += cilen;          /* Step to next CI */
+
+    switch (citype) {       /* Check CI type */
+    case CI_ADDRS:
+        if (!ao->old_addrs || ho->neg_addr ||
+        cilen != CILEN_ADDRS) { /* Check CI length */
+        orc = CONFREJ;      /* Reject CI */
+        break;
+        }
+
+        /*
+         * If he has no address, or if we both have his address but
+         * disagree about it, then NAK it with our idea.
+         * In particular, if we don't know his address, but he does,
+         * then accept it.
+         */
+        GETLONG(tl, p);     /* Parse source address (his) */
+        ciaddr1 = lwip_htonl(tl);
+        if (ciaddr1 != wo->hisaddr
+        && (ciaddr1 == 0 || !wo->accept_remote)) {
+        orc = CONFNAK;
+        if (!reject_if_disagree) {
+            DECPTR(sizeof(u32_t), p);
+            tl = lwip_ntohl(wo->hisaddr);
+            PUTLONG(tl, p);
+        }
+        } else if (ciaddr1 == 0 && wo->hisaddr == 0) {
+        /*
+         * If neither we nor he knows his address, reject the option.
+         */
+        orc = CONFREJ;
+        wo->req_addr = 0;   /* don't NAK with 0.0.0.0 later */
+        break;
+        }
+
+        /*
+         * If he doesn't know our address, or if we both have our address
+         * but disagree about it, then NAK it with our idea.
+         */
+        GETLONG(tl, p);     /* Parse destination address (ours) */
+        ciaddr2 = lwip_htonl(tl);
+        if (ciaddr2 != wo->ouraddr) {
+        if (ciaddr2 == 0 || !wo->accept_local) {
+            orc = CONFNAK;
+            if (!reject_if_disagree) {
+            DECPTR(sizeof(u32_t), p);
+            tl = lwip_ntohl(wo->ouraddr);
+            PUTLONG(tl, p);
+            }
+        } else {
+            wo->ouraddr = ciaddr2;  /* accept peer's idea */
+        }
+        }
+
+        ho->old_addrs = 1;
+        ho->hisaddr = ciaddr1;
+        ho->ouraddr = ciaddr2;
+        break;
+
+    case CI_ADDR:
+        if (!ao->neg_addr || ho->old_addrs ||
+        cilen != CILEN_ADDR) {  /* Check CI length */
+        orc = CONFREJ;      /* Reject CI */
+        break;
+        }
+
+        /*
+         * If he has no address, or if we both have his address but
+         * disagree about it, then NAK it with our idea.
+         * In particular, if we don't know his address, but he does,
+         * then accept it.
+         */
+        GETLONG(tl, p); /* Parse source address (his) */
+        ciaddr1 = lwip_htonl(tl);
+        if (ciaddr1 != wo->hisaddr
+        && (ciaddr1 == 0 || !wo->accept_remote)) {
+        orc = CONFNAK;
+        if (!reject_if_disagree) {
+            DECPTR(sizeof(u32_t), p);
+            tl = lwip_ntohl(wo->hisaddr);
+            PUTLONG(tl, p);
+        }
+        } else if (ciaddr1 == 0 && wo->hisaddr == 0) {
+        /*
+         * Don't ACK an address of 0.0.0.0 - reject it instead.
+         */
+        orc = CONFREJ;
+        wo->req_addr = 0;   /* don't NAK with 0.0.0.0 later */
+        break;
+        }
+
+        ho->neg_addr = 1;
+        ho->hisaddr = ciaddr1;
+        break;
 
 #if LWIP_DNS
-	case CI_MS_DNS1:
-	case CI_MS_DNS2:
-	    /* Microsoft primary or secondary DNS request */
-	    d = citype == CI_MS_DNS2;
-
-	    /* If we do not have a DNS address then we cannot send it */
-	    if (ao->dnsaddr[d] == 0 ||
-		cilen != CILEN_ADDR) {	/* Check CI length */
-		orc = CONFREJ;		/* Reject CI */
-		break;
-	    }
-	    GETLONG(tl, p);
-	    if (lwip_htonl(tl) != ao->dnsaddr[d]) {
+    case CI_MS_DNS1:
+    case CI_MS_DNS2:
+        /* Microsoft primary or secondary DNS request */
+        d = citype == CI_MS_DNS2;
+
+        /* If we do not have a DNS address then we cannot send it */
+        if (ao->dnsaddr[d] == 0 ||
+        cilen != CILEN_ADDR) {  /* Check CI length */
+        orc = CONFREJ;      /* Reject CI */
+        break;
+        }
+        GETLONG(tl, p);
+        if (lwip_htonl(tl) != ao->dnsaddr[d]) {
                 DECPTR(sizeof(u32_t), p);
-		tl = lwip_ntohl(ao->dnsaddr[d]);
-		PUTLONG(tl, p);
-		orc = CONFNAK;
+        tl = lwip_ntohl(ao->dnsaddr[d]);
+        PUTLONG(tl, p);
+        orc = CONFNAK;
             }
             break;
 #endif /* LWIP_DNS */
 
 #if 0 /* UNUSED - WINS */
-	case CI_MS_WINS1:
-	case CI_MS_WINS2:
-	    /* Microsoft primary or secondary WINS request */
-	    d = citype == CI_MS_WINS2;
-
-	    /* If we do not have a DNS address then we cannot send it */
-	    if (ao->winsaddr[d] == 0 ||
-		cilen != CILEN_ADDR) {	/* Check CI length */
-		orc = CONFREJ;		/* Reject CI */
-		break;
-	    }
-	    GETLONG(tl, p);
-	    if (lwip_htonl(tl) != ao->winsaddr[d]) {
+    case CI_MS_WINS1:
+    case CI_MS_WINS2:
+        /* Microsoft primary or secondary WINS request */
+        d = citype == CI_MS_WINS2;
+
+        /* If we do not have a DNS address then we cannot send it */
+        if (ao->winsaddr[d] == 0 ||
+        cilen != CILEN_ADDR) {  /* Check CI length */
+        orc = CONFREJ;      /* Reject CI */
+        break;
+        }
+        GETLONG(tl, p);
+        if (lwip_htonl(tl) != ao->winsaddr[d]) {
                 DECPTR(sizeof(u32_t), p);
-		tl = lwip_ntohl(ao->winsaddr[d]);
-		PUTLONG(tl, p);
-		orc = CONFNAK;
+        tl = lwip_ntohl(ao->winsaddr[d]);
+        PUTLONG(tl, p);
+        orc = CONFNAK;
             }
             break;
 #endif /* UNUSED - WINS */
 
 #if VJ_SUPPORT
-	case CI_COMPRESSTYPE:
-	    if (!ao->neg_vj ||
-		(cilen != CILEN_VJ && cilen != CILEN_COMPRESS)) {
-		orc = CONFREJ;
-		break;
-	    }
-	    GETSHORT(cishort, p);
-
-	    if (!(cishort == IPCP_VJ_COMP ||
-		  (cishort == IPCP_VJ_COMP_OLD && cilen == CILEN_COMPRESS))) {
-		orc = CONFREJ;
-		break;
-	    }
-
-	    ho->neg_vj = 1;
-	    ho->vj_protocol = cishort;
-	    if (cilen == CILEN_VJ) {
-		GETCHAR(maxslotindex, p);
-		if (maxslotindex > ao->maxslotindex) { 
-		    orc = CONFNAK;
-		    if (!reject_if_disagree){
-			DECPTR(1, p);
-			PUTCHAR(ao->maxslotindex, p);
-		    }
-		}
-		GETCHAR(cflag, p);
-		if (cflag && !ao->cflag) {
-		    orc = CONFNAK;
-		    if (!reject_if_disagree){
-			DECPTR(1, p);
-			PUTCHAR(wo->cflag, p);
-		    }
-		}
-		ho->maxslotindex = maxslotindex;
-		ho->cflag = cflag;
-	    } else {
-		ho->old_vj = 1;
-		ho->maxslotindex = MAX_STATES - 1;
-		ho->cflag = 1;
-	    }
-	    break;
+    case CI_COMPRESSTYPE:
+        if (!ao->neg_vj ||
+        (cilen != CILEN_VJ && cilen != CILEN_COMPRESS)) {
+        orc = CONFREJ;
+        break;
+        }
+        GETSHORT(cishort, p);
+
+        if (!(cishort == IPCP_VJ_COMP ||
+          (cishort == IPCP_VJ_COMP_OLD && cilen == CILEN_COMPRESS))) {
+        orc = CONFREJ;
+        break;
+        }
+
+        ho->neg_vj = 1;
+        ho->vj_protocol = cishort;
+        if (cilen == CILEN_VJ) {
+        GETCHAR(maxslotindex, p);
+        if (maxslotindex > ao->maxslotindex) {
+            orc = CONFNAK;
+            if (!reject_if_disagree){
+            DECPTR(1, p);
+            PUTCHAR(ao->maxslotindex, p);
+            }
+        }
+        GETCHAR(cflag, p);
+        if (cflag && !ao->cflag) {
+            orc = CONFNAK;
+            if (!reject_if_disagree){
+            DECPTR(1, p);
+            PUTCHAR(wo->cflag, p);
+            }
+        }
+        ho->maxslotindex = maxslotindex;
+        ho->cflag = cflag;
+        } else {
+        ho->old_vj = 1;
+        ho->maxslotindex = MAX_STATES - 1;
+        ho->cflag = 1;
+        }
+        break;
 #endif /* VJ_SUPPORT */
 
-	default:
-	    orc = CONFREJ;
-	    break;
-	}
+    default:
+        orc = CONFREJ;
+        break;
+    }
 endswitch:
-	if (orc == CONFACK &&		/* Good CI */
-	    rc != CONFACK)		/*  but prior CI wasn't? */
-	    continue;			/* Don't send this one */
-
-	if (orc == CONFNAK) {		/* Nak this CI? */
-	    if (reject_if_disagree)	/* Getting fed up with sending NAKs? */
-		orc = CONFREJ;		/* Get tough if so */
-	    else {
-		if (rc == CONFREJ)	/* Rejecting prior CI? */
-		    continue;		/* Don't send this one */
-		if (rc == CONFACK) {	/* Ack'd all prior CIs? */
-		    rc = CONFNAK;	/* Not anymore... */
-		    ucp = inp;		/* Backup */
-		}
-	    }
-	}
-
-	if (orc == CONFREJ &&		/* Reject this CI */
-	    rc != CONFREJ) {		/*  but no prior ones? */
-	    rc = CONFREJ;
-	    ucp = inp;			/* Backup */
-	}
-
-	/* Need to move CI? */
-	if (ucp != cip)
-	    MEMCPY(ucp, cip, cilen);	/* Move it */
-
-	/* Update output pointer */
-	INCPTR(cilen, ucp);
+    if (orc == CONFACK &&       /* Good CI */
+        rc != CONFACK)      /*  but prior CI wasn't? */
+        continue;           /* Don't send this one */
+
+    if (orc == CONFNAK) {       /* Nak this CI? */
+        if (reject_if_disagree) /* Getting fed up with sending NAKs? */
+        orc = CONFREJ;      /* Get tough if so */
+        else {
+        if (rc == CONFREJ)  /* Rejecting prior CI? */
+            continue;       /* Don't send this one */
+        if (rc == CONFACK) {    /* Ack'd all prior CIs? */
+            rc = CONFNAK;   /* Not anymore... */
+            ucp = inp;      /* Backup */
+        }
+        }
+    }
+
+    if (orc == CONFREJ &&       /* Reject this CI */
+        rc != CONFREJ) {        /*  but no prior ones? */
+        rc = CONFREJ;
+        ucp = inp;          /* Backup */
+    }
+
+    /* Need to move CI? */
+    if (ucp != cip)
+        MEMCPY(ucp, cip, cilen);    /* Move it */
+
+    /* Update output pointer */
+    INCPTR(cilen, ucp);
     }
 
     /*
@@ -1777,21 +1777,21 @@ endswitch:
      * option safely.
      */
     if (rc != CONFREJ && !ho->neg_addr && !ho->old_addrs &&
-	wo->req_addr && !reject_if_disagree && !pcb->settings.noremoteip) {
-	if (rc == CONFACK) {
-	    rc = CONFNAK;
-	    ucp = inp;			/* reset pointer */
-	    wo->req_addr = 0;		/* don't ask again */
-	}
-	PUTCHAR(CI_ADDR, ucp);
-	PUTCHAR(CILEN_ADDR, ucp);
-	tl = lwip_ntohl(wo->hisaddr);
-	PUTLONG(tl, ucp);
-    }
-
-    *len = ucp - inp;			/* Compute output length */
+    wo->req_addr && !reject_if_disagree && !pcb->settings.noremoteip) {
+    if (rc == CONFACK) {
+        rc = CONFNAK;
+        ucp = inp;          /* reset pointer */
+        wo->req_addr = 0;       /* don't ask again */
+    }
+    PUTCHAR(CI_ADDR, ucp);
+    PUTCHAR(CILEN_ADDR, ucp);
+    tl = lwip_ntohl(wo->hisaddr);
+    PUTLONG(tl, ucp);
+    }
+
+    *len = ucp - inp;           /* Compute output length */
     IPCPDEBUG(("ipcp: returning Configure-%s", CODENAME(rc)));
-    return (rc);			/* Return final code */
+    return (rc);            /* Return final code */
 }
 
 
@@ -1812,17 +1812,17 @@ ip_check_options()
      * If local IP address already given, don't bother.
      */
     if (wo->ouraddr == 0 && !disable_defaultip) {
-	/*
-	 * Look up our hostname (possibly with domain name appended)
-	 * and take the first IP address as our local IP address.
-	 * If there isn't an IP address for our hostname, too bad.
-	 */
-	wo->accept_local = 1;	/* don't insist on this default value */
-	if ((hp = gethostbyname(hostname)) != NULL) {
-	    local = *(u32_t *)hp->h_addr;
-	    if (local != 0 && !bad_ip_adrs(local))
-		wo->ouraddr = local;
-	}
+    /*
+     * Look up our hostname (possibly with domain name appended)
+     * and take the first IP address as our local IP address.
+     * If there isn't an IP address for our hostname, too bad.
+     */
+    wo->accept_local = 1;   /* don't insist on this default value */
+    if ((hp = gethostbyname(hostname)) != NULL) {
+        local = *(u32_t *)hp->h_addr;
+        if (local != 0 && !bad_ip_adrs(local))
+        wo->ouraddr = local;
+    }
     }
     ask_for_local = wo->ouraddr != 0 || !disable_defaultip;
 }
@@ -1841,37 +1841,37 @@ ip_demand_conf(u)
     ipcp_options *wo = &ipcp_wantoptions[u];
 
     if (wo->hisaddr == 0 && !pcb->settings.noremoteip) {
-	/* make up an arbitrary address for the peer */
-	wo->hisaddr = lwip_htonl(0x0a707070 + ifunit);
-	wo->accept_remote = 1;
+    /* make up an arbitrary address for the peer */
+    wo->hisaddr = lwip_htonl(0x0a707070 + ifunit);
+    wo->accept_remote = 1;
     }
     if (wo->ouraddr == 0) {
-	/* make up an arbitrary address for us */
-	wo->ouraddr = lwip_htonl(0x0a404040 + ifunit);
-	wo->accept_local = 1;
-	ask_for_local = 0;	/* don't tell the peer this address */
+    /* make up an arbitrary address for us */
+    wo->ouraddr = lwip_htonl(0x0a404040 + ifunit);
+    wo->accept_local = 1;
+    ask_for_local = 0;  /* don't tell the peer this address */
     }
     if (!sifaddr(pcb, wo->ouraddr, wo->hisaddr, get_mask(wo->ouraddr)))
-	return 0;
+    return 0;
     if (!sifup(pcb))
-	return 0;
+    return 0;
     if (!sifnpmode(pcb, PPP_IP, NPMODE_QUEUE))
-	return 0;
+    return 0;
 #if 0 /* UNUSED */
     if (wo->default_route)
-	if (sifdefaultroute(pcb, wo->ouraddr, wo->hisaddr,
-		wo->replace_default_route))
-	    default_route_set[u] = 1;
+    if (sifdefaultroute(pcb, wo->ouraddr, wo->hisaddr,
+        wo->replace_default_route))
+        default_route_set[u] = 1;
 #endif /* UNUSED */
 #if 0 /* UNUSED - PROXY ARP */
     if (wo->proxy_arp)
-	if (sifproxyarp(pcb, wo->hisaddr))
-	    proxy_arp_set[u] = 1;
+    if (sifproxyarp(pcb, wo->hisaddr))
+        proxy_arp_set[u] = 1;
 #endif /* UNUSED - PROXY ARP */
 
     ppp_notice(("local  IP address %I", wo->ouraddr));
     if (wo->hisaddr)
-	ppp_notice(("remote IP address %I", wo->hisaddr));
+    ppp_notice(("remote IP address %I", wo->hisaddr));
 
     return 1;
 }
@@ -1895,46 +1895,46 @@ static void ipcp_up(fsm *f) {
      * We must have a non-zero IP address for both ends of the link.
      */
     if (!ho->neg_addr && !ho->old_addrs)
-	ho->hisaddr = wo->hisaddr;
+    ho->hisaddr = wo->hisaddr;
 
     if (!(go->neg_addr || go->old_addrs) && (wo->neg_addr || wo->old_addrs)
-	&& wo->ouraddr != 0) {
-	ppp_error(("Peer refused to agree to our IP address"));
-	ipcp_close(f->pcb, "Refused our IP address");
-	return;
+    && wo->ouraddr != 0) {
+    ppp_error(("Peer refused to agree to our IP address"));
+    ipcp_close(f->pcb, "Refused our IP address");
+    return;
     }
     if (go->ouraddr == 0) {
-	ppp_error(("Could not determine local IP address"));
-	ipcp_close(f->pcb, "Could not determine local IP address");
-	return;
+    ppp_error(("Could not determine local IP address"));
+    ipcp_close(f->pcb, "Could not determine local IP address");
+    return;
     }
     if (ho->hisaddr == 0 && !pcb->settings.noremoteip) {
-	ho->hisaddr = lwip_htonl(0x0a404040);
-	ppp_warn(("Could not determine remote IP address: defaulting to %I",
-	     ho->hisaddr));
+    ho->hisaddr = lwip_htonl(0x0a404040);
+    ppp_warn(("Could not determine remote IP address: defaulting to %I",
+         ho->hisaddr));
     }
 #if 0 /* UNUSED */
     script_setenv("IPLOCAL", ip_ntoa(go->ouraddr), 0);
     if (ho->hisaddr != 0)
-	script_setenv("IPREMOTE", ip_ntoa(ho->hisaddr), 1);
+    script_setenv("IPREMOTE", ip_ntoa(ho->hisaddr), 1);
 #endif /* UNUSED */
 
 #if LWIP_DNS
     if (!go->req_dns1)
-	    go->dnsaddr[0] = 0;
+        go->dnsaddr[0] = 0;
     if (!go->req_dns2)
-	    go->dnsaddr[1] = 0;
+        go->dnsaddr[1] = 0;
 #if 0 /* UNUSED */
     if (go->dnsaddr[0])
-	script_setenv("DNS1", ip_ntoa(go->dnsaddr[0]), 0);
+    script_setenv("DNS1", ip_ntoa(go->dnsaddr[0]), 0);
     if (go->dnsaddr[1])
-	script_setenv("DNS2", ip_ntoa(go->dnsaddr[1]), 0);
+    script_setenv("DNS2", ip_ntoa(go->dnsaddr[1]), 0);
 #endif /* UNUSED */
     if (pcb->settings.usepeerdns && (go->dnsaddr[0] || go->dnsaddr[1])) {
-	sdns(pcb, go->dnsaddr[0], go->dnsaddr[1]);
+    sdns(pcb, go->dnsaddr[0], go->dnsaddr[1]);
 #if 0 /* UNUSED */
-	script_setenv("USEPEERDNS", "1", 0);
-	create_resolv(go->dnsaddr[0], go->dnsaddr[1]);
+    script_setenv("USEPEERDNS", "1", 0);
+    create_resolv(go->dnsaddr[0], go->dnsaddr[1]);
 #endif /* UNUSED */
     }
 #endif /* LWIP_DNS */
@@ -1943,29 +1943,29 @@ static void ipcp_up(fsm *f) {
      * Check that the peer is allowed to use the IP address it wants.
      */
     if (ho->hisaddr != 0) {
-	u32_t addr = lwip_ntohl(ho->hisaddr);
-	if ((addr >> IP_CLASSA_NSHIFT) == IP_LOOPBACKNET
-	    || IP_MULTICAST(addr) || IP_BADCLASS(addr)
-	    /*
-	     * For now, 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.
-	     */
+    u32_t addr = lwip_ntohl(ho->hisaddr);
+    if ((addr >> IP_CLASSA_NSHIFT) == IP_LOOPBACKNET
+        || IP_MULTICAST(addr) || IP_BADCLASS(addr)
+        /*
+         * For now, 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.
+         */
 #if PPP_SERVER && PPP_AUTH_SUPPORT
-	    || (pcb->settings.auth_required && wo->hisaddr != ho->hisaddr)
+        || (pcb->settings.auth_required && wo->hisaddr != ho->hisaddr)
 #endif /* PPP_SERVER && PPP_AUTH_SUPPORT */
-	    ) {
-		ppp_error(("Peer is not authorized to use remote address %I", ho->hisaddr));
-		ipcp_close(pcb, "Unauthorized remote IP address");
-		return;
-	}
+        ) {
+        ppp_error(("Peer is not authorized to use remote address %I", ho->hisaddr));
+        ipcp_close(pcb, "Unauthorized remote IP address");
+        return;
+    }
     }
 #if 0 /* Unused */
     /* Upstream checking code */
     if (ho->hisaddr != 0 && !auth_ip_addr(f->unit, ho->hisaddr)) {
-	ppp_error(("Peer is not authorized to use remote address %I", ho->hisaddr));
-	ipcp_close(f->unit, "Unauthorized remote IP address");
-	return;
+    ppp_error(("Peer is not authorized to use remote address %I", ho->hisaddr));
+    ipcp_close(f->unit, "Unauthorized remote IP address");
+    return;
     }
 #endif /* Unused */
 
@@ -1981,114 +1981,114 @@ static void ipcp_up(fsm *f) {
      * interface to pass IP packets.
      */
     if (demand) {
-	if (go->ouraddr != wo->ouraddr || ho->hisaddr != wo->hisaddr) {
-	    ipcp_clear_addrs(f->unit, wo->ouraddr, wo->hisaddr,
-				      wo->replace_default_route);
-	    if (go->ouraddr != wo->ouraddr) {
-		ppp_warn(("Local IP address changed to %I", go->ouraddr));
-		script_setenv("OLDIPLOCAL", ip_ntoa(wo->ouraddr), 0);
-		wo->ouraddr = go->ouraddr;
-	    } else
-		script_unsetenv("OLDIPLOCAL");
-	    if (ho->hisaddr != wo->hisaddr && wo->hisaddr != 0) {
-		ppp_warn(("Remote IP address changed to %I", ho->hisaddr));
-		script_setenv("OLDIPREMOTE", ip_ntoa(wo->hisaddr), 0);
-		wo->hisaddr = ho->hisaddr;
-	    } else
-		script_unsetenv("OLDIPREMOTE");
-
-	    /* Set the interface to the new addresses */
-	    mask = get_mask(go->ouraddr);
-	    if (!sifaddr(pcb, go->ouraddr, ho->hisaddr, mask)) {
+    if (go->ouraddr != wo->ouraddr || ho->hisaddr != wo->hisaddr) {
+        ipcp_clear_addrs(f->unit, wo->ouraddr, wo->hisaddr,
+                      wo->replace_default_route);
+        if (go->ouraddr != wo->ouraddr) {
+        ppp_warn(("Local IP address changed to %I", go->ouraddr));
+        script_setenv("OLDIPLOCAL", ip_ntoa(wo->ouraddr), 0);
+        wo->ouraddr = go->ouraddr;
+        } else
+        script_unsetenv("OLDIPLOCAL");
+        if (ho->hisaddr != wo->hisaddr && wo->hisaddr != 0) {
+        ppp_warn(("Remote IP address changed to %I", ho->hisaddr));
+        script_setenv("OLDIPREMOTE", ip_ntoa(wo->hisaddr), 0);
+        wo->hisaddr = ho->hisaddr;
+        } else
+        script_unsetenv("OLDIPREMOTE");
+
+        /* Set the interface to the new addresses */
+        mask = get_mask(go->ouraddr);
+        if (!sifaddr(pcb, go->ouraddr, ho->hisaddr, mask)) {
 #if PPP_DEBUG
-		ppp_warn(("Interface configuration failed"));
+        ppp_warn(("Interface configuration failed"));
 #endif /* PPP_DEBUG */
-		ipcp_close(f->unit, "Interface configuration failed");
-		return;
-	    }
+        ipcp_close(f->unit, "Interface configuration failed");
+        return;
+        }
 
-	    /* assign a default route through the interface if required */
-	    if (ipcp_wantoptions[f->unit].default_route) 
-		if (sifdefaultroute(pcb, go->ouraddr, ho->hisaddr,
-			wo->replace_default_route))
-		    default_route_set[f->unit] = 1;
+        /* assign a default route through the interface if required */
+        if (ipcp_wantoptions[f->unit].default_route)
+        if (sifdefaultroute(pcb, go->ouraddr, ho->hisaddr,
+            wo->replace_default_route))
+            default_route_set[f->unit] = 1;
 
 #if 0 /* UNUSED - PROXY ARP */
-	    /* Make a proxy ARP entry if requested. */
-	    if (ho->hisaddr != 0 && ipcp_wantoptions[f->unit].proxy_arp)
-		if (sifproxyarp(pcb, ho->hisaddr))
-		    proxy_arp_set[f->unit] = 1;
+        /* Make a proxy ARP entry if requested. */
+        if (ho->hisaddr != 0 && ipcp_wantoptions[f->unit].proxy_arp)
+        if (sifproxyarp(pcb, ho->hisaddr))
+            proxy_arp_set[f->unit] = 1;
 #endif /* UNUSED - PROXY ARP */
 
-	}
-	demand_rexmit(PPP_IP,go->ouraddr);
-	sifnpmode(pcb, PPP_IP, NPMODE_PASS);
+    }
+    demand_rexmit(PPP_IP,go->ouraddr);
+    sifnpmode(pcb, PPP_IP, NPMODE_PASS);
 
     } else
 #endif /* DEMAND_SUPPORT */
     {
-	/*
-	 * Set IP addresses and (if specified) netmask.
-	 */
-	mask = get_mask(go->ouraddr);
+    /*
+     * Set IP addresses and (if specified) netmask.
+     */
+    mask = get_mask(go->ouraddr);
 
 #if !(defined(SVR4) && (defined(SNI) || defined(__USLC__)))
-	if (!sifaddr(pcb, go->ouraddr, ho->hisaddr, mask)) {
+    if (!sifaddr(pcb, go->ouraddr, ho->hisaddr, mask)) {
 #if PPP_DEBUG
-	    ppp_warn(("Interface configuration failed"));
+        ppp_warn(("Interface configuration failed"));
 #endif /* PPP_DEBUG */
-	    ipcp_close(f->pcb, "Interface configuration failed");
-	    return;
-	}
+        ipcp_close(f->pcb, "Interface configuration failed");
+        return;
+    }
 #endif
 
-	/* bring the interface up for IP */
-	if (!sifup(pcb)) {
+    /* bring the interface up for IP */
+    if (!sifup(pcb)) {
 #if PPP_DEBUG
-	    ppp_warn(("Interface failed to come up"));
+        ppp_warn(("Interface failed to come up"));
 #endif /* PPP_DEBUG */
-	    ipcp_close(f->pcb, "Interface configuration failed");
-	    return;
-	}
+        ipcp_close(f->pcb, "Interface configuration failed");
+        return;
+    }
 
 #if (defined(SVR4) && (defined(SNI) || defined(__USLC__)))
-	if (!sifaddr(pcb, go->ouraddr, ho->hisaddr, mask)) {
+    if (!sifaddr(pcb, go->ouraddr, ho->hisaddr, mask)) {
 #if PPP_DEBUG
-	    ppp_warn(("Interface configuration failed"));
+        ppp_warn(("Interface configuration failed"));
 #endif /* PPP_DEBUG */
-	    ipcp_close(f->unit, "Interface configuration failed");
-	    return;
-	}
+        ipcp_close(f->unit, "Interface configuration failed");
+        return;
+    }
 #endif
 #if DEMAND_SUPPORT
-	sifnpmode(pcb, PPP_IP, NPMODE_PASS);
+    sifnpmode(pcb, PPP_IP, NPMODE_PASS);
 #endif /* DEMAND_SUPPORT */
 
 #if 0 /* UNUSED */
-	/* assign a default route through the interface if required */
-	if (wo->default_route)
-	    if (sifdefaultroute(pcb, go->ouraddr, ho->hisaddr,
-		    wo->replace_default_route))
-		    pcb->default_route_set = 1;
+    /* assign a default route through the interface if required */
+    if (wo->default_route)
+        if (sifdefaultroute(pcb, go->ouraddr, ho->hisaddr,
+            wo->replace_default_route))
+            pcb->default_route_set = 1;
 #endif /* UNUSED */
 
 #if 0 /* UNUSED - PROXY ARP */
-	/* Make a proxy ARP entry if requested. */
-	if (ho->hisaddr != 0 && wo->proxy_arp)
-	    if (sifproxyarp(pcb, ho->hisaddr))
-		pcb->proxy_arp_set = 1;
+    /* Make a proxy ARP entry if requested. */
+    if (ho->hisaddr != 0 && wo->proxy_arp)
+        if (sifproxyarp(pcb, ho->hisaddr))
+        pcb->proxy_arp_set = 1;
 #endif /* UNUSED - PROXY ARP */
 
-	wo->ouraddr = go->ouraddr;
+    wo->ouraddr = go->ouraddr;
 
-	ppp_notice(("local  IP address %I", go->ouraddr));
-	if (ho->hisaddr != 0)
-	    ppp_notice(("remote IP address %I", ho->hisaddr));
+    ppp_notice(("local  IP address %I", go->ouraddr));
+    if (ho->hisaddr != 0)
+        ppp_notice(("remote IP address %I", ho->hisaddr));
 #if LWIP_DNS
-	if (go->dnsaddr[0])
-	    ppp_notice(("primary   DNS address %I", go->dnsaddr[0]));
-	if (go->dnsaddr[1])
-	    ppp_notice(("secondary DNS address %I", go->dnsaddr[1]));
+    if (go->dnsaddr[0])
+        ppp_notice(("primary   DNS address %I", go->dnsaddr[0]));
+    if (go->dnsaddr[1])
+        ppp_notice(("secondary DNS address %I", go->dnsaddr[1]));
 #endif /* LWIP_DNS */
     }
 
@@ -2104,7 +2104,7 @@ static void ipcp_up(fsm *f) {
 #endif /* PPP_NOTIFY */
 #if 0 /* UNUSED */
     if (ip_up_hook)
-	ip_up_hook();
+    ip_up_hook();
 #endif /* UNUSED */
 }
 
@@ -2133,11 +2133,11 @@ static void ipcp_down(fsm *f) {
 #endif /* PPP_NOTIFY */
 #if 0 /* UNUSED */
     if (ip_down_hook)
-	ip_down_hook();
+    ip_down_hook();
 #endif /* UNUSED */
     if (pcb->ipcp_is_up) {
-	pcb->ipcp_is_up = 0;
-	np_down(pcb, PPP_IP);
+    pcb->ipcp_is_up = 0;
+    np_down(pcb, PPP_IP);
     }
 #if VJ_SUPPORT
     sifvjcomp(pcb, 0, 0, 0);
@@ -2145,8 +2145,8 @@ static void ipcp_down(fsm *f) {
 
 #if PPP_STATS_SUPPORT
     print_link_stats(); /* _after_ running the notifiers and ip_down_hook(),
-			 * because print_link_stats() sets link_stats_valid
-			 * to 0 (zero) */
+             * because print_link_stats() sets link_stats_valid
+             * to 0 (zero) */
 #endif /* PPP_STATS_SUPPORT */
 
 #if DEMAND_SUPPORT
@@ -2155,18 +2155,18 @@ static void ipcp_down(fsm *f) {
      * to queue up outgoing packets (for now).
      */
     if (demand) {
-	sifnpmode(pcb, PPP_IP, NPMODE_QUEUE);
+    sifnpmode(pcb, PPP_IP, NPMODE_QUEUE);
     } else
 #endif /* DEMAND_SUPPORT */
     {
 #if DEMAND_SUPPORT
-	sifnpmode(pcb, PPP_IP, NPMODE_DROP);
+    sifnpmode(pcb, PPP_IP, NPMODE_DROP);
 #endif /* DEMAND_SUPPORT */
-	sifdown(pcb);
-	ipcp_clear_addrs(pcb, go->ouraddr,
-			 ho->hisaddr, 0);
+    sifdown(pcb);
+    ipcp_clear_addrs(pcb, go->ouraddr,
+             ho->hisaddr, 0);
 #if LWIP_DNS
-	cdns(pcb, go->dnsaddr[0], go->dnsaddr[1]);
+    cdns(pcb, go->dnsaddr[0], go->dnsaddr[1]);
 #endif /* LWIP_DNS */
     }
 }
@@ -2181,8 +2181,8 @@ static void ipcp_clear_addrs(ppp_pcb *pcb, u32_t ouraddr, u32_t hisaddr, u8_t re
 
 #if 0 /* UNUSED - PROXY ARP */
     if (pcb->proxy_arp_set) {
-	cifproxyarp(pcb, hisaddr);
-	pcb->proxy_arp_set = 0;
+    cifproxyarp(pcb, hisaddr);
+    pcb->proxy_arp_set = 0;
     }
 #endif /* UNUSED - PROXY ARP */
 #if 0 /* UNUSED */
@@ -2195,8 +2195,8 @@ static void ipcp_clear_addrs(ppp_pcb *pcb, u32_t ouraddr, u32_t hisaddr, u8_t re
      * is one saved by an sifdefaultroute with replacedefaultroute.
      */
     if (!replacedefaultroute && pcb->default_route_set) {
-	cifdefaultroute(pcb, ouraddr, hisaddr);
-	pcb->default_route_set = 0;
+    cifdefaultroute(pcb, ouraddr, hisaddr);
+    pcb->default_route_set = 0;
     }
 #endif /* UNUSED */
     cifaddr(pcb, ouraddr, hisaddr);
@@ -2207,11 +2207,11 @@ static void ipcp_clear_addrs(ppp_pcb *pcb, u32_t ouraddr, u32_t hisaddr, u8_t re
  * ipcp_finished - possibly shut down the lower layers.
  */
 static void ipcp_finished(fsm *f) {
-	ppp_pcb *pcb = f->pcb;
-	if (pcb->ipcp_is_open) {
-		pcb->ipcp_is_open = 0;
-		np_finished(pcb, PPP_IP);
-	}
+    ppp_pcb *pcb = f->pcb;
+    if (pcb->ipcp_is_open) {
+        pcb->ipcp_is_open = 0;
+        np_finished(pcb, PPP_IP);
+    }
 }
 
 
@@ -2237,7 +2237,7 @@ static const char* const ipcp_codenames[] = {
 };
 
 static int ipcp_printpkt(const u_char *p, int plen,
-		void (*printer) (void *, const char *, ...), void *arg) {
+        void (*printer) (void *, const char *, ...), void *arg) {
     int code, id, len, olen;
     const u_char *pstart, *optend;
 #if VJ_SUPPORT
@@ -2246,18 +2246,18 @@ static int ipcp_printpkt(const u_char *p, int plen,
     u32_t cilong;
 
     if (plen < HEADERLEN)
-	return 0;
+    return 0;
     pstart = p;
     GETCHAR(code, p);
     GETCHAR(id, p);
     GETSHORT(len, p);
     if (len < HEADERLEN || len > plen)
-	return 0;
+    return 0;
 
     if (code >= 1 && code <= (int)LWIP_ARRAYSIZE(ipcp_codenames))
-	printer(arg, " %s", ipcp_codenames[code-1]);
+    printer(arg, " %s", ipcp_codenames[code-1]);
     else
-	printer(arg, " code=0x%x", code);
+    printer(arg, " code=0x%x", code);
     printer(arg, " id=0x%x", id);
     len -= HEADERLEN;
     switch (code) {
@@ -2265,98 +2265,98 @@ static int ipcp_printpkt(const u_char *p, int plen,
     case CONFACK:
     case CONFNAK:
     case CONFREJ:
-	/* print option list */
-	while (len >= 2) {
-	    GETCHAR(code, p);
-	    GETCHAR(olen, p);
-	    p -= 2;
-	    if (olen < 2 || olen > len) {
-		break;
-	    }
-	    printer(arg, " <");
-	    len -= olen;
-	    optend = p + olen;
-	    switch (code) {
-	    case CI_ADDRS:
-		if (olen == CILEN_ADDRS) {
-		    p += 2;
-		    GETLONG(cilong, p);
-		    printer(arg, "addrs %I", lwip_htonl(cilong));
-		    GETLONG(cilong, p);
-		    printer(arg, " %I", lwip_htonl(cilong));
-		}
-		break;
+    /* print option list */
+    while (len >= 2) {
+        GETCHAR(code, p);
+        GETCHAR(olen, p);
+        p -= 2;
+        if (olen < 2 || olen > len) {
+        break;
+        }
+        printer(arg, " <");
+        len -= olen;
+        optend = p + olen;
+        switch (code) {
+        case CI_ADDRS:
+        if (olen == CILEN_ADDRS) {
+            p += 2;
+            GETLONG(cilong, p);
+            printer(arg, "addrs %I", lwip_htonl(cilong));
+            GETLONG(cilong, p);
+            printer(arg, " %I", lwip_htonl(cilong));
+        }
+        break;
 #if VJ_SUPPORT
-	    case CI_COMPRESSTYPE:
-		if (olen >= CILEN_COMPRESS) {
-		    p += 2;
-		    GETSHORT(cishort, p);
-		    printer(arg, "compress ");
-		    switch (cishort) {
-		    case IPCP_VJ_COMP:
-			printer(arg, "VJ");
-			break;
-		    case IPCP_VJ_COMP_OLD:
-			printer(arg, "old-VJ");
-			break;
-		    default:
-			printer(arg, "0x%x", cishort);
-		    }
-		}
-		break;
+        case CI_COMPRESSTYPE:
+        if (olen >= CILEN_COMPRESS) {
+            p += 2;
+            GETSHORT(cishort, p);
+            printer(arg, "compress ");
+            switch (cishort) {
+            case IPCP_VJ_COMP:
+            printer(arg, "VJ");
+            break;
+            case IPCP_VJ_COMP_OLD:
+            printer(arg, "old-VJ");
+            break;
+            default:
+            printer(arg, "0x%x", cishort);
+            }
+        }
+        break;
 #endif /* VJ_SUPPORT */
-	    case CI_ADDR:
-		if (olen == CILEN_ADDR) {
-		    p += 2;
-		    GETLONG(cilong, p);
-		    printer(arg, "addr %I", lwip_htonl(cilong));
-		}
-		break;
+        case CI_ADDR:
+        if (olen == CILEN_ADDR) {
+            p += 2;
+            GETLONG(cilong, p);
+            printer(arg, "addr %I", lwip_htonl(cilong));
+        }
+        break;
 #if LWIP_DNS
-	    case CI_MS_DNS1:
-	    case CI_MS_DNS2:
-	        p += 2;
-		GETLONG(cilong, p);
-		printer(arg, "ms-dns%d %I", (code == CI_MS_DNS1? 1: 2),
-			htonl(cilong));
-		break;
+        case CI_MS_DNS1:
+        case CI_MS_DNS2:
+            p += 2;
+        GETLONG(cilong, p);
+        printer(arg, "ms-dns%d %I", (code == CI_MS_DNS1? 1: 2),
+            htonl(cilong));
+        break;
 #endif /* LWIP_DNS */
 #if 0 /* UNUSED - WINS */
-	    case CI_MS_WINS1:
-	    case CI_MS_WINS2:
-	        p += 2;
-		GETLONG(cilong, p);
-		printer(arg, "ms-wins %I", lwip_htonl(cilong));
-		break;
+        case CI_MS_WINS1:
+        case CI_MS_WINS2:
+            p += 2;
+        GETLONG(cilong, p);
+        printer(arg, "ms-wins %I", lwip_htonl(cilong));
+        break;
 #endif /* UNUSED - WINS */
-	    default:
-		break;
-	    }
-	    while (p < optend) {
-		GETCHAR(code, p);
-		printer(arg, " %.2x", code);
-	    }
-	    printer(arg, ">");
-	}
-	break;
+        default:
+        break;
+        }
+        while (p < optend) {
+        GETCHAR(code, p);
+        printer(arg, " %.2x", code);
+        }
+        printer(arg, ">");
+    }
+    break;
 
     case TERMACK:
     case TERMREQ:
-	if (len > 0 && *p >= ' ' && *p < 0x7f) {
-	    printer(arg, " ");
-	    ppp_print_string(p, len, printer, arg);
-	    p += len;
-	    len = 0;
-	}
-	break;
+    if (len > 0 && *p >= ' ' && *p < 0x7f) {
+        printer(arg, " ");
+        ppp_print_string(p, len, printer, arg);
+        p += len;
+        len = 0;
+    }
+    break;
     default:
-	break;
+    break;
     }
 
     /* print the rest of the bytes in the packet */
     for (; len > 0; --len) {
-	GETCHAR(code, p);
-	printer(arg, " %.2x", code);
+    GETCHAR(code, p);
+    printer(arg, " %.2x", code);
     }
 
     return p - pstart;
@@ -2369,25 +2369,25 @@ static int ipcp_printpkt(const u_char *p, int plen,
  * We don't bring the link up for IP fragments or for TCP FIN packets
  * with no data.
  */
-#define IP_HDRLEN	20	/* bytes */
-#define IP_OFFMASK	0x1fff
+#define IP_HDRLEN   20  /* bytes */
+#define IP_OFFMASK  0x1fff
 #ifndef IPPROTO_TCP
-#define IPPROTO_TCP	6
+#define IPPROTO_TCP 6
 #endif
-#define TCP_HDRLEN	20
-#define TH_FIN		0x01
+#define TCP_HDRLEN  20
+#define TH_FIN      0x01
 
 /*
  * We use these macros because the IP header may be at an odd address,
  * and some compilers might use word loads to get th_off or ip_hl.
  */
 
-#define net_short(x)	(((x)[0] << 8) + (x)[1])
-#define get_iphl(x)	(((unsigned char *)(x))[0] & 0xF)
-#define get_ipoff(x)	net_short((unsigned char *)(x) + 6)
-#define get_ipproto(x)	(((unsigned char *)(x))[9])
-#define get_tcpoff(x)	(((unsigned char *)(x))[12] >> 4)
-#define get_tcpflags(x)	(((unsigned char *)(x))[13])
+#define net_short(x)    (((x)[0] << 8) + (x)[1])
+#define get_iphl(x) (((unsigned char *)(x))[0] & 0xF)
+#define get_ipoff(x)    net_short((unsigned char *)(x) + 6)
+#define get_ipproto(x)  (((unsigned char *)(x))[9])
+#define get_tcpoff(x)   (((unsigned char *)(x))[12] >> 4)
+#define get_tcpflags(x) (((unsigned char *)(x))[13])
 
 static int
 ip_active_pkt(pkt, len)
@@ -2400,17 +2400,17 @@ ip_active_pkt(pkt, len)
     len -= PPP_HDRLEN;
     pkt += PPP_HDRLEN;
     if (len < IP_HDRLEN)
-	return 0;
+    return 0;
     if ((get_ipoff(pkt) & IP_OFFMASK) != 0)
-	return 0;
+    return 0;
     if (get_ipproto(pkt) != IPPROTO_TCP)
-	return 1;
+    return 1;
     hlen = get_iphl(pkt) * 4;
     if (len < hlen + TCP_HDRLEN)
-	return 0;
+    return 0;
     tcp = pkt + hlen;
     if ((get_tcpflags(tcp) & TH_FIN) != 0 && len == hlen + get_tcpoff(tcp) * 4)
-	return 0;
+    return 0;
     return 1;
 }
 #endif /* DEMAND_SUPPORT */
diff --git a/src/netif/ppp/ipv6cp.c b/src/netif/ppp/ipv6cp.c
index 2035ef9b..d8bf8f97 100644
--- a/src/netif/ppp/ipv6cp.c
+++ b/src/netif/ppp/ipv6cp.c
@@ -73,7 +73,7 @@
     between BULL S.A. and INRIA).
 
     This software is available with usual "research" terms
-    with the aim of retain credits of the software. 
+    with the aim of retain credits of the software.
     Permission to use, copy, modify and distribute this software for any
     purpose and without fee is hereby granted, provided that the above
     copyright notice and this permission notice appear in all copies,
@@ -135,11 +135,11 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- * $Id: ipv6cp.c,v 1.21 2005/08/25 23:59:34 paulus Exp $ 
+ * $Id: ipv6cp.c,v 1.21 2005/08/25 23:59:34 paulus Exp $
  */
 
 /*
- * @todo: 
+ * @todo:
  *
  * Proxy Neighbour Discovery.
  *
@@ -188,21 +188,21 @@ static void ipv6cp_down(fsm *f); /* We're DOWN */
 static void ipv6cp_finished(fsm *f); /* Don't need lower layer */
 
 static const fsm_callbacks ipv6cp_callbacks = { /* IPV6CP callback routines */
-    ipv6cp_resetci,		/* Reset our Configuration Information */
-    ipv6cp_cilen,		/* Length of our Configuration Information */
-    ipv6cp_addci,		/* Add our Configuration Information */
-    ipv6cp_ackci,		/* ACK our Configuration Information */
-    ipv6cp_nakci,		/* NAK our Configuration Information */
-    ipv6cp_rejci,		/* Reject our Configuration Information */
-    ipv6cp_reqci,		/* Request peer's Configuration Information */
-    ipv6cp_up,			/* Called when fsm reaches OPENED state */
-    ipv6cp_down,		/* Called when fsm leaves OPENED state */
-    NULL,			/* Called when we want the lower layer up */
-    ipv6cp_finished,		/* Called when we want the lower layer down */
-    NULL,			/* Called when Protocol-Reject received */
-    NULL,			/* Retransmission is necessary */
-    NULL,			/* Called to handle protocol-specific codes */
-    "IPV6CP"			/* String name of protocol */
+    ipv6cp_resetci,     /* Reset our Configuration Information */
+    ipv6cp_cilen,       /* Length of our Configuration Information */
+    ipv6cp_addci,       /* Add our Configuration Information */
+    ipv6cp_ackci,       /* ACK our Configuration Information */
+    ipv6cp_nakci,       /* NAK our Configuration Information */
+    ipv6cp_rejci,       /* Reject our Configuration Information */
+    ipv6cp_reqci,       /* Request peer's Configuration Information */
+    ipv6cp_up,          /* Called when fsm reaches OPENED state */
+    ipv6cp_down,        /* Called when fsm leaves OPENED state */
+    NULL,           /* Called when we want the lower layer up */
+    ipv6cp_finished,        /* Called when we want the lower layer down */
+    NULL,           /* Called when Protocol-Reject received */
+    NULL,           /* Retransmission is necessary */
+    NULL,           /* Called to handle protocol-specific codes */
+    "IPV6CP"            /* String name of protocol */
 };
 
 #if PPP_OPTIONS
@@ -211,7 +211,7 @@ static const fsm_callbacks ipv6cp_callbacks = { /* IPV6CP callback routines */
  */
 static int setifaceid(char **arg));
 static void printifaceid(option_t *,
-			      void (*)(void *, char *, ...), void *));
+                  void (*)(void *, char *, ...), void *));
 
 static option_t ipv6cp_option_list[] = {
     { "ipv6", o_special, (void *)setifaceid,
@@ -265,7 +265,7 @@ static int  ipv6_demand_conf(int u);
 #endif /* DEMAND_SUPPORT */
 #if PRINTPKT_SUPPORT
 static int ipv6cp_printpkt(const u_char *p, int plen,
-		void (*printer)(void *, const char *, ...), void *arg);
+        void (*printer)(void *, const char *, ...), void *arg);
 #endif /* PRINTPKT_SUPPORT */
 #if DEMAND_SUPPORT
 static int ipv6_active_pkt(u_char *pkt, int len);
@@ -309,12 +309,12 @@ static void ipv6cp_script_done(void *));
 /*
  * Lengths of configuration options.
  */
-#define CILEN_VOID	2
-#define CILEN_COMPRESS	4	/* length for RFC2023 compress opt. */
-#define CILEN_IFACEID   10	/* RFC2472, interface identifier    */
+#define CILEN_VOID  2
+#define CILEN_COMPRESS  4   /* length for RFC2023 compress opt. */
+#define CILEN_IFACEID   10  /* RFC2472, interface identifier    */
 
-#define CODENAME(x)	((x) == CONFACK ? "ACK" : \
-			 (x) == CONFNAK ? "NAK" : "REJ")
+#define CODENAME(x) ((x) == CONFACK ? "ACK" : \
+             (x) == CONFNAK ? "NAK" : "REJ")
 
 #if 0 /* UNUSED */
 /*
@@ -344,49 +344,49 @@ setifaceid(argv)
     static int prio_local, prio_remote;
 
 #define VALIDID(a) ( (((a).s6_addr32[0] == 0) && ((a).s6_addr32[1] == 0)) && \
-			(((a).s6_addr32[2] != 0) || ((a).s6_addr32[3] != 0)) )
-    
+            (((a).s6_addr32[2] != 0) || ((a).s6_addr32[3] != 0)) )
+
     arg = *argv;
     if ((comma = strchr(arg, ',')) == NULL)
-	comma = arg + strlen(arg);
-    
-    /* 
+    comma = arg + strlen(arg);
+
+    /*
      * If comma first character, then no local identifier
      */
     if (comma != arg) {
-	c = *comma;
-	*comma = '\0';
-
-	if (inet_pton(AF_INET6, arg, &addr) == 0 || !VALIDID(addr)) {
-	    option_error("Illegal interface identifier (local): %s", arg);
-	    return 0;
-	}
-
-	if (option_priority >= prio_local) {
-	    eui64_copy(addr.s6_addr32[2], wo->ourid);
-	    wo->opt_local = 1;
-	    prio_local = option_priority;
-	}
-	*comma = c;
+    c = *comma;
+    *comma = '\0';
+
+    if (inet_pton(AF_INET6, arg, &addr) == 0 || !VALIDID(addr)) {
+        option_error("Illegal interface identifier (local): %s", arg);
+        return 0;
+    }
+
+    if (option_priority >= prio_local) {
+        eui64_copy(addr.s6_addr32[2], wo->ourid);
+        wo->opt_local = 1;
+        prio_local = option_priority;
+    }
+    *comma = c;
     }
-    
+
     /*
      * If comma last character, the no remote identifier
      */
     if (*comma != 0 && *++comma != '\0') {
-	if (inet_pton(AF_INET6, comma, &addr) == 0 || !VALIDID(addr)) {
-	    option_error("Illegal interface identifier (remote): %s", comma);
-	    return 0;
-	}
-	if (option_priority >= prio_remote) {
-	    eui64_copy(addr.s6_addr32[2], wo->hisid);
-	    wo->opt_remote = 1;
-	    prio_remote = option_priority;
-	}
+    if (inet_pton(AF_INET6, comma, &addr) == 0 || !VALIDID(addr)) {
+        option_error("Illegal interface identifier (remote): %s", comma);
+        return 0;
+    }
+    if (option_priority >= prio_remote) {
+        eui64_copy(addr.s6_addr32[2], wo->hisid);
+        wo->opt_remote = 1;
+        prio_remote = option_priority;
+    }
     }
 
     if (override_value("+ipv6", option_priority, option_source))
-	ipv6cp_protent.enabled_flag = 1;
+    ipv6cp_protent.enabled_flag = 1;
     return 1;
 }
 
@@ -396,13 +396,13 @@ printifaceid(opt, printer, arg)
     void (*printer)(void *, char *, ...));
     void *arg;
 {
-	ipv6cp_options *wo = &ipv6cp_wantoptions[0];
+    ipv6cp_options *wo = &ipv6cp_wantoptions[0];
 
-	if (wo->opt_local)
-		printer(arg, "%s", llv6_ntoa(wo->ourid));
-	printer(arg, ",");
-	if (wo->opt_remote)
-		printer(arg, "%s", llv6_ntoa(wo->hisid));
+    if (wo->opt_local)
+        printer(arg, "%s", llv6_ntoa(wo->ourid));
+    printer(arg, ",");
+    if (wo->opt_remote)
+        printer(arg, "%s", llv6_ntoa(wo->hisid));
 }
 #endif /* PPP_OPTIONS */
 
@@ -513,13 +513,13 @@ static void ipv6cp_resetci(fsm *f) {
     ipv6cp_options *ao = &pcb->ipv6cp_allowoptions;
 
     wo->req_ifaceid = wo->neg_ifaceid && ao->neg_ifaceid;
-    
+
     if (!wo->opt_local) {
-	eui64_magic_nz(wo->ourid);
+    eui64_magic_nz(wo->ourid);
     }
-    
+
     *go = *wo;
-    eui64_zero(go->hisid);	/* last proposed interface identifier */
+    eui64_zero(go->hisid);  /* last proposed interface identifier */
 }
 
 
@@ -531,15 +531,15 @@ static int ipv6cp_cilen(fsm *f) {
     ipv6cp_options *go = &pcb->ipv6cp_gotoptions;
 
 #ifdef IPV6CP_COMP
-#define LENCIVJ(neg)		(neg ? CILEN_COMPRESS : 0)
+#define LENCIVJ(neg)        (neg ? CILEN_COMPRESS : 0)
 #endif /* IPV6CP_COMP */
-#define LENCIIFACEID(neg)	(neg ? CILEN_IFACEID : 0)
+#define LENCIIFACEID(neg)   (neg ? CILEN_IFACEID : 0)
 
     return (LENCIIFACEID(go->neg_ifaceid) +
 #ifdef IPV6CP_COMP
-	    LENCIVJ(go->neg_vj) +
+        LENCIVJ(go->neg_vj) +
 #endif /* IPV6CP_COMP */
-	    0);
+        0);
 }
 
 
@@ -554,27 +554,27 @@ static void ipv6cp_addci(fsm *f, u_char *ucp, int *lenp) {
 #ifdef IPV6CP_COMP
 #define ADDCIVJ(opt, neg, val) \
     if (neg) { \
-	int vjlen = CILEN_COMPRESS; \
-	if (len >= vjlen) { \
-	    PUTCHAR(opt, ucp); \
-	    PUTCHAR(vjlen, ucp); \
-	    PUTSHORT(val, ucp); \
-	    len -= vjlen; \
-	} else \
-	    neg = 0; \
+    int vjlen = CILEN_COMPRESS; \
+    if (len >= vjlen) { \
+        PUTCHAR(opt, ucp); \
+        PUTCHAR(vjlen, ucp); \
+        PUTSHORT(val, ucp); \
+        len -= vjlen; \
+    } else \
+        neg = 0; \
     }
 #endif /* IPV6CP_COMP */
 
 #define ADDCIIFACEID(opt, neg, val1) \
     if (neg) { \
-	int idlen = CILEN_IFACEID; \
-	if (len >= idlen) { \
-	    PUTCHAR(opt, ucp); \
-	    PUTCHAR(idlen, ucp); \
-	    eui64_put(val1, ucp); \
-	    len -= idlen; \
-	} else \
-	    neg = 0; \
+    int idlen = CILEN_IFACEID; \
+    if (len >= idlen) { \
+        PUTCHAR(opt, ucp); \
+        PUTCHAR(idlen, ucp); \
+        eui64_put(val1, ucp); \
+        len -= idlen; \
+    } else \
+        neg = 0; \
     }
 
     ADDCIIFACEID(CI_IFACEID, go->neg_ifaceid, go->ourid);
@@ -591,8 +591,8 @@ static void ipv6cp_addci(fsm *f, u_char *ucp, int *lenp) {
  * ipv6cp_ackci - Ack our CIs.
  *
  * Returns:
- *	0 - Ack was bad.
- *	1 - Ack was good.
+ *  0 - Ack was bad.
+ *  1 - Ack was good.
  */
 static int ipv6cp_ackci(fsm *f, u_char *p, int len) {
     ppp_pcb *pcb = f->pcb;
@@ -612,33 +612,33 @@ static int ipv6cp_ackci(fsm *f, u_char *p, int len) {
 #ifdef IPV6CP_COMP
 #define ACKCIVJ(opt, neg, val) \
     if (neg) { \
-	int vjlen = CILEN_COMPRESS; \
-	if ((len -= vjlen) < 0) \
-	    goto bad; \
-	GETCHAR(citype, p); \
-	GETCHAR(cilen, p); \
-	if (cilen != vjlen || \
-	    citype != opt)  \
-	    goto bad; \
-	GETSHORT(cishort, p); \
-	if (cishort != val) \
-	    goto bad; \
+    int vjlen = CILEN_COMPRESS; \
+    if ((len -= vjlen) < 0) \
+        goto bad; \
+    GETCHAR(citype, p); \
+    GETCHAR(cilen, p); \
+    if (cilen != vjlen || \
+        citype != opt)  \
+        goto bad; \
+    GETSHORT(cishort, p); \
+    if (cishort != val) \
+        goto bad; \
     }
 #endif /* IPV6CP_COMP */
 
 #define ACKCIIFACEID(opt, neg, val1) \
     if (neg) { \
-	int idlen = CILEN_IFACEID; \
-	if ((len -= idlen) < 0) \
-	    goto bad; \
-	GETCHAR(citype, p); \
-	GETCHAR(cilen, p); \
-	if (cilen != idlen || \
-	    citype != opt) \
-	    goto bad; \
-	eui64_get(ifaceid, p); \
-	if (! eui64_equals(val1, ifaceid)) \
-	    goto bad; \
+    int idlen = CILEN_IFACEID; \
+    if ((len -= idlen) < 0) \
+        goto bad; \
+    GETCHAR(citype, p); \
+    GETCHAR(cilen, p); \
+    if (cilen != idlen || \
+        citype != opt) \
+        goto bad; \
+    eui64_get(ifaceid, p); \
+    if (! eui64_equals(val1, ifaceid)) \
+        goto bad; \
     }
 
     ACKCIIFACEID(CI_IFACEID, go->neg_ifaceid, go->ourid);
@@ -651,7 +651,7 @@ static int ipv6cp_ackci(fsm *f, u_char *p, int len) {
      * If there are any remaining CIs, then this packet is bad.
      */
     if (len != 0)
-	goto bad;
+    goto bad;
     return (1);
 
 bad:
@@ -665,8 +665,8 @@ bad:
  * or if IPV6CP is in the OPENED state.
  *
  * Returns:
- *	0 - Nak was bad.
- *	1 - Nak was good.
+ *  0 - Nak was bad.
+ *  1 - Nak was good.
  */
 static int ipv6cp_nakci(fsm *f, u_char *p, int len, int treat_as_reject) {
     ppp_pcb *pcb = f->pcb;
@@ -676,8 +676,8 @@ static int ipv6cp_nakci(fsm *f, u_char *p, int len, int treat_as_reject) {
     u_short cishort;
 #endif /* IPV6CP_COMP */
     eui64_t ifaceid;
-    ipv6cp_options no;		/* options we've seen Naks for */
-    ipv6cp_options try_;	/* options to request next time */
+    ipv6cp_options no;      /* options we've seen Naks for */
+    ipv6cp_options try_;    /* options to request next time */
 
     BZERO(&no, sizeof(no));
     try_ = *go;
@@ -689,26 +689,26 @@ static int ipv6cp_nakci(fsm *f, u_char *p, int len, int treat_as_reject) {
      */
 #define NAKCIIFACEID(opt, neg, code) \
     if (go->neg && \
-	len >= (cilen = CILEN_IFACEID) && \
-	p[1] == cilen && \
-	p[0] == opt) { \
-	len -= cilen; \
-	INCPTR(2, p); \
-	eui64_get(ifaceid, p); \
-	no.neg = 1; \
-	code \
+    len >= (cilen = CILEN_IFACEID) && \
+    p[1] == cilen && \
+    p[0] == opt) { \
+    len -= cilen; \
+    INCPTR(2, p); \
+    eui64_get(ifaceid, p); \
+    no.neg = 1; \
+    code \
     }
 
 #ifdef IPV6CP_COMP
 #define NAKCIVJ(opt, neg, code) \
     if (go->neg && \
-	((cilen = p[1]) == CILEN_COMPRESS) && \
-	len >= cilen && \
-	p[0] == opt) { \
-	len -= cilen; \
-	INCPTR(2, p); \
-	GETSHORT(cishort, p); \
-	no.neg = 1; \
+    ((cilen = p[1]) == CILEN_COMPRESS) && \
+    len >= cilen && \
+    p[0] == opt) { \
+    len -= cilen; \
+    INCPTR(2, p); \
+    GETSHORT(cishort, p); \
+    no.neg = 1; \
         code \
     }
 #endif /* IPV6CP_COMP */
@@ -718,27 +718,27 @@ static int ipv6cp_nakci(fsm *f, u_char *p, int len, int treat_as_reject) {
      * from our idea, only if the accept_{local,remote} flag is set.
      */
     NAKCIIFACEID(CI_IFACEID, neg_ifaceid,
-		 if (treat_as_reject) {
-		     try_.neg_ifaceid = 0;
-		 } else if (go->accept_local) {
-		     while (eui64_iszero(ifaceid) || 
-			    eui64_equals(ifaceid, go->hisid)) /* bad luck */
-			 eui64_magic(ifaceid);
-		     try_.ourid = ifaceid;
-		     IPV6CPDEBUG(("local LL address %s", llv6_ntoa(ifaceid)));
-		 }
-		 );
+         if (treat_as_reject) {
+             try_.neg_ifaceid = 0;
+         } else if (go->accept_local) {
+             while (eui64_iszero(ifaceid) ||
+                eui64_equals(ifaceid, go->hisid)) /* bad luck */
+             eui64_magic(ifaceid);
+             try_.ourid = ifaceid;
+             IPV6CPDEBUG(("local LL address %s", llv6_ntoa(ifaceid)));
+         }
+         );
 
 #ifdef IPV6CP_COMP
     NAKCIVJ(CI_COMPRESSTYPE, neg_vj,
-	    {
-		if (cishort == IPV6CP_COMP && !treat_as_reject) {
-		    try_.vj_protocol = cishort;
-		} else {
-		    try_.neg_vj = 0;
-		}
-	    }
-	    );
+        {
+        if (cishort == IPV6CP_COMP && !treat_as_reject) {
+            try_.vj_protocol = cishort;
+        } else {
+            try_.neg_vj = 0;
+        }
+        }
+        );
 #endif /* IPV6CP_COMP */
 
     /*
@@ -748,49 +748,49 @@ static int ipv6cp_nakci(fsm *f, u_char *p, int len, int treat_as_reject) {
      * If they want us to ask for compression, we refuse.
      */
     while (len >= CILEN_VOID) {
-	GETCHAR(citype, p);
-	GETCHAR(cilen, p);
-	if ( cilen < CILEN_VOID || (len -= cilen) < 0 )
-	    goto bad;
-	next = p + cilen - 2;
+    GETCHAR(citype, p);
+    GETCHAR(cilen, p);
+    if ( cilen < CILEN_VOID || (len -= cilen) < 0 )
+        goto bad;
+    next = p + cilen - 2;
 
-	switch (citype) {
+    switch (citype) {
 #ifdef IPV6CP_COMP
-	case CI_COMPRESSTYPE:
-	    if (go->neg_vj || no.neg_vj ||
-		(cilen != CILEN_COMPRESS))
-		goto bad;
-	    no.neg_vj = 1;
-	    break;
+    case CI_COMPRESSTYPE:
+        if (go->neg_vj || no.neg_vj ||
+        (cilen != CILEN_COMPRESS))
+        goto bad;
+        no.neg_vj = 1;
+        break;
 #endif /* IPV6CP_COMP */
-	case CI_IFACEID:
-	    if (go->neg_ifaceid || no.neg_ifaceid || cilen != CILEN_IFACEID)
-		goto bad;
-	    try_.neg_ifaceid = 1;
-	    eui64_get(ifaceid, p);
-	    if (go->accept_local) {
-		while (eui64_iszero(ifaceid) || 
-		       eui64_equals(ifaceid, go->hisid)) /* bad luck */
-		    eui64_magic(ifaceid);
-		try_.ourid = ifaceid;
-	    }
-	    no.neg_ifaceid = 1;
-	    break;
-	default:
-	    break;
-	}
-	p = next;
+    case CI_IFACEID:
+        if (go->neg_ifaceid || no.neg_ifaceid || cilen != CILEN_IFACEID)
+        goto bad;
+        try_.neg_ifaceid = 1;
+        eui64_get(ifaceid, p);
+        if (go->accept_local) {
+        while (eui64_iszero(ifaceid) ||
+               eui64_equals(ifaceid, go->hisid)) /* bad luck */
+            eui64_magic(ifaceid);
+        try_.ourid = ifaceid;
+        }
+        no.neg_ifaceid = 1;
+        break;
+    default:
+        break;
+    }
+    p = next;
     }
 
     /* If there is still anything left, this packet is bad. */
     if (len != 0)
-	goto bad;
+    goto bad;
 
     /*
      * OK, the Nak is good.  Now we can update state.
      */
     if (f->state != PPP_FSM_OPENED)
-	*go = try_;
+    *go = try_;
 
     return 1;
 
@@ -811,7 +811,7 @@ static int ipv6cp_rejci(fsm *f, u_char *p, int len) {
     u_short cishort;
 #endif /* IPV6CP_COMP */
     eui64_t ifaceid;
-    ipv6cp_options try_;		/* options to request next time */
+    ipv6cp_options try_;        /* options to request next time */
 
     try_ = *go;
     /*
@@ -821,31 +821,31 @@ static int ipv6cp_rejci(fsm *f, u_char *p, int len) {
      */
 #define REJCIIFACEID(opt, neg, val1) \
     if (go->neg && \
-	len >= (cilen = CILEN_IFACEID) && \
-	p[1] == cilen && \
-	p[0] == opt) { \
-	len -= cilen; \
-	INCPTR(2, p); \
-	eui64_get(ifaceid, p); \
-	/* Check rejected value. */ \
-	if (! eui64_equals(ifaceid, val1)) \
-	    goto bad; \
-	try_.neg = 0; \
+    len >= (cilen = CILEN_IFACEID) && \
+    p[1] == cilen && \
+    p[0] == opt) { \
+    len -= cilen; \
+    INCPTR(2, p); \
+    eui64_get(ifaceid, p); \
+    /* Check rejected value. */ \
+    if (! eui64_equals(ifaceid, val1)) \
+        goto bad; \
+    try_.neg = 0; \
     }
 
 #ifdef IPV6CP_COMP
 #define REJCIVJ(opt, neg, val) \
     if (go->neg && \
-	p[1] == CILEN_COMPRESS && \
-	len >= p[1] && \
-	p[0] == opt) { \
-	len -= p[1]; \
-	INCPTR(2, p); \
-	GETSHORT(cishort, p); \
-	/* Check rejected value. */  \
-	if (cishort != val) \
-	    goto bad; \
-	try_.neg = 0; \
+    p[1] == CILEN_COMPRESS && \
+    len >= p[1] && \
+    p[0] == opt) { \
+    len -= p[1]; \
+    INCPTR(2, p); \
+    GETSHORT(cishort, p); \
+    /* Check rejected value. */  \
+    if (cishort != val) \
+        goto bad; \
+    try_.neg = 0; \
      }
 #endif /* IPV6CP_COMP */
 
@@ -859,12 +859,12 @@ static int ipv6cp_rejci(fsm *f, u_char *p, int len) {
      * If there are any remaining CIs, then this packet is bad.
      */
     if (len != 0)
-	goto bad;
+    goto bad;
     /*
      * Now we can update state.
      */
     if (f->state != PPP_FSM_OPENED)
-	*go = try_;
+    *go = try_;
     return 1;
 
 bad:
@@ -890,150 +890,150 @@ static int ipv6cp_reqci(fsm *f, u_char *inp, int *len, int reject_if_disagree) {
     ipv6cp_options *ho = &pcb->ipv6cp_hisoptions;
     ipv6cp_options *ao = &pcb->ipv6cp_allowoptions;
     ipv6cp_options *go = &pcb->ipv6cp_gotoptions;
-    u_char *cip, *next;		/* Pointer to current and next CIs */
-    u_short cilen, citype;	/* Parsed len, type */
+    u_char *cip, *next;     /* Pointer to current and next CIs */
+    u_short cilen, citype;  /* Parsed len, type */
 #ifdef IPV6CP_COMP
-    u_short cishort;		/* Parsed short value */
+    u_short cishort;        /* Parsed short value */
 #endif /* IPV6CP_COMP */
-    eui64_t ifaceid;		/* Parsed interface identifier */
-    int rc = CONFACK;		/* Final packet return code */
-    int orc;			/* Individual option return code */
-    u_char *p;			/* Pointer to next char to parse */
-    u_char *ucp = inp;		/* Pointer to current output char */
-    int l = *len;		/* Length left */
+    eui64_t ifaceid;        /* Parsed interface identifier */
+    int rc = CONFACK;       /* Final packet return code */
+    int orc;            /* Individual option return code */
+    u_char *p;          /* Pointer to next char to parse */
+    u_char *ucp = inp;      /* Pointer to current output char */
+    int l = *len;       /* Length left */
 
     /*
      * Reset all his options.
      */
     BZERO(ho, sizeof(*ho));
-    
+
     /*
      * Process all his options.
      */
     next = inp;
     while (l) {
-	orc = CONFACK;			/* Assume success */
-	cip = p = next;			/* Remember beginning of CI */
-	if (l < 2 ||			/* Not enough data for CI header or */
-	    p[1] < 2 ||			/*  CI length too small or */
-	    p[1] > l) {			/*  CI length too big? */
-	    IPV6CPDEBUG(("ipv6cp_reqci: bad CI length!"));
-	    orc = CONFREJ;		/* Reject bad CI */
-	    cilen = l;			/* Reject till end of packet */
-	    l = 0;			/* Don't loop again */
-	    goto endswitch;
-	}
-	GETCHAR(citype, p);		/* Parse CI type */
-	GETCHAR(cilen, p);		/* Parse CI length */
-	l -= cilen;			/* Adjust remaining length */
-	next += cilen;			/* Step to next CI */
-
-	switch (citype) {		/* Check CI type */
-	case CI_IFACEID:
-	    IPV6CPDEBUG(("ipv6cp: received interface identifier "));
-
-	    if (!ao->neg_ifaceid ||
-		cilen != CILEN_IFACEID) {	/* Check CI length */
-		orc = CONFREJ;		/* Reject CI */
-		break;
-	    }
-
-	    /*
-	     * If he has no interface identifier, or if we both have same 
-	     * identifier then NAK it with new idea.
-	     * In particular, if we don't know his identifier, but he does,
-	     * then accept it.
-	     */
-	    eui64_get(ifaceid, p);
-	    IPV6CPDEBUG(("(%s)", llv6_ntoa(ifaceid)));
-	    if (eui64_iszero(ifaceid) && eui64_iszero(go->ourid)) {
-		orc = CONFREJ;		/* Reject CI */
-		break;
-	    }
-	    if (!eui64_iszero(wo->hisid) && 
-		!eui64_equals(ifaceid, wo->hisid) && 
-		eui64_iszero(go->hisid)) {
-		    
-		orc = CONFNAK;
-		ifaceid = wo->hisid;
-		go->hisid = ifaceid;
-		DECPTR(sizeof(ifaceid), p);
-		eui64_put(ifaceid, p);
-	    } else
-	    if (eui64_iszero(ifaceid) || eui64_equals(ifaceid, go->ourid)) {
-		orc = CONFNAK;
-		if (eui64_iszero(go->hisid))	/* first time, try option */
-		    ifaceid = wo->hisid;
-		while (eui64_iszero(ifaceid) || 
-		       eui64_equals(ifaceid, go->ourid)) /* bad luck */
-		    eui64_magic(ifaceid);
-		go->hisid = ifaceid;
-		DECPTR(sizeof(ifaceid), p);
-		eui64_put(ifaceid, p);
-	    }
-
-	    ho->neg_ifaceid = 1;
-	    ho->hisid = ifaceid;
-	    break;
+    orc = CONFACK;          /* Assume success */
+    cip = p = next;         /* Remember beginning of CI */
+    if (l < 2 ||            /* Not enough data for CI header or */
+        p[1] < 2 ||         /*  CI length too small or */
+        p[1] > l) {         /*  CI length too big? */
+        IPV6CPDEBUG(("ipv6cp_reqci: bad CI length!"));
+        orc = CONFREJ;      /* Reject bad CI */
+        cilen = l;          /* Reject till end of packet */
+        l = 0;          /* Don't loop again */
+        goto endswitch;
+    }
+    GETCHAR(citype, p);     /* Parse CI type */
+    GETCHAR(cilen, p);      /* Parse CI length */
+    l -= cilen;         /* Adjust remaining length */
+    next += cilen;          /* Step to next CI */
+
+    switch (citype) {       /* Check CI type */
+    case CI_IFACEID:
+        IPV6CPDEBUG(("ipv6cp: received interface identifier "));
+
+        if (!ao->neg_ifaceid ||
+        cilen != CILEN_IFACEID) {   /* Check CI length */
+        orc = CONFREJ;      /* Reject CI */
+        break;
+        }
+
+        /*
+         * If he has no interface identifier, or if we both have same
+         * identifier then NAK it with new idea.
+         * In particular, if we don't know his identifier, but he does,
+         * then accept it.
+         */
+        eui64_get(ifaceid, p);
+        IPV6CPDEBUG(("(%s)", llv6_ntoa(ifaceid)));
+        if (eui64_iszero(ifaceid) && eui64_iszero(go->ourid)) {
+        orc = CONFREJ;      /* Reject CI */
+        break;
+        }
+        if (!eui64_iszero(wo->hisid) &&
+        !eui64_equals(ifaceid, wo->hisid) &&
+        eui64_iszero(go->hisid)) {
+
+        orc = CONFNAK;
+        ifaceid = wo->hisid;
+        go->hisid = ifaceid;
+        DECPTR(sizeof(ifaceid), p);
+        eui64_put(ifaceid, p);
+        } else
+        if (eui64_iszero(ifaceid) || eui64_equals(ifaceid, go->ourid)) {
+        orc = CONFNAK;
+        if (eui64_iszero(go->hisid))    /* first time, try option */
+            ifaceid = wo->hisid;
+        while (eui64_iszero(ifaceid) ||
+               eui64_equals(ifaceid, go->ourid)) /* bad luck */
+            eui64_magic(ifaceid);
+        go->hisid = ifaceid;
+        DECPTR(sizeof(ifaceid), p);
+        eui64_put(ifaceid, p);
+        }
+
+        ho->neg_ifaceid = 1;
+        ho->hisid = ifaceid;
+        break;
 
 #ifdef IPV6CP_COMP
-	case CI_COMPRESSTYPE:
-	    IPV6CPDEBUG(("ipv6cp: received COMPRESSTYPE "));
-	    if (!ao->neg_vj ||
-		(cilen != CILEN_COMPRESS)) {
-		orc = CONFREJ;
-		break;
-	    }
-	    GETSHORT(cishort, p);
-	    IPV6CPDEBUG(("(%d)", cishort));
-
-	    if (!(cishort == IPV6CP_COMP)) {
-		orc = CONFREJ;
-		break;
-	    }
-
-	    ho->neg_vj = 1;
-	    ho->vj_protocol = cishort;
-	    break;
+    case CI_COMPRESSTYPE:
+        IPV6CPDEBUG(("ipv6cp: received COMPRESSTYPE "));
+        if (!ao->neg_vj ||
+        (cilen != CILEN_COMPRESS)) {
+        orc = CONFREJ;
+        break;
+        }
+        GETSHORT(cishort, p);
+        IPV6CPDEBUG(("(%d)", cishort));
+
+        if (!(cishort == IPV6CP_COMP)) {
+        orc = CONFREJ;
+        break;
+        }
+
+        ho->neg_vj = 1;
+        ho->vj_protocol = cishort;
+        break;
 #endif /* IPV6CP_COMP */
 
-	default:
-	    orc = CONFREJ;
-	    break;
-	}
+    default:
+        orc = CONFREJ;
+        break;
+    }
 
 endswitch:
-	IPV6CPDEBUG((" (%s)\n", CODENAME(orc)));
-
-	if (orc == CONFACK &&		/* Good CI */
-	    rc != CONFACK)		/*  but prior CI wasn't? */
-	    continue;			/* Don't send this one */
-
-	if (orc == CONFNAK) {		/* Nak this CI? */
-	    if (reject_if_disagree)	/* Getting fed up with sending NAKs? */
-		orc = CONFREJ;		/* Get tough if so */
-	    else {
-		if (rc == CONFREJ)	/* Rejecting prior CI? */
-		    continue;		/* Don't send this one */
-		if (rc == CONFACK) {	/* Ack'd all prior CIs? */
-		    rc = CONFNAK;	/* Not anymore... */
-		    ucp = inp;		/* Backup */
-		}
-	    }
-	}
-
-	if (orc == CONFREJ &&		/* Reject this CI */
-	    rc != CONFREJ) {		/*  but no prior ones? */
-	    rc = CONFREJ;
-	    ucp = inp;			/* Backup */
-	}
-
-	/* Need to move CI? */
-	if (ucp != cip)
-	    MEMCPY(ucp, cip, cilen);	/* Move it */
-
-	/* Update output pointer */
-	INCPTR(cilen, ucp);
+    IPV6CPDEBUG((" (%s)\n", CODENAME(orc)));
+
+    if (orc == CONFACK &&       /* Good CI */
+        rc != CONFACK)      /*  but prior CI wasn't? */
+        continue;           /* Don't send this one */
+
+    if (orc == CONFNAK) {       /* Nak this CI? */
+        if (reject_if_disagree) /* Getting fed up with sending NAKs? */
+        orc = CONFREJ;      /* Get tough if so */
+        else {
+        if (rc == CONFREJ)  /* Rejecting prior CI? */
+            continue;       /* Don't send this one */
+        if (rc == CONFACK) {    /* Ack'd all prior CIs? */
+            rc = CONFNAK;   /* Not anymore... */
+            ucp = inp;      /* Backup */
+        }
+        }
+    }
+
+    if (orc == CONFREJ &&       /* Reject this CI */
+        rc != CONFREJ) {        /*  but no prior ones? */
+        rc = CONFREJ;
+        ucp = inp;          /* Backup */
+    }
+
+    /* Need to move CI? */
+    if (ucp != cip)
+        MEMCPY(ucp, cip, cilen);    /* Move it */
+
+    /* Update output pointer */
+    INCPTR(cilen, ucp);
     }
 
     /*
@@ -1044,20 +1044,20 @@ endswitch:
      * option safely.
      */
     if (rc != CONFREJ && !ho->neg_ifaceid &&
-	wo->req_ifaceid && !reject_if_disagree) {
-	if (rc == CONFACK) {
-	    rc = CONFNAK;
-	    ucp = inp;				/* reset pointer */
-	    wo->req_ifaceid = 0;		/* don't ask again */
-	}
-	PUTCHAR(CI_IFACEID, ucp);
-	PUTCHAR(CILEN_IFACEID, ucp);
-	eui64_put(wo->hisid, ucp);
+    wo->req_ifaceid && !reject_if_disagree) {
+    if (rc == CONFACK) {
+        rc = CONFNAK;
+        ucp = inp;              /* reset pointer */
+        wo->req_ifaceid = 0;        /* don't ask again */
+    }
+    PUTCHAR(CI_IFACEID, ucp);
+    PUTCHAR(CILEN_IFACEID, ucp);
+    eui64_put(wo->hisid, ucp);
     }
 
-    *len = ucp - inp;			/* Compute output length */
+    *len = ucp - inp;           /* Compute output length */
     IPV6CPDEBUG(("ipv6cp: returning Configure-%s", CODENAME(rc)));
-    return (rc);			/* Return final code */
+    return (rc);            /* Return final code */
 }
 
 #if PPP_OPTIONS
@@ -1069,7 +1069,7 @@ static void ipv6_check_options() {
     ipv6cp_options *wo = &ipv6cp_wantoptions[0];
 
     if (!ipv6cp_protent.enabled_flag)
-	return;
+    return;
 
     /*
      * Persistent link-local id is only used when user has not explicitly
@@ -1077,42 +1077,42 @@ static void ipv6_check_options() {
      */
     if ((wo->use_persistent) && (!wo->opt_local) && (!wo->opt_remote)) {
 
-	/* 
-	 * On systems where there are no Ethernet interfaces used, there
-	 * may be other ways to obtain a persistent id. Right now, it
-	 * will fall back to using magic [see eui64_magic] below when
-	 * an EUI-48 from MAC address can't be obtained. Other possibilities
-	 * include obtaining EEPROM serial numbers, or some other unique
-	 * yet persistent number. On Sparc platforms, this is possible,
-	 * but too bad there's no standards yet for x86 machines.
-	 */
-	if (ether_to_eui64(&wo->ourid)) {
-	    wo->opt_local = 1;
-	}
+    /*
+     * On systems where there are no Ethernet interfaces used, there
+     * may be other ways to obtain a persistent id. Right now, it
+     * will fall back to using magic [see eui64_magic] below when
+     * an EUI-48 from MAC address can't be obtained. Other possibilities
+     * include obtaining EEPROM serial numbers, or some other unique
+     * yet persistent number. On Sparc platforms, this is possible,
+     * but too bad there's no standards yet for x86 machines.
+     */
+    if (ether_to_eui64(&wo->ourid)) {
+        wo->opt_local = 1;
+    }
+    }
+
+    if (!wo->opt_local) {   /* init interface identifier */
+    if (wo->use_ip && eui64_iszero(wo->ourid)) {
+        eui64_setlo32(wo->ourid, lwip_ntohl(ipcp_wantoptions[0].ouraddr));
+        if (!eui64_iszero(wo->ourid))
+        wo->opt_local = 1;
     }
 
-    if (!wo->opt_local) {	/* init interface identifier */
-	if (wo->use_ip && eui64_iszero(wo->ourid)) {
-	    eui64_setlo32(wo->ourid, lwip_ntohl(ipcp_wantoptions[0].ouraddr));
-	    if (!eui64_iszero(wo->ourid))
-		wo->opt_local = 1;
-	}
-	
-	while (eui64_iszero(wo->ourid))
-	    eui64_magic(wo->ourid);
+    while (eui64_iszero(wo->ourid))
+        eui64_magic(wo->ourid);
     }
 
     if (!wo->opt_remote) {
-	if (wo->use_ip && eui64_iszero(wo->hisid)) {
-	    eui64_setlo32(wo->hisid, lwip_ntohl(ipcp_wantoptions[0].hisaddr));
-	    if (!eui64_iszero(wo->hisid))
-		wo->opt_remote = 1;
-	}
+    if (wo->use_ip && eui64_iszero(wo->hisid)) {
+        eui64_setlo32(wo->hisid, lwip_ntohl(ipcp_wantoptions[0].hisaddr));
+        if (!eui64_iszero(wo->hisid))
+        wo->opt_remote = 1;
+    }
     }
 
     if (demand && (eui64_iszero(wo->ourid) || eui64_iszero(wo->hisid))) {
-	option_error("local/remote LL address required for demand-dialling\n");
-	exit(1);
+    option_error("local/remote LL address required for demand-dialling\n");
+    exit(1);
     }
 }
 #endif /* PPP_OPTIONS */
@@ -1126,13 +1126,13 @@ static int ipv6_demand_conf(int u) {
     ipv6cp_options *wo = &ipv6cp_wantoptions[u];
 
     if (!sif6up(u))
-	return 0;
+    return 0;
 
     if (!sif6addr(u, wo->ourid, wo->hisid))
-	return 0;
+    return 0;
 
     if (!sifnpmode(u, PPP_IPV6, NPMODE_QUEUE))
-	return 0;
+    return 0;
 
     ppp_notice(("ipv6_demand_conf"));
     ppp_notice(("local  LL address %s", llv6_ntoa(wo->ourid)));
@@ -1160,26 +1160,26 @@ static void ipv6cp_up(fsm *f) {
      * We must have a non-zero LL address for both ends of the link.
      */
     if (!ho->neg_ifaceid)
-	ho->hisid = wo->hisid;
+    ho->hisid = wo->hisid;
 
 #if 0 /* UNUSED */
     if(!no_ifaceid_neg) {
 #endif /* UNUSED */
-	if (eui64_iszero(ho->hisid)) {
-	    ppp_error(("Could not determine remote LL address"));
-	    ipv6cp_close(f->pcb, "Could not determine remote LL address");
-	    return;
-	}
-	if (eui64_iszero(go->ourid)) {
-	    ppp_error(("Could not determine local LL address"));
-	    ipv6cp_close(f->pcb, "Could not determine local LL address");
-	    return;
-	}
-	if (eui64_equals(go->ourid, ho->hisid)) {
-	    ppp_error(("local and remote LL addresses are equal"));
-	    ipv6cp_close(f->pcb, "local and remote LL addresses are equal");
-	    return;
-	}
+    if (eui64_iszero(ho->hisid)) {
+        ppp_error(("Could not determine remote LL address"));
+        ipv6cp_close(f->pcb, "Could not determine remote LL address");
+        return;
+    }
+    if (eui64_iszero(go->ourid)) {
+        ppp_error(("Could not determine local LL address"));
+        ipv6cp_close(f->pcb, "Could not determine local LL address");
+        return;
+    }
+    if (eui64_equals(go->ourid, ho->hisid)) {
+        ppp_error(("local and remote LL addresses are equal"));
+        ipv6cp_close(f->pcb, "local and remote LL addresses are equal");
+        return;
+    }
 #if 0 /* UNUSED */
     }
 #endif /* UNUSED */
@@ -1200,52 +1200,52 @@ static void ipv6cp_up(fsm *f) {
      * interface to pass IPv6 packets.
      */
     if (demand) {
-	if (! eui64_equals(go->ourid, wo->ourid) || 
-	    ! eui64_equals(ho->hisid, wo->hisid)) {
-	    if (! eui64_equals(go->ourid, wo->ourid))
-		warn("Local LL address changed to %s", 
-		     llv6_ntoa(go->ourid));
-	    if (! eui64_equals(ho->hisid, wo->hisid))
-		warn("Remote LL address changed to %s", 
-		     llv6_ntoa(ho->hisid));
-	    ipv6cp_clear_addrs(f->pcb, go->ourid, ho->hisid);
-
-	    /* Set the interface to the new addresses */
-	    if (!sif6addr(f->pcb, go->ourid, ho->hisid)) {
-		if (debug)
-		    warn("sif6addr failed");
-		ipv6cp_close(f->unit, "Interface configuration failed");
-		return;
-	    }
-
-	}
-	demand_rexmit(PPP_IPV6);
-	sifnpmode(f->unit, PPP_IPV6, NPMODE_PASS);
+    if (! eui64_equals(go->ourid, wo->ourid) ||
+        ! eui64_equals(ho->hisid, wo->hisid)) {
+        if (! eui64_equals(go->ourid, wo->ourid))
+        warn("Local LL address changed to %s",
+             llv6_ntoa(go->ourid));
+        if (! eui64_equals(ho->hisid, wo->hisid))
+        warn("Remote LL address changed to %s",
+             llv6_ntoa(ho->hisid));
+        ipv6cp_clear_addrs(f->pcb, go->ourid, ho->hisid);
+
+        /* Set the interface to the new addresses */
+        if (!sif6addr(f->pcb, go->ourid, ho->hisid)) {
+        if (debug)
+            warn("sif6addr failed");
+        ipv6cp_close(f->unit, "Interface configuration failed");
+        return;
+        }
+
+    }
+    demand_rexmit(PPP_IPV6);
+    sifnpmode(f->unit, PPP_IPV6, NPMODE_PASS);
 
     } else
 #endif /* DEMAND_SUPPORT */
     {
-	/*
-	 * Set LL addresses
-	 */
-	if (!sif6addr(f->pcb, go->ourid, ho->hisid)) {
-	    PPPDEBUG(LOG_DEBUG, ("sif6addr failed"));
-	    ipv6cp_close(f->pcb, "Interface configuration failed");
-	    return;
-	}
-
-	/* bring the interface up for IPv6 */
-	if (!sif6up(f->pcb)) {
-	    PPPDEBUG(LOG_DEBUG, ("sif6up failed (IPV6)"));
-	    ipv6cp_close(f->pcb, "Interface configuration failed");
-	    return;
-	}
+    /*
+     * Set LL addresses
+     */
+    if (!sif6addr(f->pcb, go->ourid, ho->hisid)) {
+        PPPDEBUG(LOG_DEBUG, ("sif6addr failed"));
+        ipv6cp_close(f->pcb, "Interface configuration failed");
+        return;
+    }
+
+    /* bring the interface up for IPv6 */
+    if (!sif6up(f->pcb)) {
+        PPPDEBUG(LOG_DEBUG, ("sif6up failed (IPV6)"));
+        ipv6cp_close(f->pcb, "Interface configuration failed");
+        return;
+    }
 #if DEMAND_SUPPORT
-	sifnpmode(f->pcb, PPP_IPV6, NPMODE_PASS);
+    sifnpmode(f->pcb, PPP_IPV6, NPMODE_PASS);
 #endif /* DEMAND_SUPPORT */
 
-	ppp_notice(("local  LL address %s", llv6_ntoa(go->ourid)));
-	ppp_notice(("remote LL address %s", llv6_ntoa(ho->hisid)));
+    ppp_notice(("local  LL address %s", llv6_ntoa(go->ourid)));
+    ppp_notice(("remote LL address %s", llv6_ntoa(ho->hisid)));
     }
 
     np_up(f->pcb, PPP_IPV6);
@@ -1254,11 +1254,11 @@ static void ipv6cp_up(fsm *f) {
 #if 0 /* UNUSED */
     /*
      * Execute the ipv6-up script, like this:
-     *	/etc/ppp/ipv6-up interface tty speed local-LL remote-LL
+     *  /etc/ppp/ipv6-up interface tty speed local-LL remote-LL
      */
     if (ipv6cp_script_state == s_down && ipv6cp_script_pid == 0) {
-	ipv6cp_script_state = s_up;
-	ipv6cp_script(_PATH_IPV6UP);
+    ipv6cp_script_state = s_up;
+    ipv6cp_script(_PATH_IPV6UP);
     }
 #endif /* UNUSED */
 }
@@ -1280,8 +1280,8 @@ static void ipv6cp_down(fsm *f) {
     update_link_stats(f->unit);
 #endif /* PPP_STATS_SUPPORT */
     if (pcb->ipv6cp_is_up) {
-	pcb->ipv6cp_is_up = 0;
-	np_down(f->pcb, PPP_IPV6);
+    pcb->ipv6cp_is_up = 0;
+    np_down(f->pcb, PPP_IPV6);
     }
 #ifdef IPV6CP_COMP
     sif6comp(f->unit, 0);
@@ -1293,24 +1293,24 @@ static void ipv6cp_down(fsm *f) {
      * to queue up outgoing packets (for now).
      */
     if (demand) {
-	sifnpmode(f->pcb, PPP_IPV6, NPMODE_QUEUE);
+    sifnpmode(f->pcb, PPP_IPV6, NPMODE_QUEUE);
     } else
 #endif /* DEMAND_SUPPORT */
     {
 #if DEMAND_SUPPORT
-	sifnpmode(f->pcb, PPP_IPV6, NPMODE_DROP);
+    sifnpmode(f->pcb, PPP_IPV6, NPMODE_DROP);
 #endif /* DEMAND_SUPPORT */
-	ipv6cp_clear_addrs(f->pcb,
-			   go->ourid,
-			   ho->hisid);
-	sif6down(f->pcb);
+    ipv6cp_clear_addrs(f->pcb,
+               go->ourid,
+               ho->hisid);
+    sif6down(f->pcb);
     }
 
 #if 0 /* UNUSED */
     /* Execute the ipv6-down script */
     if (ipv6cp_script_state == s_up && ipv6cp_script_pid == 0) {
-	ipv6cp_script_state = s_down;
-	ipv6cp_script(_PATH_IPV6DOWN);
+    ipv6cp_script_state = s_down;
+    ipv6cp_script(_PATH_IPV6DOWN);
     }
 #endif /* UNUSED */
 }
@@ -1345,17 +1345,17 @@ ipv6cp_script_done(arg)
     ipv6cp_script_pid = 0;
     switch (ipv6cp_script_state) {
     case s_up:
-	if (ipv6cp_fsm[0].state != PPP_FSM_OPENED) {
-	    ipv6cp_script_state = s_down;
-	    ipv6cp_script(_PATH_IPV6DOWN);
-	}
-	break;
+    if (ipv6cp_fsm[0].state != PPP_FSM_OPENED) {
+        ipv6cp_script_state = s_down;
+        ipv6cp_script(_PATH_IPV6DOWN);
+    }
+    break;
     case s_down:
-	if (ipv6cp_fsm[0].state == PPP_FSM_OPENED) {
-	    ipv6cp_script_state = s_up;
-	    ipv6cp_script(_PATH_IPV6UP);
-	}
-	break;
+    if (ipv6cp_fsm[0].state == PPP_FSM_OPENED) {
+        ipv6cp_script_state = s_up;
+        ipv6cp_script(_PATH_IPV6UP);
+    }
+    break;
     }
 }
 
@@ -1385,7 +1385,7 @@ ipv6cp_script(script)
     argv[7] = NULL;
 
     ipv6cp_script_pid = run_program(script, argv, 0, ipv6cp_script_done,
-				    NULL, 0);
+                    NULL, 0);
 }
 #endif /* UNUSED */
 
@@ -1399,7 +1399,7 @@ static const char* const ipv6cp_codenames[] = {
 };
 
 static int ipv6cp_printpkt(const u_char *p, int plen,
-		void (*printer)(void *, const char *, ...), void *arg) {
+        void (*printer)(void *, const char *, ...), void *arg) {
     int code, id, len, olen;
     const u_char *pstart, *optend;
 #ifdef IPV6CP_COMP
@@ -1408,18 +1408,18 @@ static int ipv6cp_printpkt(const u_char *p, int plen,
     eui64_t ifaceid;
 
     if (plen < HEADERLEN)
-	return 0;
+    return 0;
     pstart = p;
     GETCHAR(code, p);
     GETCHAR(id, p);
     GETSHORT(len, p);
     if (len < HEADERLEN || len > plen)
-	return 0;
+    return 0;
 
     if (code >= 1 && code <= (int)LWIP_ARRAYSIZE(ipv6cp_codenames))
-	printer(arg, " %s", ipv6cp_codenames[code-1]);
+    printer(arg, " %s", ipv6cp_codenames[code-1]);
     else
-	printer(arg, " code=0x%x", code);
+    printer(arg, " code=0x%x", code);
     printer(arg, " id=0x%x", id);
     len -= HEADERLEN;
     switch (code) {
@@ -1427,63 +1427,63 @@ static int ipv6cp_printpkt(const u_char *p, int plen,
     case CONFACK:
     case CONFNAK:
     case CONFREJ:
-	/* print option list */
-	while (len >= 2) {
-	    GETCHAR(code, p);
-	    GETCHAR(olen, p);
-	    p -= 2;
-	    if (olen < 2 || olen > len) {
-		break;
-	    }
-	    printer(arg, " <");
-	    len -= olen;
-	    optend = p + olen;
-	    switch (code) {
+    /* print option list */
+    while (len >= 2) {
+        GETCHAR(code, p);
+        GETCHAR(olen, p);
+        p -= 2;
+        if (olen < 2 || olen > len) {
+        break;
+        }
+        printer(arg, " <");
+        len -= olen;
+        optend = p + olen;
+        switch (code) {
 #ifdef IPV6CP_COMP
-	    case CI_COMPRESSTYPE:
-		if (olen >= CILEN_COMPRESS) {
-		    p += 2;
-		    GETSHORT(cishort, p);
-		    printer(arg, "compress ");
-		    printer(arg, "0x%x", cishort);
-		}
-		break;
+        case CI_COMPRESSTYPE:
+        if (olen >= CILEN_COMPRESS) {
+            p += 2;
+            GETSHORT(cishort, p);
+            printer(arg, "compress ");
+            printer(arg, "0x%x", cishort);
+        }
+        break;
 #endif /* IPV6CP_COMP */
-	    case CI_IFACEID:
-		if (olen == CILEN_IFACEID) {
-		    p += 2;
-		    eui64_get(ifaceid, p);
-		    printer(arg, "addr %s", llv6_ntoa(ifaceid));
-		}
-		break;
-	    default:
-		break;
-	    }
-	    while (p < optend) {
-		GETCHAR(code, p);
-		printer(arg, " %.2x", code);
-	    }
-	    printer(arg, ">");
-	}
-	break;
+        case CI_IFACEID:
+        if (olen == CILEN_IFACEID) {
+            p += 2;
+            eui64_get(ifaceid, p);
+            printer(arg, "addr %s", llv6_ntoa(ifaceid));
+        }
+        break;
+        default:
+        break;
+        }
+        while (p < optend) {
+        GETCHAR(code, p);
+        printer(arg, " %.2x", code);
+        }
+        printer(arg, ">");
+    }
+    break;
 
     case TERMACK:
     case TERMREQ:
-	if (len > 0 && *p >= ' ' && *p < 0x7f) {
-	    printer(arg, " ");
-	    ppp_print_string(p, len, printer, arg);
-	    p += len;
-	    len = 0;
-	}
-	break;
+    if (len > 0 && *p >= ' ' && *p < 0x7f) {
+        printer(arg, " ");
+        ppp_print_string(p, len, printer, arg);
+        p += len;
+        len = 0;
+    }
+    break;
     default:
-	break;
+    break;
     }
 
     /* print the rest of the bytes in the packet */
     for (; len > 0; --len) {
-	GETCHAR(code, p);
-	printer(arg, " %.2x", code);
+    GETCHAR(code, p);
+    printer(arg, " %.2x", code);
     }
 
     return p - pstart;
@@ -1496,19 +1496,19 @@ static int ipv6cp_printpkt(const u_char *p, int plen,
  * We don't bring the link up for IP fragments or for TCP FIN packets
  * with no data.
  */
-#define IP6_HDRLEN	40	/* bytes */
-#define IP6_NHDR_FRAG	44	/* fragment IPv6 header */
-#define TCP_HDRLEN	20
-#define TH_FIN		0x01
+#define IP6_HDRLEN  40  /* bytes */
+#define IP6_NHDR_FRAG   44  /* fragment IPv6 header */
+#define TCP_HDRLEN  20
+#define TH_FIN      0x01
 
 /*
  * We use these macros because the IP header may be at an odd address,
  * and some compilers might use word loads to get th_off or ip_hl.
  */
 
-#define get_ip6nh(x)	(((unsigned char *)(x))[6])
-#define get_tcpoff(x)	(((unsigned char *)(x))[12] >> 4)
-#define get_tcpflags(x)	(((unsigned char *)(x))[13])
+#define get_ip6nh(x)    (((unsigned char *)(x))[6])
+#define get_tcpoff(x)   (((unsigned char *)(x))[12] >> 4)
+#define get_tcpflags(x) (((unsigned char *)(x))[13])
 
 static int ipv6_active_pkt(u_char *pkt, int len) {
     u_char *tcp;
@@ -1516,16 +1516,16 @@ static int ipv6_active_pkt(u_char *pkt, int len) {
     len -= PPP_HDRLEN;
     pkt += PPP_HDRLEN;
     if (len < IP6_HDRLEN)
-	return 0;
+    return 0;
     if (get_ip6nh(pkt) == IP6_NHDR_FRAG)
-	return 0;
+    return 0;
     if (get_ip6nh(pkt) != IPPROTO_TCP)
-	return 1;
+    return 1;
     if (len < IP6_HDRLEN + TCP_HDRLEN)
-	return 0;
+    return 0;
     tcp = pkt + IP6_HDRLEN;
     if ((get_tcpflags(tcp) & TH_FIN) != 0 && len == IP6_HDRLEN + get_tcpoff(tcp) * 4)
-	return 0;
+    return 0;
     return 1;
 }
 #endif /* DEMAND_SUPPORT */
diff --git a/src/netif/ppp/lcp.c b/src/netif/ppp/lcp.c
index 9c550520..1cf2e922 100644
--- a/src/netif/ppp/lcp.c
+++ b/src/netif/ppp/lcp.c
@@ -68,7 +68,7 @@
  * configure-requests.  We do this by delaying the fsm_lowerup call.
  */
 /* steal a bit in fsm flags word */
-#define DELAYED_UP	0x80
+#define DELAYED_UP  0x80
 
 static void lcp_delayed_up(void *arg);
 
@@ -76,8 +76,8 @@ static void lcp_delayed_up(void *arg);
  * LCP-related command-line options.
  */
 #if 0 /* UNUSED */
-int	lcp_echo_interval = 0; 	/* Interval between LCP echo-requests */
-int	lcp_echo_fails = 0;	/* Tolerance to unanswered echo-requests */
+int lcp_echo_interval = 0;  /* Interval between LCP echo-requests */
+int lcp_echo_fails = 0; /* Tolerance to unanswered echo-requests */
 #endif /* UNUSED */
 
 #if 0 /* UNUSED */
@@ -88,10 +88,10 @@ static u_int lcp_echo_fails         = LCP_MAXECHOFAILS; /* Tolerance to unanswer
 
 #if 0 /* UNUSED */
 #if PPP_LCP_ADAPTIVE
-bool	lcp_echo_adaptive = 0;	/* request echo only if the link was idle */
+bool    lcp_echo_adaptive = 0;  /* request echo only if the link was idle */
 #endif
-bool	lax_recv = 0;		/* accept control chars in asyncmap */
-bool	noendpoint = 0;		/* don't send/accept endpoint discriminator */
+bool    lax_recv = 0;       /* accept control chars in asyncmap */
+bool    noendpoint = 0;     /* don't send/accept endpoint discriminator */
 #endif /* UNUSED */
 
 #if PPP_OPTIONS
@@ -101,7 +101,7 @@ static int noopt (char **);
 #ifdef HAVE_MULTILINK
 static int setendpoint (char **);
 static void printendpoint (option_t *, void (*)(void *, char *, ...),
-			       void *);
+                   void *);
 #endif /* HAVE_MULTILINK */
 
 #if PPP_OPTIONS
@@ -215,17 +215,17 @@ static option_t lcp_option_list[] = {
 /*
  * Callbacks for fsm code.  (CI = Configuration Information)
  */
-static void lcp_resetci(fsm *f);	/* Reset our CI */
-static int  lcp_cilen(fsm *f);		/* Return length of our CI */
+static void lcp_resetci(fsm *f);    /* Reset our CI */
+static int  lcp_cilen(fsm *f);      /* Return length of our CI */
 static void lcp_addci(fsm *f, u_char *ucp, int *lenp); /* Add our CI to pkt */
 static int  lcp_ackci(fsm *f, u_char *p, int len); /* Peer ack'd our CI */
 static int  lcp_nakci(fsm *f, u_char *p, int len, int treat_as_reject); /* Peer nak'd our CI */
 static int  lcp_rejci(fsm *f, u_char *p, int len); /* Peer rej'd our CI */
 static int  lcp_reqci(fsm *f, u_char *inp, int *lenp, int reject_if_disagree); /* Rcv peer CI */
-static void lcp_up(fsm *f);		/* We're UP */
-static void lcp_down(fsm *f);		/* We're DOWN */
-static void lcp_starting (fsm *);	/* We need lower layer up */
-static void lcp_finished (fsm *);	/* We need lower layer down */
+static void lcp_up(fsm *f);     /* We're UP */
+static void lcp_down(fsm *f);       /* We're DOWN */
+static void lcp_starting (fsm *);   /* We need lower layer up */
+static void lcp_finished (fsm *);   /* We need lower layer down */
 static int  lcp_extcode(fsm *f, int code, int id, u_char *inp, int len);
 static void lcp_rprotrej(fsm *f, u_char *inp, int len);
 
@@ -241,22 +241,22 @@ static void LcpSendEchoRequest(fsm *f);
 static void LcpLinkFailure(fsm *f);
 static void LcpEchoCheck(fsm *f);
 
-static const fsm_callbacks lcp_callbacks = {	/* LCP callback routines */
-    lcp_resetci,		/* Reset our Configuration Information */
-    lcp_cilen,			/* Length of our Configuration Information */
-    lcp_addci,			/* Add our Configuration Information */
-    lcp_ackci,			/* ACK our Configuration Information */
-    lcp_nakci,			/* NAK our Configuration Information */
-    lcp_rejci,			/* Reject our Configuration Information */
-    lcp_reqci,			/* Request peer's Configuration Information */
-    lcp_up,			/* Called when fsm reaches OPENED state */
-    lcp_down,			/* Called when fsm leaves OPENED state */
-    lcp_starting,		/* Called when we want the lower layer up */
-    lcp_finished,		/* Called when we want the lower layer down */
-    NULL,			/* Called when Protocol-Reject received */
-    NULL,			/* Retransmission is necessary */
-    lcp_extcode,		/* Called to handle LCP-specific codes */
-    "LCP"			/* String name of protocol */
+static const fsm_callbacks lcp_callbacks = {    /* LCP callback routines */
+    lcp_resetci,        /* Reset our Configuration Information */
+    lcp_cilen,          /* Length of our Configuration Information */
+    lcp_addci,          /* Add our Configuration Information */
+    lcp_ackci,          /* ACK our Configuration Information */
+    lcp_nakci,          /* NAK our Configuration Information */
+    lcp_rejci,          /* Reject our Configuration Information */
+    lcp_reqci,          /* Request peer's Configuration Information */
+    lcp_up,         /* Called when fsm reaches OPENED state */
+    lcp_down,           /* Called when fsm leaves OPENED state */
+    lcp_starting,       /* Called when we want the lower layer up */
+    lcp_finished,       /* Called when we want the lower layer down */
+    NULL,           /* Called when Protocol-Reject received */
+    NULL,           /* Retransmission is necessary */
+    lcp_extcode,        /* Called to handle LCP-specific codes */
+    "LCP"           /* String name of protocol */
 };
 
 /*
@@ -269,7 +269,7 @@ static void lcp_input(ppp_pcb *pcb, u_char *p, int len);
 static void lcp_protrej(ppp_pcb *pcb);
 #if PRINTPKT_SUPPORT
 static int lcp_printpkt(const u_char *p, int plen,
-		void (*printer) (void *, const char *, ...), void *arg);
+        void (*printer) (void *, const char *, ...), void *arg);
 #endif /* PRINTPKT_SUPPORT */
 
 const struct protent lcp_protent = {
@@ -304,20 +304,20 @@ const struct protent lcp_protent = {
 /*
  * Length of each type of configuration option (in octets)
  */
-#define CILEN_VOID	2
-#define CILEN_CHAR	3
-#define CILEN_SHORT	4	/* CILEN_VOID + 2 */
+#define CILEN_VOID  2
+#define CILEN_CHAR  3
+#define CILEN_SHORT 4   /* CILEN_VOID + 2 */
 #if CHAP_SUPPORT
-#define CILEN_CHAP	5	/* CILEN_VOID + 2 + 1 */
+#define CILEN_CHAP  5   /* CILEN_VOID + 2 + 1 */
 #endif /* CHAP_SUPPORT */
-#define CILEN_LONG	6	/* CILEN_VOID + 4 */
+#define CILEN_LONG  6   /* CILEN_VOID + 4 */
 #if LQR_SUPPORT
-#define CILEN_LQR	8	/* CILEN_VOID + 2 + 4 */
+#define CILEN_LQR   8   /* CILEN_VOID + 2 + 4 */
 #endif /* LQR_SUPPORT */
-#define CILEN_CBCP	3
+#define CILEN_CBCP  3
 
-#define CODENAME(x)	((x) == CONFACK ? "ACK" : \
-			 (x) == CONFNAK ? "NAK" : "REJ")
+#define CODENAME(x) ((x) == CONFACK ? "ACK" : \
+             (x) == CONFNAK ? "NAK" : "REJ")
 
 #if PPP_OPTIONS
 /*
@@ -340,8 +340,8 @@ setendpoint(argv)
     char **argv;
 {
     if (str_to_epdisc(&lcp_wantoptions[0].endpoint, *argv)) {
-	lcp_wantoptions[0].neg_endpoint = 1;
-	return 1;
+    lcp_wantoptions[0].neg_endpoint = 1;
+    return 1;
     }
     option_error("Can't parse '%s' as an endpoint discriminator", *argv);
     return 0;
@@ -353,7 +353,7 @@ printendpoint(opt, printer, arg)
     void (*printer) (void *, char *, ...);
     void *arg;
 {
-	printer(arg, "%s", epdisc_to_str(&lcp_wantoptions[0].endpoint));
+    printer(arg, "%s", epdisc_to_str(&lcp_wantoptions[0].endpoint));
 }
 #endif /* HAVE_MULTILINK */
 
@@ -409,9 +409,9 @@ void lcp_open(ppp_pcb *pcb) {
 
     f->flags &= ~(OPT_PASSIVE | OPT_SILENT);
     if (wo->passive)
-	f->flags |= OPT_PASSIVE;
+    f->flags |= OPT_PASSIVE;
     if (wo->silent)
-	f->flags |= OPT_SILENT;
+    f->flags |= OPT_SILENT;
     fsm_open(f);
 }
 
@@ -428,25 +428,25 @@ void lcp_close(ppp_pcb *pcb, const char *reason) {
     && pcb->phase != PPP_PHASE_MASTER
 #endif /* HAVE_MULTILINK */
     )
-	new_phase(pcb, PPP_PHASE_TERMINATE);
+    new_phase(pcb, PPP_PHASE_TERMINATE);
 
     if (f->flags & DELAYED_UP) {
-	UNTIMEOUT(lcp_delayed_up, f);
-	f->state = PPP_FSM_STOPPED;
+    UNTIMEOUT(lcp_delayed_up, f);
+    f->state = PPP_FSM_STOPPED;
     }
     oldstate = f->state;
 
     fsm_close(f, reason);
     if (oldstate == PPP_FSM_STOPPED && (f->flags & (OPT_PASSIVE|OPT_SILENT|DELAYED_UP))) {
-	/*
-	 * This action is not strictly according to the FSM in RFC1548,
-	 * but it does mean that the program terminates if you do a
-	 * lcp_close() when a connection hasn't been established
-	 * because we are in passive/silent mode or because we have
-	 * delayed the fsm_lowerup() call and it hasn't happened yet.
-	 */
-	f->flags &= ~DELAYED_UP;
-	lcp_finished(f);
+    /*
+     * This action is not strictly according to the FSM in RFC1548,
+     * but it does mean that the program terminates if you do a
+     * lcp_close() when a connection hasn't been established
+     * because we are in passive/silent mode or because we have
+     * delayed the fsm_lowerup() call and it hasn't happened yet.
+     */
+    f->flags &= ~DELAYED_UP;
+    lcp_finished(f);
     }
 }
 
@@ -463,16 +463,16 @@ void lcp_lowerup(ppp_pcb *pcb) {
      * if we are going to ask for A/C and protocol compression.
      */
     if (ppp_send_config(pcb, PPP_DEFMRU, 0xffffffff, 0, 0) < 0
-	|| ppp_recv_config(pcb, PPP_DEFMRU, (pcb->settings.lax_recv? 0: 0xffffffff),
-			   wo->neg_pcompression, wo->neg_accompression) < 0)
-	    return;
+    || ppp_recv_config(pcb, PPP_DEFMRU, (pcb->settings.lax_recv? 0: 0xffffffff),
+               wo->neg_pcompression, wo->neg_accompression) < 0)
+        return;
     pcb->peer_mru = PPP_DEFMRU;
 
     if (pcb->settings.listen_time != 0) {
-	f->flags |= DELAYED_UP;
-	TIMEOUTMS(lcp_delayed_up, f, pcb->settings.listen_time);
+    f->flags |= DELAYED_UP;
+    TIMEOUTMS(lcp_delayed_up, f, pcb->settings.listen_time);
     } else
-	fsm_lowerup(f);
+    fsm_lowerup(f);
 }
 
 
@@ -483,10 +483,10 @@ void lcp_lowerdown(ppp_pcb *pcb) {
     fsm *f = &pcb->lcp_fsm;
 
     if (f->flags & DELAYED_UP) {
-	f->flags &= ~DELAYED_UP;
-	UNTIMEOUT(lcp_delayed_up, f);
+    f->flags &= ~DELAYED_UP;
+    UNTIMEOUT(lcp_delayed_up, f);
     } else
-	fsm_lowerdown(f);
+    fsm_lowerdown(f);
 }
 
 
@@ -497,8 +497,8 @@ static void lcp_delayed_up(void *arg) {
     fsm *f = (fsm*)arg;
 
     if (f->flags & DELAYED_UP) {
-	f->flags &= ~DELAYED_UP;
-	fsm_lowerup(f);
+    f->flags &= ~DELAYED_UP;
+    fsm_lowerup(f);
     }
 }
 
@@ -510,9 +510,9 @@ static void lcp_input(ppp_pcb *pcb, u_char *p, int len) {
     fsm *f = &pcb->lcp_fsm;
 
     if (f->flags & DELAYED_UP) {
-	f->flags &= ~DELAYED_UP;
-	UNTIMEOUT(lcp_delayed_up, f);
-	fsm_lowerup(f);
+    f->flags &= ~DELAYED_UP;
+    UNTIMEOUT(lcp_delayed_up, f);
+    fsm_lowerup(f);
     }
     fsm_input(f, p, len);
 }
@@ -527,33 +527,33 @@ static int lcp_extcode(fsm *f, int code, int id, u_char *inp, int len) {
 
     switch( code ){
     case PROTREJ:
-	lcp_rprotrej(f, inp, len);
-	break;
-    
+    lcp_rprotrej(f, inp, len);
+    break;
+
     case ECHOREQ:
-	if (f->state != PPP_FSM_OPENED)
-	    break;
-	magp = inp;
-	PUTLONG(go->magicnumber, magp);
-	fsm_sdata(f, ECHOREP, id, inp, len);
-	break;
-    
+    if (f->state != PPP_FSM_OPENED)
+        break;
+    magp = inp;
+    PUTLONG(go->magicnumber, magp);
+    fsm_sdata(f, ECHOREP, id, inp, len);
+    break;
+
     case ECHOREP:
-	lcp_received_echo_reply(f, id, inp, len);
-	break;
+    lcp_received_echo_reply(f, id, inp, len);
+    break;
 
     case DISCREQ:
     case IDENTIF:
     case TIMEREM:
-	break;
+    break;
 
     default:
-	return 0;
+    return 0;
     }
     return 1;
 }
 
-    
+
 /*
  * lcp_rprotrej - Receive an Protocol-Reject.
  *
@@ -568,8 +568,8 @@ static void lcp_rprotrej(fsm *f, u_char *inp, int len) {
 #endif /* PPP_PROTOCOLNAME */
 
     if (len < 2) {
-	LCPDEBUG(("lcp_rprotrej: Rcvd short Protocol-Reject packet!"));
-	return;
+    LCPDEBUG(("lcp_rprotrej: Rcvd short Protocol-Reject packet!"));
+    return;
     }
 
     GETSHORT(prot, inp);
@@ -579,8 +579,8 @@ static void lcp_rprotrej(fsm *f, u_char *inp, int len) {
      * OPENED state SHOULD be silently discarded.
      */
     if( f->state != PPP_FSM_OPENED ){
-	LCPDEBUG(("Protocol-Reject discarded: LCP in state %d", f->state));
-	return;
+    LCPDEBUG(("Protocol-Reject discarded: LCP in state %d", f->state));
+    return;
     }
 
 #if PPP_PROTOCOLNAME
@@ -591,25 +591,25 @@ static void lcp_rprotrej(fsm *f, u_char *inp, int len) {
      * Upcall the proper Protocol-Reject routine.
      */
     for (i = 0; (protp = protocols[i]) != NULL; ++i)
-	if (protp->protocol == prot) {
+    if (protp->protocol == prot) {
 #if PPP_PROTOCOLNAME
-	    if (pname != NULL)
-		ppp_dbglog(("Protocol-Reject for '%s' (0x%x) received", pname,
-		       prot));
-	    else
+        if (pname != NULL)
+        ppp_dbglog(("Protocol-Reject for '%s' (0x%x) received", pname,
+               prot));
+        else
 #endif /* PPP_PROTOCOLNAME */
-		ppp_dbglog(("Protocol-Reject for 0x%x received", prot));
-	    (*protp->protrej)(f->pcb);
-	    return;
-	}
+        ppp_dbglog(("Protocol-Reject for 0x%x received", prot));
+        (*protp->protrej)(f->pcb);
+        return;
+    }
 
 #if PPP_PROTOCOLNAME
     if (pname != NULL)
-	ppp_warn(("Protocol-Reject for unsupported protocol '%s' (0x%x)", pname,
-	     prot));
+    ppp_warn(("Protocol-Reject for unsupported protocol '%s' (0x%x)", pname,
+         prot));
     else
 #endif /* #if PPP_PROTOCOLNAME */
-	ppp_warn(("Protocol-Reject for unsupported protocol 0x%x", prot));
+    ppp_warn(("Protocol-Reject for unsupported protocol 0x%x", prot));
 }
 
 
@@ -641,7 +641,7 @@ void lcp_sprotrej(ppp_pcb *pcb, u_char *p, int len) {
 #endif
 
     fsm_sdata(f, PROTREJ, ++f->id,
-	      p, len);
+          p, len);
 }
 
 
@@ -748,15 +748,15 @@ static void lcp_resetci(fsm *f) {
     *go = *wo;
 #ifdef HAVE_MULTILINK
     if (!multilink) {
-	go->neg_mrru = 0;
+    go->neg_mrru = 0;
 #endif /* HAVE_MULTILINK */
-	go->neg_ssnhf = 0;
-	go->neg_endpoint = 0;
+    go->neg_ssnhf = 0;
+    go->neg_endpoint = 0;
 #ifdef HAVE_MULTILINK
     }
 #endif /* HAVE_MULTILINK */
     if (pcb->settings.noendpoint)
-	ao->neg_endpoint = 0;
+    ao->neg_endpoint = 0;
     pcb->peer_mru = PPP_DEFMRU;
 #if 0 /* UNUSED */
     auth_reset(pcb);
@@ -771,60 +771,60 @@ static int lcp_cilen(fsm *f) {
     ppp_pcb *pcb = f->pcb;
     lcp_options *go = &pcb->lcp_gotoptions;
 
-#define LENCIVOID(neg)	((neg) ? CILEN_VOID : 0)
+#define LENCIVOID(neg)  ((neg) ? CILEN_VOID : 0)
 #if CHAP_SUPPORT
-#define LENCICHAP(neg)	((neg) ? CILEN_CHAP : 0)
+#define LENCICHAP(neg)  ((neg) ? CILEN_CHAP : 0)
 #endif /* CHAP_SUPPORT */
-#define LENCISHORT(neg)	((neg) ? CILEN_SHORT : 0)
-#define LENCILONG(neg)	((neg) ? CILEN_LONG : 0)
+#define LENCISHORT(neg) ((neg) ? CILEN_SHORT : 0)
+#define LENCILONG(neg)  ((neg) ? CILEN_LONG : 0)
 #if LQR_SUPPORT
-#define LENCILQR(neg)	((neg) ? CILEN_LQR: 0)
+#define LENCILQR(neg)   ((neg) ? CILEN_LQR: 0)
 #endif /* LQR_SUPPORT */
-#define LENCICBCP(neg)	((neg) ? CILEN_CBCP: 0)
+#define LENCICBCP(neg)  ((neg) ? CILEN_CBCP: 0)
     /*
      * NB: we only ask for one of CHAP, UPAP, or EAP, even if we will
      * accept more than one.  We prefer EAP first, then CHAP, then
      * PAP.
      */
     return (LENCISHORT(go->neg_mru && go->mru != PPP_DEFMRU) +
-	    LENCILONG(go->neg_asyncmap && go->asyncmap != 0xFFFFFFFF) +
+        LENCILONG(go->neg_asyncmap && go->asyncmap != 0xFFFFFFFF) +
 #if EAP_SUPPORT
-	    LENCISHORT(go->neg_eap) +
+        LENCISHORT(go->neg_eap) +
 #endif /* EAP_SUPPORT */
 #if CHAP_SUPPORT /* cannot be improved, embedding a directive within macro arguments is not portable */
 #if EAP_SUPPORT
-	    LENCICHAP(!go->neg_eap && go->neg_chap) +
+        LENCICHAP(!go->neg_eap && go->neg_chap) +
 #endif /* EAP_SUPPORT */
 #if !EAP_SUPPORT
-	    LENCICHAP(go->neg_chap) +
+        LENCICHAP(go->neg_chap) +
 #endif /* !EAP_SUPPORT */
 #endif /* CHAP_SUPPORT */
 #if PAP_SUPPORT /* cannot be improved, embedding a directive within macro arguments is not portable */
 #if EAP_SUPPORT && CHAP_SUPPORT
-	    LENCISHORT(!go->neg_eap && !go->neg_chap && go->neg_upap) +
+        LENCISHORT(!go->neg_eap && !go->neg_chap && go->neg_upap) +
 #endif /* EAP_SUPPORT && CHAP_SUPPORT */
 #if EAP_SUPPORT && !CHAP_SUPPORT
-	    LENCISHORT(!go->neg_eap && go->neg_upap) +
+        LENCISHORT(!go->neg_eap && go->neg_upap) +
 #endif /* EAP_SUPPORT && !CHAP_SUPPORT */
 #if !EAP_SUPPORT && CHAP_SUPPORT
-	    LENCISHORT(!go->neg_chap && go->neg_upap) +
+        LENCISHORT(!go->neg_chap && go->neg_upap) +
 #endif /* !EAP_SUPPORT && CHAP_SUPPORT */
 #if !EAP_SUPPORT && !CHAP_SUPPORT
-	    LENCISHORT(go->neg_upap) +
+        LENCISHORT(go->neg_upap) +
 #endif /* !EAP_SUPPORT && !CHAP_SUPPORT */
 #endif /* PAP_SUPPORT */
 #if LQR_SUPPORT
-	    LENCILQR(go->neg_lqr) +
+        LENCILQR(go->neg_lqr) +
 #endif /* LQR_SUPPORT */
-	    LENCICBCP(go->neg_cbcp) +
-	    LENCILONG(go->neg_magicnumber) +
-	    LENCIVOID(go->neg_pcompression) +
-	    LENCIVOID(go->neg_accompression) +
+        LENCICBCP(go->neg_cbcp) +
+        LENCILONG(go->neg_magicnumber) +
+        LENCIVOID(go->neg_pcompression) +
+        LENCIVOID(go->neg_accompression) +
 #ifdef HAVE_MULTILINK
-	    LENCISHORT(go->neg_mrru) +
+        LENCISHORT(go->neg_mrru) +
 #endif /* HAVE_MULTILINK */
-	    LENCIVOID(go->neg_ssnhf) +
-	    (go->neg_endpoint? CILEN_CHAR + go->endpoint.length: 0));
+        LENCIVOID(go->neg_ssnhf) +
+        (go->neg_endpoint? CILEN_CHAR + go->endpoint.length: 0));
 }
 
 
@@ -838,58 +838,58 @@ static void lcp_addci(fsm *f, u_char *ucp, int *lenp) {
 
 #define ADDCIVOID(opt, neg) \
     if (neg) { \
-	PUTCHAR(opt, ucp); \
-	PUTCHAR(CILEN_VOID, ucp); \
+    PUTCHAR(opt, ucp); \
+    PUTCHAR(CILEN_VOID, ucp); \
     }
 #define ADDCISHORT(opt, neg, val) \
     if (neg) { \
-	PUTCHAR(opt, ucp); \
-	PUTCHAR(CILEN_SHORT, ucp); \
-	PUTSHORT(val, ucp); \
+    PUTCHAR(opt, ucp); \
+    PUTCHAR(CILEN_SHORT, ucp); \
+    PUTSHORT(val, ucp); \
     }
 #if CHAP_SUPPORT
 #define ADDCICHAP(opt, neg, val) \
     if (neg) { \
-	PUTCHAR((opt), ucp); \
-	PUTCHAR(CILEN_CHAP, ucp); \
-	PUTSHORT(PPP_CHAP, ucp); \
-	PUTCHAR((CHAP_DIGEST(val)), ucp); \
+    PUTCHAR((opt), ucp); \
+    PUTCHAR(CILEN_CHAP, ucp); \
+    PUTSHORT(PPP_CHAP, ucp); \
+    PUTCHAR((CHAP_DIGEST(val)), ucp); \
     }
 #endif /* CHAP_SUPPORT */
 #define ADDCILONG(opt, neg, val) \
     if (neg) { \
-	PUTCHAR(opt, ucp); \
-	PUTCHAR(CILEN_LONG, ucp); \
-	PUTLONG(val, ucp); \
+    PUTCHAR(opt, ucp); \
+    PUTCHAR(CILEN_LONG, ucp); \
+    PUTLONG(val, ucp); \
     }
 #if LQR_SUPPORT
 #define ADDCILQR(opt, neg, val) \
     if (neg) { \
-	PUTCHAR(opt, ucp); \
-	PUTCHAR(CILEN_LQR, ucp); \
-	PUTSHORT(PPP_LQR, ucp); \
-	PUTLONG(val, ucp); \
+    PUTCHAR(opt, ucp); \
+    PUTCHAR(CILEN_LQR, ucp); \
+    PUTSHORT(PPP_LQR, ucp); \
+    PUTLONG(val, ucp); \
     }
 #endif /* LQR_SUPPORT */
 #define ADDCICHAR(opt, neg, val) \
     if (neg) { \
-	PUTCHAR(opt, ucp); \
-	PUTCHAR(CILEN_CHAR, ucp); \
-	PUTCHAR(val, ucp); \
+    PUTCHAR(opt, ucp); \
+    PUTCHAR(CILEN_CHAR, ucp); \
+    PUTCHAR(val, ucp); \
     }
 #define ADDCIENDP(opt, neg, class, val, len) \
     if (neg) { \
-	int i; \
-	PUTCHAR(opt, ucp); \
-	PUTCHAR(CILEN_CHAR + len, ucp); \
-	PUTCHAR(class, ucp); \
-	for (i = 0; i < len; ++i) \
-	    PUTCHAR(val[i], ucp); \
+    int i; \
+    PUTCHAR(opt, ucp); \
+    PUTCHAR(CILEN_CHAR + len, ucp); \
+    PUTCHAR(class, ucp); \
+    for (i = 0; i < len; ++i) \
+        PUTCHAR(val[i], ucp); \
     }
 
     ADDCISHORT(CI_MRU, go->neg_mru && go->mru != PPP_DEFMRU, go->mru);
     ADDCILONG(CI_ASYNCMAP, go->neg_asyncmap && go->asyncmap != 0xFFFFFFFF,
-	      go->asyncmap);
+          go->asyncmap);
 #if EAP_SUPPORT
     ADDCISHORT(CI_AUTHTYPE, go->neg_eap, PPP_EAP);
 #endif /* EAP_SUPPORT */
@@ -927,11 +927,11 @@ static void lcp_addci(fsm *f, u_char *ucp, int *lenp) {
 #endif
     ADDCIVOID(CI_SSNHF, go->neg_ssnhf);
     ADDCIENDP(CI_EPDISC, go->neg_endpoint, go->endpoint.class_,
-	      go->endpoint.value, go->endpoint.length);
+          go->endpoint.value, go->endpoint.length);
 
     if (ucp - start_ucp != *lenp) {
-	/* this should never happen, because peer_mtu should be 1500 */
-	ppp_error(("Bug in lcp_addci: wrong length"));
+    /* this should never happen, because peer_mtu should be 1500 */
+    ppp_error(("Bug in lcp_addci: wrong length"));
     }
 }
 
@@ -941,8 +941,8 @@ static void lcp_addci(fsm *f, u_char *ucp, int *lenp) {
  * This should not modify any state if the Ack is bad.
  *
  * Returns:
- *	0 - Ack was bad.
- *	1 - Ack was good.
+ *  0 - Ack was bad.
+ *  1 - Ack was good.
  */
 static int lcp_ackci(fsm *f, u_char *p, int len) {
     ppp_pcb *pcb = f->pcb;
@@ -958,112 +958,112 @@ static int lcp_ackci(fsm *f, u_char *p, int len) {
      */
 #define ACKCIVOID(opt, neg) \
     if (neg) { \
-	if ((len -= CILEN_VOID) < 0) \
-	    goto bad; \
-	GETCHAR(citype, p); \
-	GETCHAR(cilen, p); \
-	if (cilen != CILEN_VOID || \
-	    citype != opt) \
-	    goto bad; \
+    if ((len -= CILEN_VOID) < 0) \
+        goto bad; \
+    GETCHAR(citype, p); \
+    GETCHAR(cilen, p); \
+    if (cilen != CILEN_VOID || \
+        citype != opt) \
+        goto bad; \
     }
 #define ACKCISHORT(opt, neg, val) \
     if (neg) { \
-	if ((len -= CILEN_SHORT) < 0) \
-	    goto bad; \
-	GETCHAR(citype, p); \
-	GETCHAR(cilen, p); \
-	if (cilen != CILEN_SHORT || \
-	    citype != opt) \
-	    goto bad; \
-	GETSHORT(cishort, p); \
-	if (cishort != val) \
-	    goto bad; \
+    if ((len -= CILEN_SHORT) < 0) \
+        goto bad; \
+    GETCHAR(citype, p); \
+    GETCHAR(cilen, p); \
+    if (cilen != CILEN_SHORT || \
+        citype != opt) \
+        goto bad; \
+    GETSHORT(cishort, p); \
+    if (cishort != val) \
+        goto bad; \
     }
 #define ACKCICHAR(opt, neg, val) \
     if (neg) { \
-	if ((len -= CILEN_CHAR) < 0) \
-	    goto bad; \
-	GETCHAR(citype, p); \
-	GETCHAR(cilen, p); \
-	if (cilen != CILEN_CHAR || \
-	    citype != opt) \
-	    goto bad; \
-	GETCHAR(cichar, p); \
-	if (cichar != val) \
-	    goto bad; \
+    if ((len -= CILEN_CHAR) < 0) \
+        goto bad; \
+    GETCHAR(citype, p); \
+    GETCHAR(cilen, p); \
+    if (cilen != CILEN_CHAR || \
+        citype != opt) \
+        goto bad; \
+    GETCHAR(cichar, p); \
+    if (cichar != val) \
+        goto bad; \
     }
 #if CHAP_SUPPORT
 #define ACKCICHAP(opt, neg, val) \
     if (neg) { \
-	if ((len -= CILEN_CHAP) < 0) \
-	    goto bad; \
-	GETCHAR(citype, p); \
-	GETCHAR(cilen, p); \
-	if (cilen != CILEN_CHAP || \
-	    citype != (opt)) \
-	    goto bad; \
-	GETSHORT(cishort, p); \
-	if (cishort != PPP_CHAP) \
-	    goto bad; \
-	GETCHAR(cichar, p); \
-	if (cichar != (CHAP_DIGEST(val))) \
-	  goto bad; \
+    if ((len -= CILEN_CHAP) < 0) \
+        goto bad; \
+    GETCHAR(citype, p); \
+    GETCHAR(cilen, p); \
+    if (cilen != CILEN_CHAP || \
+        citype != (opt)) \
+        goto bad; \
+    GETSHORT(cishort, p); \
+    if (cishort != PPP_CHAP) \
+        goto bad; \
+    GETCHAR(cichar, p); \
+    if (cichar != (CHAP_DIGEST(val))) \
+      goto bad; \
     }
 #endif /* CHAP_SUPPORT */
 #define ACKCILONG(opt, neg, val) \
     if (neg) { \
-	if ((len -= CILEN_LONG) < 0) \
-	    goto bad; \
-	GETCHAR(citype, p); \
-	GETCHAR(cilen, p); \
-	if (cilen != CILEN_LONG || \
-	    citype != opt) \
-	    goto bad; \
-	GETLONG(cilong, p); \
-	if (cilong != val) \
-	    goto bad; \
+    if ((len -= CILEN_LONG) < 0) \
+        goto bad; \
+    GETCHAR(citype, p); \
+    GETCHAR(cilen, p); \
+    if (cilen != CILEN_LONG || \
+        citype != opt) \
+        goto bad; \
+    GETLONG(cilong, p); \
+    if (cilong != val) \
+        goto bad; \
     }
 #if LQR_SUPPORT
 #define ACKCILQR(opt, neg, val) \
     if (neg) { \
-	if ((len -= CILEN_LQR) < 0) \
-	    goto bad; \
-	GETCHAR(citype, p); \
-	GETCHAR(cilen, p); \
-	if (cilen != CILEN_LQR || \
-	    citype != opt) \
-	    goto bad; \
-	GETSHORT(cishort, p); \
-	if (cishort != PPP_LQR) \
-	    goto bad; \
-	GETLONG(cilong, p); \
-	if (cilong != val) \
-	  goto bad; \
+    if ((len -= CILEN_LQR) < 0) \
+        goto bad; \
+    GETCHAR(citype, p); \
+    GETCHAR(cilen, p); \
+    if (cilen != CILEN_LQR || \
+        citype != opt) \
+        goto bad; \
+    GETSHORT(cishort, p); \
+    if (cishort != PPP_LQR) \
+        goto bad; \
+    GETLONG(cilong, p); \
+    if (cilong != val) \
+      goto bad; \
     }
 #endif /* LQR_SUPPORT */
 #define ACKCIENDP(opt, neg, class, val, vlen) \
     if (neg) { \
-	int i; \
-	if ((len -= CILEN_CHAR + vlen) < 0) \
-	    goto bad; \
-	GETCHAR(citype, p); \
-	GETCHAR(cilen, p); \
-	if (cilen != CILEN_CHAR + vlen || \
-	    citype != opt) \
-	    goto bad; \
-	GETCHAR(cichar, p); \
-	if (cichar != class) \
-	    goto bad; \
-	for (i = 0; i < vlen; ++i) { \
-	    GETCHAR(cichar, p); \
-	    if (cichar != val[i]) \
-		goto bad; \
-	} \
+    int i; \
+    if ((len -= CILEN_CHAR + vlen) < 0) \
+        goto bad; \
+    GETCHAR(citype, p); \
+    GETCHAR(cilen, p); \
+    if (cilen != CILEN_CHAR + vlen || \
+        citype != opt) \
+        goto bad; \
+    GETCHAR(cichar, p); \
+    if (cichar != class) \
+        goto bad; \
+    for (i = 0; i < vlen; ++i) { \
+        GETCHAR(cichar, p); \
+        if (cichar != val[i]) \
+        goto bad; \
+    } \
     }
 
     ACKCISHORT(CI_MRU, go->neg_mru && go->mru != PPP_DEFMRU, go->mru);
     ACKCILONG(CI_ASYNCMAP, go->neg_asyncmap && go->asyncmap != 0xFFFFFFFF,
-	      go->asyncmap);
+          go->asyncmap);
 #if EAP_SUPPORT
     ACKCISHORT(CI_AUTHTYPE, go->neg_eap, PPP_EAP);
 #endif /* EAP_SUPPORT */
@@ -1101,13 +1101,13 @@ static int lcp_ackci(fsm *f, u_char *p, int len) {
 #endif /* HAVE_MULTILINK */
     ACKCIVOID(CI_SSNHF, go->neg_ssnhf);
     ACKCIENDP(CI_EPDISC, go->neg_endpoint, go->endpoint.class_,
-	      go->endpoint.value, go->endpoint.length);
+          go->endpoint.value, go->endpoint.length);
 
     /*
      * If there are any remaining CIs, then this packet is bad.
      */
     if (len != 0)
-	goto bad;
+    goto bad;
     return (1);
 bad:
     LCPDEBUG(("lcp_acki: received bad Ack!"));
@@ -1121,8 +1121,8 @@ bad:
  * or if LCP is in the OPENED state.
  *
  * Returns:
- *	0 - Nak was bad.
- *	1 - Nak was good.
+ *  0 - Nak was bad.
+ *  1 - Nak was good.
  */
 static int lcp_nakci(fsm *f, u_char *p, int len, int treat_as_reject) {
     ppp_pcb *pcb = f->pcb;
@@ -1131,8 +1131,8 @@ static int lcp_nakci(fsm *f, u_char *p, int len, int treat_as_reject) {
     u_char citype, cichar, *next;
     u_short cishort;
     u32_t cilong;
-    lcp_options no;		/* options we've seen Naks for */
-    lcp_options try_;		/* options to request next time */
+    lcp_options no;     /* options we've seen Naks for */
+    lcp_options try_;       /* options to request next time */
     int looped_back = 0;
     int cilen;
 
@@ -1146,85 +1146,85 @@ static int lcp_nakci(fsm *f, u_char *p, int len, int treat_as_reject) {
      */
 #define NAKCIVOID(opt, neg) \
     if (go->neg && \
-	len >= CILEN_VOID && \
-	p[1] == CILEN_VOID && \
-	p[0] == opt) { \
-	len -= CILEN_VOID; \
-	INCPTR(CILEN_VOID, p); \
-	no.neg = 1; \
-	try_.neg = 0; \
+    len >= CILEN_VOID && \
+    p[1] == CILEN_VOID && \
+    p[0] == opt) { \
+    len -= CILEN_VOID; \
+    INCPTR(CILEN_VOID, p); \
+    no.neg = 1; \
+    try_.neg = 0; \
     }
 #if CHAP_SUPPORT
 #define NAKCICHAP(opt, neg, code) \
     if (go->neg && \
-	len >= CILEN_CHAP && \
-	p[1] == CILEN_CHAP && \
-	p[0] == opt) { \
-	len -= CILEN_CHAP; \
-	INCPTR(2, p); \
-	GETSHORT(cishort, p); \
-	GETCHAR(cichar, p); \
-	no.neg = 1; \
-	code \
+    len >= CILEN_CHAP && \
+    p[1] == CILEN_CHAP && \
+    p[0] == opt) { \
+    len -= CILEN_CHAP; \
+    INCPTR(2, p); \
+    GETSHORT(cishort, p); \
+    GETCHAR(cichar, p); \
+    no.neg = 1; \
+    code \
     }
 #endif /* CHAP_SUPPORT */
 #define NAKCICHAR(opt, neg, code) \
     if (go->neg && \
-	len >= CILEN_CHAR && \
-	p[1] == CILEN_CHAR && \
-	p[0] == opt) { \
-	len -= CILEN_CHAR; \
-	INCPTR(2, p); \
-	GETCHAR(cichar, p); \
-	no.neg = 1; \
-	code \
+    len >= CILEN_CHAR && \
+    p[1] == CILEN_CHAR && \
+    p[0] == opt) { \
+    len -= CILEN_CHAR; \
+    INCPTR(2, p); \
+    GETCHAR(cichar, p); \
+    no.neg = 1; \
+    code \
     }
 #define NAKCISHORT(opt, neg, code) \
     if (go->neg && \
-	len >= CILEN_SHORT && \
-	p[1] == CILEN_SHORT && \
-	p[0] == opt) { \
-	len -= CILEN_SHORT; \
-	INCPTR(2, p); \
-	GETSHORT(cishort, p); \
-	no.neg = 1; \
-	code \
+    len >= CILEN_SHORT && \
+    p[1] == CILEN_SHORT && \
+    p[0] == opt) { \
+    len -= CILEN_SHORT; \
+    INCPTR(2, p); \
+    GETSHORT(cishort, p); \
+    no.neg = 1; \
+    code \
     }
 #define NAKCILONG(opt, neg, code) \
     if (go->neg && \
-	len >= CILEN_LONG && \
-	p[1] == CILEN_LONG && \
-	p[0] == opt) { \
-	len -= CILEN_LONG; \
-	INCPTR(2, p); \
-	GETLONG(cilong, p); \
-	no.neg = 1; \
-	code \
+    len >= CILEN_LONG && \
+    p[1] == CILEN_LONG && \
+    p[0] == opt) { \
+    len -= CILEN_LONG; \
+    INCPTR(2, p); \
+    GETLONG(cilong, p); \
+    no.neg = 1; \
+    code \
     }
 #if LQR_SUPPORT
 #define NAKCILQR(opt, neg, code) \
     if (go->neg && \
-	len >= CILEN_LQR && \
-	p[1] == CILEN_LQR && \
-	p[0] == opt) { \
-	len -= CILEN_LQR; \
-	INCPTR(2, p); \
-	GETSHORT(cishort, p); \
-	GETLONG(cilong, p); \
-	no.neg = 1; \
-	code \
+    len >= CILEN_LQR && \
+    p[1] == CILEN_LQR && \
+    p[0] == opt) { \
+    len -= CILEN_LQR; \
+    INCPTR(2, p); \
+    GETSHORT(cishort, p); \
+    GETLONG(cilong, p); \
+    no.neg = 1; \
+    code \
     }
 #endif /* LQR_SUPPORT */
 #define NAKCIENDP(opt, neg) \
     if (go->neg && \
-	len >= CILEN_CHAR && \
-	p[0] == opt && \
-	p[1] >= CILEN_CHAR && \
-	p[1] <= len) { \
-	len -= p[1]; \
-	INCPTR(p[1], p); \
-	no.neg = 1; \
-	try_.neg = 0; \
+    len >= CILEN_CHAR && \
+    p[0] == opt && \
+    p[1] >= CILEN_CHAR && \
+    p[1] <= len) { \
+    len -= p[1]; \
+    INCPTR(p[1], p); \
+    no.neg = 1; \
+    try_.neg = 0; \
     }
 
     /*
@@ -1239,19 +1239,19 @@ static int lcp_nakci(fsm *f, u_char *p, int len, int treat_as_reject) {
      * the limit of the default MRU we'd get if we didn't negotiate.
      */
     if (go->neg_mru && go->mru != PPP_DEFMRU) {
-	NAKCISHORT(CI_MRU, neg_mru,
-		   if (cishort <= wo->mru || cishort <= PPP_DEFMRU)
-		       try_.mru = cishort;
-		   );
+    NAKCISHORT(CI_MRU, neg_mru,
+           if (cishort <= wo->mru || cishort <= PPP_DEFMRU)
+               try_.mru = cishort;
+           );
     }
 
     /*
      * Add any characters they want to our (receive-side) asyncmap.
      */
     if (go->neg_asyncmap && go->asyncmap != 0xFFFFFFFF) {
-	NAKCILONG(CI_ASYNCMAP, neg_asyncmap,
-		  try_.asyncmap = go->asyncmap | cilong;
-		  );
+    NAKCILONG(CI_ASYNCMAP, neg_asyncmap,
+          try_.asyncmap = go->asyncmap | cilong;
+          );
     }
 
     /*
@@ -1270,125 +1270,125 @@ static int lcp_nakci(fsm *f, u_char *p, int len, int treat_as_reject) {
         || go->neg_eap
 #endif /* EAP_SUPPORT */
         )
-	&& len >= CILEN_SHORT
-	&& p[0] == CI_AUTHTYPE && p[1] >= CILEN_SHORT && p[1] <= len) {
-	cilen = p[1];
-	len -= cilen;
+    && len >= CILEN_SHORT
+    && p[0] == CI_AUTHTYPE && p[1] >= CILEN_SHORT && p[1] <= len) {
+    cilen = p[1];
+    len -= cilen;
 #if CHAP_SUPPORT
-	no.neg_chap = go->neg_chap;
+    no.neg_chap = go->neg_chap;
 #endif /* CHAP_SUPPORT */
 #if PAP_SUPPORT
-	no.neg_upap = go->neg_upap;
+    no.neg_upap = go->neg_upap;
 #endif /* PAP_SUPPORT */
 #if EAP_SUPPORT
-	no.neg_eap = go->neg_eap;
+    no.neg_eap = go->neg_eap;
 #endif /* EAP_SUPPORT */
-	INCPTR(2, p);
-	GETSHORT(cishort, p);
+    INCPTR(2, p);
+    GETSHORT(cishort, p);
 
 #if PAP_SUPPORT
-	if (cishort == PPP_PAP && cilen == CILEN_SHORT) {
+    if (cishort == PPP_PAP && cilen == CILEN_SHORT) {
 #if EAP_SUPPORT
-	    /* If we were asking for EAP, then we need to stop that. */
-	    if (go->neg_eap)
-		try_.neg_eap = 0;
-	    else
+        /* If we were asking for EAP, then we need to stop that. */
+        if (go->neg_eap)
+        try_.neg_eap = 0;
+        else
 #endif /* EAP_SUPPORT */
 
 #if CHAP_SUPPORT
-	    /* If we were asking for CHAP, then we need to stop that. */
-	    if (go->neg_chap)
-		try_.neg_chap = 0;
-	    else
+        /* If we were asking for CHAP, then we need to stop that. */
+        if (go->neg_chap)
+        try_.neg_chap = 0;
+        else
 #endif /* CHAP_SUPPORT */
 
-	    /*
-	     * If we weren't asking for CHAP or EAP, then we were asking for
-	     * PAP, in which case this Nak is bad.
-	     */
-		goto bad;
-	} else
+        /*
+         * If we weren't asking for CHAP or EAP, then we were asking for
+         * PAP, in which case this Nak is bad.
+         */
+        goto bad;
+    } else
 #endif /* PAP_SUPPORT */
 
 #if CHAP_SUPPORT
-	if (cishort == PPP_CHAP && cilen == CILEN_CHAP) {
-	    GETCHAR(cichar, p);
+    if (cishort == PPP_CHAP && cilen == CILEN_CHAP) {
+        GETCHAR(cichar, p);
 #if EAP_SUPPORT
-	    /* Stop asking for EAP, if we were. */
-	    if (go->neg_eap) {
-		try_.neg_eap = 0;
-		/* Try to set up to use their suggestion, if possible */
-		if (CHAP_CANDIGEST(go->chap_mdtype, cichar))
-		    try_.chap_mdtype = CHAP_MDTYPE_D(cichar);
-	    } else
+        /* Stop asking for EAP, if we were. */
+        if (go->neg_eap) {
+        try_.neg_eap = 0;
+        /* Try to set up to use their suggestion, if possible */
+        if (CHAP_CANDIGEST(go->chap_mdtype, cichar))
+            try_.chap_mdtype = CHAP_MDTYPE_D(cichar);
+        } else
 #endif /* EAP_SUPPORT */
-	    if (go->neg_chap) {
-		/*
-		 * We were asking for our preferred algorithm, they must
-		 * want something different.
-		 */
-		if (cichar != CHAP_DIGEST(go->chap_mdtype)) {
-		    if (CHAP_CANDIGEST(go->chap_mdtype, cichar)) {
-			/* Use their suggestion if we support it ... */
-			try_.chap_mdtype = CHAP_MDTYPE_D(cichar);
-		    } else {
-			/* ... otherwise, try our next-preferred algorithm. */
-			try_.chap_mdtype &= ~(CHAP_MDTYPE(try_.chap_mdtype));
-			if (try_.chap_mdtype == MDTYPE_NONE) /* out of algos */
-			    try_.neg_chap = 0;
-		    }
-		} else {
-		    /*
-		     * Whoops, they Nak'd our algorithm of choice
-		     * but then suggested it back to us.
-		     */
-		    goto bad;
-		}
-	    } else {
-		/*
-		 * Stop asking for PAP if we were asking for it.
-		 */
+        if (go->neg_chap) {
+        /*
+         * We were asking for our preferred algorithm, they must
+         * want something different.
+         */
+        if (cichar != CHAP_DIGEST(go->chap_mdtype)) {
+            if (CHAP_CANDIGEST(go->chap_mdtype, cichar)) {
+            /* Use their suggestion if we support it ... */
+            try_.chap_mdtype = CHAP_MDTYPE_D(cichar);
+            } else {
+            /* ... otherwise, try our next-preferred algorithm. */
+            try_.chap_mdtype &= ~(CHAP_MDTYPE(try_.chap_mdtype));
+            if (try_.chap_mdtype == MDTYPE_NONE) /* out of algos */
+                try_.neg_chap = 0;
+            }
+        } else {
+            /*
+             * Whoops, they Nak'd our algorithm of choice
+             * but then suggested it back to us.
+             */
+            goto bad;
+        }
+        } else {
+        /*
+         * Stop asking for PAP if we were asking for it.
+         */
 #if PAP_SUPPORT
-		try_.neg_upap = 0;
+        try_.neg_upap = 0;
 #endif /* PAP_SUPPORT */
-	    }
+        }
 
-	} else
+    } else
 #endif /* CHAP_SUPPORT */
-	{
+    {
 
 #if EAP_SUPPORT
-	    /*
-	     * If we were asking for EAP, and they're Conf-Naking EAP,
-	     * well, that's just strange.  Nobody should do that.
-	     */
-	    if (cishort == PPP_EAP && cilen == CILEN_SHORT && go->neg_eap)
-		ppp_dbglog(("Unexpected Conf-Nak for EAP"));
-
-	    /*
-	     * We don't recognize what they're suggesting.
-	     * Stop asking for what we were asking for.
-	     */
-	    if (go->neg_eap)
-		try_.neg_eap = 0;
-	    else
+        /*
+         * If we were asking for EAP, and they're Conf-Naking EAP,
+         * well, that's just strange.  Nobody should do that.
+         */
+        if (cishort == PPP_EAP && cilen == CILEN_SHORT && go->neg_eap)
+        ppp_dbglog(("Unexpected Conf-Nak for EAP"));
+
+        /*
+         * We don't recognize what they're suggesting.
+         * Stop asking for what we were asking for.
+         */
+        if (go->neg_eap)
+        try_.neg_eap = 0;
+        else
 #endif /* EAP_SUPPORT */
 
 #if CHAP_SUPPORT
-	    if (go->neg_chap)
-		try_.neg_chap = 0;
-	    else
+        if (go->neg_chap)
+        try_.neg_chap = 0;
+        else
 #endif /* CHAP_SUPPORT */
 
 #if PAP_SUPPORT
-	    if(1)
-		try_.neg_upap = 0;
-	    else
+        if(1)
+        try_.neg_upap = 0;
+        else
 #endif /* PAP_SUPPORT */
-	    {}
+        {}
 
-	    p += cilen - CILEN_SHORT;
-	}
+        p += cilen - CILEN_SHORT;
+    }
     }
 
 #if LQR_SUPPORT
@@ -1398,11 +1398,11 @@ static int lcp_nakci(fsm *f, u_char *p, int len, int treat_as_reject) {
      * If they Nak the reporting period, take their value XXX ?
      */
     NAKCILQR(CI_QUALITY, neg_lqr,
-	     if (cishort != PPP_LQR)
-		 try_.neg_lqr = 0;
-	     else
-		 try_.lqr_period = cilong;
-	     );
+         if (cishort != PPP_LQR)
+         try_.neg_lqr = 0;
+         else
+         try_.lqr_period = cilong;
+         );
 #endif /* LQR_SUPPORT */
 
     /*
@@ -1417,9 +1417,9 @@ static int lcp_nakci(fsm *f, u_char *p, int len, int treat_as_reject) {
      * Check for a looped-back line.
      */
     NAKCILONG(CI_MAGICNUMBER, neg_magicnumber,
-	      try_.magicnumber = magic();
-	      looped_back = 1;
-	      );
+          try_.magicnumber = magic();
+          looped_back = 1;
+          );
 
     /*
      * Peer shouldn't send Nak for protocol compression or
@@ -1435,12 +1435,12 @@ static int lcp_nakci(fsm *f, u_char *p, int len, int treat_as_reject) {
      * than the one we want.
      */
     if (go->neg_mrru) {
-	NAKCISHORT(CI_MRRU, neg_mrru,
-		   if (treat_as_reject)
-		       try_.neg_mrru = 0;
-		   else if (cishort <= wo->mrru)
-		       try_.mrru = cishort;
-		   );
+    NAKCISHORT(CI_MRRU, neg_mrru,
+           if (treat_as_reject)
+               try_.neg_mrru = 0;
+           else if (cishort <= wo->mrru)
+               try_.mrru = cishort;
+           );
     }
 #else /* HAVE_MULTILINK */
     LWIP_UNUSED_ARG(treat_as_reject);
@@ -1475,30 +1475,30 @@ static int lcp_nakci(fsm *f, u_char *p, int len, int treat_as_reject) {
      * negotiate some option we don't support, so ignore it.
      */
     while (len >= CILEN_VOID) {
-	GETCHAR(citype, p);
-	GETCHAR(cilen, p);
-	if (cilen < CILEN_VOID || (len -= cilen) < 0)
-	    goto bad;
-	next = p + cilen - 2;
-
-	switch (citype) {
-	case CI_MRU:
-	    if ((go->neg_mru && go->mru != PPP_DEFMRU)
-		|| no.neg_mru || cilen != CILEN_SHORT)
-		goto bad;
-	    GETSHORT(cishort, p);
-	    if (cishort < PPP_DEFMRU) {
-		try_.neg_mru = 1;
-		try_.mru = cishort;
-	    }
-	    break;
-	case CI_ASYNCMAP:
-	    if ((go->neg_asyncmap && go->asyncmap != 0xFFFFFFFF)
-		|| no.neg_asyncmap || cilen != CILEN_LONG)
-		goto bad;
-	    break;
-	case CI_AUTHTYPE:
-	    if (0
+    GETCHAR(citype, p);
+    GETCHAR(cilen, p);
+    if (cilen < CILEN_VOID || (len -= cilen) < 0)
+        goto bad;
+    next = p + cilen - 2;
+
+    switch (citype) {
+    case CI_MRU:
+        if ((go->neg_mru && go->mru != PPP_DEFMRU)
+        || no.neg_mru || cilen != CILEN_SHORT)
+        goto bad;
+        GETSHORT(cishort, p);
+        if (cishort < PPP_DEFMRU) {
+        try_.neg_mru = 1;
+        try_.mru = cishort;
+        }
+        break;
+    case CI_ASYNCMAP:
+        if ((go->neg_asyncmap && go->asyncmap != 0xFFFFFFFF)
+        || no.neg_asyncmap || cilen != CILEN_LONG)
+        goto bad;
+        break;
+    case CI_AUTHTYPE:
+        if (0
 #if CHAP_SUPPORT
                 || go->neg_chap || no.neg_chap
 #endif /* CHAP_SUPPORT */
@@ -1506,51 +1506,51 @@ static int lcp_nakci(fsm *f, u_char *p, int len, int treat_as_reject) {
                 || go->neg_upap || no.neg_upap
 #endif /* PAP_SUPPORT */
 #if EAP_SUPPORT
-		|| go->neg_eap || no.neg_eap
+        || go->neg_eap || no.neg_eap
 #endif /* EAP_SUPPORT */
-		)
-		goto bad;
-	    break;
-	case CI_MAGICNUMBER:
-	    if (go->neg_magicnumber || no.neg_magicnumber ||
-		cilen != CILEN_LONG)
-		goto bad;
-	    break;
-	case CI_PCOMPRESSION:
-	    if (go->neg_pcompression || no.neg_pcompression
-		|| cilen != CILEN_VOID)
-		goto bad;
-	    break;
-	case CI_ACCOMPRESSION:
-	    if (go->neg_accompression || no.neg_accompression
-		|| cilen != CILEN_VOID)
-		goto bad;
-	    break;
+        )
+        goto bad;
+        break;
+    case CI_MAGICNUMBER:
+        if (go->neg_magicnumber || no.neg_magicnumber ||
+        cilen != CILEN_LONG)
+        goto bad;
+        break;
+    case CI_PCOMPRESSION:
+        if (go->neg_pcompression || no.neg_pcompression
+        || cilen != CILEN_VOID)
+        goto bad;
+        break;
+    case CI_ACCOMPRESSION:
+        if (go->neg_accompression || no.neg_accompression
+        || cilen != CILEN_VOID)
+        goto bad;
+        break;
 #if LQR_SUPPORT
-	case CI_QUALITY:
-	    if (go->neg_lqr || no.neg_lqr || cilen != CILEN_LQR)
-		goto bad;
-	    break;
+    case CI_QUALITY:
+        if (go->neg_lqr || no.neg_lqr || cilen != CILEN_LQR)
+        goto bad;
+        break;
 #endif /* LQR_SUPPORT */
 #ifdef HAVE_MULTILINK
-	case CI_MRRU:
-	    if (go->neg_mrru || no.neg_mrru || cilen != CILEN_SHORT)
-		goto bad;
-	    break;
+    case CI_MRRU:
+        if (go->neg_mrru || no.neg_mrru || cilen != CILEN_SHORT)
+        goto bad;
+        break;
 #endif /* HAVE_MULTILINK */
-	case CI_SSNHF:
-	    if (go->neg_ssnhf || no.neg_ssnhf || cilen != CILEN_VOID)
-		goto bad;
-	    try_.neg_ssnhf = 1;
-	    break;
-	case CI_EPDISC:
-	    if (go->neg_endpoint || no.neg_endpoint || cilen < CILEN_CHAR)
-		goto bad;
-	    break;
-	default:
-	    break;
-	}
-	p = next;
+    case CI_SSNHF:
+        if (go->neg_ssnhf || no.neg_ssnhf || cilen != CILEN_VOID)
+        goto bad;
+        try_.neg_ssnhf = 1;
+        break;
+    case CI_EPDISC:
+        if (go->neg_endpoint || no.neg_endpoint || cilen < CILEN_CHAR)
+        goto bad;
+        break;
+    default:
+        break;
+    }
+    p = next;
     }
 
     /*
@@ -1558,15 +1558,15 @@ static int lcp_nakci(fsm *f, u_char *p, int len, int treat_as_reject) {
      * If there are any options left we ignore them.
      */
     if (f->state != PPP_FSM_OPENED) {
-	if (looped_back) {
-	    if (++try_.numloops >= pcb->settings.lcp_loopbackfail) {
-		ppp_notice(("Serial line is looped back."));
-		pcb->err_code = PPPERR_LOOPBACK;
-		lcp_close(f->pcb, "Loopback detected");
-	    }
-	} else
-	    try_.numloops = 0;
-	*go = try_;
+    if (looped_back) {
+        if (++try_.numloops >= pcb->settings.lcp_loopbackfail) {
+        ppp_notice(("Serial line is looped back."));
+        pcb->err_code = PPPERR_LOOPBACK;
+        lcp_close(f->pcb, "Loopback detected");
+        }
+    } else
+        try_.numloops = 0;
+    *go = try_;
     }
 
     return 1;
@@ -1583,8 +1583,8 @@ bad:
  * or if LCP is in the OPENED state.
  *
  * Returns:
- *	0 - Reject was bad.
- *	1 - Reject was good.
+ *  0 - Reject was bad.
+ *  1 - Reject was good.
  */
 static int lcp_rejci(fsm *f, u_char *p, int len) {
     ppp_pcb *pcb = f->pcb;
@@ -1592,7 +1592,7 @@ static int lcp_rejci(fsm *f, u_char *p, int len) {
     u_char cichar;
     u_short cishort;
     u32_t cilong;
-    lcp_options try_;		/* options to request next time */
+    lcp_options try_;       /* options to request next time */
 
     try_ = *go;
 
@@ -1603,157 +1603,157 @@ static int lcp_rejci(fsm *f, u_char *p, int len) {
      */
 #define REJCIVOID(opt, neg) \
     if (go->neg && \
-	len >= CILEN_VOID && \
-	p[1] == CILEN_VOID && \
-	p[0] == opt) { \
-	len -= CILEN_VOID; \
-	INCPTR(CILEN_VOID, p); \
-	try_.neg = 0; \
+    len >= CILEN_VOID && \
+    p[1] == CILEN_VOID && \
+    p[0] == opt) { \
+    len -= CILEN_VOID; \
+    INCPTR(CILEN_VOID, p); \
+    try_.neg = 0; \
     }
 #define REJCISHORT(opt, neg, val) \
     if (go->neg && \
-	len >= CILEN_SHORT && \
-	p[1] == CILEN_SHORT && \
-	p[0] == opt) { \
-	len -= CILEN_SHORT; \
-	INCPTR(2, p); \
-	GETSHORT(cishort, p); \
-	/* Check rejected value. */ \
-	if (cishort != val) \
-	    goto bad; \
-	try_.neg = 0; \
+    len >= CILEN_SHORT && \
+    p[1] == CILEN_SHORT && \
+    p[0] == opt) { \
+    len -= CILEN_SHORT; \
+    INCPTR(2, p); \
+    GETSHORT(cishort, p); \
+    /* Check rejected value. */ \
+    if (cishort != val) \
+        goto bad; \
+    try_.neg = 0; \
     }
 
 #if CHAP_SUPPORT && EAP_SUPPORT && PAP_SUPPORT
 #define REJCICHAP(opt, neg, val) \
     if (go->neg && \
-	len >= CILEN_CHAP && \
-	p[1] == CILEN_CHAP && \
-	p[0] == opt) { \
-	len -= CILEN_CHAP; \
-	INCPTR(2, p); \
-	GETSHORT(cishort, p); \
-	GETCHAR(cichar, p); \
-	/* Check rejected value. */ \
-	if ((cishort != PPP_CHAP) || (cichar != (CHAP_DIGEST(val)))) \
-	    goto bad; \
-	try_.neg = 0; \
-	try_.neg_eap = try_.neg_upap = 0; \
+    len >= CILEN_CHAP && \
+    p[1] == CILEN_CHAP && \
+    p[0] == opt) { \
+    len -= CILEN_CHAP; \
+    INCPTR(2, p); \
+    GETSHORT(cishort, p); \
+    GETCHAR(cichar, p); \
+    /* Check rejected value. */ \
+    if ((cishort != PPP_CHAP) || (cichar != (CHAP_DIGEST(val)))) \
+        goto bad; \
+    try_.neg = 0; \
+    try_.neg_eap = try_.neg_upap = 0; \
     }
 #endif /* CHAP_SUPPORT && EAP_SUPPORT && PAP_SUPPORT */
 
 #if CHAP_SUPPORT && !EAP_SUPPORT && PAP_SUPPORT
 #define REJCICHAP(opt, neg, val) \
     if (go->neg && \
-	len >= CILEN_CHAP && \
-	p[1] == CILEN_CHAP && \
-	p[0] == opt) { \
-	len -= CILEN_CHAP; \
-	INCPTR(2, p); \
-	GETSHORT(cishort, p); \
-	GETCHAR(cichar, p); \
-	/* Check rejected value. */ \
-	if ((cishort != PPP_CHAP) || (cichar != (CHAP_DIGEST(val)))) \
-	    goto bad; \
-	try_.neg = 0; \
-	try_.neg_upap = 0; \
+    len >= CILEN_CHAP && \
+    p[1] == CILEN_CHAP && \
+    p[0] == opt) { \
+    len -= CILEN_CHAP; \
+    INCPTR(2, p); \
+    GETSHORT(cishort, p); \
+    GETCHAR(cichar, p); \
+    /* Check rejected value. */ \
+    if ((cishort != PPP_CHAP) || (cichar != (CHAP_DIGEST(val)))) \
+        goto bad; \
+    try_.neg = 0; \
+    try_.neg_upap = 0; \
     }
 #endif /* CHAP_SUPPORT && !EAP_SUPPORT && PAP_SUPPORT */
 
 #if CHAP_SUPPORT && EAP_SUPPORT && !PAP_SUPPORT
 #define REJCICHAP(opt, neg, val) \
     if (go->neg && \
-	len >= CILEN_CHAP && \
-	p[1] == CILEN_CHAP && \
-	p[0] == opt) { \
-	len -= CILEN_CHAP; \
-	INCPTR(2, p); \
-	GETSHORT(cishort, p); \
-	GETCHAR(cichar, p); \
-	/* Check rejected value. */ \
-	if ((cishort != PPP_CHAP) || (cichar != (CHAP_DIGEST(val)))) \
-	    goto bad; \
-	try_.neg = 0; \
-	try_.neg_eap = 0; \
+    len >= CILEN_CHAP && \
+    p[1] == CILEN_CHAP && \
+    p[0] == opt) { \
+    len -= CILEN_CHAP; \
+    INCPTR(2, p); \
+    GETSHORT(cishort, p); \
+    GETCHAR(cichar, p); \
+    /* Check rejected value. */ \
+    if ((cishort != PPP_CHAP) || (cichar != (CHAP_DIGEST(val)))) \
+        goto bad; \
+    try_.neg = 0; \
+    try_.neg_eap = 0; \
     }
 #endif /* CHAP_SUPPORT && EAP_SUPPORT && !PAP_SUPPORT */
 
 #if CHAP_SUPPORT && !EAP_SUPPORT && !PAP_SUPPORT
 #define REJCICHAP(opt, neg, val) \
     if (go->neg && \
-	len >= CILEN_CHAP && \
-	p[1] == CILEN_CHAP && \
-	p[0] == opt) { \
-	len -= CILEN_CHAP; \
-	INCPTR(2, p); \
-	GETSHORT(cishort, p); \
-	GETCHAR(cichar, p); \
-	/* Check rejected value. */ \
-	if ((cishort != PPP_CHAP) || (cichar != (CHAP_DIGEST(val)))) \
-	    goto bad; \
-	try_.neg = 0; \
+    len >= CILEN_CHAP && \
+    p[1] == CILEN_CHAP && \
+    p[0] == opt) { \
+    len -= CILEN_CHAP; \
+    INCPTR(2, p); \
+    GETSHORT(cishort, p); \
+    GETCHAR(cichar, p); \
+    /* Check rejected value. */ \
+    if ((cishort != PPP_CHAP) || (cichar != (CHAP_DIGEST(val)))) \
+        goto bad; \
+    try_.neg = 0; \
     }
 #endif /* CHAP_SUPPORT && !EAP_SUPPORT && !PAP_SUPPORT */
 
 #define REJCILONG(opt, neg, val) \
     if (go->neg && \
-	len >= CILEN_LONG && \
-	p[1] == CILEN_LONG && \
-	p[0] == opt) { \
-	len -= CILEN_LONG; \
-	INCPTR(2, p); \
-	GETLONG(cilong, p); \
-	/* Check rejected value. */ \
-	if (cilong != val) \
-	    goto bad; \
-	try_.neg = 0; \
+    len >= CILEN_LONG && \
+    p[1] == CILEN_LONG && \
+    p[0] == opt) { \
+    len -= CILEN_LONG; \
+    INCPTR(2, p); \
+    GETLONG(cilong, p); \
+    /* Check rejected value. */ \
+    if (cilong != val) \
+        goto bad; \
+    try_.neg = 0; \
     }
 #if LQR_SUPPORT
 #define REJCILQR(opt, neg, val) \
     if (go->neg && \
-	len >= CILEN_LQR && \
-	p[1] == CILEN_LQR && \
-	p[0] == opt) { \
-	len -= CILEN_LQR; \
-	INCPTR(2, p); \
-	GETSHORT(cishort, p); \
-	GETLONG(cilong, p); \
-	/* Check rejected value. */ \
-	if (cishort != PPP_LQR || cilong != val) \
-	    goto bad; \
-	try_.neg = 0; \
+    len >= CILEN_LQR && \
+    p[1] == CILEN_LQR && \
+    p[0] == opt) { \
+    len -= CILEN_LQR; \
+    INCPTR(2, p); \
+    GETSHORT(cishort, p); \
+    GETLONG(cilong, p); \
+    /* Check rejected value. */ \
+    if (cishort != PPP_LQR || cilong != val) \
+        goto bad; \
+    try_.neg = 0; \
     }
 #endif /* LQR_SUPPORT */
 #define REJCICBCP(opt, neg, val) \
     if (go->neg && \
-	len >= CILEN_CBCP && \
-	p[1] == CILEN_CBCP && \
-	p[0] == opt) { \
-	len -= CILEN_CBCP; \
-	INCPTR(2, p); \
-	GETCHAR(cichar, p); \
-	/* Check rejected value. */ \
-	if (cichar != val) \
-	    goto bad; \
-	try_.neg = 0; \
+    len >= CILEN_CBCP && \
+    p[1] == CILEN_CBCP && \
+    p[0] == opt) { \
+    len -= CILEN_CBCP; \
+    INCPTR(2, p); \
+    GETCHAR(cichar, p); \
+    /* Check rejected value. */ \
+    if (cichar != val) \
+        goto bad; \
+    try_.neg = 0; \
     }
 #define REJCIENDP(opt, neg, class, val, vlen) \
     if (go->neg && \
-	len >= CILEN_CHAR + vlen && \
-	p[0] == opt && \
-	p[1] == CILEN_CHAR + vlen) { \
-	int i; \
-	len -= CILEN_CHAR + vlen; \
-	INCPTR(2, p); \
-	GETCHAR(cichar, p); \
-	if (cichar != class) \
-	    goto bad; \
-	for (i = 0; i < vlen; ++i) { \
-	    GETCHAR(cichar, p); \
-	    if (cichar != val[i]) \
-		goto bad; \
-	} \
-	try_.neg = 0; \
+    len >= CILEN_CHAR + vlen && \
+    p[0] == opt && \
+    p[1] == CILEN_CHAR + vlen) { \
+    int i; \
+    len -= CILEN_CHAR + vlen; \
+    INCPTR(2, p); \
+    GETCHAR(cichar, p); \
+    if (cichar != class) \
+        goto bad; \
+    for (i = 0; i < vlen; ++i) { \
+        GETCHAR(cichar, p); \
+        if (cichar != val[i]) \
+        goto bad; \
+    } \
+    try_.neg = 0; \
     }
 
     REJCISHORT(CI_MRU, neg_mru, go->mru);
@@ -1763,14 +1763,14 @@ static int lcp_rejci(fsm *f, u_char *p, int len) {
     if (!go->neg_eap) {
 #endif /* EAP_SUPPORT */
 #if CHAP_SUPPORT
-	REJCICHAP(CI_AUTHTYPE, neg_chap, go->chap_mdtype);
-	if (!go->neg_chap) {
+    REJCICHAP(CI_AUTHTYPE, neg_chap, go->chap_mdtype);
+    if (!go->neg_chap) {
 #endif /* CHAP_SUPPORT */
 #if PAP_SUPPORT
-	    REJCISHORT(CI_AUTHTYPE, neg_upap, PPP_PAP);
+        REJCISHORT(CI_AUTHTYPE, neg_upap, PPP_PAP);
 #endif /* PAP_SUPPORT */
 #if CHAP_SUPPORT
-	}
+    }
 #endif /* CHAP_SUPPORT */
 #if EAP_SUPPORT
     }
@@ -1787,18 +1787,18 @@ static int lcp_rejci(fsm *f, u_char *p, int len) {
 #endif /* HAVE_MULTILINK */
     REJCIVOID(CI_SSNHF, neg_ssnhf);
     REJCIENDP(CI_EPDISC, neg_endpoint, go->endpoint.class_,
-	      go->endpoint.value, go->endpoint.length);
+          go->endpoint.value, go->endpoint.length);
 
     /*
      * If there are any remaining CIs, then this packet is bad.
      */
     if (len != 0)
-	goto bad;
+    goto bad;
     /*
      * Now we can update state.
      */
     if (f->state != PPP_FSM_OPENED)
-	*go = try_;
+    *go = try_;
     return 1;
 
 bad:
@@ -1822,17 +1822,17 @@ static int lcp_reqci(fsm *f, u_char *inp, int *lenp, int reject_if_disagree) {
     lcp_options *go = &pcb->lcp_gotoptions;
     lcp_options *ho = &pcb->lcp_hisoptions;
     lcp_options *ao = &pcb->lcp_allowoptions;
-    u_char *cip, *next;		/* Pointer to current and next CIs */
-    int cilen, citype, cichar;	/* Parsed len, type, char value */
-    u_short cishort;		/* Parsed short value */
-    u32_t cilong;		/* Parse long value */
-    int rc = CONFACK;		/* Final packet return code */
-    int orc;			/* Individual option return code */
-    u_char *p;			/* Pointer to next char to parse */
-    u_char *rejp;		/* Pointer to next char in reject frame */
+    u_char *cip, *next;     /* Pointer to current and next CIs */
+    int cilen, citype, cichar;  /* Parsed len, type, char value */
+    u_short cishort;        /* Parsed short value */
+    u32_t cilong;       /* Parse long value */
+    int rc = CONFACK;       /* Final packet return code */
+    int orc;            /* Individual option return code */
+    u_char *p;          /* Pointer to next char to parse */
+    u_char *rejp;       /* Pointer to next char in reject frame */
     struct pbuf *nakp;          /* Nak buffer */
-    u_char *nakoutp;		/* Pointer to next char in Nak frame */
-    int l = *lenp;		/* Length left */
+    u_char *nakoutp;        /* Pointer to next char in Nak frame */
+    int l = *lenp;      /* Length left */
 
     /*
      * Reset all his options.
@@ -1854,403 +1854,403 @@ static int lcp_reqci(fsm *f, u_char *inp, int *lenp, int reject_if_disagree) {
     nakoutp = (u_char*)nakp->payload;
     rejp = inp;
     while (l) {
-	orc = CONFACK;			/* Assume success */
-	cip = p = next;			/* Remember beginning of CI */
-	if (l < 2 ||			/* Not enough data for CI header or */
-	    p[1] < 2 ||			/*  CI length too small or */
-	    p[1] > l) {			/*  CI length too big? */
-	    LCPDEBUG(("lcp_reqci: bad CI length!"));
-	    orc = CONFREJ;		/* Reject bad CI */
-	    cilen = l;			/* Reject till end of packet */
-	    l = 0;			/* Don't loop again */
-	    citype = 0;
-	    goto endswitch;
-	}
-	GETCHAR(citype, p);		/* Parse CI type */
-	GETCHAR(cilen, p);		/* Parse CI length */
-	l -= cilen;			/* Adjust remaining length */
-	next += cilen;			/* Step to next CI */
-
-	switch (citype) {		/* Check CI type */
-	case CI_MRU:
-	    if (!ao->neg_mru ||		/* Allow option? */
-		cilen != CILEN_SHORT) {	/* Check CI length */
-		orc = CONFREJ;		/* Reject CI */
-		break;
-	    }
-	    GETSHORT(cishort, p);	/* Parse MRU */
-
-	    /*
-	     * He must be able to receive at least our minimum.
-	     * No need to check a maximum.  If he sends a large number,
-	     * we'll just ignore it.
-	     */
-	    if (cishort < PPP_MINMRU) {
-		orc = CONFNAK;		/* Nak CI */
-		PUTCHAR(CI_MRU, nakoutp);
-		PUTCHAR(CILEN_SHORT, nakoutp);
-		PUTSHORT(PPP_MINMRU, nakoutp);	/* Give him a hint */
-		break;
-	    }
-	    ho->neg_mru = 1;		/* Remember he sent MRU */
-	    ho->mru = cishort;		/* And remember value */
-	    break;
-
-	case CI_ASYNCMAP:
-	    if (!ao->neg_asyncmap ||
-		cilen != CILEN_LONG) {
-		orc = CONFREJ;
-		break;
-	    }
-	    GETLONG(cilong, p);
-
-	    /*
-	     * Asyncmap must have set at least the bits
-	     * which are set in lcp_allowoptions[unit].asyncmap.
-	     */
-	    if ((ao->asyncmap & ~cilong) != 0) {
-		orc = CONFNAK;
-		PUTCHAR(CI_ASYNCMAP, nakoutp);
-		PUTCHAR(CILEN_LONG, nakoutp);
-		PUTLONG(ao->asyncmap | cilong, nakoutp);
-		break;
-	    }
-	    ho->neg_asyncmap = 1;
-	    ho->asyncmap = cilong;
-	    break;
-
-	case CI_AUTHTYPE:
-	    if (cilen < CILEN_SHORT ||
-		!(0
+    orc = CONFACK;          /* Assume success */
+    cip = p = next;         /* Remember beginning of CI */
+    if (l < 2 ||            /* Not enough data for CI header or */
+        p[1] < 2 ||         /*  CI length too small or */
+        p[1] > l) {         /*  CI length too big? */
+        LCPDEBUG(("lcp_reqci: bad CI length!"));
+        orc = CONFREJ;      /* Reject bad CI */
+        cilen = l;          /* Reject till end of packet */
+        l = 0;          /* Don't loop again */
+        citype = 0;
+        goto endswitch;
+    }
+    GETCHAR(citype, p);     /* Parse CI type */
+    GETCHAR(cilen, p);      /* Parse CI length */
+    l -= cilen;         /* Adjust remaining length */
+    next += cilen;          /* Step to next CI */
+
+    switch (citype) {       /* Check CI type */
+    case CI_MRU:
+        if (!ao->neg_mru ||     /* Allow option? */
+        cilen != CILEN_SHORT) { /* Check CI length */
+        orc = CONFREJ;      /* Reject CI */
+        break;
+        }
+        GETSHORT(cishort, p);   /* Parse MRU */
+
+        /*
+         * He must be able to receive at least our minimum.
+         * No need to check a maximum.  If he sends a large number,
+         * we'll just ignore it.
+         */
+        if (cishort < PPP_MINMRU) {
+        orc = CONFNAK;      /* Nak CI */
+        PUTCHAR(CI_MRU, nakoutp);
+        PUTCHAR(CILEN_SHORT, nakoutp);
+        PUTSHORT(PPP_MINMRU, nakoutp);  /* Give him a hint */
+        break;
+        }
+        ho->neg_mru = 1;        /* Remember he sent MRU */
+        ho->mru = cishort;      /* And remember value */
+        break;
+
+    case CI_ASYNCMAP:
+        if (!ao->neg_asyncmap ||
+        cilen != CILEN_LONG) {
+        orc = CONFREJ;
+        break;
+        }
+        GETLONG(cilong, p);
+
+        /*
+         * Asyncmap must have set at least the bits
+         * which are set in lcp_allowoptions[unit].asyncmap.
+         */
+        if ((ao->asyncmap & ~cilong) != 0) {
+        orc = CONFNAK;
+        PUTCHAR(CI_ASYNCMAP, nakoutp);
+        PUTCHAR(CILEN_LONG, nakoutp);
+        PUTLONG(ao->asyncmap | cilong, nakoutp);
+        break;
+        }
+        ho->neg_asyncmap = 1;
+        ho->asyncmap = cilong;
+        break;
+
+    case CI_AUTHTYPE:
+        if (cilen < CILEN_SHORT ||
+        !(0
 #if PAP_SUPPORT
-		|| ao->neg_upap
+        || ao->neg_upap
 #endif /* PAP_SUPPORT */
 #if CHAP_SUPPORT
-		|| ao->neg_chap
+        || ao->neg_chap
 #endif /* CHAP_SUPPORT */
 #if EAP_SUPPORT
-		|| ao->neg_eap
+        || ao->neg_eap
 #endif /* EAP_SUPPORT */
-		)) {
-		/*
-		 * Reject the option if we're not willing to authenticate.
-		 */
-		ppp_dbglog(("No auth is possible"));
-		orc = CONFREJ;
-		break;
-	    }
-	    GETSHORT(cishort, p);
-
-	    /*
-	     * Authtype must be PAP, CHAP, or EAP.
-	     *
-	     * Note: if more than one of ao->neg_upap, ao->neg_chap, and
-	     * ao->neg_eap are set, and the peer sends a Configure-Request
-	     * with two or more authenticate-protocol requests, then we will
-	     * reject the second request.
-	     * Whether we end up doing CHAP, UPAP, or EAP depends then on
-	     * the ordering of the CIs in the peer's Configure-Request.
+        )) {
+        /*
+         * Reject the option if we're not willing to authenticate.
+         */
+        ppp_dbglog(("No auth is possible"));
+        orc = CONFREJ;
+        break;
+        }
+        GETSHORT(cishort, p);
+
+        /*
+         * Authtype must be PAP, CHAP, or EAP.
+         *
+         * Note: if more than one of ao->neg_upap, ao->neg_chap, and
+         * ao->neg_eap are set, and the peer sends a Configure-Request
+         * with two or more authenticate-protocol requests, then we will
+         * reject the second request.
+         * Whether we end up doing CHAP, UPAP, or EAP depends then on
+         * the ordering of the CIs in the peer's Configure-Request.
              */
 
 #if PAP_SUPPORT
-	    if (cishort == PPP_PAP) {
-		/* we've already accepted CHAP or EAP */
-		if (0
+        if (cishort == PPP_PAP) {
+        /* we've already accepted CHAP or EAP */
+        if (0
 #if CHAP_SUPPORT
-		    || ho->neg_chap
+            || ho->neg_chap
 #endif /* CHAP_SUPPORT */
 #if EAP_SUPPORT
-		    || ho->neg_eap
+            || ho->neg_eap
 #endif /* EAP_SUPPORT */
-		    || cilen != CILEN_SHORT) {
-		    LCPDEBUG(("lcp_reqci: rcvd AUTHTYPE PAP, rejecting..."));
-		    orc = CONFREJ;
-		    break;
-		}
-		if (!ao->neg_upap) {	/* we don't want to do PAP */
-		    orc = CONFNAK;	/* NAK it and suggest CHAP or EAP */
-		    PUTCHAR(CI_AUTHTYPE, nakoutp);
+            || cilen != CILEN_SHORT) {
+            LCPDEBUG(("lcp_reqci: rcvd AUTHTYPE PAP, rejecting..."));
+            orc = CONFREJ;
+            break;
+        }
+        if (!ao->neg_upap) {    /* we don't want to do PAP */
+            orc = CONFNAK;  /* NAK it and suggest CHAP or EAP */
+            PUTCHAR(CI_AUTHTYPE, nakoutp);
 #if EAP_SUPPORT
-		    if (ao->neg_eap) {
-			PUTCHAR(CILEN_SHORT, nakoutp);
-			PUTSHORT(PPP_EAP, nakoutp);
-		    } else {
+            if (ao->neg_eap) {
+            PUTCHAR(CILEN_SHORT, nakoutp);
+            PUTSHORT(PPP_EAP, nakoutp);
+            } else {
 #endif /* EAP_SUPPORT */
 #if CHAP_SUPPORT
-			PUTCHAR(CILEN_CHAP, nakoutp);
-			PUTSHORT(PPP_CHAP, nakoutp);
-			PUTCHAR(CHAP_DIGEST(ao->chap_mdtype), nakoutp);
+            PUTCHAR(CILEN_CHAP, nakoutp);
+            PUTSHORT(PPP_CHAP, nakoutp);
+            PUTCHAR(CHAP_DIGEST(ao->chap_mdtype), nakoutp);
 #endif /* CHAP_SUPPORT */
 #if EAP_SUPPORT
-		    }
+            }
 #endif /* EAP_SUPPORT */
-		    break;
-		}
-		ho->neg_upap = 1;
-		break;
-	    }
+            break;
+        }
+        ho->neg_upap = 1;
+        break;
+        }
 #endif /* PAP_SUPPORT */
 #if CHAP_SUPPORT
-	    if (cishort == PPP_CHAP) {
-		/* we've already accepted PAP or EAP */
-		if (
+        if (cishort == PPP_CHAP) {
+        /* we've already accepted PAP or EAP */
+        if (
 #if PAP_SUPPORT
-		    ho->neg_upap ||
+            ho->neg_upap ||
 #endif /* PAP_SUPPORT */
 #if EAP_SUPPORT
-		    ho->neg_eap ||
+            ho->neg_eap ||
 #endif /* EAP_SUPPORT */
-		    cilen != CILEN_CHAP) {
-		    LCPDEBUG(("lcp_reqci: rcvd AUTHTYPE CHAP, rejecting..."));
-		    orc = CONFREJ;
-		    break;
-		}
-		if (!ao->neg_chap) {	/* we don't want to do CHAP */
-		    orc = CONFNAK;	/* NAK it and suggest EAP or PAP */
-		    PUTCHAR(CI_AUTHTYPE, nakoutp);
-		    PUTCHAR(CILEN_SHORT, nakoutp);
+            cilen != CILEN_CHAP) {
+            LCPDEBUG(("lcp_reqci: rcvd AUTHTYPE CHAP, rejecting..."));
+            orc = CONFREJ;
+            break;
+        }
+        if (!ao->neg_chap) {    /* we don't want to do CHAP */
+            orc = CONFNAK;  /* NAK it and suggest EAP or PAP */
+            PUTCHAR(CI_AUTHTYPE, nakoutp);
+            PUTCHAR(CILEN_SHORT, nakoutp);
 #if EAP_SUPPORT
-		    if (ao->neg_eap) {
-			PUTSHORT(PPP_EAP, nakoutp);
-		    } else
+            if (ao->neg_eap) {
+            PUTSHORT(PPP_EAP, nakoutp);
+            } else
 #endif /* EAP_SUPPORT */
 #if PAP_SUPPORT
-		    if(1) {
-			PUTSHORT(PPP_PAP, nakoutp);
-		    }
-		    else
+            if(1) {
+            PUTSHORT(PPP_PAP, nakoutp);
+            }
+            else
 #endif /* PAP_SUPPORT */
-		    {}
-		    break;
-		}
-		GETCHAR(cichar, p);	/* get digest type */
-		if (!(CHAP_CANDIGEST(ao->chap_mdtype, cichar))) {
-		    /*
-		     * We can't/won't do the requested type,
-		     * suggest something else.
-		     */
-		    orc = CONFNAK;
-		    PUTCHAR(CI_AUTHTYPE, nakoutp);
-		    PUTCHAR(CILEN_CHAP, nakoutp);
-		    PUTSHORT(PPP_CHAP, nakoutp);
-		    PUTCHAR(CHAP_DIGEST(ao->chap_mdtype), nakoutp);
-		    break;
-		}
-		ho->chap_mdtype = CHAP_MDTYPE_D(cichar); /* save md type */
-		ho->neg_chap = 1;
-		break;
-	    }
+            {}
+            break;
+        }
+        GETCHAR(cichar, p); /* get digest type */
+        if (!(CHAP_CANDIGEST(ao->chap_mdtype, cichar))) {
+            /*
+             * We can't/won't do the requested type,
+             * suggest something else.
+             */
+            orc = CONFNAK;
+            PUTCHAR(CI_AUTHTYPE, nakoutp);
+            PUTCHAR(CILEN_CHAP, nakoutp);
+            PUTSHORT(PPP_CHAP, nakoutp);
+            PUTCHAR(CHAP_DIGEST(ao->chap_mdtype), nakoutp);
+            break;
+        }
+        ho->chap_mdtype = CHAP_MDTYPE_D(cichar); /* save md type */
+        ho->neg_chap = 1;
+        break;
+        }
 #endif /* CHAP_SUPPORT */
 #if EAP_SUPPORT
-	    if (cishort == PPP_EAP) {
-		/* we've already accepted CHAP or PAP */
-		if (
+        if (cishort == PPP_EAP) {
+        /* we've already accepted CHAP or PAP */
+        if (
 #if CHAP_SUPPORT
-		    ho->neg_chap ||
+            ho->neg_chap ||
 #endif /* CHAP_SUPPORT */
 #if PAP_SUPPORT
-		    ho->neg_upap ||
+            ho->neg_upap ||
 #endif /* PAP_SUPPORT */
-		    cilen != CILEN_SHORT) {
-		    LCPDEBUG(("lcp_reqci: rcvd AUTHTYPE EAP, rejecting..."));
-		    orc = CONFREJ;
-		    break;
-		}
-		if (!ao->neg_eap) {	/* we don't want to do EAP */
-		    orc = CONFNAK;	/* NAK it and suggest CHAP or PAP */
-		    PUTCHAR(CI_AUTHTYPE, nakoutp);
+            cilen != CILEN_SHORT) {
+            LCPDEBUG(("lcp_reqci: rcvd AUTHTYPE EAP, rejecting..."));
+            orc = CONFREJ;
+            break;
+        }
+        if (!ao->neg_eap) { /* we don't want to do EAP */
+            orc = CONFNAK;  /* NAK it and suggest CHAP or PAP */
+            PUTCHAR(CI_AUTHTYPE, nakoutp);
 #if CHAP_SUPPORT
-		    if (ao->neg_chap) {
-			PUTCHAR(CILEN_CHAP, nakoutp);
-			PUTSHORT(PPP_CHAP, nakoutp);
-			PUTCHAR(CHAP_DIGEST(ao->chap_mdtype), nakoutp);
-		    } else
+            if (ao->neg_chap) {
+            PUTCHAR(CILEN_CHAP, nakoutp);
+            PUTSHORT(PPP_CHAP, nakoutp);
+            PUTCHAR(CHAP_DIGEST(ao->chap_mdtype), nakoutp);
+            } else
 #endif /* CHAP_SUPPORT */
 #if PAP_SUPPORT
-		    if(1) {
-			PUTCHAR(CILEN_SHORT, nakoutp);
-			PUTSHORT(PPP_PAP, nakoutp);
-		    } else
+            if(1) {
+            PUTCHAR(CILEN_SHORT, nakoutp);
+            PUTSHORT(PPP_PAP, nakoutp);
+            } else
 #endif /* PAP_SUPPORT */
-		    {}
-		    break;
-		}
-		ho->neg_eap = 1;
-		break;
-	    }
+            {}
+            break;
+        }
+        ho->neg_eap = 1;
+        break;
+        }
 #endif /* EAP_SUPPORT */
 
-	    /*
-	     * We don't recognize the protocol they're asking for.
-	     * Nak it with something we're willing to do.
-	     * (At this point we know ao->neg_upap || ao->neg_chap ||
-	     * ao->neg_eap.)
-	     */
-	    orc = CONFNAK;
-	    PUTCHAR(CI_AUTHTYPE, nakoutp);
+        /*
+         * We don't recognize the protocol they're asking for.
+         * Nak it with something we're willing to do.
+         * (At this point we know ao->neg_upap || ao->neg_chap ||
+         * ao->neg_eap.)
+         */
+        orc = CONFNAK;
+        PUTCHAR(CI_AUTHTYPE, nakoutp);
 
 #if EAP_SUPPORT
-	    if (ao->neg_eap) {
-		PUTCHAR(CILEN_SHORT, nakoutp);
-		PUTSHORT(PPP_EAP, nakoutp);
-	    } else
+        if (ao->neg_eap) {
+        PUTCHAR(CILEN_SHORT, nakoutp);
+        PUTSHORT(PPP_EAP, nakoutp);
+        } else
 #endif /* EAP_SUPPORT */
 #if CHAP_SUPPORT
-	    if (ao->neg_chap) {
-		PUTCHAR(CILEN_CHAP, nakoutp);
-		PUTSHORT(PPP_CHAP, nakoutp);
-		PUTCHAR(CHAP_DIGEST(ao->chap_mdtype), nakoutp);
-	    } else
+        if (ao->neg_chap) {
+        PUTCHAR(CILEN_CHAP, nakoutp);
+        PUTSHORT(PPP_CHAP, nakoutp);
+        PUTCHAR(CHAP_DIGEST(ao->chap_mdtype), nakoutp);
+        } else
 #endif /* CHAP_SUPPORT */
 #if PAP_SUPPORT
-	    if(1) {
-		PUTCHAR(CILEN_SHORT, nakoutp);
-		PUTSHORT(PPP_PAP, nakoutp);
-	    } else
+        if(1) {
+        PUTCHAR(CILEN_SHORT, nakoutp);
+        PUTSHORT(PPP_PAP, nakoutp);
+        } else
 #endif /* PAP_SUPPORT */
-	    {}
-	    break;
+        {}
+        break;
 
 #if LQR_SUPPORT
-	case CI_QUALITY:
-	    if (!ao->neg_lqr ||
-		cilen != CILEN_LQR) {
-		orc = CONFREJ;
-		break;
-	    }
-
-	    GETSHORT(cishort, p);
-	    GETLONG(cilong, p);
-
-	    /*
-	     * Check the protocol and the reporting period.
-	     * XXX When should we Nak this, and what with?
-	     */
-	    if (cishort != PPP_LQR) {
-		orc = CONFNAK;
-		PUTCHAR(CI_QUALITY, nakoutp);
-		PUTCHAR(CILEN_LQR, nakoutp);
-		PUTSHORT(PPP_LQR, nakoutp);
-		PUTLONG(ao->lqr_period, nakoutp);
-		break;
-	    }
-	    break;
+    case CI_QUALITY:
+        if (!ao->neg_lqr ||
+        cilen != CILEN_LQR) {
+        orc = CONFREJ;
+        break;
+        }
+
+        GETSHORT(cishort, p);
+        GETLONG(cilong, p);
+
+        /*
+         * Check the protocol and the reporting period.
+         * XXX When should we Nak this, and what with?
+         */
+        if (cishort != PPP_LQR) {
+        orc = CONFNAK;
+        PUTCHAR(CI_QUALITY, nakoutp);
+        PUTCHAR(CILEN_LQR, nakoutp);
+        PUTSHORT(PPP_LQR, nakoutp);
+        PUTLONG(ao->lqr_period, nakoutp);
+        break;
+        }
+        break;
 #endif /* LQR_SUPPORT */
 
-	case CI_MAGICNUMBER:
-	    if (!(ao->neg_magicnumber || go->neg_magicnumber) ||
-		cilen != CILEN_LONG) {
-		orc = CONFREJ;
-		break;
-	    }
-	    GETLONG(cilong, p);
-
-	    /*
-	     * He must have a different magic number.
-	     */
-	    if (go->neg_magicnumber &&
-		cilong == go->magicnumber) {
-		cilong = magic();	/* Don't put magic() inside macro! */
-		orc = CONFNAK;
-		PUTCHAR(CI_MAGICNUMBER, nakoutp);
-		PUTCHAR(CILEN_LONG, nakoutp);
-		PUTLONG(cilong, nakoutp);
-		break;
-	    }
-	    ho->neg_magicnumber = 1;
-	    ho->magicnumber = cilong;
-	    break;
-
-
-	case CI_PCOMPRESSION:
-	    if (!ao->neg_pcompression ||
-		cilen != CILEN_VOID) {
-		orc = CONFREJ;
-		break;
-	    }
-	    ho->neg_pcompression = 1;
-	    break;
-
-	case CI_ACCOMPRESSION:
-	    if (!ao->neg_accompression ||
-		cilen != CILEN_VOID) {
-		orc = CONFREJ;
-		break;
-	    }
-	    ho->neg_accompression = 1;
-	    break;
+    case CI_MAGICNUMBER:
+        if (!(ao->neg_magicnumber || go->neg_magicnumber) ||
+        cilen != CILEN_LONG) {
+        orc = CONFREJ;
+        break;
+        }
+        GETLONG(cilong, p);
+
+        /*
+         * He must have a different magic number.
+         */
+        if (go->neg_magicnumber &&
+        cilong == go->magicnumber) {
+        cilong = magic();   /* Don't put magic() inside macro! */
+        orc = CONFNAK;
+        PUTCHAR(CI_MAGICNUMBER, nakoutp);
+        PUTCHAR(CILEN_LONG, nakoutp);
+        PUTLONG(cilong, nakoutp);
+        break;
+        }
+        ho->neg_magicnumber = 1;
+        ho->magicnumber = cilong;
+        break;
+
+
+    case CI_PCOMPRESSION:
+        if (!ao->neg_pcompression ||
+        cilen != CILEN_VOID) {
+        orc = CONFREJ;
+        break;
+        }
+        ho->neg_pcompression = 1;
+        break;
+
+    case CI_ACCOMPRESSION:
+        if (!ao->neg_accompression ||
+        cilen != CILEN_VOID) {
+        orc = CONFREJ;
+        break;
+        }
+        ho->neg_accompression = 1;
+        break;
 
 #ifdef HAVE_MULTILINK
-	case CI_MRRU:
-	    if (!ao->neg_mrru
-		|| !multilink
-		|| cilen != CILEN_SHORT) {
-		orc = CONFREJ;
-		break;
-	    }
-
-	    GETSHORT(cishort, p);
-	    /* possibly should insist on a minimum/maximum MRRU here */
-	    ho->neg_mrru = 1;
-	    ho->mrru = cishort;
-	    break;
+    case CI_MRRU:
+        if (!ao->neg_mrru
+        || !multilink
+        || cilen != CILEN_SHORT) {
+        orc = CONFREJ;
+        break;
+        }
+
+        GETSHORT(cishort, p);
+        /* possibly should insist on a minimum/maximum MRRU here */
+        ho->neg_mrru = 1;
+        ho->mrru = cishort;
+        break;
 #endif /* HAVE_MULTILINK */
 
-	case CI_SSNHF:
-	    if (!ao->neg_ssnhf
+    case CI_SSNHF:
+        if (!ao->neg_ssnhf
 #ifdef HAVE_MULTILINK
-		|| !multilink
+        || !multilink
 #endif /* HAVE_MULTILINK */
-		|| cilen != CILEN_VOID) {
-		orc = CONFREJ;
-		break;
-	    }
-	    ho->neg_ssnhf = 1;
-	    break;
-
-	case CI_EPDISC:
-	    if (!ao->neg_endpoint ||
-		cilen < CILEN_CHAR ||
-		cilen > CILEN_CHAR + MAX_ENDP_LEN) {
-		orc = CONFREJ;
-		break;
-	    }
-	    GETCHAR(cichar, p);
-	    cilen -= CILEN_CHAR;
-	    ho->neg_endpoint = 1;
-	    ho->endpoint.class_ = cichar;
-	    ho->endpoint.length = cilen;
-	    MEMCPY(ho->endpoint.value, p, cilen);
-	    INCPTR(cilen, p);
-	    break;
-
-	default:
-	    LCPDEBUG(("lcp_reqci: rcvd unknown option %d", citype));
-	    orc = CONFREJ;
-	    break;
-	}
+        || cilen != CILEN_VOID) {
+        orc = CONFREJ;
+        break;
+        }
+        ho->neg_ssnhf = 1;
+        break;
+
+    case CI_EPDISC:
+        if (!ao->neg_endpoint ||
+        cilen < CILEN_CHAR ||
+        cilen > CILEN_CHAR + MAX_ENDP_LEN) {
+        orc = CONFREJ;
+        break;
+        }
+        GETCHAR(cichar, p);
+        cilen -= CILEN_CHAR;
+        ho->neg_endpoint = 1;
+        ho->endpoint.class_ = cichar;
+        ho->endpoint.length = cilen;
+        MEMCPY(ho->endpoint.value, p, cilen);
+        INCPTR(cilen, p);
+        break;
+
+    default:
+        LCPDEBUG(("lcp_reqci: rcvd unknown option %d", citype));
+        orc = CONFREJ;
+        break;
+    }
 
 endswitch:
-	if (orc == CONFACK &&		/* Good CI */
-	    rc != CONFACK)		/*  but prior CI wasn't? */
-	    continue;			/* Don't send this one */
-
-	if (orc == CONFNAK) {		/* Nak this CI? */
-	    if (reject_if_disagree	/* Getting fed up with sending NAKs? */
-		&& citype != CI_MAGICNUMBER) {
-		orc = CONFREJ;		/* Get tough if so */
-	    } else {
-		if (rc == CONFREJ)	/* Rejecting prior CI? */
-		    continue;		/* Don't send this one */
-		rc = CONFNAK;
-	    }
-	}
-	if (orc == CONFREJ) {		/* Reject this CI */
-	    rc = CONFREJ;
-	    if (cip != rejp)		/* Need to move rejected CI? */
-		MEMCPY(rejp, cip, cilen); /* Move it */
-	    INCPTR(cilen, rejp);	/* Update output pointer */
-	}
+    if (orc == CONFACK &&       /* Good CI */
+        rc != CONFACK)      /*  but prior CI wasn't? */
+        continue;           /* Don't send this one */
+
+    if (orc == CONFNAK) {       /* Nak this CI? */
+        if (reject_if_disagree  /* Getting fed up with sending NAKs? */
+        && citype != CI_MAGICNUMBER) {
+        orc = CONFREJ;      /* Get tough if so */
+        } else {
+        if (rc == CONFREJ)  /* Rejecting prior CI? */
+            continue;       /* Don't send this one */
+        rc = CONFNAK;
+        }
+    }
+    if (orc == CONFREJ) {       /* Reject this CI */
+        rc = CONFREJ;
+        if (cip != rejp)        /* Need to move rejected CI? */
+        MEMCPY(rejp, cip, cilen); /* Move it */
+        INCPTR(cilen, rejp);    /* Update output pointer */
+    }
     }
 
     /*
@@ -2262,25 +2262,25 @@ endswitch:
 
     switch (rc) {
     case CONFACK:
-	*lenp = next - inp;
-	break;
+    *lenp = next - inp;
+    break;
     case CONFNAK:
-	/*
-	 * Copy the Nak'd options from the nak buffer to the caller's buffer.
-	 */
-	*lenp = nakoutp - (u_char*)nakp->payload;
-	MEMCPY(inp, nakp->payload, *lenp);
-	break;
+    /*
+     * Copy the Nak'd options from the nak buffer to the caller's buffer.
+     */
+    *lenp = nakoutp - (u_char*)nakp->payload;
+    MEMCPY(inp, nakp->payload, *lenp);
+    break;
     case CONFREJ:
-	*lenp = rejp - inp;
-	break;
+    *lenp = rejp - inp;
+    break;
     default:
-	break;
+    break;
     }
 
     pbuf_free(nakp);
     LCPDEBUG(("lcp_reqci: returning CONF%s.", CODENAME(rc)));
-    return (rc);			/* Return final code */
+    return (rc);            /* Return final code */
 }
 
 
@@ -2296,9 +2296,9 @@ static void lcp_up(fsm *f) {
     int mtu, mru;
 
     if (!go->neg_magicnumber)
-	go->magicnumber = 0;
+    go->magicnumber = 0;
     if (!ho->neg_magicnumber)
-	ho->magicnumber = 0;
+    ho->magicnumber = 0;
 
     /*
      * Set our MTU to the smaller of the MTU we wanted and
@@ -2314,16 +2314,16 @@ static void lcp_up(fsm *f) {
 #ifdef HAVE_MULTILINK
     if (!(multilink && go->neg_mrru && ho->neg_mrru))
 #endif /* HAVE_MULTILINK */
-	ppp_netif_set_mtu(pcb, LWIP_MIN(LWIP_MIN(mtu, mru), ao->mru));
+    ppp_netif_set_mtu(pcb, LWIP_MIN(LWIP_MIN(mtu, mru), ao->mru));
     ppp_send_config(pcb, mtu,
-		    (ho->neg_asyncmap? ho->asyncmap: 0xffffffff),
-		    ho->neg_pcompression, ho->neg_accompression);
+            (ho->neg_asyncmap? ho->asyncmap: 0xffffffff),
+            ho->neg_pcompression, ho->neg_accompression);
     ppp_recv_config(pcb, mru,
-		    (pcb->settings.lax_recv? 0: go->neg_asyncmap? go->asyncmap: 0xffffffff),
-		    go->neg_pcompression, go->neg_accompression);
+            (pcb->settings.lax_recv? 0: go->neg_asyncmap? go->asyncmap: 0xffffffff),
+            go->neg_pcompression, go->neg_accompression);
 
     if (ho->neg_mru)
-	pcb->peer_mru = ho->mru;
+    pcb->peer_mru = ho->mru;
 
     lcp_echo_lowerup(f->pcb);  /* Enable echo messages */
 
@@ -2346,8 +2346,8 @@ static void lcp_down(fsm *f) {
 
     ppp_send_config(pcb, PPP_DEFMRU, 0xffffffff, 0, 0);
     ppp_recv_config(pcb, PPP_DEFMRU,
-		    (go->neg_asyncmap? go->asyncmap: 0xffffffff),
-		    go->neg_pcompression, go->neg_accompression);
+            (go->neg_asyncmap? go->asyncmap: 0xffffffff),
+            go->neg_pcompression, go->neg_accompression);
     pcb->peer_mru = PPP_DEFMRU;
 }
 
@@ -2382,25 +2382,25 @@ static const char* const lcp_codenames[] = {
 };
 
 static int lcp_printpkt(const u_char *p, int plen,
-		void (*printer) (void *, const char *, ...), void *arg) {
+        void (*printer) (void *, const char *, ...), void *arg) {
     int code, id, len, olen, i;
     const u_char *pstart, *optend;
     u_short cishort;
     u32_t cilong;
 
     if (plen < HEADERLEN)
-	return 0;
+    return 0;
     pstart = p;
     GETCHAR(code, p);
     GETCHAR(id, p);
     GETSHORT(len, p);
     if (len < HEADERLEN || len > plen)
-	return 0;
+    return 0;
 
    if (code >= 1 && code <= (int)LWIP_ARRAYSIZE(lcp_codenames))
-	printer(arg, " %s", lcp_codenames[code-1]);
+    printer(arg, " %s", lcp_codenames[code-1]);
     else
-	printer(arg, " code=0x%x", code);
+    printer(arg, " code=0x%x", code);
     printer(arg, " id=0x%x", id);
     len -= HEADERLEN;
     switch (code) {
@@ -2408,224 +2408,224 @@ static int lcp_printpkt(const u_char *p, int plen,
     case CONFACK:
     case CONFNAK:
     case CONFREJ:
-	/* print option list */
-	while (len >= 2) {
-	    GETCHAR(code, p);
-	    GETCHAR(olen, p);
-	    p -= 2;
-	    if (olen < 2 || olen > len) {
-		break;
-	    }
-	    printer(arg, " <");
-	    len -= olen;
-	    optend = p + olen;
-	    switch (code) {
-	    case CI_MRU:
-		if (olen == CILEN_SHORT) {
-		    p += 2;
-		    GETSHORT(cishort, p);
-		    printer(arg, "mru %d", cishort);
-		}
-		break;
-	    case CI_ASYNCMAP:
-		if (olen == CILEN_LONG) {
-		    p += 2;
-		    GETLONG(cilong, p);
-		    printer(arg, "asyncmap 0x%x", cilong);
-		}
-		break;
-	    case CI_AUTHTYPE:
-		if (olen >= CILEN_SHORT) {
-		    p += 2;
-		    printer(arg, "auth ");
-		    GETSHORT(cishort, p);
-		    switch (cishort) {
+    /* print option list */
+    while (len >= 2) {
+        GETCHAR(code, p);
+        GETCHAR(olen, p);
+        p -= 2;
+        if (olen < 2 || olen > len) {
+        break;
+        }
+        printer(arg, " <");
+        len -= olen;
+        optend = p + olen;
+        switch (code) {
+        case CI_MRU:
+        if (olen == CILEN_SHORT) {
+            p += 2;
+            GETSHORT(cishort, p);
+            printer(arg, "mru %d", cishort);
+        }
+        break;
+        case CI_ASYNCMAP:
+        if (olen == CILEN_LONG) {
+            p += 2;
+            GETLONG(cilong, p);
+            printer(arg, "asyncmap 0x%x", cilong);
+        }
+        break;
+        case CI_AUTHTYPE:
+        if (olen >= CILEN_SHORT) {
+            p += 2;
+            printer(arg, "auth ");
+            GETSHORT(cishort, p);
+            switch (cishort) {
 #if PAP_SUPPORT
-		    case PPP_PAP:
-			printer(arg, "pap");
-			break;
+            case PPP_PAP:
+            printer(arg, "pap");
+            break;
 #endif /* PAP_SUPPORT */
 #if CHAP_SUPPORT
-		    case PPP_CHAP:
-			printer(arg, "chap");
-			if (p < optend) {
-			    switch (*p) {
-			    case CHAP_MD5:
-				printer(arg, " MD5");
-				++p;
-				break;
+            case PPP_CHAP:
+            printer(arg, "chap");
+            if (p < optend) {
+                switch (*p) {
+                case CHAP_MD5:
+                printer(arg, " MD5");
+                ++p;
+                break;
 #if MSCHAP_SUPPORT
-			    case CHAP_MICROSOFT:
-				printer(arg, " MS");
-				++p;
-				break;
-
-			    case CHAP_MICROSOFT_V2:
-				printer(arg, " MS-v2");
-				++p;
-				break;
+                case CHAP_MICROSOFT:
+                printer(arg, " MS");
+                ++p;
+                break;
+
+                case CHAP_MICROSOFT_V2:
+                printer(arg, " MS-v2");
+                ++p;
+                break;
 #endif /* MSCHAP_SUPPORT */
-			    default:
-				break;
-			    }
-			}
-			break;
+                default:
+                break;
+                }
+            }
+            break;
 #endif /* CHAP_SUPPORT */
 #if EAP_SUPPORT
-		    case PPP_EAP:
-			printer(arg, "eap");
-			break;
+            case PPP_EAP:
+            printer(arg, "eap");
+            break;
 #endif /* EAP_SUPPORT */
-		    default:
-			printer(arg, "0x%x", cishort);
-		    }
-		}
-		break;
+            default:
+            printer(arg, "0x%x", cishort);
+            }
+        }
+        break;
 #if LQR_SUPPORT
-	    case CI_QUALITY:
-		if (olen >= CILEN_SHORT) {
-		    p += 2;
-		    printer(arg, "quality ");
-		    GETSHORT(cishort, p);
-		    switch (cishort) {
-		    case PPP_LQR:
-			printer(arg, "lqr");
-			break;
-		    default:
-			printer(arg, "0x%x", cishort);
-		    }
-		}
-		break;
+        case CI_QUALITY:
+        if (olen >= CILEN_SHORT) {
+            p += 2;
+            printer(arg, "quality ");
+            GETSHORT(cishort, p);
+            switch (cishort) {
+            case PPP_LQR:
+            printer(arg, "lqr");
+            break;
+            default:
+            printer(arg, "0x%x", cishort);
+            }
+        }
+        break;
 #endif /* LQR_SUPPORT */
-	    case CI_CALLBACK:
-		if (olen >= CILEN_CHAR) {
-		    p += 2;
-		    printer(arg, "callback ");
-		    GETCHAR(cishort, p);
-		    switch (cishort) {
-		    case CBCP_OPT:
-			printer(arg, "CBCP");
-			break;
-		    default:
-			printer(arg, "0x%x", cishort);
-		    }
-		}
-		break;
-	    case CI_MAGICNUMBER:
-		if (olen == CILEN_LONG) {
-		    p += 2;
-		    GETLONG(cilong, p);
-		    printer(arg, "magic 0x%x", cilong);
-		}
-		break;
-	    case CI_PCOMPRESSION:
-		if (olen == CILEN_VOID) {
-		    p += 2;
-		    printer(arg, "pcomp");
-		}
-		break;
-	    case CI_ACCOMPRESSION:
-		if (olen == CILEN_VOID) {
-		    p += 2;
-		    printer(arg, "accomp");
-		}
-		break;
-	    case CI_MRRU:
-		if (olen == CILEN_SHORT) {
-		    p += 2;
-		    GETSHORT(cishort, p);
-		    printer(arg, "mrru %d", cishort);
-		}
-		break;
-	    case CI_SSNHF:
-		if (olen == CILEN_VOID) {
-		    p += 2;
-		    printer(arg, "ssnhf");
-		}
-		break;
-	    case CI_EPDISC:
+        case CI_CALLBACK:
+        if (olen >= CILEN_CHAR) {
+            p += 2;
+            printer(arg, "callback ");
+            GETCHAR(cishort, p);
+            switch (cishort) {
+            case CBCP_OPT:
+            printer(arg, "CBCP");
+            break;
+            default:
+            printer(arg, "0x%x", cishort);
+            }
+        }
+        break;
+        case CI_MAGICNUMBER:
+        if (olen == CILEN_LONG) {
+            p += 2;
+            GETLONG(cilong, p);
+            printer(arg, "magic 0x%x", cilong);
+        }
+        break;
+        case CI_PCOMPRESSION:
+        if (olen == CILEN_VOID) {
+            p += 2;
+            printer(arg, "pcomp");
+        }
+        break;
+        case CI_ACCOMPRESSION:
+        if (olen == CILEN_VOID) {
+            p += 2;
+            printer(arg, "accomp");
+        }
+        break;
+        case CI_MRRU:
+        if (olen == CILEN_SHORT) {
+            p += 2;
+            GETSHORT(cishort, p);
+            printer(arg, "mrru %d", cishort);
+        }
+        break;
+        case CI_SSNHF:
+        if (olen == CILEN_VOID) {
+            p += 2;
+            printer(arg, "ssnhf");
+        }
+        break;
+        case CI_EPDISC:
 #ifdef HAVE_MULTILINK
-		if (olen >= CILEN_CHAR) {
-		    struct epdisc epd;
-		    p += 2;
-		    GETCHAR(epd.class, p);
-		    epd.length = olen - CILEN_CHAR;
-		    if (epd.length > MAX_ENDP_LEN)
-			epd.length = MAX_ENDP_LEN;
-		    if (epd.length > 0) {
-			MEMCPY(epd.value, p, epd.length);
-			p += epd.length;
-		    }
-		    printer(arg, "endpoint [%s]", epdisc_to_str(&epd));
-		}
+        if (olen >= CILEN_CHAR) {
+            struct epdisc epd;
+            p += 2;
+            GETCHAR(epd.class, p);
+            epd.length = olen - CILEN_CHAR;
+            if (epd.length > MAX_ENDP_LEN)
+            epd.length = MAX_ENDP_LEN;
+            if (epd.length > 0) {
+            MEMCPY(epd.value, p, epd.length);
+            p += epd.length;
+            }
+            printer(arg, "endpoint [%s]", epdisc_to_str(&epd));
+        }
 #else
-		printer(arg, "endpoint");
+        printer(arg, "endpoint");
 #endif
-		break;
-	    default:
-		break;
-	    }
-	    while (p < optend) {
-		GETCHAR(code, p);
-		printer(arg, " %.2x", code);
-	    }
-	    printer(arg, ">");
-	}
-	break;
+        break;
+        default:
+        break;
+        }
+        while (p < optend) {
+        GETCHAR(code, p);
+        printer(arg, " %.2x", code);
+        }
+        printer(arg, ">");
+    }
+    break;
 
     case TERMACK:
     case TERMREQ:
-	if (len > 0 && *p >= ' ' && *p < 0x7f) {
-	    printer(arg, " ");
-	    ppp_print_string(p, len, printer, arg);
-	    p += len;
-	    len = 0;
-	}
-	break;
+    if (len > 0 && *p >= ' ' && *p < 0x7f) {
+        printer(arg, " ");
+        ppp_print_string(p, len, printer, arg);
+        p += len;
+        len = 0;
+    }
+    break;
 
     case ECHOREQ:
     case ECHOREP:
     case DISCREQ:
-	if (len >= 4) {
-	    GETLONG(cilong, p);
-	    printer(arg, " magic=0x%x", cilong);
-	    len -= 4;
-	}
-	break;
+    if (len >= 4) {
+        GETLONG(cilong, p);
+        printer(arg, " magic=0x%x", cilong);
+        len -= 4;
+    }
+    break;
 
     case IDENTIF:
     case TIMEREM:
-	if (len >= 4) {
-	    GETLONG(cilong, p);
-	    printer(arg, " magic=0x%x", cilong);
-	    len -= 4;
-	}
-	if (code == TIMEREM) {
-	    if (len < 4)
-		break;
-	    GETLONG(cilong, p);
-	    printer(arg, " seconds=%u", cilong);
-	    len -= 4;
-	}
-	if (len > 0) {
-	    printer(arg, " ");
-	    ppp_print_string(p, len, printer, arg);
-	    p += len;
-	    len = 0;
-	}
-	break;
+    if (len >= 4) {
+        GETLONG(cilong, p);
+        printer(arg, " magic=0x%x", cilong);
+        len -= 4;
+    }
+    if (code == TIMEREM) {
+        if (len < 4)
+        break;
+        GETLONG(cilong, p);
+        printer(arg, " seconds=%u", cilong);
+        len -= 4;
+    }
+    if (len > 0) {
+        printer(arg, " ");
+        ppp_print_string(p, len, printer, arg);
+        p += len;
+        len = 0;
+    }
+    break;
     default:
-	break;
+    break;
     }
 
     /* print the rest of the bytes in the packet */
     for (i = 0; i < len && i < 32; ++i) {
-	GETCHAR(code, p);
-	printer(arg, " %.2x", code);
+    GETCHAR(code, p);
+    printer(arg, " %.2x", code);
     }
     if (i < len) {
-	printer(arg, " ...");
-	p += len - i;
+    printer(arg, " ...");
+    p += len - i;
     }
 
     return p - pstart;
@@ -2639,10 +2639,10 @@ static int lcp_printpkt(const u_char *p, int plen,
 static void LcpLinkFailure(fsm *f) {
     ppp_pcb *pcb = f->pcb;
     if (f->state == PPP_FSM_OPENED) {
-	ppp_info(("No response to %d echo-requests", pcb->lcp_echos_pending));
+    ppp_info(("No response to %d echo-requests", pcb->lcp_echos_pending));
         ppp_notice(("Serial link appears to be disconnected."));
-	pcb->err_code = PPPERR_PEERDEAD;
-	lcp_close(pcb, "Peer not responding");
+    pcb->err_code = PPPERR_PEERDEAD;
+    lcp_close(pcb, "Peer not responding");
     }
 }
 
@@ -2655,13 +2655,13 @@ static void LcpEchoCheck(fsm *f) {
 
     LcpSendEchoRequest (f);
     if (f->state != PPP_FSM_OPENED)
-	return;
+    return;
 
     /*
      * Start the timer for the next interval.
      */
     if (pcb->lcp_echo_timer_running)
-	ppp_warn(("assertion lcp_echo_timer_running==0 failed"));
+    ppp_warn(("assertion lcp_echo_timer_running==0 failed"));
     TIMEOUT (LcpEchoTimeout, f, pcb->settings.lcp_echo_interval);
     pcb->lcp_echo_timer_running = 1;
 }
@@ -2691,14 +2691,14 @@ static void lcp_received_echo_reply(fsm *f, int id, u_char *inp, int len) {
 
     /* Check the magic number - don't count replies from ourselves. */
     if (len < 4) {
-	ppp_dbglog(("lcp: received short Echo-Reply, length %d", len));
-	return;
+    ppp_dbglog(("lcp: received short Echo-Reply, length %d", len));
+    return;
     }
     GETLONG(magic_val, inp);
     if (go->neg_magicnumber
-	&& magic_val == go->magicnumber) {
-	ppp_warn(("appear to have received our own echo-reply!"));
-	return;
+    && magic_val == go->magicnumber) {
+    ppp_warn(("appear to have received our own echo-reply!"));
+    return;
     }
 
     /* Reset the number of outstanding echo frames */
@@ -2722,7 +2722,7 @@ static void LcpSendEchoRequest(fsm *f) {
         if (pcb->lcp_echos_pending >= pcb->settings.lcp_echo_fails) {
             LcpLinkFailure(f);
             pcb->lcp_echos_pending = 0;
-	}
+    }
     }
 
 #if PPP_LCP_ADAPTIVE
@@ -2731,17 +2731,17 @@ static void LcpSendEchoRequest(fsm *f) {
      * no traffic was received since the last one.
      */
     if (pcb->settings.lcp_echo_adaptive) {
-	static unsigned int last_pkts_in = 0;
+    static unsigned int last_pkts_in = 0;
 
 #if PPP_STATS_SUPPORT
-	update_link_stats(f->unit);
-	link_stats_valid = 0;
+    update_link_stats(f->unit);
+    link_stats_valid = 0;
 #endif /* PPP_STATS_SUPPORT */
 
-	if (link_stats.pkts_in != last_pkts_in) {
-	    last_pkts_in = link_stats.pkts_in;
-	    return;
-	}
+    if (link_stats.pkts_in != last_pkts_in) {
+        last_pkts_in = link_stats.pkts_in;
+        return;
+    }
     }
 #endif
 
@@ -2750,10 +2750,10 @@ static void LcpSendEchoRequest(fsm *f) {
      */
     if (f->state == PPP_FSM_OPENED) {
         lcp_magic = go->magicnumber;
-	pktp = pkt;
-	PUTLONG(lcp_magic, pktp);
+    pktp = pkt;
+    PUTLONG(lcp_magic, pktp);
         fsm_sdata(f, ECHOREQ, pcb->lcp_echo_number++, pkt, pktp - pkt);
-	++pcb->lcp_echos_pending;
+    ++pcb->lcp_echos_pending;
     }
 }
 
@@ -2768,7 +2768,7 @@ static void lcp_echo_lowerup(ppp_pcb *pcb) {
     pcb->lcp_echos_pending      = 0;
     pcb->lcp_echo_number        = 0;
     pcb->lcp_echo_timer_running = 0;
-  
+
     /* If a timeout interval is specified then start the timer */
     if (pcb->settings.lcp_echo_interval != 0)
         LcpEchoCheck (f);
diff --git a/src/netif/ppp/mppe.c b/src/netif/ppp/mppe.c
index 4cca89de..6e9ffe67 100644
--- a/src/netif/ppp/mppe.c
+++ b/src/netif/ppp/mppe.c
@@ -39,20 +39,20 @@
 #define SHA1_SIGNATURE_SIZE 20
 
 /* ppp_mppe_state.bits definitions */
-#define MPPE_BIT_A	0x80	/* Encryption table were (re)inititalized */
-#define MPPE_BIT_B	0x40	/* MPPC only (not implemented) */
-#define MPPE_BIT_C	0x20	/* MPPC only (not implemented) */
-#define MPPE_BIT_D	0x10	/* This is an encrypted frame */
+#define MPPE_BIT_A  0x80    /* Encryption table were (re)inititalized */
+#define MPPE_BIT_B  0x40    /* MPPC only (not implemented) */
+#define MPPE_BIT_C  0x20    /* MPPC only (not implemented) */
+#define MPPE_BIT_D  0x10    /* This is an encrypted frame */
 
-#define MPPE_BIT_FLUSHED	MPPE_BIT_A
-#define MPPE_BIT_ENCRYPTED	MPPE_BIT_D
+#define MPPE_BIT_FLUSHED    MPPE_BIT_A
+#define MPPE_BIT_ENCRYPTED  MPPE_BIT_D
 
 #define MPPE_BITS(p) ((p)[0] & 0xf0)
 #define MPPE_CCOUNT(p) ((((p)[0] & 0x0f) << 8) + (p)[1])
-#define MPPE_CCOUNT_SPACE 0x1000	/* The size of the ccount space */
+#define MPPE_CCOUNT_SPACE 0x1000    /* The size of the ccount space */
 
-#define MPPE_OVHD	2	/* MPPE overhead/packet */
-#define SANITY_MAX	1600	/* Max bogon factor we will tolerate */
+#define MPPE_OVHD   2   /* MPPE overhead/packet */
+#define SANITY_MAX  1600    /* Max bogon factor we will tolerate */
 
 /*
  * Perform the MPPE rekey algorithm, from RFC 3078, sec. 7.3.
@@ -60,37 +60,37 @@
  */
 static void mppe_rekey(ppp_mppe_state * state, int initial_key)
 {
-	lwip_sha1_context sha1_ctx;
-	u8_t sha1_digest[SHA1_SIGNATURE_SIZE];
-
-	/*
-	 * Key Derivation, from RFC 3078, RFC 3079.
-	 * Equivalent to Get_Key() for MS-CHAP as described in RFC 3079.
-	 */
-	lwip_sha1_init(&sha1_ctx);
-	lwip_sha1_starts(&sha1_ctx);
-	lwip_sha1_update(&sha1_ctx, state->master_key, state->keylen);
-	lwip_sha1_update(&sha1_ctx, mppe_sha1_pad1, SHA1_PAD_SIZE);
-	lwip_sha1_update(&sha1_ctx, state->session_key, state->keylen);
-	lwip_sha1_update(&sha1_ctx, mppe_sha1_pad2, SHA1_PAD_SIZE);
-	lwip_sha1_finish(&sha1_ctx, sha1_digest);
-	lwip_sha1_free(&sha1_ctx);
-	MEMCPY(state->session_key, sha1_digest, state->keylen);
-
-	if (!initial_key) {
-		lwip_arc4_init(&state->arc4);
-		lwip_arc4_setup(&state->arc4, sha1_digest, state->keylen);
-		lwip_arc4_crypt(&state->arc4, state->session_key, state->keylen);
-		lwip_arc4_free(&state->arc4);
-	}
-	if (state->keylen == 8) {
-		/* See RFC 3078 */
-		state->session_key[0] = 0xd1;
-		state->session_key[1] = 0x26;
-		state->session_key[2] = 0x9e;
-	}
-	lwip_arc4_init(&state->arc4);
-	lwip_arc4_setup(&state->arc4, state->session_key, state->keylen);
+    lwip_sha1_context sha1_ctx;
+    u8_t sha1_digest[SHA1_SIGNATURE_SIZE];
+
+    /*
+     * Key Derivation, from RFC 3078, RFC 3079.
+     * Equivalent to Get_Key() for MS-CHAP as described in RFC 3079.
+     */
+    lwip_sha1_init(&sha1_ctx);
+    lwip_sha1_starts(&sha1_ctx);
+    lwip_sha1_update(&sha1_ctx, state->master_key, state->keylen);
+    lwip_sha1_update(&sha1_ctx, mppe_sha1_pad1, SHA1_PAD_SIZE);
+    lwip_sha1_update(&sha1_ctx, state->session_key, state->keylen);
+    lwip_sha1_update(&sha1_ctx, mppe_sha1_pad2, SHA1_PAD_SIZE);
+    lwip_sha1_finish(&sha1_ctx, sha1_digest);
+    lwip_sha1_free(&sha1_ctx);
+    MEMCPY(state->session_key, sha1_digest, state->keylen);
+
+    if (!initial_key) {
+        lwip_arc4_init(&state->arc4);
+        lwip_arc4_setup(&state->arc4, sha1_digest, state->keylen);
+        lwip_arc4_crypt(&state->arc4, state->session_key, state->keylen);
+        lwip_arc4_free(&state->arc4);
+    }
+    if (state->keylen == 8) {
+        /* See RFC 3078 */
+        state->session_key[0] = 0xd1;
+        state->session_key[1] = 0x26;
+        state->session_key[2] = 0x9e;
+    }
+    lwip_arc4_init(&state->arc4);
+    lwip_arc4_setup(&state->arc4, state->session_key, state->keylen);
 }
 
 /*
@@ -98,8 +98,8 @@ static void mppe_rekey(ppp_mppe_state * state, int initial_key)
  * don't have to keep multiple copies of keys.
  */
 void mppe_set_key(ppp_pcb *pcb, ppp_mppe_state *state, u8_t *key) {
-	LWIP_UNUSED_ARG(pcb);
-	MEMCPY(state->master_key, key, MPPE_MAX_KEY_LEN);
+    LWIP_UNUSED_ARG(pcb);
+    MEMCPY(state->master_key, key, MPPE_MAX_KEY_LEN);
 }
 
 /*
@@ -109,64 +109,64 @@ void
 mppe_init(ppp_pcb *pcb, ppp_mppe_state *state, u8_t options)
 {
 #if PPP_DEBUG
-	const u8_t *debugstr = (const u8_t*)"mppe_comp_init";
-	if (&pcb->mppe_decomp == state) {
-	    debugstr = (const u8_t*)"mppe_decomp_init";
-	}
+    const u8_t *debugstr = (const u8_t*)"mppe_comp_init";
+    if (&pcb->mppe_decomp == state) {
+        debugstr = (const u8_t*)"mppe_decomp_init";
+    }
 #endif /* PPP_DEBUG */
 
-	/* Save keys. */
-	MEMCPY(state->session_key, state->master_key, sizeof(state->master_key));
-
-	if (options & MPPE_OPT_128)
-		state->keylen = 16;
-	else if (options & MPPE_OPT_40)
-		state->keylen = 8;
-	else {
-		PPPDEBUG(LOG_DEBUG, ("%s[%d]: unknown key length\n", debugstr,
-			pcb->netif->num));
-		lcp_close(pcb, "MPPE required but peer negotiation failed");
-		return;
-	}
-	if (options & MPPE_OPT_STATEFUL)
-		state->stateful = 1;
-
-	/* Generate the initial session key. */
-	mppe_rekey(state, 1);
+    /* Save keys. */
+    MEMCPY(state->session_key, state->master_key, sizeof(state->master_key));
+
+    if (options & MPPE_OPT_128)
+        state->keylen = 16;
+    else if (options & MPPE_OPT_40)
+        state->keylen = 8;
+    else {
+        PPPDEBUG(LOG_DEBUG, ("%s[%d]: unknown key length\n", debugstr,
+            pcb->netif->num));
+        lcp_close(pcb, "MPPE required but peer negotiation failed");
+        return;
+    }
+    if (options & MPPE_OPT_STATEFUL)
+        state->stateful = 1;
+
+    /* Generate the initial session key. */
+    mppe_rekey(state, 1);
 
 #if PPP_DEBUG
-	{
-		int i;
-		char mkey[sizeof(state->master_key) * 2 + 1];
-		char skey[sizeof(state->session_key) * 2 + 1];
-
-		PPPDEBUG(LOG_DEBUG, ("%s[%d]: initialized with %d-bit %s mode\n",
-		       debugstr, pcb->netif->num, (state->keylen == 16) ? 128 : 40,
-		       (state->stateful) ? "stateful" : "stateless"));
-
-		for (i = 0; i < (int)sizeof(state->master_key); i++)
-			sprintf(mkey + i * 2, "%02x", state->master_key[i]);
-		for (i = 0; i < (int)sizeof(state->session_key); i++)
-			sprintf(skey + i * 2, "%02x", state->session_key[i]);
-		PPPDEBUG(LOG_DEBUG,
-		       ("%s[%d]: keys: master: %s initial session: %s\n",
-		       debugstr, pcb->netif->num, mkey, skey));
-	}
+    {
+        int i;
+        char mkey[sizeof(state->master_key) * 2 + 1];
+        char skey[sizeof(state->session_key) * 2 + 1];
+
+        PPPDEBUG(LOG_DEBUG, ("%s[%d]: initialized with %d-bit %s mode\n",
+               debugstr, pcb->netif->num, (state->keylen == 16) ? 128 : 40,
+               (state->stateful) ? "stateful" : "stateless"));
+
+        for (i = 0; i < (int)sizeof(state->master_key); i++)
+            sprintf(mkey + i * 2, "%02x", state->master_key[i]);
+        for (i = 0; i < (int)sizeof(state->session_key); i++)
+            sprintf(skey + i * 2, "%02x", state->session_key[i]);
+        PPPDEBUG(LOG_DEBUG,
+               ("%s[%d]: keys: master: %s initial session: %s\n",
+               debugstr, pcb->netif->num, mkey, skey));
+    }
 #endif /* PPP_DEBUG */
 
-	/*
-	 * Initialize the coherency count.  The initial value is not specified
-	 * in RFC 3078, but we can make a reasonable assumption that it will
-	 * start at 0.  Setting it to the max here makes the comp/decomp code
-	 * do the right thing (determined through experiment).
-	 */
-	state->ccount = MPPE_CCOUNT_SPACE - 1;
-
-	/*
-	 * Note that even though we have initialized the key table, we don't
-	 * set the FLUSHED bit.  This is contrary to RFC 3078, sec. 3.1.
-	 */
-	state->bits = MPPE_BIT_ENCRYPTED;
+    /*
+     * Initialize the coherency count.  The initial value is not specified
+     * in RFC 3078, but we can make a reasonable assumption that it will
+     * start at 0.  Setting it to the max here makes the comp/decomp code
+     * do the right thing (determined through experiment).
+     */
+    state->ccount = MPPE_CCOUNT_SPACE - 1;
+
+    /*
+     * Note that even though we have initialized the key table, we don't
+     * set the FLUSHED bit.  This is contrary to RFC 3078, sec. 3.1.
+     */
+    state->bits = MPPE_BIT_ENCRYPTED;
 }
 
 /*
@@ -180,8 +180,8 @@ mppe_init(ppp_pcb *pcb, ppp_mppe_state *state, u8_t options)
  */
 void mppe_comp_reset(ppp_pcb *pcb, ppp_mppe_state *state)
 {
-	LWIP_UNUSED_ARG(pcb);
-	state->bits |= MPPE_BIT_FLUSHED;
+    LWIP_UNUSED_ARG(pcb);
+    state->bits |= MPPE_BIT_FLUSHED;
 }
 
 /*
@@ -192,74 +192,74 @@ void mppe_comp_reset(ppp_pcb *pcb, ppp_mppe_state *state)
 err_t
 mppe_compress(ppp_pcb *pcb, ppp_mppe_state *state, struct pbuf **pb, u16_t protocol)
 {
-	struct pbuf *n, *np;
-	u8_t *pl;
-	err_t err;
-
-	LWIP_UNUSED_ARG(pcb);
-
-	/* TCP stack requires that we don't change the packet payload, therefore we copy
-	 * the whole packet before encryption.
-	 */
-	np = pbuf_alloc(PBUF_RAW, MPPE_OVHD + sizeof(protocol) + (*pb)->tot_len, PBUF_RAM);
-	if (!np) {
-		return ERR_MEM;
-	}
-
-	/* Hide MPPE header + protocol */
-	pbuf_remove_header(np, MPPE_OVHD + sizeof(protocol));
-
-	if ((err = pbuf_copy(np, *pb)) != ERR_OK) {
-		pbuf_free(np);
-		return err;
-	}
-
-	/* Reveal MPPE header + protocol */
-	pbuf_add_header(np, MPPE_OVHD + sizeof(protocol));
-
-	*pb = np;
-	pl = (u8_t*)np->payload;
-
-	state->ccount = (state->ccount + 1) % MPPE_CCOUNT_SPACE;
-	PPPDEBUG(LOG_DEBUG, ("mppe_compress[%d]: ccount %d\n", pcb->netif->num, state->ccount));
-	/* FIXME: use PUT* macros */
-	pl[0] = state->ccount>>8;
-	pl[1] = state->ccount;
-
-	if (!state->stateful ||	/* stateless mode     */
-	    ((state->ccount & 0xff) == 0xff) ||	/* "flag" packet      */
-	    (state->bits & MPPE_BIT_FLUSHED)) {	/* CCP Reset-Request  */
-		/* We must rekey */
-		if (state->stateful) {
-			PPPDEBUG(LOG_DEBUG, ("mppe_compress[%d]: rekeying\n", pcb->netif->num));
-		}
-		mppe_rekey(state, 0);
-		state->bits |= MPPE_BIT_FLUSHED;
-	}
-	pl[0] |= state->bits;
-	state->bits &= ~MPPE_BIT_FLUSHED;	/* reset for next xmit */
-	pl += MPPE_OVHD;
-
-	/* Add protocol */
-	/* FIXME: add PFC support */
-	pl[0] = protocol >> 8;
-	pl[1] = protocol;
-
-	/* Hide MPPE header */
-	pbuf_remove_header(np, MPPE_OVHD);
-
-	/* Encrypt packet */
-	for (n = np; n != NULL; n = n->next) {
-		lwip_arc4_crypt(&state->arc4, (u8_t*)n->payload, n->len);
-		if (n->tot_len == n->len) {
-			break;
-		}
-	}
-
-	/* Reveal MPPE header */
-	pbuf_add_header(np, MPPE_OVHD);
-
-	return ERR_OK;
+    struct pbuf *n, *np;
+    u8_t *pl;
+    err_t err;
+
+    LWIP_UNUSED_ARG(pcb);
+
+    /* TCP stack requires that we don't change the packet payload, therefore we copy
+     * the whole packet before encryption.
+     */
+    np = pbuf_alloc(PBUF_RAW, MPPE_OVHD + sizeof(protocol) + (*pb)->tot_len, PBUF_RAM);
+    if (!np) {
+        return ERR_MEM;
+    }
+
+    /* Hide MPPE header + protocol */
+    pbuf_remove_header(np, MPPE_OVHD + sizeof(protocol));
+
+    if ((err = pbuf_copy(np, *pb)) != ERR_OK) {
+        pbuf_free(np);
+        return err;
+    }
+
+    /* Reveal MPPE header + protocol */
+    pbuf_add_header(np, MPPE_OVHD + sizeof(protocol));
+
+    *pb = np;
+    pl = (u8_t*)np->payload;
+
+    state->ccount = (state->ccount + 1) % MPPE_CCOUNT_SPACE;
+    PPPDEBUG(LOG_DEBUG, ("mppe_compress[%d]: ccount %d\n", pcb->netif->num, state->ccount));
+    /* FIXME: use PUT* macros */
+    pl[0] = state->ccount>>8;
+    pl[1] = state->ccount;
+
+    if (!state->stateful || /* stateless mode     */
+        ((state->ccount & 0xff) == 0xff) || /* "flag" packet      */
+        (state->bits & MPPE_BIT_FLUSHED)) { /* CCP Reset-Request  */
+        /* We must rekey */
+        if (state->stateful) {
+            PPPDEBUG(LOG_DEBUG, ("mppe_compress[%d]: rekeying\n", pcb->netif->num));
+        }
+        mppe_rekey(state, 0);
+        state->bits |= MPPE_BIT_FLUSHED;
+    }
+    pl[0] |= state->bits;
+    state->bits &= ~MPPE_BIT_FLUSHED;   /* reset for next xmit */
+    pl += MPPE_OVHD;
+
+    /* Add protocol */
+    /* FIXME: add PFC support */
+    pl[0] = protocol >> 8;
+    pl[1] = protocol;
+
+    /* Hide MPPE header */
+    pbuf_remove_header(np, MPPE_OVHD);
+
+    /* Encrypt packet */
+    for (n = np; n != NULL; n = n->next) {
+        lwip_arc4_crypt(&state->arc4, (u8_t*)n->payload, n->len);
+        if (n->tot_len == n->len) {
+            break;
+        }
+    }
+
+    /* Reveal MPPE header */
+    pbuf_add_header(np, MPPE_OVHD);
+
+    return ERR_OK;
 }
 
 /*
@@ -267,9 +267,9 @@ mppe_compress(ppp_pcb *pcb, ppp_mppe_state *state, struct pbuf **pb, u16_t proto
  */
 void mppe_decomp_reset(ppp_pcb *pcb, ppp_mppe_state *state)
 {
-	LWIP_UNUSED_ARG(pcb);
-	LWIP_UNUSED_ARG(state);
-	return;
+    LWIP_UNUSED_ARG(pcb);
+    LWIP_UNUSED_ARG(state);
+    return;
 }
 
 /*
@@ -278,135 +278,135 @@ void mppe_decomp_reset(ppp_pcb *pcb, ppp_mppe_state *state)
 err_t
 mppe_decompress(ppp_pcb *pcb, ppp_mppe_state *state, struct pbuf **pb)
 {
-	struct pbuf *n0 = *pb, *n;
-	u8_t *pl;
-	u16_t ccount;
-	u8_t flushed;
-
-	/* MPPE Header */
-	if (n0->len < MPPE_OVHD) {
-		PPPDEBUG(LOG_DEBUG,
-		       ("mppe_decompress[%d]: short pkt (%d)\n",
-		       pcb->netif->num, n0->len));
-		state->sanity_errors += 100;
-		goto sanity_error;
-	}
-
-	pl = (u8_t*)n0->payload;
-	flushed = MPPE_BITS(pl) & MPPE_BIT_FLUSHED;
-	ccount = MPPE_CCOUNT(pl);
-	PPPDEBUG(LOG_DEBUG, ("mppe_decompress[%d]: ccount %d\n",
-	       pcb->netif->num, ccount));
-
-	/* sanity checks -- terminate with extreme prejudice */
-	if (!(MPPE_BITS(pl) & MPPE_BIT_ENCRYPTED)) {
-		PPPDEBUG(LOG_DEBUG,
-		       ("mppe_decompress[%d]: ENCRYPTED bit not set!\n",
-		       pcb->netif->num));
-		state->sanity_errors += 100;
-		goto sanity_error;
-	}
-	if (!state->stateful && !flushed) {
-		PPPDEBUG(LOG_DEBUG, ("mppe_decompress[%d]: FLUSHED bit not set in "
-		       "stateless mode!\n", pcb->netif->num));
-		state->sanity_errors += 100;
-		goto sanity_error;
-	}
-	if (state->stateful && ((ccount & 0xff) == 0xff) && !flushed) {
-		PPPDEBUG(LOG_DEBUG, ("mppe_decompress[%d]: FLUSHED bit not set on "
-		       "flag packet!\n", pcb->netif->num));
-		state->sanity_errors += 100;
-		goto sanity_error;
-	}
-
-	/*
-	 * Check the coherency count.
-	 */
-
-	if (!state->stateful) {
-		/* Discard late packet */
-		if ((ccount - state->ccount) % MPPE_CCOUNT_SPACE > MPPE_CCOUNT_SPACE / 2) {
-			state->sanity_errors++;
-			goto sanity_error;
-		}
-
-		/* RFC 3078, sec 8.1.  Rekey for every packet. */
-		while (state->ccount != ccount) {
-			mppe_rekey(state, 0);
-			state->ccount = (state->ccount + 1) % MPPE_CCOUNT_SPACE;
-		}
-	} else {
-		/* RFC 3078, sec 8.2. */
-		if (!state->discard) {
-			/* normal state */
-			state->ccount = (state->ccount + 1) % MPPE_CCOUNT_SPACE;
-			if (ccount != state->ccount) {
-				/*
-				 * (ccount > state->ccount)
-				 * Packet loss detected, enter the discard state.
-				 * Signal the peer to rekey (by sending a CCP Reset-Request).
-				 */
-				state->discard = 1;
-				ccp_resetrequest(pcb);
-				return ERR_BUF;
-			}
-		} else {
-			/* discard state */
-			if (!flushed) {
-				/* ccp.c will be silent (no additional CCP Reset-Requests). */
-				return ERR_BUF;
-			} else {
-				/* Rekey for every missed "flag" packet. */
-				while ((ccount & ~0xff) !=
-				       (state->ccount & ~0xff)) {
-					mppe_rekey(state, 0);
-					state->ccount =
-					    (state->ccount +
-					     256) % MPPE_CCOUNT_SPACE;
-				}
-
-				/* reset */
-				state->discard = 0;
-				state->ccount = ccount;
-				/*
-				 * Another problem with RFC 3078 here.  It implies that the
-				 * peer need not send a Reset-Ack packet.  But RFC 1962
-				 * requires it.  Hopefully, M$ does send a Reset-Ack; even
-				 * though it isn't required for MPPE synchronization, it is
-				 * required to reset CCP state.
-				 */
-			}
-		}
-		if (flushed)
-			mppe_rekey(state, 0);
-	}
-
-	/* Hide MPPE header */
-	pbuf_remove_header(n0, MPPE_OVHD);
-
-	/* Decrypt the packet. */
-	for (n = n0; n != NULL; n = n->next) {
-		lwip_arc4_crypt(&state->arc4, (u8_t*)n->payload, n->len);
-		if (n->tot_len == n->len) {
-			break;
-		}
-	}
-
-	/* good packet credit */
-	state->sanity_errors >>= 1;
-
-	return ERR_OK;
+    struct pbuf *n0 = *pb, *n;
+    u8_t *pl;
+    u16_t ccount;
+    u8_t flushed;
+
+    /* MPPE Header */
+    if (n0->len < MPPE_OVHD) {
+        PPPDEBUG(LOG_DEBUG,
+               ("mppe_decompress[%d]: short pkt (%d)\n",
+               pcb->netif->num, n0->len));
+        state->sanity_errors += 100;
+        goto sanity_error;
+    }
+
+    pl = (u8_t*)n0->payload;
+    flushed = MPPE_BITS(pl) & MPPE_BIT_FLUSHED;
+    ccount = MPPE_CCOUNT(pl);
+    PPPDEBUG(LOG_DEBUG, ("mppe_decompress[%d]: ccount %d\n",
+           pcb->netif->num, ccount));
+
+    /* sanity checks -- terminate with extreme prejudice */
+    if (!(MPPE_BITS(pl) & MPPE_BIT_ENCRYPTED)) {
+        PPPDEBUG(LOG_DEBUG,
+               ("mppe_decompress[%d]: ENCRYPTED bit not set!\n",
+               pcb->netif->num));
+        state->sanity_errors += 100;
+        goto sanity_error;
+    }
+    if (!state->stateful && !flushed) {
+        PPPDEBUG(LOG_DEBUG, ("mppe_decompress[%d]: FLUSHED bit not set in "
+               "stateless mode!\n", pcb->netif->num));
+        state->sanity_errors += 100;
+        goto sanity_error;
+    }
+    if (state->stateful && ((ccount & 0xff) == 0xff) && !flushed) {
+        PPPDEBUG(LOG_DEBUG, ("mppe_decompress[%d]: FLUSHED bit not set on "
+               "flag packet!\n", pcb->netif->num));
+        state->sanity_errors += 100;
+        goto sanity_error;
+    }
+
+    /*
+     * Check the coherency count.
+     */
+
+    if (!state->stateful) {
+        /* Discard late packet */
+        if ((ccount - state->ccount) % MPPE_CCOUNT_SPACE > MPPE_CCOUNT_SPACE / 2) {
+            state->sanity_errors++;
+            goto sanity_error;
+        }
+
+        /* RFC 3078, sec 8.1.  Rekey for every packet. */
+        while (state->ccount != ccount) {
+            mppe_rekey(state, 0);
+            state->ccount = (state->ccount + 1) % MPPE_CCOUNT_SPACE;
+        }
+    } else {
+        /* RFC 3078, sec 8.2. */
+        if (!state->discard) {
+            /* normal state */
+            state->ccount = (state->ccount + 1) % MPPE_CCOUNT_SPACE;
+            if (ccount != state->ccount) {
+                /*
+                 * (ccount > state->ccount)
+                 * Packet loss detected, enter the discard state.
+                 * Signal the peer to rekey (by sending a CCP Reset-Request).
+                 */
+                state->discard = 1;
+                ccp_resetrequest(pcb);
+                return ERR_BUF;
+            }
+        } else {
+            /* discard state */
+            if (!flushed) {
+                /* ccp.c will be silent (no additional CCP Reset-Requests). */
+                return ERR_BUF;
+            } else {
+                /* Rekey for every missed "flag" packet. */
+                while ((ccount & ~0xff) !=
+                       (state->ccount & ~0xff)) {
+                    mppe_rekey(state, 0);
+                    state->ccount =
+                        (state->ccount +
+                         256) % MPPE_CCOUNT_SPACE;
+                }
+
+                /* reset */
+                state->discard = 0;
+                state->ccount = ccount;
+                /*
+                 * Another problem with RFC 3078 here.  It implies that the
+                 * peer need not send a Reset-Ack packet.  But RFC 1962
+                 * requires it.  Hopefully, M$ does send a Reset-Ack; even
+                 * though it isn't required for MPPE synchronization, it is
+                 * required to reset CCP state.
+                 */
+            }
+        }
+        if (flushed)
+            mppe_rekey(state, 0);
+    }
+
+    /* Hide MPPE header */
+    pbuf_remove_header(n0, MPPE_OVHD);
+
+    /* Decrypt the packet. */
+    for (n = n0; n != NULL; n = n->next) {
+        lwip_arc4_crypt(&state->arc4, (u8_t*)n->payload, n->len);
+        if (n->tot_len == n->len) {
+            break;
+        }
+    }
+
+    /* good packet credit */
+    state->sanity_errors >>= 1;
+
+    return ERR_OK;
 
 sanity_error:
-	if (state->sanity_errors >= SANITY_MAX) {
-		/*
-		 * Take LCP down if the peer is sending too many bogons.
-		 * We don't want to do this for a single or just a few
-		 * instances since it could just be due to packet corruption.
-		 */
-		lcp_close(pcb, "Too many MPPE errors");
-	}
-	return ERR_BUF;
+    if (state->sanity_errors >= SANITY_MAX) {
+        /*
+         * Take LCP down if the peer is sending too many bogons.
+         * We don't want to do this for a single or just a few
+         * instances since it could just be due to packet corruption.
+         */
+        lcp_close(pcb, "Too many MPPE errors");
+    }
+    return ERR_BUF;
 }
 
 #endif /* PPP_SUPPORT && MPPE_SUPPORT */
diff --git a/src/netif/ppp/multilink.c b/src/netif/ppp/multilink.c
index 795d6b50..1e9280b9 100644
--- a/src/netif/ppp/multilink.c
+++ b/src/netif/ppp/multilink.c
@@ -55,11 +55,11 @@
 #include "netif/ppp/lcp.h"
 #include "netif/ppp/tdb.h"
 
-bool endpoint_specified;	/* user gave explicit endpoint discriminator */
-char *bundle_id;		/* identifier for our bundle */
-char *blinks_id;		/* key for the list of links */
-bool doing_multilink;		/* multilink was enabled and agreed to */
-bool multilink_master;		/* we own the multilink bundle */
+bool endpoint_specified;    /* user gave explicit endpoint discriminator */
+char *bundle_id;        /* identifier for our bundle */
+char *blinks_id;        /* key for the list of links */
+bool doing_multilink;       /* multilink was enabled and agreed to */
+bool multilink_master;      /* we own the multilink bundle */
 
 extern TDB_CONTEXT *pppdb;
 extern char db_key[];
@@ -72,43 +72,43 @@ static int get_default_epdisc (struct epdisc *);
 static int parse_num (char *str, const char *key, int *valp);
 static int owns_unit (TDB_DATA pid, int unit);
 
-#define set_ip_epdisc(ep, addr) do {	\
-	ep->length = 4;			\
-	ep->value[0] = addr >> 24;	\
-	ep->value[1] = addr >> 16;	\
-	ep->value[2] = addr >> 8;	\
-	ep->value[3] = addr;		\
+#define set_ip_epdisc(ep, addr) do {    \
+    ep->length = 4;         \
+    ep->value[0] = addr >> 24;  \
+    ep->value[1] = addr >> 16;  \
+    ep->value[2] = addr >> 8;   \
+    ep->value[3] = addr;        \
 } while (0)
 
-#define LOCAL_IP_ADDR(addr)						  \
-	(((addr) & 0xff000000) == 0x0a000000		/* 10.x.x.x */	  \
-	 || ((addr) & 0xfff00000) == 0xac100000		/* 172.16.x.x */  \
-	 || ((addr) & 0xffff0000) == 0xc0a80000)	/* 192.168.x.x */
+#define LOCAL_IP_ADDR(addr)                       \
+    (((addr) & 0xff000000) == 0x0a000000        /* 10.x.x.x */    \
+     || ((addr) & 0xfff00000) == 0xac100000     /* 172.16.x.x */  \
+     || ((addr) & 0xffff0000) == 0xc0a80000)    /* 192.168.x.x */
 
-#define process_exists(n)	(kill((n), 0) == 0 || errno != ESRCH)
+#define process_exists(n)   (kill((n), 0) == 0 || errno != ESRCH)
 
 void
 mp_check_options()
 {
-	lcp_options *wo = &lcp_wantoptions[0];
-	lcp_options *ao = &lcp_allowoptions[0];
-
-	doing_multilink = 0;
-	if (!multilink)
-		return;
-	/* if we're doing multilink, we have to negotiate MRRU */
-	if (!wo->neg_mrru) {
-		/* mrru not specified, default to mru */
-		wo->mrru = wo->mru;
-		wo->neg_mrru = 1;
-	}
-	ao->mrru = ao->mru;
-	ao->neg_mrru = 1;
-
-	if (!wo->neg_endpoint && !noendpoint) {
-		/* get a default endpoint value */
-		wo->neg_endpoint = get_default_epdisc(&wo->endpoint);
-	}
+    lcp_options *wo = &lcp_wantoptions[0];
+    lcp_options *ao = &lcp_allowoptions[0];
+
+    doing_multilink = 0;
+    if (!multilink)
+        return;
+    /* if we're doing multilink, we have to negotiate MRRU */
+    if (!wo->neg_mrru) {
+        /* mrru not specified, default to mru */
+        wo->mrru = wo->mru;
+        wo->neg_mrru = 1;
+    }
+    ao->mrru = ao->mru;
+    ao->neg_mrru = 1;
+
+    if (!wo->neg_endpoint && !noendpoint) {
+        /* get a default endpoint value */
+        wo->neg_endpoint = get_default_epdisc(&wo->endpoint);
+    }
 }
 
 /*
@@ -118,289 +118,289 @@ mp_check_options()
 int
 mp_join_bundle()
 {
-	lcp_options *go = &lcp_gotoptions[0];
-	lcp_options *ho = &lcp_hisoptions[0];
-	lcp_options *ao = &lcp_allowoptions[0];
-	int unit, pppd_pid;
-	int l, mtu;
-	char *p;
-	TDB_DATA key, pid, rec;
-
-	if (doing_multilink) {
-		/* have previously joined a bundle */
-		if (!go->neg_mrru || !ho->neg_mrru) {
-			notice("oops, didn't get multilink on renegotiation");
-			lcp_close(pcb, "multilink required");
-			return 0;
-		}
-		/* XXX should check the peer_authname and ho->endpoint
-		   are the same as previously */
-		return 0;
-	}
-
-	if (!go->neg_mrru || !ho->neg_mrru) {
-		/* not doing multilink */
-		if (go->neg_mrru)
-			notice("oops, multilink negotiated only for receive");
-		mtu = ho->neg_mru? ho->mru: PPP_DEFMRU;
-		if (mtu > ao->mru)
-			mtu = ao->mru;
-		if (demand) {
-			/* already have a bundle */
-			cfg_bundle(0, 0, 0, 0);
-			ppp_netif_set_mtu(pcb, mtu);
-			return 0;
-		}
-		make_new_bundle(0, 0, 0, 0);
-		set_ifunit(1);
-		ppp_netif_set_mtu(pcb, mtu);
-		return 0;
-	}
-
-	doing_multilink = 1;
-
-	/*
-	 * Find the appropriate bundle or join a new one.
-	 * First we make up a name for the bundle.
-	 * The length estimate is worst-case assuming every
-	 * character has to be quoted.
-	 */
-	l = 4 * strlen(peer_authname) + 10;
-	if (ho->neg_endpoint)
-		l += 3 * ho->endpoint.length + 8;
-	if (bundle_name)
-		l += 3 * strlen(bundle_name) + 2;
-	bundle_id = malloc(l);
-	if (bundle_id == 0)
-		novm("bundle identifier");
-
-	p = bundle_id;
-	p += slprintf(p, l-1, "BUNDLE=\"%q\"", peer_authname);
-	if (ho->neg_endpoint || bundle_name)
-		*p++ = '/';
-	if (ho->neg_endpoint)
-		p += slprintf(p, bundle_id+l-p, "%s",
-			      epdisc_to_str(&ho->endpoint));
-	if (bundle_name)
-		p += slprintf(p, bundle_id+l-p, "/%v", bundle_name);
-
-	/* Make the key for the list of links belonging to the bundle */
-	l = p - bundle_id;
-	blinks_id = malloc(l + 7);
-	if (blinks_id == NULL)
-		novm("bundle links key");
-	slprintf(blinks_id, l + 7, "BUNDLE_LINKS=%s", bundle_id + 7);
-
-	/*
-	 * For demand mode, we only need to configure the bundle
-	 * and attach the link.
-	 */
-	mtu = LWIP_MIN(ho->mrru, ao->mru);
-	if (demand) {
-		cfg_bundle(go->mrru, ho->mrru, go->neg_ssnhf, ho->neg_ssnhf);
-		ppp_netif_set_mtu(pcb, mtu);
-		script_setenv("BUNDLE", bundle_id + 7, 1);
-		return 0;
-	}
-
-	/*
-	 * Check if the bundle ID is already in the database.
-	 */
-	unit = -1;
-	lock_db();
-	key.dptr = bundle_id;
-	key.dsize = p - bundle_id;
-	pid = tdb_fetch(pppdb, key);
-	if (pid.dptr != NULL) {
-		/* bundle ID exists, see if the pppd record exists */
-		rec = tdb_fetch(pppdb, pid);
-		if (rec.dptr != NULL && rec.dsize > 0) {
-			/* make sure the string is null-terminated */
-			rec.dptr[rec.dsize-1] = 0;
-			/* parse the interface number */
-			parse_num(rec.dptr, "IFNAME=ppp", &unit);
-			/* check the pid value */
-			if (!parse_num(rec.dptr, "PPPD_PID=", &pppd_pid)
-			    || !process_exists(pppd_pid)
-			    || !owns_unit(pid, unit))
-				unit = -1;
-			free(rec.dptr);
-		}
-		free(pid.dptr);
-	}
-
-	if (unit >= 0) {
-		/* attach to existing unit */
-		if (bundle_attach(unit)) {
-			set_ifunit(0);
-			script_setenv("BUNDLE", bundle_id + 7, 0);
-			make_bundle_links(1);
-			unlock_db();
-			info("Link attached to %s", ifname);
-			return 1;
-		}
-		/* attach failed because bundle doesn't exist */
-	}
-
-	/* we have to make a new bundle */
-	make_new_bundle(go->mrru, ho->mrru, go->neg_ssnhf, ho->neg_ssnhf);
-	set_ifunit(1);
-	ppp_netif_set_mtu(pcb, mtu);
-	script_setenv("BUNDLE", bundle_id + 7, 1);
-	make_bundle_links(pcb);
-	unlock_db();
-	info("New bundle %s created", ifname);
-	multilink_master = 1;
-	return 0;
+    lcp_options *go = &lcp_gotoptions[0];
+    lcp_options *ho = &lcp_hisoptions[0];
+    lcp_options *ao = &lcp_allowoptions[0];
+    int unit, pppd_pid;
+    int l, mtu;
+    char *p;
+    TDB_DATA key, pid, rec;
+
+    if (doing_multilink) {
+        /* have previously joined a bundle */
+        if (!go->neg_mrru || !ho->neg_mrru) {
+            notice("oops, didn't get multilink on renegotiation");
+            lcp_close(pcb, "multilink required");
+            return 0;
+        }
+        /* XXX should check the peer_authname and ho->endpoint
+           are the same as previously */
+        return 0;
+    }
+
+    if (!go->neg_mrru || !ho->neg_mrru) {
+        /* not doing multilink */
+        if (go->neg_mrru)
+            notice("oops, multilink negotiated only for receive");
+        mtu = ho->neg_mru? ho->mru: PPP_DEFMRU;
+        if (mtu > ao->mru)
+            mtu = ao->mru;
+        if (demand) {
+            /* already have a bundle */
+            cfg_bundle(0, 0, 0, 0);
+            ppp_netif_set_mtu(pcb, mtu);
+            return 0;
+        }
+        make_new_bundle(0, 0, 0, 0);
+        set_ifunit(1);
+        ppp_netif_set_mtu(pcb, mtu);
+        return 0;
+    }
+
+    doing_multilink = 1;
+
+    /*
+     * Find the appropriate bundle or join a new one.
+     * First we make up a name for the bundle.
+     * The length estimate is worst-case assuming every
+     * character has to be quoted.
+     */
+    l = 4 * strlen(peer_authname) + 10;
+    if (ho->neg_endpoint)
+        l += 3 * ho->endpoint.length + 8;
+    if (bundle_name)
+        l += 3 * strlen(bundle_name) + 2;
+    bundle_id = malloc(l);
+    if (bundle_id == 0)
+        novm("bundle identifier");
+
+    p = bundle_id;
+    p += slprintf(p, l-1, "BUNDLE=\"%q\"", peer_authname);
+    if (ho->neg_endpoint || bundle_name)
+        *p++ = '/';
+    if (ho->neg_endpoint)
+        p += slprintf(p, bundle_id+l-p, "%s",
+                  epdisc_to_str(&ho->endpoint));
+    if (bundle_name)
+        p += slprintf(p, bundle_id+l-p, "/%v", bundle_name);
+
+    /* Make the key for the list of links belonging to the bundle */
+    l = p - bundle_id;
+    blinks_id = malloc(l + 7);
+    if (blinks_id == NULL)
+        novm("bundle links key");
+    slprintf(blinks_id, l + 7, "BUNDLE_LINKS=%s", bundle_id + 7);
+
+    /*
+     * For demand mode, we only need to configure the bundle
+     * and attach the link.
+     */
+    mtu = LWIP_MIN(ho->mrru, ao->mru);
+    if (demand) {
+        cfg_bundle(go->mrru, ho->mrru, go->neg_ssnhf, ho->neg_ssnhf);
+        ppp_netif_set_mtu(pcb, mtu);
+        script_setenv("BUNDLE", bundle_id + 7, 1);
+        return 0;
+    }
+
+    /*
+     * Check if the bundle ID is already in the database.
+     */
+    unit = -1;
+    lock_db();
+    key.dptr = bundle_id;
+    key.dsize = p - bundle_id;
+    pid = tdb_fetch(pppdb, key);
+    if (pid.dptr != NULL) {
+        /* bundle ID exists, see if the pppd record exists */
+        rec = tdb_fetch(pppdb, pid);
+        if (rec.dptr != NULL && rec.dsize > 0) {
+            /* make sure the string is null-terminated */
+            rec.dptr[rec.dsize-1] = 0;
+            /* parse the interface number */
+            parse_num(rec.dptr, "IFNAME=ppp", &unit);
+            /* check the pid value */
+            if (!parse_num(rec.dptr, "PPPD_PID=", &pppd_pid)
+                || !process_exists(pppd_pid)
+                || !owns_unit(pid, unit))
+                unit = -1;
+            free(rec.dptr);
+        }
+        free(pid.dptr);
+    }
+
+    if (unit >= 0) {
+        /* attach to existing unit */
+        if (bundle_attach(unit)) {
+            set_ifunit(0);
+            script_setenv("BUNDLE", bundle_id + 7, 0);
+            make_bundle_links(1);
+            unlock_db();
+            info("Link attached to %s", ifname);
+            return 1;
+        }
+        /* attach failed because bundle doesn't exist */
+    }
+
+    /* we have to make a new bundle */
+    make_new_bundle(go->mrru, ho->mrru, go->neg_ssnhf, ho->neg_ssnhf);
+    set_ifunit(1);
+    ppp_netif_set_mtu(pcb, mtu);
+    script_setenv("BUNDLE", bundle_id + 7, 1);
+    make_bundle_links(pcb);
+    unlock_db();
+    info("New bundle %s created", ifname);
+    multilink_master = 1;
+    return 0;
 }
 
 void mp_exit_bundle()
 {
-	lock_db();
-	remove_bundle_link();
-	unlock_db();
+    lock_db();
+    remove_bundle_link();
+    unlock_db();
 }
 
 static void sendhup(char *str)
 {
-	int pid;
+    int pid;
 
-	if (parse_num(str, "PPPD_PID=", &pid) && pid != getpid()) {
-		if (debug)
-			dbglog("sending SIGHUP to process %d", pid);
-		kill(pid, SIGHUP);
-	}
+    if (parse_num(str, "PPPD_PID=", &pid) && pid != getpid()) {
+        if (debug)
+            dbglog("sending SIGHUP to process %d", pid);
+        kill(pid, SIGHUP);
+    }
 }
 
 void mp_bundle_terminated()
 {
-	TDB_DATA key;
+    TDB_DATA key;
 
-	bundle_terminating = 1;
-	upper_layers_down(pcb);
-	notice("Connection terminated.");
+    bundle_terminating = 1;
+    upper_layers_down(pcb);
+    notice("Connection terminated.");
 #if PPP_STATS_SUPPORT
-	print_link_stats();
+    print_link_stats();
 #endif /* PPP_STATS_SUPPORT */
-	if (!demand) {
-		remove_pidfiles();
-		script_unsetenv("IFNAME");
-	}
-
-	lock_db();
-	destroy_bundle();
-	iterate_bundle_links(sendhup);
-	key.dptr = blinks_id;
-	key.dsize = strlen(blinks_id);
-	tdb_delete(pppdb, key);
-	unlock_db();
-
-	new_phase(PPP_PHASE_DEAD);
-
-	doing_multilink = 0;
-	multilink_master = 0;
+    if (!demand) {
+        remove_pidfiles();
+        script_unsetenv("IFNAME");
+    }
+
+    lock_db();
+    destroy_bundle();
+    iterate_bundle_links(sendhup);
+    key.dptr = blinks_id;
+    key.dsize = strlen(blinks_id);
+    tdb_delete(pppdb, key);
+    unlock_db();
+
+    new_phase(PPP_PHASE_DEAD);
+
+    doing_multilink = 0;
+    multilink_master = 0;
 }
 
 static void make_bundle_links(int append)
 {
-	TDB_DATA key, rec;
-	char *p;
-	char entry[32];
-	int l;
-
-	key.dptr = blinks_id;
-	key.dsize = strlen(blinks_id);
-	slprintf(entry, sizeof(entry), "%s;", db_key);
-	p = entry;
-	if (append) {
-		rec = tdb_fetch(pppdb, key);
-		if (rec.dptr != NULL && rec.dsize > 0) {
-			rec.dptr[rec.dsize-1] = 0;
-			if (strstr(rec.dptr, db_key) != NULL) {
-				/* already in there? strange */
-				warn("link entry already exists in tdb");
-				return;
-			}
-			l = rec.dsize + strlen(entry);
-			p = malloc(l);
-			if (p == NULL)
-				novm("bundle link list");
-			slprintf(p, l, "%s%s", rec.dptr, entry);
-		} else {
-			warn("bundle link list not found");
-		}
-		if (rec.dptr != NULL)
-			free(rec.dptr);
-	}
-	rec.dptr = p;
-	rec.dsize = strlen(p) + 1;
-	if (tdb_store(pppdb, key, rec, TDB_REPLACE))
-		error("couldn't %s bundle link list",
-		      append? "update": "create");
-	if (p != entry)
-		free(p);
+    TDB_DATA key, rec;
+    char *p;
+    char entry[32];
+    int l;
+
+    key.dptr = blinks_id;
+    key.dsize = strlen(blinks_id);
+    slprintf(entry, sizeof(entry), "%s;", db_key);
+    p = entry;
+    if (append) {
+        rec = tdb_fetch(pppdb, key);
+        if (rec.dptr != NULL && rec.dsize > 0) {
+            rec.dptr[rec.dsize-1] = 0;
+            if (strstr(rec.dptr, db_key) != NULL) {
+                /* already in there? strange */
+                warn("link entry already exists in tdb");
+                return;
+            }
+            l = rec.dsize + strlen(entry);
+            p = malloc(l);
+            if (p == NULL)
+                novm("bundle link list");
+            slprintf(p, l, "%s%s", rec.dptr, entry);
+        } else {
+            warn("bundle link list not found");
+        }
+        if (rec.dptr != NULL)
+            free(rec.dptr);
+    }
+    rec.dptr = p;
+    rec.dsize = strlen(p) + 1;
+    if (tdb_store(pppdb, key, rec, TDB_REPLACE))
+        error("couldn't %s bundle link list",
+              append? "update": "create");
+    if (p != entry)
+        free(p);
 }
 
 static void remove_bundle_link()
 {
-	TDB_DATA key, rec;
-	char entry[32];
-	char *p, *q;
-	int l;
-
-	key.dptr = blinks_id;
-	key.dsize = strlen(blinks_id);
-	slprintf(entry, sizeof(entry), "%s;", db_key);
-
-	rec = tdb_fetch(pppdb, key);
-	if (rec.dptr == NULL || rec.dsize <= 0) {
-		if (rec.dptr != NULL)
-			free(rec.dptr);
-		return;
-	}
-	rec.dptr[rec.dsize-1] = 0;
-	p = strstr(rec.dptr, entry);
-	if (p != NULL) {
-		q = p + strlen(entry);
-		l = strlen(q) + 1;
-		memmove(p, q, l);
-		rec.dsize = p - rec.dptr + l;
-		if (tdb_store(pppdb, key, rec, TDB_REPLACE))
-			error("couldn't update bundle link list (removal)");
-	}
-	free(rec.dptr);
+    TDB_DATA key, rec;
+    char entry[32];
+    char *p, *q;
+    int l;
+
+    key.dptr = blinks_id;
+    key.dsize = strlen(blinks_id);
+    slprintf(entry, sizeof(entry), "%s;", db_key);
+
+    rec = tdb_fetch(pppdb, key);
+    if (rec.dptr == NULL || rec.dsize <= 0) {
+        if (rec.dptr != NULL)
+            free(rec.dptr);
+        return;
+    }
+    rec.dptr[rec.dsize-1] = 0;
+    p = strstr(rec.dptr, entry);
+    if (p != NULL) {
+        q = p + strlen(entry);
+        l = strlen(q) + 1;
+        memmove(p, q, l);
+        rec.dsize = p - rec.dptr + l;
+        if (tdb_store(pppdb, key, rec, TDB_REPLACE))
+            error("couldn't update bundle link list (removal)");
+    }
+    free(rec.dptr);
 }
 
 static void iterate_bundle_links(void (*func)(char *))
 {
-	TDB_DATA key, rec, pp;
-	char *p, *q;
-
-	key.dptr = blinks_id;
-	key.dsize = strlen(blinks_id);
-	rec = tdb_fetch(pppdb, key);
-	if (rec.dptr == NULL || rec.dsize <= 0) {
-		error("bundle link list not found (iterating list)");
-		if (rec.dptr != NULL)
-			free(rec.dptr);
-		return;
-	}
-	p = rec.dptr;
-	p[rec.dsize-1] = 0;
-	while ((q = strchr(p, ';')) != NULL) {
-		*q = 0;
-		key.dptr = p;
-		key.dsize = q - p;
-		pp = tdb_fetch(pppdb, key);
-		if (pp.dptr != NULL && pp.dsize > 0) {
-			pp.dptr[pp.dsize-1] = 0;
-			func(pp.dptr);
-		}
-		if (pp.dptr != NULL)
-			free(pp.dptr);
-		p = q + 1;
-	}
-	free(rec.dptr);
+    TDB_DATA key, rec, pp;
+    char *p, *q;
+
+    key.dptr = blinks_id;
+    key.dsize = strlen(blinks_id);
+    rec = tdb_fetch(pppdb, key);
+    if (rec.dptr == NULL || rec.dsize <= 0) {
+        error("bundle link list not found (iterating list)");
+        if (rec.dptr != NULL)
+            free(rec.dptr);
+        return;
+    }
+    p = rec.dptr;
+    p[rec.dsize-1] = 0;
+    while ((q = strchr(p, ';')) != NULL) {
+        *q = 0;
+        key.dptr = p;
+        key.dsize = q - p;
+        pp = tdb_fetch(pppdb, key);
+        if (pp.dptr != NULL && pp.dsize > 0) {
+            pp.dptr[pp.dsize-1] = 0;
+            func(pp.dptr);
+        }
+        if (pp.dptr != NULL)
+            free(pp.dptr);
+        p = q + 1;
+    }
+    free(rec.dptr);
 }
 
 static int
@@ -409,19 +409,19 @@ parse_num(str, key, valp)
      const char *key;
      int *valp;
 {
-	char *p, *endp;
-	int i;
-
-	p = strstr(str, key);
-	if (p != 0) {
-		p += strlen(key);
-		i = strtol(p, &endp, 10);
-		if (endp != p && (*endp == 0 || *endp == ';')) {
-			*valp = i;
-			return 1;
-		}
-	}
-	return 0;
+    char *p, *endp;
+    int i;
+
+    p = strstr(str, key);
+    if (p != 0) {
+        p += strlen(key);
+        i = strtol(p, &endp, 10);
+        if (endp != p && (*endp == 0 || *endp == ';')) {
+            *valp = i;
+            return 1;
+        }
+    }
+    return 0;
 }
 
 /*
@@ -432,53 +432,53 @@ owns_unit(key, unit)
      TDB_DATA key;
      int unit;
 {
-	char ifkey[32];
-	TDB_DATA kd, vd;
-	int ret = 0;
-
-	slprintf(ifkey, sizeof(ifkey), "IFNAME=ppp%d", unit);
-	kd.dptr = ifkey;
-	kd.dsize = strlen(ifkey);
-	vd = tdb_fetch(pppdb, kd);
-	if (vd.dptr != NULL) {
-		ret = vd.dsize == key.dsize
-			&& memcmp(vd.dptr, key.dptr, vd.dsize) == 0;
-		free(vd.dptr);
-	}
-	return ret;
+    char ifkey[32];
+    TDB_DATA kd, vd;
+    int ret = 0;
+
+    slprintf(ifkey, sizeof(ifkey), "IFNAME=ppp%d", unit);
+    kd.dptr = ifkey;
+    kd.dsize = strlen(ifkey);
+    vd = tdb_fetch(pppdb, kd);
+    if (vd.dptr != NULL) {
+        ret = vd.dsize == key.dsize
+            && memcmp(vd.dptr, key.dptr, vd.dsize) == 0;
+        free(vd.dptr);
+    }
+    return ret;
 }
 
 static int
 get_default_epdisc(ep)
      struct epdisc *ep;
 {
-	char *p;
-	struct hostent *hp;
-	u32_t addr;
-
-	/* First try for an ethernet MAC address */
-	p = get_first_ethernet();
-	if (p != 0 && get_if_hwaddr(ep->value, p) >= 0) {
-		ep->class = EPD_MAC;
-		ep->length = 6;
-		return 1;
-	}
-
-	/* see if our hostname corresponds to a reasonable IP address */
-	hp = gethostbyname(hostname);
-	if (hp != NULL) {
-		addr = *(u32_t *)hp->h_addr;
-		if (!bad_ip_adrs(addr)) {
-			addr = lwip_ntohl(addr);
-			if (!LOCAL_IP_ADDR(addr)) {
-				ep->class = EPD_IP;
-				set_ip_epdisc(ep, addr);
-				return 1;
-			}
-		}
-	}
-
-	return 0;
+    char *p;
+    struct hostent *hp;
+    u32_t addr;
+
+    /* First try for an ethernet MAC address */
+    p = get_first_ethernet();
+    if (p != 0 && get_if_hwaddr(ep->value, p) >= 0) {
+        ep->class = EPD_MAC;
+        ep->length = 6;
+        return 1;
+    }
+
+    /* see if our hostname corresponds to a reasonable IP address */
+    hp = gethostbyname(hostname);
+    if (hp != NULL) {
+        addr = *(u32_t *)hp->h_addr;
+        if (!bad_ip_adrs(addr)) {
+            addr = lwip_ntohl(addr);
+            if (!LOCAL_IP_ADDR(addr)) {
+                ep->class = EPD_IP;
+                set_ip_epdisc(ep, addr);
+                return 1;
+            }
+        }
+    }
+
+    return 0;
 }
 
 /*
@@ -493,51 +493,51 @@ char *
 epdisc_to_str(ep)
      struct epdisc *ep;
 {
-	static char str[MAX_ENDP_LEN*3+8];
-	u_char *p = ep->value;
-	int i, mask = 0;
-	char *q, c, c2;
-
-	if (ep->class == EPD_NULL && ep->length == 0)
-		return "null";
-	if (ep->class == EPD_IP && ep->length == 4) {
-		u32_t addr;
-
-		GETLONG(addr, p);
-		slprintf(str, sizeof(str), "IP:%I", lwip_htonl(addr));
-		return str;
-	}
-
-	c = ':';
-	c2 = '.';
-	if (ep->class == EPD_MAC && ep->length == 6)
-		c2 = ':';
-	else if (ep->class == EPD_MAGIC && (ep->length % 4) == 0)
-		mask = 3;
-	q = str;
-	if (ep->class <= EPD_PHONENUM)
-		q += slprintf(q, sizeof(str)-1, "%s",
-			      endp_class_names[ep->class]);
-	else
-		q += slprintf(q, sizeof(str)-1, "%d", ep->class);
-	c = ':';
-	for (i = 0; i < ep->length && i < MAX_ENDP_LEN; ++i) {
-		if ((i & mask) == 0) {
-			*q++ = c;
-			c = c2;
-		}
-		q += slprintf(q, str + sizeof(str) - q, "%.2x", ep->value[i]);
-	}
-	return str;
+    static char str[MAX_ENDP_LEN*3+8];
+    u_char *p = ep->value;
+    int i, mask = 0;
+    char *q, c, c2;
+
+    if (ep->class == EPD_NULL && ep->length == 0)
+        return "null";
+    if (ep->class == EPD_IP && ep->length == 4) {
+        u32_t addr;
+
+        GETLONG(addr, p);
+        slprintf(str, sizeof(str), "IP:%I", lwip_htonl(addr));
+        return str;
+    }
+
+    c = ':';
+    c2 = '.';
+    if (ep->class == EPD_MAC && ep->length == 6)
+        c2 = ':';
+    else if (ep->class == EPD_MAGIC && (ep->length % 4) == 0)
+        mask = 3;
+    q = str;
+    if (ep->class <= EPD_PHONENUM)
+        q += slprintf(q, sizeof(str)-1, "%s",
+                  endp_class_names[ep->class]);
+    else
+        q += slprintf(q, sizeof(str)-1, "%d", ep->class);
+    c = ':';
+    for (i = 0; i < ep->length && i < MAX_ENDP_LEN; ++i) {
+        if ((i & mask) == 0) {
+            *q++ = c;
+            c = c2;
+        }
+        q += slprintf(q, str + sizeof(str) - q, "%.2x", ep->value[i]);
+    }
+    return str;
 }
 
 static int hexc_val(int c)
 {
-	if (c >= 'a')
-		return c - 'a' + 10;
-	if (c >= 'A')
-		return c - 'A' + 10;
-	return c - '0';
+    if (c >= 'a')
+        return c - 'a' + 10;
+    if (c >= 'A')
+        return c - 'A' + 10;
+    return c - '0';
 }
 
 int
@@ -545,65 +545,65 @@ str_to_epdisc(ep, str)
      struct epdisc *ep;
      char *str;
 {
-	int i, l;
-	char *p, *endp;
-
-	for (i = EPD_NULL; i <= EPD_PHONENUM; ++i) {
-		int sl = strlen(endp_class_names[i]);
-		if (strncasecmp(str, endp_class_names[i], sl) == 0) {
-			str += sl;
-			break;
-		}
-	}
-	if (i > EPD_PHONENUM) {
-		/* not a class name, try a decimal class number */
-		i = strtol(str, &endp, 10);
-		if (endp == str)
-			return 0;	/* can't parse class number */
-		str = endp;
-	}
-	ep->class = i;
-	if (*str == 0) {
-		ep->length = 0;
-		return 1;
-	}
-	if (*str != ':' && *str != '.')
-		return 0;
-	++str;
-
-	if (i == EPD_IP) {
-		u32_t addr;
-		i = parse_dotted_ip(str, &addr);
-		if (i == 0 || str[i] != 0)
-			return 0;
-		set_ip_epdisc(ep, addr);
-		return 1;
-	}
-	if (i == EPD_MAC && get_if_hwaddr(ep->value, str) >= 0) {
-		ep->length = 6;
-		return 1;
-	}
-
-	p = str;
-	for (l = 0; l < MAX_ENDP_LEN; ++l) {
-		if (*str == 0)
-			break;
-		if (p <= str)
-			for (p = str; isxdigit(*p); ++p)
-				;
-		i = p - str;
-		if (i == 0)
-			return 0;
-		ep->value[l] = hexc_val(*str++);
-		if ((i & 1) == 0)
-			ep->value[l] = (ep->value[l] << 4) + hexc_val(*str++);
-		if (*str == ':' || *str == '.')
-			++str;
-	}
-	if (*str != 0 || (ep->class == EPD_MAC && l != 6))
-		return 0;
-	ep->length = l;
-	return 1;
+    int i, l;
+    char *p, *endp;
+
+    for (i = EPD_NULL; i <= EPD_PHONENUM; ++i) {
+        int sl = strlen(endp_class_names[i]);
+        if (strncasecmp(str, endp_class_names[i], sl) == 0) {
+            str += sl;
+            break;
+        }
+    }
+    if (i > EPD_PHONENUM) {
+        /* not a class name, try a decimal class number */
+        i = strtol(str, &endp, 10);
+        if (endp == str)
+            return 0;   /* can't parse class number */
+        str = endp;
+    }
+    ep->class = i;
+    if (*str == 0) {
+        ep->length = 0;
+        return 1;
+    }
+    if (*str != ':' && *str != '.')
+        return 0;
+    ++str;
+
+    if (i == EPD_IP) {
+        u32_t addr;
+        i = parse_dotted_ip(str, &addr);
+        if (i == 0 || str[i] != 0)
+            return 0;
+        set_ip_epdisc(ep, addr);
+        return 1;
+    }
+    if (i == EPD_MAC && get_if_hwaddr(ep->value, str) >= 0) {
+        ep->length = 6;
+        return 1;
+    }
+
+    p = str;
+    for (l = 0; l < MAX_ENDP_LEN; ++l) {
+        if (*str == 0)
+            break;
+        if (p <= str)
+            for (p = str; isxdigit(*p); ++p)
+                ;
+        i = p - str;
+        if (i == 0)
+            return 0;
+        ep->value[l] = hexc_val(*str++);
+        if ((i & 1) == 0)
+            ep->value[l] = (ep->value[l] << 4) + hexc_val(*str++);
+        if (*str == ':' || *str == '.')
+            ++str;
+    }
+    if (*str != 0 || (ep->class == EPD_MAC && l != 6))
+        return 0;
+    ep->length = l;
+    return 1;
 }
 
 #endif /* PPP_SUPPORT && HAVE_MULTILINK */
diff --git a/src/netif/ppp/polarssl/arc4.c b/src/netif/ppp/polarssl/arc4.c
index 6e17ec42..cb31b876 100644
--- a/src/netif/ppp/polarssl/arc4.c
+++ b/src/netif/ppp/polarssl/arc4.c
@@ -10,7 +10,7 @@
  *  Redistribution and use in source and binary forms, with or without
  *  modification, are permitted provided that the following conditions
  *  are met:
- *  
+ *
  *    * Redistributions of source code must retain the above copyright
  *      notice, this list of conditions and the following disclaimer.
  *    * Redistributions in binary form must reproduce the above copyright
@@ -19,7 +19,7 @@
  *    * Neither the names of PolarSSL or XySSL nor the names of its contributors
  *      may be used to endorse or promote products derived from this software
  *      without specific prior written permission.
- *  
+ *
  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
diff --git a/src/netif/ppp/polarssl/des.c b/src/netif/ppp/polarssl/des.c
index 9a89d007..b01e07fa 100644
--- a/src/netif/ppp/polarssl/des.c
+++ b/src/netif/ppp/polarssl/des.c
@@ -10,7 +10,7 @@
  *  Redistribution and use in source and binary forms, with or without
  *  modification, are permitted provided that the following conditions
  *  are met:
- *  
+ *
  *    * Redistributions of source code must retain the above copyright
  *      notice, this list of conditions and the following disclaimer.
  *    * Redistributions in binary form must reproduce the above copyright
@@ -19,7 +19,7 @@
  *    * Neither the names of PolarSSL or XySSL nor the names of its contributors
  *      may be used to endorse or promote products derived from this software
  *      without specific prior written permission.
- *  
+ *
  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
diff --git a/src/netif/ppp/polarssl/md4.c b/src/netif/ppp/polarssl/md4.c
index b1701a07..34e5b10c 100644
--- a/src/netif/ppp/polarssl/md4.c
+++ b/src/netif/ppp/polarssl/md4.c
@@ -10,7 +10,7 @@
  *  Redistribution and use in source and binary forms, with or without
  *  modification, are permitted provided that the following conditions
  *  are met:
- *  
+ *
  *    * Redistributions of source code must retain the above copyright
  *      notice, this list of conditions and the following disclaimer.
  *    * Redistributions in binary form must reproduce the above copyright
@@ -19,7 +19,7 @@
  *    * Neither the names of PolarSSL or XySSL nor the names of its contributors
  *      may be used to endorse or promote products derived from this software
  *      without specific prior written permission.
- *  
+ *
  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
diff --git a/src/netif/ppp/polarssl/md5.c b/src/netif/ppp/polarssl/md5.c
index 1ec4d81a..fa636584 100644
--- a/src/netif/ppp/polarssl/md5.c
+++ b/src/netif/ppp/polarssl/md5.c
@@ -10,7 +10,7 @@
  *  Redistribution and use in source and binary forms, with or without
  *  modification, are permitted provided that the following conditions
  *  are met:
- *  
+ *
  *    * Redistributions of source code must retain the above copyright
  *      notice, this list of conditions and the following disclaimer.
  *    * Redistributions in binary form must reproduce the above copyright
@@ -19,7 +19,7 @@
  *    * Neither the names of PolarSSL or XySSL nor the names of its contributors
  *      may be used to endorse or promote products derived from this software
  *      without specific prior written permission.
- *  
+ *
  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
@@ -156,7 +156,7 @@ static void md5_process( md5_context *ctx, const unsigned char data[64] )
     P( B, C, D, A, 12, 20, 0x8D2A4C8A );
 
 #undef F
-    
+
 #define F(x,y,z) (x ^ y ^ z)
 
     P( A, B, C, D,  5,  4, 0xFFFA3942 );
diff --git a/src/netif/ppp/polarssl/sha1.c b/src/netif/ppp/polarssl/sha1.c
index c2192eac..6079af3b 100644
--- a/src/netif/ppp/polarssl/sha1.c
+++ b/src/netif/ppp/polarssl/sha1.c
@@ -10,7 +10,7 @@
  *  Redistribution and use in source and binary forms, with or without
  *  modification, are permitted provided that the following conditions
  *  are met:
- *  
+ *
  *    * Redistributions of source code must retain the above copyright
  *      notice, this list of conditions and the following disclaimer.
  *    * Redistributions in binary form must reproduce the above copyright
@@ -19,7 +19,7 @@
  *    * Neither the names of PolarSSL or XySSL nor the names of its contributors
  *      may be used to endorse or promote products derived from this software
  *      without specific prior written permission.
- *  
+ *
  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
diff --git a/src/netif/ppp/ppp.c b/src/netif/ppp/ppp.c
index 1cd5958e..64035f52 100644
--- a/src/netif/ppp/ppp.c
+++ b/src/netif/ppp/ppp.c
@@ -636,7 +636,7 @@ int ppp_init(void)
 
   return 0;
 }
- 
+
 /*
  * Create a new PPP control block.
  *
diff --git a/src/netif/ppp/pppapi.c b/src/netif/ppp/pppapi.c
index 947f7ba8..0ad8e986 100644
--- a/src/netif/ppp/pppapi.c
+++ b/src/netif/ppp/pppapi.c
@@ -57,10 +57,10 @@ LWIP_MEMPOOL_DECLARE(PPPAPI_MSG, MEMP_NUM_PPP_API_MSG, sizeof(struct pppapi_msg)
 static err_t
 pppapi_do_ppp_set_default(struct tcpip_api_call_data *m)
 {
-  /* cast through void* to silence alignment warnings. 
+  /* cast through void* to silence alignment warnings.
    * We know it works because the structs have been instantiated as struct pppapi_msg */
   struct pppapi_msg *msg = (struct pppapi_msg *)(void*)m;
-  
+
   ppp_set_default(msg->msg.ppp);
   return ERR_OK;
 }
@@ -90,7 +90,7 @@ pppapi_set_default(ppp_pcb *pcb)
 static err_t
 pppapi_do_ppp_set_notify_phase_callback(struct tcpip_api_call_data *m)
 {
-  /* cast through void* to silence alignment warnings. 
+  /* cast through void* to silence alignment warnings.
    * We know it works because the structs have been instantiated as struct pppapi_msg */
    struct pppapi_msg *msg = (struct pppapi_msg *)(void*)m;
 
@@ -125,7 +125,7 @@ pppapi_set_notify_phase_callback(ppp_pcb *pcb, ppp_notify_phase_cb_fn notify_pha
 static err_t
 pppapi_do_pppos_create(struct tcpip_api_call_data *m)
 {
-  /* cast through void* to silence alignment warnings. 
+  /* cast through void* to silence alignment warnings.
    * We know it works because the structs have been instantiated as struct pppapi_msg */
   struct pppapi_msg *msg = (struct pppapi_msg *)(void*)m;
 
@@ -166,7 +166,7 @@ pppapi_pppos_create(struct netif *pppif, pppos_output_cb_fn output_cb,
 static err_t
 pppapi_do_pppoe_create(struct tcpip_api_call_data *m)
 {
-  /* cast through void* to silence alignment warnings. 
+  /* cast through void* to silence alignment warnings.
    * We know it works because the structs have been instantiated as struct pppapi_msg */
   struct pppapi_msg *msg = (struct pppapi_msg *)(void*)m;
 
@@ -211,7 +211,7 @@ pppapi_pppoe_create(struct netif *pppif, struct netif *ethif, const char *servic
 static err_t
 pppapi_do_pppol2tp_create(struct tcpip_api_call_data *m)
 {
-  /* cast through void* to silence alignment warnings. 
+  /* cast through void* to silence alignment warnings.
    * We know it works because the structs have been instantiated as struct pppapi_msg */
   struct pppapi_msg *msg = (struct pppapi_msg *)(void*)m;
 
@@ -270,7 +270,7 @@ pppapi_pppol2tp_create(struct netif *pppif, struct netif *netif, ip_addr_t *ipad
 static err_t
 pppapi_do_ppp_connect(struct tcpip_api_call_data *m)
 {
-  /* cast through void* to silence alignment warnings. 
+  /* cast through void* to silence alignment warnings.
    * We know it works because the structs have been instantiated as struct pppapi_msg */
   struct pppapi_msg *msg = (struct pppapi_msg *)(void*)m;
 
@@ -303,7 +303,7 @@ pppapi_connect(ppp_pcb *pcb, u16_t holdoff)
 static err_t
 pppapi_do_ppp_listen(struct tcpip_api_call_data *m)
 {
-  /* cast through void* to silence alignment warnings. 
+  /* cast through void* to silence alignment warnings.
    * We know it works because the structs have been instantiated as struct pppapi_msg */
   struct pppapi_msg *msg = (struct pppapi_msg *)(void*)m;
 
@@ -335,7 +335,7 @@ pppapi_listen(ppp_pcb *pcb)
 static err_t
 pppapi_do_ppp_close(struct tcpip_api_call_data *m)
 {
-  /* cast through void* to silence alignment warnings. 
+  /* cast through void* to silence alignment warnings.
    * We know it works because the structs have been instantiated as struct pppapi_msg */
   struct pppapi_msg *msg = (struct pppapi_msg *)(void*)m;
 
@@ -367,7 +367,7 @@ pppapi_close(ppp_pcb *pcb, u8_t nocarrier)
 static err_t
 pppapi_do_ppp_free(struct tcpip_api_call_data *m)
 {
-  /* cast through void* to silence alignment warnings. 
+  /* cast through void* to silence alignment warnings.
    * We know it works because the structs have been instantiated as struct pppapi_msg */
   struct pppapi_msg *msg = (struct pppapi_msg *)(void*)m;
 
@@ -398,7 +398,7 @@ pppapi_free(ppp_pcb *pcb)
 static err_t
 pppapi_do_ppp_ioctl(struct tcpip_api_call_data *m)
 {
-  /* cast through void* to silence alignment warnings. 
+  /* cast through void* to silence alignment warnings.
    * We know it works because the structs have been instantiated as struct pppapi_msg */
   struct pppapi_msg *msg = (struct pppapi_msg *)(void*)m;
 
diff --git a/src/netif/ppp/pppcrypt.c b/src/netif/ppp/pppcrypt.c
index 82d78c13..81e4008d 100644
--- a/src/netif/ppp/pppcrypt.c
+++ b/src/netif/ppp/pppcrypt.c
@@ -39,28 +39,28 @@
 
 
 static u_char pppcrypt_get_7bits(u_char *input, int startBit) {
-	unsigned int word;
+    unsigned int word;
 
-	word  = (unsigned)input[startBit / 8] << 8;
-	word |= (unsigned)input[startBit / 8 + 1];
+    word  = (unsigned)input[startBit / 8] << 8;
+    word |= (unsigned)input[startBit / 8 + 1];
 
-	word >>= 15 - (startBit % 8 + 7);
+    word >>= 15 - (startBit % 8 + 7);
 
-	return word & 0xFE;
+    return word & 0xFE;
 }
 
 /* IN  56 bit DES key missing parity bits
  * OUT 64 bit DES key with parity bits added
  */
 void pppcrypt_56_to_64_bit_key(u_char *key, u_char * des_key) {
-	des_key[0] = pppcrypt_get_7bits(key,  0);
-	des_key[1] = pppcrypt_get_7bits(key,  7);
-	des_key[2] = pppcrypt_get_7bits(key, 14);
-	des_key[3] = pppcrypt_get_7bits(key, 21);
-	des_key[4] = pppcrypt_get_7bits(key, 28);
-	des_key[5] = pppcrypt_get_7bits(key, 35);
-	des_key[6] = pppcrypt_get_7bits(key, 42);
-	des_key[7] = pppcrypt_get_7bits(key, 49);
+    des_key[0] = pppcrypt_get_7bits(key,  0);
+    des_key[1] = pppcrypt_get_7bits(key,  7);
+    des_key[2] = pppcrypt_get_7bits(key, 14);
+    des_key[3] = pppcrypt_get_7bits(key, 21);
+    des_key[4] = pppcrypt_get_7bits(key, 28);
+    des_key[5] = pppcrypt_get_7bits(key, 35);
+    des_key[6] = pppcrypt_get_7bits(key, 42);
+    des_key[7] = pppcrypt_get_7bits(key, 49);
 }
 
 #endif /* PPP_SUPPORT && MSCHAP_SUPPORT */
diff --git a/src/netif/ppp/pppoe.c b/src/netif/ppp/pppoe.c
index 9e4f3468..a530ee14 100644
--- a/src/netif/ppp/pppoe.c
+++ b/src/netif/ppp/pppoe.c
@@ -6,13 +6,13 @@
 * The authors hereby grant permission to use, copy, modify, distribute,
 * and license this software and its documentation for any purpose, provided
 * that existing copyright notices are retained in all copies and that this
-* notice and the following disclaimer are included verbatim in any 
+* notice and the following disclaimer are included verbatim in any
 * distributions. No written agreement, license, or royalty fee is required
 * for any of the authorized uses.
 *
 * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
+* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 * IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
@@ -684,7 +684,7 @@ pppoe_data_input(struct netif *netif, struct pbuf *pb)
     PPPDEBUG(LOG_ERR, ("pppoe_data_input: pbuf_remove_header failed\n"));
     LINK_STATS_INC(link.lenerr);
     goto drop;
-  } 
+  }
 
   if (pb->len < sizeof(*ph)) {
     PPPDEBUG(LOG_DEBUG, ("pppoe_data_input: could not get PPPoE header\n"));
@@ -717,7 +717,7 @@ pppoe_data_input(struct netif *netif, struct pbuf *pb)
     PPPDEBUG(LOG_ERR, ("pppoe_data_input: pbuf_remove_header PPPOE_HEADERLEN failed\n"));
     LINK_STATS_INC(link.lenerr);
     goto drop;
-  } 
+  }
 
   PPPDEBUG(LOG_DEBUG, ("pppoe_data_input: %c%c%"U16_F": pkthdr.len=%d, pppoe.len=%d\n",
         sc->sc_ethif->name[0], sc->sc_ethif->name[1], sc->sc_ethif->num,
diff --git a/src/netif/ppp/upap.c b/src/netif/ppp/upap.c
index c8cd3941..2ded37a9 100644
--- a/src/netif/ppp/upap.c
+++ b/src/netif/ppp/upap.c
@@ -166,12 +166,12 @@ void upap_authwithpeer(ppp_pcb *pcb, const char *user, const char *password) {
 
     /* Lower layer up yet? */
     if (pcb->upap.us_clientstate == UPAPCS_INITIAL ||
-	pcb->upap.us_clientstate == UPAPCS_PENDING) {
-	pcb->upap.us_clientstate = UPAPCS_PENDING;
-	return;
+    pcb->upap.us_clientstate == UPAPCS_PENDING) {
+    pcb->upap.us_clientstate = UPAPCS_PENDING;
+    return;
     }
 
-    upap_sauthreq(pcb);		/* Start protocol */
+    upap_sauthreq(pcb);     /* Start protocol */
 }
 
 #if PPP_SERVER
@@ -184,14 +184,14 @@ void upap_authpeer(ppp_pcb *pcb) {
 
     /* Lower layer up yet? */
     if (pcb->upap.us_serverstate == UPAPSS_INITIAL ||
-	pcb->upap.us_serverstate == UPAPSS_PENDING) {
-	pcb->upap.us_serverstate = UPAPSS_PENDING;
-	return;
+    pcb->upap.us_serverstate == UPAPSS_PENDING) {
+    pcb->upap.us_serverstate = UPAPSS_PENDING;
+    return;
     }
 
     pcb->upap.us_serverstate = UPAPSS_LISTEN;
     if (pcb->settings.pap_req_timeout > 0)
-	TIMEOUT(upap_reqtimeout, pcb, pcb->settings.pap_req_timeout);
+    TIMEOUT(upap_reqtimeout, pcb, pcb->settings.pap_req_timeout);
 }
 #endif /* PPP_SERVER */
 
@@ -202,17 +202,17 @@ static void upap_timeout(void *arg) {
     ppp_pcb *pcb = (ppp_pcb*)arg;
 
     if (pcb->upap.us_clientstate != UPAPCS_AUTHREQ)
-	return;
+    return;
 
     if (pcb->upap.us_transmits >= pcb->settings.pap_max_transmits) {
-	/* give up in disgust */
-	ppp_error(("No response to PAP authenticate-requests"));
-	pcb->upap.us_clientstate = UPAPCS_BADAUTH;
-	auth_withpeer_fail(pcb, PPP_PAP);
-	return;
+    /* give up in disgust */
+    ppp_error(("No response to PAP authenticate-requests"));
+    pcb->upap.us_clientstate = UPAPCS_BADAUTH;
+    auth_withpeer_fail(pcb, PPP_PAP);
+    return;
     }
 
-    upap_sauthreq(pcb);		/* Send Authenticate-Request */
+    upap_sauthreq(pcb);     /* Send Authenticate-Request */
 }
 
 
@@ -224,7 +224,7 @@ static void upap_reqtimeout(void *arg) {
     ppp_pcb *pcb = (ppp_pcb*)arg;
 
     if (pcb->upap.us_serverstate != UPAPSS_LISTEN)
-	return;			/* huh?? */
+    return;         /* huh?? */
 
     auth_peer_fail(pcb, PPP_PAP);
     pcb->upap.us_serverstate = UPAPSS_BADAUTH;
@@ -240,18 +240,18 @@ static void upap_reqtimeout(void *arg) {
 static void upap_lowerup(ppp_pcb *pcb) {
 
     if (pcb->upap.us_clientstate == UPAPCS_INITIAL)
-	pcb->upap.us_clientstate = UPAPCS_CLOSED;
+    pcb->upap.us_clientstate = UPAPCS_CLOSED;
     else if (pcb->upap.us_clientstate == UPAPCS_PENDING) {
-	upap_sauthreq(pcb);	/* send an auth-request */
+    upap_sauthreq(pcb); /* send an auth-request */
     }
 
 #if PPP_SERVER
     if (pcb->upap.us_serverstate == UPAPSS_INITIAL)
-	pcb->upap.us_serverstate = UPAPSS_CLOSED;
+    pcb->upap.us_serverstate = UPAPSS_CLOSED;
     else if (pcb->upap.us_serverstate == UPAPSS_PENDING) {
-	pcb->upap.us_serverstate = UPAPSS_LISTEN;
-	if (pcb->settings.pap_req_timeout > 0)
-	    TIMEOUT(upap_reqtimeout, pcb, pcb->settings.pap_req_timeout);
+    pcb->upap.us_serverstate = UPAPSS_LISTEN;
+    if (pcb->settings.pap_req_timeout > 0)
+        TIMEOUT(upap_reqtimeout, pcb, pcb->settings.pap_req_timeout);
     }
 #endif /* PPP_SERVER */
 }
@@ -264,11 +264,11 @@ static void upap_lowerup(ppp_pcb *pcb) {
  */
 static void upap_lowerdown(ppp_pcb *pcb) {
 
-    if (pcb->upap.us_clientstate == UPAPCS_AUTHREQ)	/* Timeout pending? */
-	UNTIMEOUT(upap_timeout, pcb);		/* Cancel timeout */
+    if (pcb->upap.us_clientstate == UPAPCS_AUTHREQ) /* Timeout pending? */
+    UNTIMEOUT(upap_timeout, pcb);       /* Cancel timeout */
 #if PPP_SERVER
     if (pcb->upap.us_serverstate == UPAPSS_LISTEN && pcb->settings.pap_req_timeout > 0)
-	UNTIMEOUT(upap_reqtimeout, pcb);
+    UNTIMEOUT(upap_reqtimeout, pcb);
 #endif /* PPP_SERVER */
 
     pcb->upap.us_clientstate = UPAPCS_INITIAL;
@@ -286,13 +286,13 @@ static void upap_lowerdown(ppp_pcb *pcb) {
 static void upap_protrej(ppp_pcb *pcb) {
 
     if (pcb->upap.us_clientstate == UPAPCS_AUTHREQ) {
-	ppp_error(("PAP authentication failed due to protocol-reject"));
-	auth_withpeer_fail(pcb, PPP_PAP);
+    ppp_error(("PAP authentication failed due to protocol-reject"));
+    auth_withpeer_fail(pcb, PPP_PAP);
     }
 #if PPP_SERVER
     if (pcb->upap.us_serverstate == UPAPSS_LISTEN) {
-	ppp_error(("PAP authentication of peer failed (protocol-reject)"));
-	auth_peer_fail(pcb, PPP_PAP);
+    ppp_error(("PAP authentication of peer failed (protocol-reject)"));
+    auth_peer_fail(pcb, PPP_PAP);
     }
 #endif /* PPP_SERVER */
     upap_lowerdown(pcb);
@@ -313,19 +313,19 @@ static void upap_input(ppp_pcb *pcb, u_char *inpacket, int l) {
      */
     inp = inpacket;
     if (l < UPAP_HEADERLEN) {
-	UPAPDEBUG(("pap_input: rcvd short header."));
-	return;
+    UPAPDEBUG(("pap_input: rcvd short header."));
+    return;
     }
     GETCHAR(code, inp);
     GETCHAR(id, inp);
     GETSHORT(len, inp);
     if (len < UPAP_HEADERLEN) {
-	UPAPDEBUG(("pap_input: rcvd illegal length."));
-	return;
+    UPAPDEBUG(("pap_input: rcvd illegal length."));
+    return;
     }
     if (len > l) {
-	UPAPDEBUG(("pap_input: rcvd short packet."));
-	return;
+    UPAPDEBUG(("pap_input: rcvd short packet."));
+    return;
     }
     len -= UPAP_HEADERLEN;
 
@@ -335,20 +335,20 @@ static void upap_input(ppp_pcb *pcb, u_char *inpacket, int l) {
     switch (code) {
     case UPAP_AUTHREQ:
 #if PPP_SERVER
-	upap_rauthreq(pcb, inp, id, len);
+    upap_rauthreq(pcb, inp, id, len);
 #endif /* PPP_SERVER */
-	break;
+    break;
 
     case UPAP_AUTHACK:
-	upap_rauthack(pcb, inp, id, len);
-	break;
+    upap_rauthack(pcb, inp, id, len);
+    break;
 
     case UPAP_AUTHNAK:
-	upap_rauthnak(pcb, inp, id, len);
-	break;
+    upap_rauthnak(pcb, inp, id, len);
+    break;
 
-    default:				/* XXX Need code reject */
-	break;
+    default:                /* XXX Need code reject */
+    break;
     }
 }
 
@@ -366,40 +366,40 @@ static void upap_rauthreq(ppp_pcb *pcb, u_char *inp, int id, int len) {
     int msglen;
 
     if (pcb->upap.us_serverstate < UPAPSS_LISTEN)
-	return;
+    return;
 
     /*
      * If we receive a duplicate authenticate-request, we are
      * supposed to return the same status as for the first request.
      */
     if (pcb->upap.us_serverstate == UPAPSS_OPEN) {
-	upap_sresp(pcb, UPAP_AUTHACK, id, "", 0);	/* return auth-ack */
-	return;
+    upap_sresp(pcb, UPAP_AUTHACK, id, "", 0);   /* return auth-ack */
+    return;
     }
     if (pcb->upap.us_serverstate == UPAPSS_BADAUTH) {
-	upap_sresp(pcb, UPAP_AUTHNAK, id, "", 0);	/* return auth-nak */
-	return;
+    upap_sresp(pcb, UPAP_AUTHNAK, id, "", 0);   /* return auth-nak */
+    return;
     }
 
     /*
      * Parse user/passwd.
      */
     if (len < 1) {
-	UPAPDEBUG(("pap_rauth: rcvd short packet."));
-	return;
+    UPAPDEBUG(("pap_rauth: rcvd short packet."));
+    return;
     }
     GETCHAR(ruserlen, inp);
     len -= sizeof (u_char) + ruserlen + sizeof (u_char);
     if (len < 0) {
-	UPAPDEBUG(("pap_rauth: rcvd short packet."));
-	return;
+    UPAPDEBUG(("pap_rauth: rcvd short packet."));
+    return;
     }
     ruser = (char *) inp;
     INCPTR(ruserlen, inp);
     GETCHAR(rpasswdlen, inp);
     if (len < rpasswdlen) {
-	UPAPDEBUG(("pap_rauth: rcvd short packet."));
-	return;
+    UPAPDEBUG(("pap_rauth: rcvd short packet."));
+    return;
     }
 
     rpasswd = (char *) inp;
@@ -420,16 +420,16 @@ static void upap_rauthreq(ppp_pcb *pcb, u_char *inp, int id, int len) {
      * return an authenticate failure, is leaving it for us to verify.
      */
     if (retcode == UPAP_AUTHACK) {
-	if (!auth_number()) {
-	    /* We do not want to leak info about the pap result. */
-	    retcode = UPAP_AUTHNAK; /* XXX exit value will be "wrong" */
-	    warn("calling number %q is not authorized", remote_number);
-	}
+    if (!auth_number()) {
+        /* We do not want to leak info about the pap result. */
+        retcode = UPAP_AUTHNAK; /* XXX exit value will be "wrong" */
+        warn("calling number %q is not authorized", remote_number);
+    }
     }
 
     msglen = strlen(msg);
     if (msglen > 255)
-	msglen = 255;
+    msglen = 255;
 #endif /* UNUSED */
 
     upap_sresp(pcb, retcode, id, msg, msglen);
@@ -438,17 +438,17 @@ static void upap_rauthreq(ppp_pcb *pcb, u_char *inp, int id, int len) {
     ppp_slprintf(rhostname, sizeof(rhostname), "%.*v", ruserlen, ruser);
 
     if (retcode == UPAP_AUTHACK) {
-	pcb->upap.us_serverstate = UPAPSS_OPEN;
-	ppp_notice(("PAP peer authentication succeeded for %q", rhostname));
-	auth_peer_success(pcb, PPP_PAP, 0, ruser, ruserlen);
+    pcb->upap.us_serverstate = UPAPSS_OPEN;
+    ppp_notice(("PAP peer authentication succeeded for %q", rhostname));
+    auth_peer_success(pcb, PPP_PAP, 0, ruser, ruserlen);
     } else {
-	pcb->upap.us_serverstate = UPAPSS_BADAUTH;
-	ppp_warn(("PAP peer authentication failed for %q", rhostname));
-	auth_peer_fail(pcb, PPP_PAP);
+    pcb->upap.us_serverstate = UPAPSS_BADAUTH;
+    ppp_warn(("PAP peer authentication failed for %q", rhostname));
+    auth_peer_fail(pcb, PPP_PAP);
     }
 
     if (pcb->settings.pap_req_timeout > 0)
-	UNTIMEOUT(upap_reqtimeout, pcb);
+    UNTIMEOUT(upap_reqtimeout, pcb);
 }
 #endif /* PPP_SERVER */
 
@@ -461,24 +461,24 @@ static void upap_rauthack(ppp_pcb *pcb, u_char *inp, int id, int len) {
     LWIP_UNUSED_ARG(id);
 
     if (pcb->upap.us_clientstate != UPAPCS_AUTHREQ) /* XXX */
-	return;
+    return;
 
     /*
      * Parse message.
      */
     if (len < 1) {
-	UPAPDEBUG(("pap_rauthack: ignoring missing msg-length."));
+    UPAPDEBUG(("pap_rauthack: ignoring missing msg-length."));
     } else {
-	GETCHAR(msglen, inp);
-	if (msglen > 0) {
-	    len -= sizeof (u_char);
-	    if (len < msglen) {
-		UPAPDEBUG(("pap_rauthack: rcvd short packet."));
-		return;
-	    }
-	    msg = (char *) inp;
-	    PRINTMSG(msg, msglen);
-	}
+    GETCHAR(msglen, inp);
+    if (msglen > 0) {
+        len -= sizeof (u_char);
+        if (len < msglen) {
+        UPAPDEBUG(("pap_rauthack: rcvd short packet."));
+        return;
+        }
+        msg = (char *) inp;
+        PRINTMSG(msg, msglen);
+    }
     }
 
     UNTIMEOUT(upap_timeout, pcb);
@@ -497,24 +497,24 @@ static void upap_rauthnak(ppp_pcb *pcb, u_char *inp, int id, int len) {
     LWIP_UNUSED_ARG(id);
 
     if (pcb->upap.us_clientstate != UPAPCS_AUTHREQ) /* XXX */
-	return;
+    return;
 
     /*
      * Parse message.
      */
     if (len < 1) {
-	UPAPDEBUG(("pap_rauthnak: ignoring missing msg-length."));
+    UPAPDEBUG(("pap_rauthnak: ignoring missing msg-length."));
     } else {
-	GETCHAR(msglen, inp);
-	if (msglen > 0) {
-	    len -= sizeof (u_char);
-	    if (len < msglen) {
-		UPAPDEBUG(("pap_rauthnak: rcvd short packet."));
-		return;
-	    }
-	    msg = (char *) inp;
-	    PRINTMSG(msg, msglen);
-	}
+    GETCHAR(msglen, inp);
+    if (msglen > 0) {
+        len -= sizeof (u_char);
+        if (len < msglen) {
+        UPAPDEBUG(("pap_rauthnak: rcvd short packet."));
+        return;
+        }
+        msg = (char *) inp;
+        PRINTMSG(msg, msglen);
+    }
     }
 
     UNTIMEOUT(upap_timeout, pcb);
@@ -534,7 +534,7 @@ static void upap_sauthreq(ppp_pcb *pcb) {
     int outlen;
 
     outlen = UPAP_HEADERLEN + 2 * sizeof (u_char) +
-	pcb->upap.us_userlen + pcb->upap.us_passwdlen;
+    pcb->upap.us_userlen + pcb->upap.us_passwdlen;
     p = pbuf_alloc(PBUF_RAW, (u16_t)(PPP_HDRLEN +outlen), PBUF_RAM);
     if(NULL == p)
         return;
@@ -608,68 +608,68 @@ static int upap_printpkt(const u_char *p, int plen, void (*printer) (void *, con
     const u_char *pstart;
 
     if (plen < UPAP_HEADERLEN)
-	return 0;
+    return 0;
     pstart = p;
     GETCHAR(code, p);
     GETCHAR(id, p);
     GETSHORT(len, p);
     if (len < UPAP_HEADERLEN || len > plen)
-	return 0;
+    return 0;
 
     if (code >= 1 && code <= (int)LWIP_ARRAYSIZE(upap_codenames))
-	printer(arg, " %s", upap_codenames[code-1]);
+    printer(arg, " %s", upap_codenames[code-1]);
     else
-	printer(arg, " code=0x%x", code);
+    printer(arg, " code=0x%x", code);
     printer(arg, " id=0x%x", id);
     len -= UPAP_HEADERLEN;
     switch (code) {
     case UPAP_AUTHREQ:
-	if (len < 1)
-	    break;
-	ulen = p[0];
-	if (len < ulen + 2)
-	    break;
-	wlen = p[ulen + 1];
-	if (len < ulen + wlen + 2)
-	    break;
-	user = (const u_char *) (p + 1);
-	pwd = (const u_char *) (p + ulen + 2);
-	p += ulen + wlen + 2;
-	len -= ulen + wlen + 2;
-	printer(arg, " user=");
-	ppp_print_string(user, ulen, printer, arg);
-	printer(arg, " password=");
+    if (len < 1)
+        break;
+    ulen = p[0];
+    if (len < ulen + 2)
+        break;
+    wlen = p[ulen + 1];
+    if (len < ulen + wlen + 2)
+        break;
+    user = (const u_char *) (p + 1);
+    pwd = (const u_char *) (p + ulen + 2);
+    p += ulen + wlen + 2;
+    len -= ulen + wlen + 2;
+    printer(arg, " user=");
+    ppp_print_string(user, ulen, printer, arg);
+    printer(arg, " password=");
 /* FIXME: require ppp_pcb struct as printpkt() argument */
 #if 0
-	if (!pcb->settings.hide_password)
+    if (!pcb->settings.hide_password)
 #endif
-	    ppp_print_string(pwd, wlen, printer, arg);
+        ppp_print_string(pwd, wlen, printer, arg);
 #if 0
-	else
-	    printer(arg, "<hidden>");
+    else
+        printer(arg, "<hidden>");
 #endif
-	break;
+    break;
     case UPAP_AUTHACK:
     case UPAP_AUTHNAK:
-	if (len < 1)
-	    break;
-	mlen = p[0];
-	if (len < mlen + 1)
-	    break;
-	msg = (const u_char *) (p + 1);
-	p += mlen + 1;
-	len -= mlen + 1;
-	printer(arg, " ");
-	ppp_print_string(msg, mlen, printer, arg);
-	break;
+    if (len < 1)
+        break;
+    mlen = p[0];
+    if (len < mlen + 1)
+        break;
+    msg = (const u_char *) (p + 1);
+    p += mlen + 1;
+    len -= mlen + 1;
+    printer(arg, " ");
+    ppp_print_string(msg, mlen, printer, arg);
+    break;
     default:
-	break;
+    break;
     }
 
     /* print the rest of the bytes in the packet */
     for (; len > 0; --len) {
-	GETCHAR(code, p);
-	printer(arg, " %.2x", code);
+    GETCHAR(code, p);
+    printer(arg, " %.2x", code);
     }
 
     return p - pstart;
diff --git a/src/netif/ppp/utils.c b/src/netif/ppp/utils.c
index 99a5fb1d..69a87fff 100644
--- a/src/netif/ppp/utils.c
+++ b/src/netif/ppp/utils.c
@@ -72,7 +72,7 @@ static void ppp_log_write(int level, char *buf);
 #if PRINTPKT_SUPPORT
 static void ppp_vslp_printer(void *arg, const char *fmt, ...);
 static void ppp_format_packet(const u_char *p, int len,
-		void (*printer) (void *, const char *, ...), void *arg);
+        void (*printer) (void *, const char *, ...), void *arg);
 
 struct buffer_info {
     char *ptr;
@@ -88,12 +88,12 @@ size_t ppp_strlcpy(char *dest, const char *src, size_t len) {
     size_t ret = strlen(src);
 
     if (len != 0) {
-	if (ret < len)
-	    strcpy(dest, src);
-	else {
-	    strncpy(dest, src, len - 1);
-	    dest[len-1] = 0;
-	}
+    if (ret < len)
+        strcpy(dest, src);
+    else {
+        strncpy(dest, src, len - 1);
+        dest[len-1] = 0;
+    }
     }
     return ret;
 }
@@ -130,7 +130,7 @@ int ppp_slprintf(char *buf, int buflen, const char *fmt, ...) {
 /*
  * ppp_vslprintf - like ppp_slprintf, takes a va_list instead of a list of args.
  */
-#define OUTCHAR(c)	(buflen > 0? (--buflen, *buf++ = (c)): 0)
+#define OUTCHAR(c)  (buflen > 0? (--buflen, *buf++ = (c)): 0)
 
 int ppp_vslprintf(char *buf, int buflen, const char *fmt, va_list args) {
     int c, i, n;
@@ -153,249 +153,249 @@ int ppp_vslprintf(char *buf, int buflen, const char *fmt, va_list args) {
     buf0 = buf;
     --buflen;
     while (buflen > 0) {
-	for (f = fmt; *f != '%' && *f != 0; ++f)
-	    ;
-	if (f > fmt) {
-	    len = f - fmt;
-	    if (len > buflen)
-		len = buflen;
-	    memcpy(buf, fmt, len);
-	    buf += len;
-	    buflen -= len;
-	    fmt = f;
-	}
-	if (*fmt == 0)
-	    break;
-	c = *++fmt;
-	width = 0;
-	prec = -1;
-	fillch = ' ';
-	if (c == '0') {
-	    fillch = '0';
-	    c = *++fmt;
-	}
-	if (c == '*') {
-	    width = va_arg(args, int);
-	    c = *++fmt;
-	} else {
-	    while (lwip_isdigit(c)) {
-		width = width * 10 + c - '0';
-		c = *++fmt;
-	    }
-	}
-	if (c == '.') {
-	    c = *++fmt;
-	    if (c == '*') {
-		prec = va_arg(args, int);
-		c = *++fmt;
-	    } else {
-		prec = 0;
-		while (lwip_isdigit(c)) {
-		    prec = prec * 10 + c - '0';
-		    c = *++fmt;
-		}
-	    }
-	}
-	str = 0;
-	base = 0;
-	neg = 0;
-	++fmt;
-	switch (c) {
-	case 'l':
-	    c = *fmt++;
-	    switch (c) {
-	    case 'd':
-		val = va_arg(args, long);
-		if ((long)val < 0) {
-		    neg = 1;
-		    val = (unsigned long)-(long)val;
-		}
-		base = 10;
-		break;
-	    case 'u':
-		val = va_arg(args, unsigned long);
-		base = 10;
-		break;
-	    default:
-		OUTCHAR('%');
-		OUTCHAR('l');
-		--fmt;		/* so %lz outputs %lz etc. */
-		continue;
-	    }
-	    break;
-	case 'd':
-	    i = va_arg(args, int);
-	    if (i < 0) {
-		neg = 1;
-		val = -i;
-	    } else
-		val = i;
-	    base = 10;
-	    break;
-	case 'u':
-	    val = va_arg(args, unsigned int);
-	    base = 10;
-	    break;
-	case 'o':
-	    val = va_arg(args, unsigned int);
-	    base = 8;
-	    break;
-	case 'x':
-	case 'X':
-	    val = va_arg(args, unsigned int);
-	    base = 16;
-	    break;
+    for (f = fmt; *f != '%' && *f != 0; ++f)
+        ;
+    if (f > fmt) {
+        len = f - fmt;
+        if (len > buflen)
+        len = buflen;
+        memcpy(buf, fmt, len);
+        buf += len;
+        buflen -= len;
+        fmt = f;
+    }
+    if (*fmt == 0)
+        break;
+    c = *++fmt;
+    width = 0;
+    prec = -1;
+    fillch = ' ';
+    if (c == '0') {
+        fillch = '0';
+        c = *++fmt;
+    }
+    if (c == '*') {
+        width = va_arg(args, int);
+        c = *++fmt;
+    } else {
+        while (lwip_isdigit(c)) {
+        width = width * 10 + c - '0';
+        c = *++fmt;
+        }
+    }
+    if (c == '.') {
+        c = *++fmt;
+        if (c == '*') {
+        prec = va_arg(args, int);
+        c = *++fmt;
+        } else {
+        prec = 0;
+        while (lwip_isdigit(c)) {
+            prec = prec * 10 + c - '0';
+            c = *++fmt;
+        }
+        }
+    }
+    str = 0;
+    base = 0;
+    neg = 0;
+    ++fmt;
+    switch (c) {
+    case 'l':
+        c = *fmt++;
+        switch (c) {
+        case 'd':
+        val = va_arg(args, long);
+        if ((long)val < 0) {
+            neg = 1;
+            val = (unsigned long)-(long)val;
+        }
+        base = 10;
+        break;
+        case 'u':
+        val = va_arg(args, unsigned long);
+        base = 10;
+        break;
+        default:
+        OUTCHAR('%');
+        OUTCHAR('l');
+        --fmt;      /* so %lz outputs %lz etc. */
+        continue;
+        }
+        break;
+    case 'd':
+        i = va_arg(args, int);
+        if (i < 0) {
+        neg = 1;
+        val = -i;
+        } else
+        val = i;
+        base = 10;
+        break;
+    case 'u':
+        val = va_arg(args, unsigned int);
+        base = 10;
+        break;
+    case 'o':
+        val = va_arg(args, unsigned int);
+        base = 8;
+        break;
+    case 'x':
+    case 'X':
+        val = va_arg(args, unsigned int);
+        base = 16;
+        break;
 #if 0 /* unused (and wrong on LLP64 systems) */
-	case 'p':
-	    val = (unsigned long) va_arg(args, void *);
-	    base = 16;
-	    neg = 2;
-	    break;
+    case 'p':
+        val = (unsigned long) va_arg(args, void *);
+        base = 16;
+        neg = 2;
+        break;
 #endif /* unused (and wrong on LLP64 systems) */
-	case 's':
-	    str = va_arg(args, char *);
-	    break;
-	case 'c':
-	    num[0] = va_arg(args, int);
-	    num[1] = 0;
-	    str = num;
-	    break;
+    case 's':
+        str = va_arg(args, char *);
+        break;
+    case 'c':
+        num[0] = va_arg(args, int);
+        num[1] = 0;
+        str = num;
+        break;
 #if 0 /* do we always have strerror() in embedded ? */
-	case 'm':
-	    str = strerror(errno);
-	    break;
+    case 'm':
+        str = strerror(errno);
+        break;
 #endif /* do we always have strerror() in embedded ? */
-	case 'I':
-	    ip = va_arg(args, u32_t);
-	    ip = lwip_ntohl(ip);
-	    ppp_slprintf(num, sizeof(num), "%d.%d.%d.%d", (ip >> 24) & 0xff,
-		     (ip >> 16) & 0xff, (ip >> 8) & 0xff, ip & 0xff);
-	    str = num;
-	    break;
+    case 'I':
+        ip = va_arg(args, u32_t);
+        ip = lwip_ntohl(ip);
+        ppp_slprintf(num, sizeof(num), "%d.%d.%d.%d", (ip >> 24) & 0xff,
+             (ip >> 16) & 0xff, (ip >> 8) & 0xff, ip & 0xff);
+        str = num;
+        break;
 #if 0 /* need port */
-	case 't':
-	    time(&t);
-	    str = ctime(&t);
-	    str += 4;		/* chop off the day name */
-	    str[15] = 0;	/* chop off year and newline */
-	    break;
+    case 't':
+        time(&t);
+        str = ctime(&t);
+        str += 4;       /* chop off the day name */
+        str[15] = 0;    /* chop off year and newline */
+        break;
 #endif /* need port */
-	case 'v':		/* "visible" string */
-	case 'q':		/* quoted string */
-	    quoted = c == 'q';
-	    p = va_arg(args, unsigned char *);
-	    if (p == NULL)
-		p = (const unsigned char *)"<NULL>";
-	    if (fillch == '0' && prec >= 0) {
-		n = prec;
-	    } else {
-		n = strlen((const char *)p);
-		if (prec >= 0 && n > prec)
-		    n = prec;
-	    }
-	    while (n > 0 && buflen > 0) {
-		c = *p++;
-		--n;
-		if (!quoted && c >= 0x80) {
-		    OUTCHAR('M');
-		    OUTCHAR('-');
-		    c -= 0x80;
-		}
-		if (quoted && (c == '"' || c == '\\'))
-		    OUTCHAR('\\');
-		if (c < 0x20 || (0x7f <= c && c < 0xa0)) {
-		    if (quoted) {
-			OUTCHAR('\\');
-			switch (c) {
-			case '\t':	OUTCHAR('t');	break;
-			case '\n':	OUTCHAR('n');	break;
-			case '\b':	OUTCHAR('b');	break;
-			case '\f':	OUTCHAR('f');	break;
-			default:
-			    OUTCHAR('x');
-			    OUTCHAR(hexchars[c >> 4]);
-			    OUTCHAR(hexchars[c & 0xf]);
-			}
-		    } else {
-			if (c == '\t')
-			    OUTCHAR(c);
-			else {
-			    OUTCHAR('^');
-			    OUTCHAR(c ^ 0x40);
-			}
-		    }
-		} else
-		    OUTCHAR(c);
-	    }
-	    continue;
+    case 'v':       /* "visible" string */
+    case 'q':       /* quoted string */
+        quoted = c == 'q';
+        p = va_arg(args, unsigned char *);
+        if (p == NULL)
+        p = (const unsigned char *)"<NULL>";
+        if (fillch == '0' && prec >= 0) {
+        n = prec;
+        } else {
+        n = strlen((const char *)p);
+        if (prec >= 0 && n > prec)
+            n = prec;
+        }
+        while (n > 0 && buflen > 0) {
+        c = *p++;
+        --n;
+        if (!quoted && c >= 0x80) {
+            OUTCHAR('M');
+            OUTCHAR('-');
+            c -= 0x80;
+        }
+        if (quoted && (c == '"' || c == '\\'))
+            OUTCHAR('\\');
+        if (c < 0x20 || (0x7f <= c && c < 0xa0)) {
+            if (quoted) {
+            OUTCHAR('\\');
+            switch (c) {
+            case '\t':  OUTCHAR('t');   break;
+            case '\n':  OUTCHAR('n');   break;
+            case '\b':  OUTCHAR('b');   break;
+            case '\f':  OUTCHAR('f');   break;
+            default:
+                OUTCHAR('x');
+                OUTCHAR(hexchars[c >> 4]);
+                OUTCHAR(hexchars[c & 0xf]);
+            }
+            } else {
+            if (c == '\t')
+                OUTCHAR(c);
+            else {
+                OUTCHAR('^');
+                OUTCHAR(c ^ 0x40);
+            }
+            }
+        } else
+            OUTCHAR(c);
+        }
+        continue;
 #if PRINTPKT_SUPPORT
-	case 'P':		/* print PPP packet */
-	    bufinfo.ptr = buf;
-	    bufinfo.len = buflen + 1;
-	    p = va_arg(args, unsigned char *);
-	    n = va_arg(args, int);
-	    ppp_format_packet(p, n, ppp_vslp_printer, &bufinfo);
-	    buf = bufinfo.ptr;
-	    buflen = bufinfo.len - 1;
-	    continue;
+    case 'P':       /* print PPP packet */
+        bufinfo.ptr = buf;
+        bufinfo.len = buflen + 1;
+        p = va_arg(args, unsigned char *);
+        n = va_arg(args, int);
+        ppp_format_packet(p, n, ppp_vslp_printer, &bufinfo);
+        buf = bufinfo.ptr;
+        buflen = bufinfo.len - 1;
+        continue;
 #endif /* PRINTPKT_SUPPORT */
-	case 'B':
-	    p = va_arg(args, unsigned char *);
-	    for (n = prec; n > 0; --n) {
-		c = *p++;
-		if (fillch == ' ')
-		    OUTCHAR(' ');
-		OUTCHAR(hexchars[(c >> 4) & 0xf]);
-		OUTCHAR(hexchars[c & 0xf]);
-	    }
-	    continue;
-	default:
-	    *buf++ = '%';
-	    if (c != '%')
-		--fmt;		/* so %z outputs %z etc. */
-	    --buflen;
-	    continue;
-	}
-	if (base != 0) {
-	    str = num + sizeof(num);
-	    *--str = 0;
-	    while (str > num + neg) {
-		*--str = hexchars[val % base];
-		val = val / base;
-		if (--prec <= 0 && val == 0)
-		    break;
-	    }
-	    switch (neg) {
-	    case 1:
-		*--str = '-';
-		break;
-	    case 2:
-		*--str = 'x';
-		*--str = '0';
-		break;
-	    default:
-		break;
-	    }
-	    len = num + sizeof(num) - 1 - str;
-	} else {
-	    len = strlen(str);
-	    if (prec >= 0 && len > prec)
-		len = prec;
-	}
-	if (width > 0) {
-	    if (width > buflen)
-		width = buflen;
-	    if ((n = width - len) > 0) {
-		buflen -= n;
-		for (; n > 0; --n)
-		    *buf++ = fillch;
-	    }
-	}
-	if (len > buflen)
-	    len = buflen;
-	memcpy(buf, str, len);
-	buf += len;
-	buflen -= len;
+    case 'B':
+        p = va_arg(args, unsigned char *);
+        for (n = prec; n > 0; --n) {
+        c = *p++;
+        if (fillch == ' ')
+            OUTCHAR(' ');
+        OUTCHAR(hexchars[(c >> 4) & 0xf]);
+        OUTCHAR(hexchars[c & 0xf]);
+        }
+        continue;
+    default:
+        *buf++ = '%';
+        if (c != '%')
+        --fmt;      /* so %z outputs %z etc. */
+        --buflen;
+        continue;
+    }
+    if (base != 0) {
+        str = num + sizeof(num);
+        *--str = 0;
+        while (str > num + neg) {
+        *--str = hexchars[val % base];
+        val = val / base;
+        if (--prec <= 0 && val == 0)
+            break;
+        }
+        switch (neg) {
+        case 1:
+        *--str = '-';
+        break;
+        case 2:
+        *--str = 'x';
+        *--str = '0';
+        break;
+        default:
+        break;
+        }
+        len = num + sizeof(num) - 1 - str;
+    } else {
+        len = strlen(str);
+        if (prec >= 0 && len > prec)
+        len = prec;
+    }
+    if (width > 0) {
+        if (width > buflen)
+        width = buflen;
+        if ((n = width - len) > 0) {
+        buflen -= n;
+        for (; n > 0; --n)
+            *buf++ = fillch;
+        }
+    }
+    if (len > buflen)
+        len = buflen;
+    memcpy(buf, str, len);
+    buf += len;
+    buflen -= len;
     }
     *buf = 0;
     return buf - buf0;
@@ -432,9 +432,9 @@ log_packet(p, len, prefix, level)
     char *prefix;
     int level;
 {
-	init_pr_log(prefix, level);
-	ppp_format_packet(p, len, pr_log, &level);
-	end_pr_log();
+    init_pr_log(prefix, level);
+    ppp_format_packet(p, len, pr_log, &level);
+    end_pr_log();
 }
 #endif /* UNUSED */
 
@@ -444,43 +444,43 @@ log_packet(p, len, prefix, level)
  * calling `printer(arg, format, ...)' to output it.
  */
 static void ppp_format_packet(const u_char *p, int len,
-		void (*printer) (void *, const char *, ...), void *arg) {
+        void (*printer) (void *, const char *, ...), void *arg) {
     int i, n;
     u_short proto;
     const struct protent *protp;
 
     if (len >= 2) {
-	GETSHORT(proto, p);
-	len -= 2;
-	for (i = 0; (protp = protocols[i]) != NULL; ++i)
-	    if (proto == protp->protocol)
-		break;
-	if (protp != NULL) {
-	    printer(arg, "[%s", protp->name);
-	    n = (*protp->printpkt)(p, len, printer, arg);
-	    printer(arg, "]");
-	    p += n;
-	    len -= n;
-	} else {
-	    for (i = 0; (protp = protocols[i]) != NULL; ++i)
-		if (proto == (protp->protocol & ~0x8000))
-		    break;
-	    if (protp != 0 && protp->data_name != 0) {
-		printer(arg, "[%s data]", protp->data_name);
-		if (len > 8)
-		    printer(arg, "%.8B ...", p);
-		else
-		    printer(arg, "%.*B", len, p);
-		len = 0;
-	    } else
-		printer(arg, "[proto=0x%x]", proto);
-	}
+    GETSHORT(proto, p);
+    len -= 2;
+    for (i = 0; (protp = protocols[i]) != NULL; ++i)
+        if (proto == protp->protocol)
+        break;
+    if (protp != NULL) {
+        printer(arg, "[%s", protp->name);
+        n = (*protp->printpkt)(p, len, printer, arg);
+        printer(arg, "]");
+        p += n;
+        len -= n;
+    } else {
+        for (i = 0; (protp = protocols[i]) != NULL; ++i)
+        if (proto == (protp->protocol & ~0x8000))
+            break;
+        if (protp != 0 && protp->data_name != 0) {
+        printer(arg, "[%s data]", protp->data_name);
+        if (len > 8)
+            printer(arg, "%.8B ...", p);
+        else
+            printer(arg, "%.*B", len, p);
+        len = 0;
+        } else
+        printer(arg, "[proto=0x%x]", proto);
+    }
     }
 
     if (len > 32)
-	printer(arg, "%.32B ...", p);
+    printer(arg, "%.32B ...", p);
     else
-	printer(arg, "%.*B", len, p);
+    printer(arg, "%.*B", len, p);
 }
 #endif /* PRINTPKT_SUPPORT */
 
@@ -489,30 +489,30 @@ static void ppp_format_packet(const u_char *p, int len,
  * init_pr_log, end_pr_log - initialize and finish use of pr_log.
  */
 
-static char line[256];		/* line to be logged accumulated here */
-static char *linep;		/* current pointer within line */
-static int llevel;		/* level for logging */
+static char line[256];      /* line to be logged accumulated here */
+static char *linep;     /* current pointer within line */
+static int llevel;      /* level for logging */
 
 void
 init_pr_log(prefix, level)
      const char *prefix;
      int level;
 {
-	linep = line;
-	if (prefix != NULL) {
-		ppp_strlcpy(line, prefix, sizeof(line));
-		linep = line + strlen(line);
-	}
-	llevel = level;
+    linep = line;
+    if (prefix != NULL) {
+        ppp_strlcpy(line, prefix, sizeof(line));
+        linep = line + strlen(line);
+    }
+    llevel = level;
 }
 
 void
 end_pr_log()
 {
-	if (linep != line) {
-		*linep = 0;
-		ppp_log_write(llevel, line);
-	}
+    if (linep != line) {
+        *linep = 0;
+        ppp_log_write(llevel, line);
+    }
 }
 
 /*
@@ -521,47 +521,47 @@ end_pr_log()
 void
 pr_log (void *arg, const char *fmt, ...)
 {
-	int l, n;
-	va_list pvar;
-	char *p, *eol;
-	char buf[256];
-
-	va_start(pvar, fmt);
-	n = ppp_vslprintf(buf, sizeof(buf), fmt, pvar);
-	va_end(pvar);
-
-	p = buf;
-	eol = strchr(buf, '\n');
-	if (linep != line) {
-		l = (eol == NULL)? n: eol - buf;
-		if (linep + l < line + sizeof(line)) {
-			if (l > 0) {
-				memcpy(linep, buf, l);
-				linep += l;
-			}
-			if (eol == NULL)
-				return;
-			p = eol + 1;
-			eol = strchr(p, '\n');
-		}
-		*linep = 0;
-		ppp_log_write(llevel, line);
-		linep = line;
-	}
-
-	while (eol != NULL) {
-		*eol = 0;
-		ppp_log_write(llevel, p);
-		p = eol + 1;
-		eol = strchr(p, '\n');
-	}
-
-	/* assumes sizeof(buf) <= sizeof(line) */
-	l = buf + n - p;
-	if (l > 0) {
-		memcpy(line, p, n);
-		linep = line + l;
-	}
+    int l, n;
+    va_list pvar;
+    char *p, *eol;
+    char buf[256];
+
+    va_start(pvar, fmt);
+    n = ppp_vslprintf(buf, sizeof(buf), fmt, pvar);
+    va_end(pvar);
+
+    p = buf;
+    eol = strchr(buf, '\n');
+    if (linep != line) {
+        l = (eol == NULL)? n: eol - buf;
+        if (linep + l < line + sizeof(line)) {
+            if (l > 0) {
+                memcpy(linep, buf, l);
+                linep += l;
+            }
+            if (eol == NULL)
+                return;
+            p = eol + 1;
+            eol = strchr(p, '\n');
+        }
+        *linep = 0;
+        ppp_log_write(llevel, line);
+        linep = line;
+    }
+
+    while (eol != NULL) {
+        *eol = 0;
+        ppp_log_write(llevel, p);
+        p = eol + 1;
+        eol = strchr(p, '\n');
+    }
+
+    /* assumes sizeof(buf) <= sizeof(line) */
+    l = buf + n - p;
+    if (l > 0) {
+        memcpy(line, p, n);
+        linep = line + l;
+    }
 }
 #endif /* UNUSED */
 
@@ -574,27 +574,27 @@ void ppp_print_string(const u_char *p, int len, void (*printer) (void *, const c
 
     printer(arg, "\"");
     for (; len > 0; --len) {
-	c = *p++;
-	if (' ' <= c && c <= '~') {
-	    if (c == '\\' || c == '"')
-		printer(arg, "\\");
-	    printer(arg, "%c", c);
-	} else {
-	    switch (c) {
-	    case '\n':
-		printer(arg, "\\n");
-		break;
-	    case '\r':
-		printer(arg, "\\r");
-		break;
-	    case '\t':
-		printer(arg, "\\t");
-		break;
-	    default:
-		printer(arg, "\\%.3o", (u8_t)c);
-		/* no break */
-	    }
-	}
+    c = *p++;
+    if (' ' <= c && c <= '~') {
+        if (c == '\\' || c == '"')
+        printer(arg, "\\");
+        printer(arg, "%c", c);
+    } else {
+        switch (c) {
+        case '\n':
+        printer(arg, "\\n");
+        break;
+        case '\r':
+        printer(arg, "\\r");
+        break;
+        case '\t':
+        printer(arg, "\\t");
+        break;
+        default:
+        printer(arg, "\\%.3o", (u8_t)c);
+        /* no break */
+        }
+    }
     }
     printer(arg, "\"");
 }
@@ -615,13 +615,13 @@ static void ppp_log_write(int level, char *buf) {
     PPPDEBUG(level, ("%s\n", buf) );
 #if 0
     if (log_to_fd >= 0 && (level != LOG_DEBUG || debug)) {
-	int n = strlen(buf);
+    int n = strlen(buf);
 
-	if (n > 0 && buf[n-1] == '\n')
-	    --n;
-	if (write(log_to_fd, buf, n) != n
-	    || write(log_to_fd, "\n", 1) != 1)
-	    log_to_fd = -1;
+    if (n > 0 && buf[n-1] == '\n')
+        --n;
+    if (write(log_to_fd, buf, n) != n
+        || write(log_to_fd, "\n", 1) != 1)
+        log_to_fd = -1;
     }
 #endif
 }
@@ -710,18 +710,18 @@ void ppp_dump_packet(ppp_pcb *pcb, const char *tag, unsigned char *p, int len) {
      */
     proto = (p[0] << 8) + p[1];
     if (proto < 0xC000 && (proto & ~0x8000) == proto)
-	return;
+    return;
 
     /*
      * don't print valid LCP echo request/reply packets if the link is up.
      */
     if (proto == PPP_LCP && pcb->phase == PPP_PHASE_RUNNING && len >= 2 + HEADERLEN) {
-	unsigned char *lcp = p + 2;
-	int l = (lcp[2] << 8) + lcp[3];
+    unsigned char *lcp = p + 2;
+    int l = (lcp[2] << 8) + lcp[3];
 
-	if ((lcp[0] == ECHOREQ || lcp[0] == ECHOREP)
-	    && l >= HEADERLEN && l <= len - 2)
-	    return;
+    if ((lcp[0] == ECHOREQ || lcp[0] == ECHOREP)
+        && l >= HEADERLEN && l <= len - 2)
+        return;
     }
 
     ppp_dbglog(("%s %P", tag, p, len));
@@ -737,34 +737,34 @@ void ppp_dump_packet(ppp_pcb *pcb, const char *tag, unsigned char *p, int len) {
 ssize_t
 complete_read(int fd, void *buf, size_t count)
 {
-	size_t done;
-	ssize_t nb;
-	char *ptr = buf;
-
-	for (done = 0; done < count; ) {
-		nb = read(fd, ptr, count - done);
-		if (nb < 0) {
-			if (errno == EINTR)
-				continue;
-			return -1;
-		}
-		if (nb == 0)
-			break;
-		done += nb;
-		ptr += nb;
-	}
-	return done;
+    size_t done;
+    ssize_t nb;
+    char *ptr = buf;
+
+    for (done = 0; done < count; ) {
+        nb = read(fd, ptr, count - done);
+        if (nb < 0) {
+            if (errno == EINTR)
+                continue;
+            return -1;
+        }
+        if (nb == 0)
+            break;
+        done += nb;
+        ptr += nb;
+    }
+    return done;
 }
 
 /* Procedures for locking the serial device using a lock file. */
 #ifndef LOCK_DIR
 #ifdef __linux__
-#define LOCK_DIR	"/var/lock"
+#define LOCK_DIR    "/var/lock"
 #else
 #ifdef SVR4
-#define LOCK_DIR	"/var/spool/locks"
+#define LOCK_DIR    "/var/spool/locks"
 #else
-#define LOCK_DIR	"/var/spool/lock"
+#define LOCK_DIR    "/var/spool/lock"
 #endif
 #endif
 #endif /* LOCK_DIR */
@@ -783,14 +783,14 @@ lock(dev)
 
     result = mklock (dev, (void *) 0);
     if (result == 0) {
-	ppp_strlcpy(lock_file, dev, sizeof(lock_file));
-	return 0;
+    ppp_strlcpy(lock_file, dev, sizeof(lock_file));
+    return 0;
     }
 
     if (result > 0)
         ppp_notice(("Device %s is locked by pid %d", dev, result));
     else
-	ppp_error(("Can't create lock file %s", lock_file));
+    ppp_error(("Can't create lock file %s", lock_file));
     return -1;
 
 #else /* LOCKLIB */
@@ -802,83 +802,83 @@ lock(dev)
     struct stat sbuf;
 
     if (stat(dev, &sbuf) < 0) {
-	ppp_error(("Can't get device number for %s: %m", dev));
-	return -1;
+    ppp_error(("Can't get device number for %s: %m", dev));
+    return -1;
     }
     if ((sbuf.st_mode & S_IFMT) != S_IFCHR) {
-	ppp_error(("Can't lock %s: not a character device", dev));
-	return -1;
+    ppp_error(("Can't lock %s: not a character device", dev));
+    return -1;
     }
     ppp_slprintf(lock_file, sizeof(lock_file), "%s/LK.%03d.%03d.%03d",
-	     LOCK_DIR, major(sbuf.st_dev),
-	     major(sbuf.st_rdev), minor(sbuf.st_rdev));
+         LOCK_DIR, major(sbuf.st_dev),
+         major(sbuf.st_rdev), minor(sbuf.st_rdev));
 #else
     char *p;
     char lockdev[MAXPATHLEN];
 
     if ((p = strstr(dev, "dev/")) != NULL) {
-	dev = p + 4;
-	strncpy(lockdev, dev, MAXPATHLEN-1);
-	lockdev[MAXPATHLEN-1] = 0;
-	while ((p = strrchr(lockdev, '/')) != NULL) {
-	    *p = '_';
-	}
-	dev = lockdev;
+    dev = p + 4;
+    strncpy(lockdev, dev, MAXPATHLEN-1);
+    lockdev[MAXPATHLEN-1] = 0;
+    while ((p = strrchr(lockdev, '/')) != NULL) {
+        *p = '_';
+    }
+    dev = lockdev;
     } else
-	if ((p = strrchr(dev, '/')) != NULL)
-	    dev = p + 1;
+    if ((p = strrchr(dev, '/')) != NULL)
+        dev = p + 1;
 
     ppp_slprintf(lock_file, sizeof(lock_file), "%s/LCK..%s", LOCK_DIR, dev);
 #endif
 
     while ((fd = open(lock_file, O_EXCL | O_CREAT | O_RDWR, 0644)) < 0) {
-	if (errno != EEXIST) {
-	    ppp_error(("Can't create lock file %s: %m", lock_file));
-	    break;
-	}
-
-	/* Read the lock file to find out who has the device locked. */
-	fd = open(lock_file, O_RDONLY, 0);
-	if (fd < 0) {
-	    if (errno == ENOENT) /* This is just a timing problem. */
-		continue;
-	    ppp_error(("Can't open existing lock file %s: %m", lock_file));
-	    break;
-	}
+    if (errno != EEXIST) {
+        ppp_error(("Can't create lock file %s: %m", lock_file));
+        break;
+    }
+
+    /* Read the lock file to find out who has the device locked. */
+    fd = open(lock_file, O_RDONLY, 0);
+    if (fd < 0) {
+        if (errno == ENOENT) /* This is just a timing problem. */
+        continue;
+        ppp_error(("Can't open existing lock file %s: %m", lock_file));
+        break;
+    }
 #ifndef LOCK_BINARY
-	n = read(fd, lock_buffer, 11);
+    n = read(fd, lock_buffer, 11);
 #else
-	n = read(fd, &pid, sizeof(pid));
+    n = read(fd, &pid, sizeof(pid));
 #endif /* LOCK_BINARY */
-	close(fd);
-	fd = -1;
-	if (n <= 0) {
-	    ppp_error(("Can't read pid from lock file %s", lock_file));
-	    break;
-	}
-
-	/* See if the process still exists. */
+    close(fd);
+    fd = -1;
+    if (n <= 0) {
+        ppp_error(("Can't read pid from lock file %s", lock_file));
+        break;
+    }
+
+    /* See if the process still exists. */
 #ifndef LOCK_BINARY
-	lock_buffer[n] = 0;
-	pid = atoi(lock_buffer);
+    lock_buffer[n] = 0;
+    pid = atoi(lock_buffer);
 #endif /* LOCK_BINARY */
-	if (pid == getpid())
-	    return 1;		/* somebody else locked it for us */
-	if (pid == 0
-	    || (kill(pid, 0) == -1 && errno == ESRCH)) {
-	    if (unlink (lock_file) == 0) {
-		ppp_notice(("Removed stale lock on %s (pid %d)", dev, pid));
-		continue;
-	    }
-	    ppp_warn(("Couldn't remove stale lock on %s", dev));
-	} else
-	    ppp_notice(("Device %s is locked by pid %d", dev, pid));
-	break;
+    if (pid == getpid())
+        return 1;       /* somebody else locked it for us */
+    if (pid == 0
+        || (kill(pid, 0) == -1 && errno == ESRCH)) {
+        if (unlink (lock_file) == 0) {
+        ppp_notice(("Removed stale lock on %s (pid %d)", dev, pid));
+        continue;
+        }
+        ppp_warn(("Couldn't remove stale lock on %s", dev));
+    } else
+        ppp_notice(("Device %s is locked by pid %d", dev, pid));
+    break;
     }
 
     if (fd < 0) {
-	lock_file[0] = 0;
-	return -1;
+    lock_file[0] = 0;
+    return -1;
     }
 
     pid = getpid();
@@ -916,12 +916,12 @@ relock(pid)
     char lock_buffer[12];
 
     if (lock_file[0] == 0)
-	return -1;
+    return -1;
     fd = open(lock_file, O_WRONLY, 0);
     if (fd < 0) {
-	ppp_error(("Couldn't reopen lock file %s: %m", lock_file));
-	lock_file[0] = 0;
-	return -1;
+    ppp_error(("Couldn't reopen lock file %s: %m", lock_file));
+    lock_file[0] = 0;
+    return -1;
     }
 
 #ifndef LOCK_BINARY
@@ -944,11 +944,11 @@ unlock()
 {
     if (lock_file[0]) {
 #ifdef LOCKLIB
-	(void) rmlock(lock_file, (void *) 0);
+    (void) rmlock(lock_file, (void *) 0);
 #else
-	unlink(lock_file);
+    unlink(lock_file);
 #endif
-	lock_file[0] = 0;
+    lock_file[0] = 0;
     }
 }
 
diff --git a/test/fuzz/fuzz.c b/test/fuzz/fuzz.c
index 8eb453fe..6a540a7e 100644
--- a/test/fuzz/fuzz.c
+++ b/test/fuzz/fuzz.c
@@ -1,8 +1,8 @@
 /*
  * Copyright (c) 2001-2003 Swedish Institute of Computer Science.
- * All rights reserved. 
- * 
- * Redistribution and use in source and binary forms, with or without modification, 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
  * are permitted provided that the following conditions are met:
  *
  * 1. Redistributions of source code must retain the above copyright notice,
@@ -11,21 +11,21 @@
  *    this list of conditions and the following disclaimer in the documentation
  *    and/or other materials provided with the distribution.
  * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
+ *    derived from this software without specific prior written permission.
  *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
+ * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
  * OF SUCH DAMAGE.
  *
  * This file is part of the lwIP TCP/IP stack.
- * 
+ *
  * Author: Erik Ekman <erik@kryo.se>
  *         Simon Goldschmidt <goldsimon@gmx.de>
  *
diff --git a/test/fuzz/fuzz2.c b/test/fuzz/fuzz2.c
index b6a9ceb7..cace7315 100644
--- a/test/fuzz/fuzz2.c
+++ b/test/fuzz/fuzz2.c
@@ -1,8 +1,8 @@
 /*
  * Copyright (c) 2001-2003 Swedish Institute of Computer Science.
- * All rights reserved. 
- * 
- * Redistribution and use in source and binary forms, with or without modification, 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
  * are permitted provided that the following conditions are met:
  *
  * 1. Redistributions of source code must retain the above copyright notice,
@@ -11,21 +11,21 @@
  *    this list of conditions and the following disclaimer in the documentation
  *    and/or other materials provided with the distribution.
  * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
+ *    derived from this software without specific prior written permission.
  *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
+ * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
  * OF SUCH DAMAGE.
  *
  * This file is part of the lwIP TCP/IP stack.
- * 
+ *
  * Author: Erik Ekman <erik@kryo.se>
  *         Simon Goldschmidt <goldsimon@gmx.de>
  *
diff --git a/test/sockets/sockets_stresstest.c b/test/sockets/sockets_stresstest.c
index 3ac553b1..e73cfe3b 100644
--- a/test/sockets/sockets_stresstest.c
+++ b/test/sockets/sockets_stresstest.c
@@ -16,12 +16,12 @@
  * - full duplex
  * - add asserts about internal socket/netconn/pcb state?
  */
- 
+
  /*
  * Copyright (c) 2017 Simon Goldschmidt
  * All rights reserved.
- * 
- * Redistribution and use in source and binary forms, with or without modification, 
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
  * are permitted provided that the following conditions are met:
  *
  * 1. Redistributions of source code must retain the above copyright notice,
@@ -30,21 +30,21 @@
  *    this list of conditions and the following disclaimer in the documentation
  *    and/or other materials provided with the distribution.
  * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
+ *    derived from this software without specific prior written permission.
  *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
+ * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
  * OF SUCH DAMAGE.
  *
  * This file is part of the lwIP TCP/IP stack.
- * 
+ *
  * Author: Simon Goldschmidt <goldsimon@gmx.de>
  *
  */
diff --git a/test/sockets/sockets_stresstest.h b/test/sockets/sockets_stresstest.h
index 178e604a..256ea000 100644
--- a/test/sockets/sockets_stresstest.h
+++ b/test/sockets/sockets_stresstest.h
@@ -1,8 +1,8 @@
 /*
  * Copyright (c) 2017 Simon Goldschmidt
  * All rights reserved.
- * 
- * Redistribution and use in source and binary forms, with or without modification, 
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
  * are permitted provided that the following conditions are met:
  *
  * 1. Redistributions of source code must retain the above copyright notice,
@@ -11,21 +11,21 @@
  *    this list of conditions and the following disclaimer in the documentation
  *    and/or other materials provided with the distribution.
  * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
+ *    derived from this software without specific prior written permission.
  *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
+ * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
  * OF SUCH DAMAGE.
  *
  * This file is part of the lwIP TCP/IP stack.
- * 
+ *
  * Author: Simon Goldschmidt <goldsimon@gmx.de>
  *
  */
diff --git a/test/unit/api/test_sockets.c b/test/unit/api/test_sockets.c
index 3faa5ff9..8b461972 100644
--- a/test/unit/api/test_sockets.c
+++ b/test/unit/api/test_sockets.c
@@ -255,7 +255,7 @@ static void test_sockets_msgapi_update_iovs(struct msghdr *msg, size_t bytes)
   /* note: this modifies the underyling iov_base and iov_len for a partial
      read for an individual vector. This updates the msg->msg_iov pointer
      to skip fully consumed vectors */
-  
+
   /* process fully consumed vectors */
   for (i = 0; i < msg->msg_iovlen; i++) {
     if (msg->msg_iov[i].iov_len <= bytes) {
@@ -395,7 +395,7 @@ static void test_sockets_msgapi_tcp(int domain)
       /* note: since we always receive after sending, there will be open
          space in the send buffer */
       fail_unless(ret > 0);
-    
+
       bytes_written += ret;
       if (bytes_written < TOTAL_DATA_SZ) {
         test_sockets_msgapi_update_iovs(&smsg, (size_t)ret);
@@ -432,7 +432,7 @@ static void test_sockets_msgapi_tcp(int domain)
       }
     } while(ret > 0);
   }
-  
+
   ret = lwip_close(s1);
   fail_unless(ret == 0);
   ret = lwip_close(s2);
@@ -588,13 +588,13 @@ static void test_sockets_msgapi_cmsg(int domain)
   memset(rcv_buf, 0, sizeof(rcv_buf));
   ret = lwip_sendto(s, snd_buf, sizeof(snd_buf), 0, (struct sockaddr*)&addr_storage, addr_size);
   fail_unless(ret == sizeof(snd_buf));
-  
+
   tcpip_thread_poll_one();
 
   ret = lwip_recvmsg(s, &msg, 0);
   fail_unless(ret == sizeof(rcv_buf));
   fail_unless(!memcmp(rcv_buf, snd_buf, sizeof(rcv_buf)));
-  
+
   /* Verify message header */
   cmsg = CMSG_FIRSTHDR(&msg);
   fail_unless(cmsg != NULL);
diff --git a/test/unit/arch/sys_arch.c b/test/unit/arch/sys_arch.c
index ed0e34f0..c1fe6534 100644
--- a/test/unit/arch/sys_arch.c
+++ b/test/unit/arch/sys_arch.c
@@ -1,8 +1,8 @@
 /*
  * Copyright (c) 2017 Simon Goldschmidt
- * All rights reserved. 
- * 
- * Redistribution and use in source and binary forms, with or without modification, 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
  * are permitted provided that the following conditions are met:
  *
  * 1. Redistributions of source code must retain the above copyright notice,
@@ -11,21 +11,21 @@
  *    this list of conditions and the following disclaimer in the documentation
  *    and/or other materials provided with the distribution.
  * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
+ *    derived from this software without specific prior written permission.
  *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
+ * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
  * OF SUCH DAMAGE.
  *
  * This file is part of the lwIP TCP/IP stack.
- * 
+ *
  * Author: Simon Goldschmidt
  *
  */
diff --git a/test/unit/arch/sys_arch.h b/test/unit/arch/sys_arch.h
index 9157b6a8..7709553a 100644
--- a/test/unit/arch/sys_arch.h
+++ b/test/unit/arch/sys_arch.h
@@ -1,8 +1,8 @@
 /*
  * Copyright (c) 2017 Simon Goldschmidt
- * All rights reserved. 
- * 
- * Redistribution and use in source and binary forms, with or without modification, 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
  * are permitted provided that the following conditions are met:
  *
  * 1. Redistributions of source code must retain the above copyright notice,
@@ -11,21 +11,21 @@
  *    this list of conditions and the following disclaimer in the documentation
  *    and/or other materials provided with the distribution.
  * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
+ *    derived from this software without specific prior written permission.
  *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
+ * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
  * OF SUCH DAMAGE.
  *
  * This file is part of the lwIP TCP/IP stack.
- * 
+ *
  * Author: Simon Goldschmidt
  *
  */
diff --git a/test/unit/core/test_timers.c b/test/unit/core/test_timers.c
index 820b7189..30f6ac4c 100644
--- a/test/unit/core/test_timers.c
+++ b/test/unit/core/test_timers.c
@@ -61,7 +61,7 @@ do_test_cyclic_timers(u32_t offset)
   fail_unless(cyclic_fired == 1);
 
   fail_unless((*list_head)->time == (u32_t)(lwip_sys_now + test_cyclic.interval_ms - HANDLER_EXECUTION_TIME));
-  
+
   sys_untimeout(lwip_cyclic_timer, &test_cyclic);
 
 
@@ -128,7 +128,7 @@ static void
 do_test_timers(u32_t offset)
 {
   struct sys_timeo** list_head = sys_timeouts_get_next_timeout();
-  
+
   lwip_sys_now = offset + 0;
 
   sys_timeout(10, dummy_handler, LWIP_PTR_NUMERIC_CAST(void*, 0));
@@ -142,7 +142,7 @@ do_test_timers(u32_t offset)
   fail_unless((*list_head)->time             == (u32_t)(lwip_sys_now + 5));
   fail_unless((*list_head)->next->time       == (u32_t)(lwip_sys_now + 10));
   fail_unless((*list_head)->next->next->time == (u32_t)(lwip_sys_now + 20));
-  
+
   /* check timers expire in correct order */
   memset(&fired, 0, sizeof(fired));
 
diff --git a/test/unit/lwipopts.h b/test/unit/lwipopts.h
index 09175c48..b84c6360 100644
--- a/test/unit/lwipopts.h
+++ b/test/unit/lwipopts.h
@@ -1,8 +1,8 @@
 /*
  * Copyright (c) 2001-2003 Swedish Institute of Computer Science.
- * All rights reserved. 
- * 
- * Redistribution and use in source and binary forms, with or without modification, 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
  * are permitted provided that the following conditions are met:
  *
  * 1. Redistributions of source code must retain the above copyright notice,
@@ -11,21 +11,21 @@
  *    this list of conditions and the following disclaimer in the documentation
  *    and/or other materials provided with the distribution.
  * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
+ *    derived from this software without specific prior written permission.
  *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
+ * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
  * OF SUCH DAMAGE.
  *
  * This file is part of the lwIP TCP/IP stack.
- * 
+ *
  * Author: Simon Goldschmidt
  *
  */
diff --git a/test/unit/tcp/tcp_helper.c b/test/unit/tcp/tcp_helper.c
index 33ceb20f..17898325 100644
--- a/test/unit/tcp/tcp_helper.c
+++ b/test/unit/tcp/tcp_helper.c
@@ -152,13 +152,13 @@ tcp_set_state(struct tcp_pcb* pcb, enum tcp_state state, const ip_addr_t* local_
   /* @todo: are these all states? */
   /* @todo: remove from previous list */
   pcb->state = state;
-  
+
   iss = tcp_next_iss(pcb);
   pcb->snd_wl2 = iss;
   pcb->snd_nxt = iss;
   pcb->lastack = iss;
   pcb->snd_lbb = iss;
-  
+
   if (state == ESTABLISHED) {
     TCP_REG(&tcp_active_pcbs, pcb);
     ip_addr_copy(pcb->local_ip, *local_ip);
diff --git a/test/unit/tcp/test_tcp.c b/test/unit/tcp/test_tcp.c
index 42324d47..b80dc7b2 100644
--- a/test/unit/tcp/test_tcp.c
+++ b/test/unit/tcp/test_tcp.c
@@ -525,7 +525,7 @@ START_TEST(test_tcp_fast_retx_recover)
   EXPECT_RET(pcb->dupacks == 3);
   memset(&txcounters, 0, sizeof(txcounters));
   /* @todo: check expected data?*/
-  
+
   /* send data5, not output yet */
   err = tcp_write(pcb, data5, sizeof(data5), TCP_WRITE_FLAG_COPY);
   EXPECT_RET(err == ERR_OK);
@@ -1268,7 +1268,7 @@ static void test_tcp_rto_timeout_impl(int link_down)
   /* check our pcb is no longer active */
   for (cur = tcp_active_pcbs; cur != NULL; cur = cur->next) {
     EXPECT(cur != pcb);
-  }  
+  }
   EXPECT_RET(MEMP_STATS_GET(used, MEMP_TCP_PCB) == 0);
 }
 
@@ -1364,7 +1364,7 @@ static void test_tcp_rto_timeout_syn_sent_impl(int link_down)
   /* check our pcb is no longer active */
   for (cur = tcp_active_pcbs; cur != NULL; cur = cur->next) {
     EXPECT(cur != pcb);
-  }  
+  }
   EXPECT_RET(MEMP_STATS_GET(used, MEMP_TCP_PCB) == 0);
 }
 
@@ -1414,7 +1414,7 @@ static void test_tcp_zwp_timeout_impl(int link_down)
   EXPECT(err == ERR_OK);
   err = tcp_output(pcb);
   EXPECT(err == ERR_OK);
-  
+
   /* verify segment is in-flight */
   EXPECT(pcb->unsent == NULL);
   check_seqnos(pcb->unacked, 1, seqnos);
@@ -1493,7 +1493,7 @@ static void test_tcp_zwp_timeout_impl(int link_down)
   /* check our pcb is no longer active */
   for (cur = tcp_active_pcbs; cur != NULL; cur = cur->next) {
     EXPECT(cur != pcb);
-  }  
+  }
   EXPECT_RET(MEMP_STATS_GET(used, MEMP_TCP_PCB) == 0);
 }
 
-- 
2.29.1.windows.1

