summarylogtreecommitdiffstats
path: root/4149a5ddfcc666ebbca3fcc9da308e7ff9e433b7.patch
blob: 712be4cbd3c51d3cf292ec3adf8e5ab421b8b7e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
diff --git a/.travis.yml b/.travis.yml
index 9951ab0..c314910 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -6,10 +6,10 @@ before_install:
 script:
  - ./configure --enable-largelimits --enable-proxyvsa --enable-miniportal
    --enable-chilliredir --enable-chilliproxy --enable-binstatusfile
-   --enable-chilliscript --enable-chilliradsec --enable-dnslog --enable-layer3
+   --enable-chilliscript --enable-chilliradsec --with-avl --enable-layer3
    --enable-eapol --enable-uamdomainfile --enable-redirdnsreq --enable-modules
    --enable-multiroute --enable-extadmvsa --with-openssl --with-poll
-   --enable-json --enable-libjson --with-avl
+   --enable-json --enable-libjson
  - make
 compiler:
  - clang
diff --git a/conf/chilli.in b/conf/chilli.in
index 2462ba3..fea6dfe 100644
--- a/conf/chilli.in
+++ b/conf/chilli.in
@@ -61,9 +61,9 @@ start() {
         echo "*/$HS_ADMINTERVAL * * * * $0 radconfig") | crontab - 2>&-
     }
 
-    test ${HS_LANIF_KEEPADDR:-0} -eq 0 && ifconfig $HS_LANIF 0.0.0.0
+    test ${HS_LANIF_KEEPADDR:-0} -eq 0 && ip address add 0.0.0.0 dev $HS_LANIF
 
-    daemon $exec -c $CONFIG
+    daemon -- $exec -c $CONFIG
     retval=$?
     echo
     [ $retval -eq 0 ] && touch $lockfile
diff --git a/conf/functions.in b/conf/functions.in
index 2a81474..58ce43b 100644
--- a/conf/functions.in
+++ b/conf/functions.in
@@ -54,7 +54,11 @@ HS_WISPRLOGIN=${HS_WISPRLOGIN:-$HS_UAMSERVICE}
 HS_PAP_OK=${HS_PAP_OK:-on}
 HS_DNS1=${HS_DNS1:-$HS_DNS}
 HS_DNS1=${HS_DNS1:-$(grep '^nameserver' /etc/resolv.conf | head -n1 | awk '{print $2}')}
+if [ $(uname) = "Linux" ]; then
 HS_WANIF=${HS_WANIF:-$(route -n|grep '^0.0.0.0'|head -n1|awk '{print $8}')}
+else
+HS_WANIF=${HS_WANIF:-$(route get default | grep interface | awk '{print $2}')}
+fi
 
 bailout() { echo $1; exit; }
 
@@ -125,7 +129,13 @@ writeconfig() {
     addconfig1 ${HS_GID:+"gid \"$HS_GID\""}
 
     [ -n "$HS_DHCPGATEWAY" ] && {
-	HS_DHCPRELAYAGENT=${HS_DHCPRELAYAGENT:-$(ifconfig $(route -n|grep '^0.0.0.0'|awk '{ print $8 }')|grep 'inet addr:'|cut -d: -f 2|cut -d' ' -f1)}
+	if [ $(uname) = "Linux" ]; then
+	HS_DHCPRELAYAGENT=${HS_DHCPRELAYAGENT:-$(ifconfig $(route -n|grep '^0.0.0.0'| \
+	awk '{ print $8 }')|grep 'inet addr:'|cut -d: -f 2|cut -d' ' -f1)}
+	else
+	HS_DHCPRELAYAGENT=${HS_DHCPRELAYAGENT:-$(ifconfig $(netstat -rn | grep 'default' | \
+	head -n1 | awk '{print$7}') | grep 'inet ' | cut -d/ -f 1 | cut -d' ' -f2)}
+	fi
 	addconfig1 "dhcpgateway \"$HS_DHCPGATEWAY\""
 	addconfig1 "dhcprelayagent \"$HS_DHCPRELAYAGENT\""
     }
@@ -317,6 +327,10 @@ files_equal() {    # returns 0 for equal, 1 for not-equal
 	[ "$(md5sum $1 | cut -f1 -d' ')" = "$(md5sum $2 | cut -f1 -d' ')" ] && return 0;
 	return 1;
     }
+    [ -x /usr/bin/md5 ] || [ -x /sbin/md5 ] || [ -x /bin/md5 ] && {
+	[ "$(md5 $1)" = "$(md5 $2)" ] && return 0;
+	return 1;
+    }
     return 0;
 }
 
diff --git a/debian/changelog b/debian/changelog
index 585b3ce..c439d6a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+coova-chilli (1.4) UNRELEASED; urgency=medium
+
+   * See ChangeLog
+
+ -- David Bird (Coova Technologies) <support@coova.com>  Tue, 03 Jan 2017 12:34:07 +0100
+
 coova-chilli (1.3.0) unstable; urgency=low
 
    * See ChangeLog
diff --git a/debian/compat b/debian/compat
index 7f8f011..f599e28 100644
--- a/debian/compat
+++ b/debian/compat
@@ -1 +1 @@
-7
+10
diff --git a/debian/conffiles b/debian/conffiles
deleted file mode 100644
index 887d58a..0000000
--- a/debian/conffiles
+++ /dev/null
@@ -1,2 +0,0 @@
-/etc/default/chilli
-/etc/init.d/chilli
diff --git a/debian/control b/debian/control
index d10aeda..80f7eed 100644
--- a/debian/control
+++ b/debian/control
@@ -2,18 +2,26 @@ Source: coova-chilli
 Section: net
 Priority: optional
 Maintainer: David Bird (Coova Technologies) <support@coova.com>
-Build-Depends: debhelper (>= 7), libc6-dev | libc6-dev-amd64, gengetopt, libtool, automake, libssl-dev
-Standards-Version: 3.8.1
+Build-Depends: debhelper (>= 7), libc6-dev | libc6-dev-amd64, gengetopt, libtool, automake, libssl-dev, libjson-c-dev
+Standards-Version: 3.9.8
 
 Package: coova-chilli
 Architecture: any
 Replaces: chillispot
 Conflicts: chillispot
 Provides: chillispot
-Depends: iptables, haserl
+Depends:
+ ${shlibs:Depends},
+ iptables,
+ haserl,
+ adduser,
+Suggests:
+ python,
+ python-gtk2,
 Description: Wireless LAN Access Point Controller (captive portal).
  Coova-Chilli is an open source captive portal or wireless LAN access point
  controller, forked from chillispot. It supports web based login which is
- today's standard for public HotSpots and it supports Wireless Protected Access (WPA) which
- is the standard of the future. Authentication, Authorization and Accounting (AAA) 
- is handled by your favorite radius server. Read more at http://coova.github.io/
+ today's standard for public HotSpots and it supports Wireless Protected Access
+ (WPA) which is the standard of the future. Authentication, Authorization and
+ Accounting (AAA) is handled by your favorite radius server. Read more at
+ http://coova.github.io/
diff --git a/miniportal/config-local.sh.in b/miniportal/config-local.sh.in
index 9b92a69..622c5b6 100755
--- a/miniportal/config-local.sh.in
+++ b/miniportal/config-local.sh.in
@@ -130,7 +130,12 @@ local_login_url() {
     if [ "$HS_USELOCALUSERS" = "on" ]; then
 	line=$(head -1 $USERS)
 	if [ "$line" = "" ]; then
+	    if [ -x /usr/bin/md5sum ] || [ -x /bin/md5sum ]; then
 	    echo "tos:$(echo '$$$(date)'|md5sum|cut -f1)" >> $USERS
+	    fi
+	    if [ -x /usr/bin/md5 ] || [ -x /sbin/md5 ] || [ -x /bin/md5 ]; then
+	    echo "tos:$(echo '$$$(date)'|md5)" >> $USERS
+	    fi
 	    line=$(head -1 $USERS)
 	fi
 	if [ "$line" != "" ]; then
@@ -237,7 +242,12 @@ then
 	[ "$HTTPS" = "on" ] && HTTP="https"
 	URL="$HTTP://$SERVER_NAME/$REQUEST_URI?$QS"
 	CHECK="$URL$HS_UAMSECRET"
+	if [ -x /usr/bin/md5sum ] || [ -x /bin/md5sum ]; then
 	CHECK_MD5=$(echo -n "$CHECK" |md5sum|cut -d' ' -f1|tr 'a-z' 'A-Z');
+	fi
+	if [ -x /usr/bin/md5 ] || [ -x /sbin/md5 ] || [ -x /bin/md5 ]; then
+	CHECK_MD5=$(echo -n "$CHECK" |md5 |tr 'a-z' 'A-Z');
+	fi
 	if [ "$CHECK_MD5" = "$FORM_md" ]; then
 	    COOVA_USERURL=$FORM_userurl
 	else
diff --git a/src/chilli.c b/src/chilli.c
index 32a3051..0a7ba30 100644
--- a/src/chilli.c
+++ b/src/chilli.c
@@ -182,19 +182,19 @@ static pid_t launch_daemon(char *name, char *path) {
 #endif
 
 #ifdef ENABLE_CHILLIPROXY
-static void launch_chilliproxy() {
+static void launch_chilliproxy(void) {
   proxy_pid = launch_daemon("[chilli_proxy]", SBINDIR "/chilli_proxy");
 }
 #endif
 
 #ifdef ENABLE_CHILLIREDIR
-static void launch_chilliredir() {
+static void launch_chilliredir(void) {
   redir_pid = launch_daemon("[chilli_redir]", SBINDIR "/chilli_redir");
 }
 #endif
 
 #ifdef ENABLE_CHILLIRADSEC
-static void launch_chilliradsec() {
+static void launch_chilliradsec(void) {
   radsec_pid = launch_daemon("[chilli_radsec]", SBINDIR "/chilli_radsec");
 }
 #endif
@@ -316,19 +316,19 @@ static void _sigchld(int signum) {
       syslog(LOG_DEBUG, "%s(%d): child %d terminated", __FUNCTION__, __LINE__, pid);
 #endif
 #ifdef ENABLE_CHILLIRADSEC
-    if (!_options.debug && radsec_pid > 0 && radsec_pid == pid) {
+    if (radsec_pid > 0 && radsec_pid == pid) {
       syslog(LOG_ERR, "Having to re-launch chilli_radsec... PID %d exited", pid);
       launch_chilliradsec();
     }
 #endif
 #ifdef ENABLE_CHILLIPROXY
-    if (!_options.debug && proxy_pid > 0 && proxy_pid == pid) {
+    if (proxy_pid > 0 && proxy_pid == pid) {
       syslog(LOG_ERR, "Having to re-launch chilli_proxy... PID %d exited", pid);
       launch_chilliproxy();
     }
 #endif
 #ifdef ENABLE_CHILLIREDIR
-    if (!_options.debug && redir_pid > 0 && redir_pid == pid) {
+    if (redir_pid > 0 && redir_pid == pid) {
       syslog(LOG_ERR, "Having to re-launch chilli_redir... PID %d exited", pid);
       launch_chilliredir();
     }
@@ -455,11 +455,11 @@ time_t mainclock_towall(time_t t) {
   return mainclock.tv_sec;
 }
 
-time_t mainclock_wall() {
+time_t mainclock_wall(void) {
   return mainclock_towall(mainclock.tv_sec);
 }
 
-time_t mainclock_tick() {
+time_t mainclock_tick(void) {
 #ifdef HAVE_LIBRT
   struct timespec ts;
 #if defined(CLOCK_MONOTONIC)
@@ -487,11 +487,11 @@ time_t mainclock_tick() {
   return mainclock.tv_sec;
 }
 
-time_t mainclock_now() {
+time_t mainclock_now(void) {
   return mainclock.tv_sec;
 }
 
-time_t mainclock_rt() {
+time_t mainclock_rt(void) {
   time_t rt = 0;
 #ifdef HAVE_LIBRT
   struct timespec ts;
@@ -561,7 +561,7 @@ static void set_sessionid(struct app_conn_t *appconn, char full) {
 
   snprintf(appconn->s_state.sessionid,
 		sizeof(appconn->s_state.sessionid),
-		"%.8lx%.8x", appconn->rt, appconn->unit);
+		"%.8lld%.8x", (long long int)appconn->rt, appconn->unit);
 
   appconn->s_state.redir.classlen = 0;
   appconn->s_state.redir.statelen = 0;
@@ -890,7 +890,7 @@ static int newip(struct ippoolm_t **ipm, struct in_addr *hisip, uint8_t *hismac)
  * A few functions to manage connections
  */
 
-static int initconn() {
+static int initconn(void) {
   checktime = rereadtime = mainclock.tv_sec;
   return 0;
 }
@@ -1183,7 +1183,7 @@ void session_interval(struct app_conn_t *conn) {
 #endif
 }
 
-static int checkconn() {
+static int checkconn(void) {
   struct app_conn_t *conn;
   struct dhcp_conn_t* dhcpconn;
   uint32_t checkdiff;
@@ -1232,7 +1232,7 @@ static int checkconn() {
   return 0;
 }
 
-void chilli_freeconn() {
+void chilli_freeconn(void) {
   struct app_conn_t *conn, *c;
   struct dhcp_conn_t *d = NULL;
 
@@ -1252,7 +1252,7 @@ void chilli_freeconn() {
 }
 
 /* Kill all connections and send Radius Acct Stop */
-int static killconn() {
+int static killconn(void) {
   struct app_conn_t *conn;
 
   for (conn = firstusedconn; conn; conn = conn->next) {
@@ -7182,7 +7182,7 @@ static int rtmon_accept(struct rtmon_t *rtmon, int idx) {
 }
 #endif
 
-static inline void macauth_reserved() {
+static inline void macauth_reserved(void) {
   struct dhcp_conn_t *conn = dhcp->firstusedconn;
   struct app_conn_t *appconn;
 
@@ -7198,7 +7198,7 @@ static inline void macauth_reserved() {
 }
 
 #ifdef ENABLE_LAYER3
-static int session_timeout() {
+static int session_timeout(void) {
   struct app_conn_t *conn = firstusedconn;
 
   while (conn) {
@@ -7413,13 +7413,15 @@ int chilli_main(int argc, char **argv) {
       syslog(LOG_ERR, "%s: getting startup (realtime) time", strerror(errno));
     }
     if (_options.debug)
-      syslog(LOG_DEBUG, "%s(%d): clock realtime sec %ld nsec %ld", __FUNCTION__, __LINE__, startup_real.tv_sec, startup_real.tv_nsec);
+      syslog(LOG_DEBUG, "%s(%d): clock realtime sec %lld nsec %ld", __FUNCTION__, __LINE__,
+	(long long int)startup_real.tv_sec, startup_real.tv_nsec);
 #ifdef CLOCK_MONOTONIC
     if (clock_gettime(CLOCK_MONOTONIC, &startup_mono) < 0) {
       syslog(LOG_ERR, "%s: getting startup (monotonic) time", strerror(errno));
     }
     if (_options.debug)
-      syslog(LOG_DEBUG, "%s(%d): clock monotonic sec %ld nsec %ld", __FUNCTION__, __LINE__, startup_mono.tv_sec, startup_mono.tv_nsec);
+      syslog(LOG_DEBUG, "%s(%d): clock monotonic sec %lld nsec %ld", __FUNCTION__, __LINE__,
+	(long long int)startup_mono.tv_sec, startup_mono.tv_nsec);
 #endif
 #endif
 
diff --git a/src/chilli.h b/src/chilli.h
index d80ac30..1c26b6c 100644
--- a/src/chilli.h
+++ b/src/chilli.h
@@ -202,8 +202,8 @@ struct chilli_peer {
 #endif
 
 #ifdef ENABLE_STATFILE
-int printstatus();
-int loadstatus();
+int printstatus(void);
+int loadstatus(void);
 #endif
 
 int chilli_connect(struct app_conn_t **appconn, struct dhcp_conn_t *conn);
@@ -262,16 +262,16 @@ int dnprot_reject(struct app_conn_t *appconn);
 
 int get_urlparts(char *src, char *host, int hostsize, int *port, int *uripos);
 
-int cmdsock_init();
+int cmdsock_init(void);
 
-int cmdsock_port_init();
+int cmdsock_port_init(void);
 
 void cmdsock_shutdown();
 
-time_t mainclock_tick();
-time_t mainclock_now();
-time_t mainclock_rt();
-time_t mainclock_wall();
+time_t mainclock_tick(void);
+time_t mainclock_now(void);
+time_t mainclock_rt(void);
+time_t mainclock_wall(void);
 time_t mainclock_towall(time_t t);
 int mainclock_diff(time_t past);
 uint32_t mainclock_diffu(time_t past);
@@ -296,8 +296,8 @@ int chilli_learn_location(uint8_t *loc, int loclen,
 #ifdef HAVE_NETFILTER_COOVA
 int kmod_coova_update(struct app_conn_t *appconn);
 int kmod_coova_release(struct dhcp_conn_t *conn);
-int kmod_coova_sync();
-int kmod_coova_clear();
+int kmod_coova_sync(void);
+int kmod_coova_clear(void);
 #endif
 
 #ifdef HAVE_OPENSSL
@@ -325,7 +325,7 @@ uint8_t* chilli_called_station(struct session_state *state);
 int chilli_cmd(struct cmdsock_request *req, bstring s, int sock);
 
 int chilli_handle_signal(void *ctx, int fd);
-void chilli_freeconn();
+void chilli_freeconn(void);
 
 int runscript(struct app_conn_t *appconn, char* script,
 	      char *loc, char *oloc);
@@ -349,10 +349,10 @@ int selfpipe_init (void);
 int selfpipe_read (void);
 int selfpipe_trap (int signo);
 int selfpipe_ignore (int signo);
-void selfpipe_finish();
+void selfpipe_finish(void);
 
 #ifdef ENABLE_LOCATION
-void location_init();
+void location_init(void);
 #ifdef HAVE_AVL
 
 struct loc_search_t {
diff --git a/src/cmdsock.c b/src/cmdsock.c
index 3565b32..8782cf1 100644
--- a/src/cmdsock.c
+++ b/src/cmdsock.c
@@ -20,7 +20,7 @@
 #include "chilli.h"
 
 int
-cmdsock_init() {
+cmdsock_init(void) {
   struct sockaddr_un local;
   int cmdsock;
 
@@ -61,7 +61,7 @@ cmdsock_init() {
 
 
 int
-cmdsock_port_init() {
+cmdsock_port_init(void) {
   struct sockaddr_in local;
   int cmdsock;
   int rc;
diff --git a/src/dhcp.c b/src/dhcp.c
index 395998a..544f396 100644
--- a/src/dhcp.c
+++ b/src/dhcp.c
@@ -1234,10 +1234,6 @@ int dhcp_new(struct dhcp_t **pdhcp, int numconn, int hashsize,
   return 0;
 }
 
-int dhcp_reopen() {
-  return 0;
-}
-
 int dhcp_reserve_ip(uint8_t *mac, struct in_addr *ip) {
   struct dhcp_conn_t *conn = 0;
 
diff --git a/src/garden.c b/src/garden.c
index 3a56164..de1a2ce 100644
--- a/src/garden.c
+++ b/src/garden.c
@@ -74,13 +74,14 @@ int garden_print_appconn(struct app_conn_t *appconn, void *d) {
 		  inet_ntoa(appconn->hisip),
 		  appconn->s_params.pass_through_count,
 		  SESSION_PASS_THROUGH_MAX);
-    if (!safe_write(fd, line, strlen(line))) /* error */;
+    if (!safe_write(fd, line, strlen(line))) /* error */
+      ;
 #ifdef HAVE_PATRICIA
     if (appconn->ptree) {
       patricia_process(appconn->ptree, cb);
     } else
 #endif
-      garden_print_list(fd,
+    garden_print_list(fd,
 			appconn->s_params.pass_throughs,
 			appconn->s_params.pass_through_count);
   }
@@ -136,7 +137,8 @@ void garden_print(int fd) {
 		"authed garden (%d/%d):\n",
 		_options.num_authed_pass_throughs,
 		MAX_PASS_THROUGHS);
-  if (!safe_write(fd, line, strlen(line))) /* error */;
+  if (!safe_write(fd, line, strlen(line))) /* error */
+    ;
 
 #ifdef HAVE_PATRICIA
   if (dhcp->ptree_authed) {
@@ -320,7 +322,7 @@ void garden_patricia_load_list(patricia_tree_t **pptree,
     garden_patricia_add(&ptlist[i], ptree);
 }
 
-void garden_patricia_reload() {
+void garden_patricia_reload(void) {
   if (_options.patricia) {
     garden_patricia_load_list(&dhcp->ptree,
 			      _options.pass_throughs,
@@ -649,7 +651,7 @@ typedef struct uamdomain_regex_t {
 
 static uamdomain_regex * _list_head = 0;
 
-void garden_free_domainfile() {
+void garden_free_domainfile(void) {
   while (_list_head) {
     uamdomain_regex * n = _list_head;
     _list_head = _list_head->next;
@@ -658,7 +660,7 @@ void garden_free_domainfile() {
   }
 }
 
-void garden_load_domainfile() {
+void garden_load_domainfile(void) {
   garden_free_domainfile();
   if (!_options.uamdomainfile) return;
   else {
diff --git a/src/garden.h b/src/garden.h
index 1b07a23..2fc2a94 100644
--- a/src/garden.h
+++ b/src/garden.h
@@ -102,12 +102,12 @@ int garden_patricia_check(patricia_tree_t *ptree,
 void garden_patricia_load_list(patricia_tree_t **pptree,
 			       pass_through *ptlist,
 			       uint32_t ptcnt);
-void garden_patricia_reload();
+void garden_patricia_reload(void);
 #endif
 
 #ifdef ENABLE_UAMDOMAINFILE
-void garden_load_domainfile();
-void garden_free_domainfile();
+void garden_load_domainfile(void);
+void garden_free_domainfile(void);
 int  garden_check_domainfile(char *question);
 #endif
 
diff --git a/src/kcoova.c b/src/kcoova.c
index ddcb04e..faa53f6 100644
--- a/src/kcoova.c
+++ b/src/kcoova.c
@@ -58,12 +58,12 @@ kmod_coova_release(struct dhcp_conn_t *conn) {
 }
 
 int
-kmod_coova_clear() {
+kmod_coova_clear(void) {
   return kmod('/', 0);
 }
 
 int
-kmod_coova_sync() {
+kmod_coova_sync(void) {
   char file[128];
   char * line = 0;
   size_t len = 0;
diff --git a/src/location.c b/src/location.c
index 45542d1..ffc78cb 100644
--- a/src/location.c
+++ b/src/location.c
@@ -509,7 +509,7 @@ void location_printlist(bstring s, char *loc, int json, int list) {
 
 #endif
 
-void location_init() {
+void location_init(void) {
 #ifdef HAVE_AVL
   struct app_conn_t *conn = firstusedconn;
   memset(&loc_search_tree, 0, sizeof(loc_search_tree));
diff --git a/src/main-proxy.c b/src/main-proxy.c
index 4e97a64..2f720f7 100644
--- a/src/main-proxy.c
+++ b/src/main-proxy.c
@@ -87,7 +87,7 @@ static int still_running = 0;
 
 static char nas_hwaddr[PKT_ETH_ALEN];
 
-static void print_requests() {
+static void print_requests(void) {
   proxy_request * req = 0;
   int i;
 
diff --git a/src/ms_chap.c b/src/ms_chap.c
index 2c236d2..8ad8327 100644
--- a/src/ms_chap.c
+++ b/src/ms_chap.c
@@ -96,18 +96,18 @@ MakeKey(u_char *key, u_char *des_key)
   des_key[6] = Get7Bits(key, 42);
   des_key[7] = Get7Bits(key, 49);
 
-  des_set_odd_parity((des_cblock *)des_key);
+  DES_set_odd_parity((DES_cblock *)des_key);
 }
 
 static void /* IN 8 octets IN 7 octest OUT 8 octets */
 DesEncrypt(u_char *clear, u_char *key, u_char *cipher)
 {
-  des_cblock		des_key;
-  des_key_schedule	key_schedule;
+  DES_cblock		des_key;
+  DES_key_schedule	key_schedule;
 
   MakeKey(key, des_key);
-  des_set_key(&des_key, key_schedule);
-  des_ecb_encrypt((des_cblock *)clear, (des_cblock *)cipher, key_schedule, 1);
+  DES_set_key(&des_key, &key_schedule);
+  DES_ecb_encrypt((DES_cblock *)clear, (DES_cblock *)cipher, &key_schedule, 1);
 }
 
 #define LENGTH 20
diff --git a/src/net.c b/src/net.c
index cde91bd..2e4a0cf 100644
--- a/src/net.c
+++ b/src/net.c
@@ -1082,9 +1082,6 @@ int net_route(struct in_addr *dst, struct in_addr *gateway,
   close(fd);
   return 0;
 
-#elif defined(__sun__)
-  syslog(LOG_ERR, "%s: Could not set up routing on Solaris. Please add route manually.", strerror(errno));
-  return 0;
 #else
 #error  "Unknown platform!"
 #endif
@@ -1263,11 +1260,6 @@ int net_open_eth(net_interface *netif) {
     ndelay_on(netif->fd);
     coe(netif->fd);
 
-    option = 1;
-    if (net_setsockopt(netif->fd, SOL_SOCKET, TCP_NODELAY,
-		       &option, sizeof(option)) < 0)
-      return -1;
-
     /* Enable reception and transmission of broadcast frames */
     option = 1;
     if (net_setsockopt(netif->fd, SOL_SOCKET, SO_BROADCAST,
diff --git a/src/options.c b/src/options.c
index 71469a9..eef2171 100644
--- a/src/options.c
+++ b/src/options.c
@@ -23,7 +23,7 @@
 #include "chilli_module.h"
 #endif
 
-void options_init() {
+void options_init(void) {
   memset(&_options, 0, sizeof(_options));
 }
 
@@ -666,12 +666,12 @@ int reload_options(int argc, char **argv) {
   return ok;
 }
 
-void options_destroy() {
+void options_destroy(void) {
   if (_options._data)
     free(_options._data);
 }
 
-void options_cleanup() {
+void options_cleanup(void) {
   char file[128];
 
 #ifdef ENABLE_MODULES
diff --git a/src/options.h b/src/options.h
index 32499c5..af78e90 100644
--- a/src/options.h
+++ b/src/options.h
@@ -437,9 +437,9 @@ int process_options(int argc, char **argv, int minimal);
 void reprocess_options(int argc, char **argv);
 int reload_options(int argc, char **argv);
 int options_save(char *file, bstring bt);
-void options_init();
-void options_destroy();
-void options_cleanup();
+void options_init(void);
+void options_destroy(void);
+void options_cleanup(void);
 
 #ifndef MAIN_FILE /* all main() files must implement _options */
 extern struct options_t _options;
diff --git a/src/queue.c b/src/queue.c
index 587ba67..63e9e63 100644
--- a/src/queue.c
+++ b/src/queue.c
@@ -57,7 +57,7 @@ static  struct nfq_q_handle *qh;
 /*static  struct nfnl_handle *nh;*/
 static  int fd;
 
-int q_setup() {
+int q_setup(void) {
   printf("opening library handle\n");
   h = nfq_open();
   if (!h) {
diff --git a/src/redir.c b/src/redir.c
index c481f14..01b6dd0 100644
--- a/src/redir.c
+++ b/src/redir.c
@@ -3362,7 +3362,8 @@ int redir_main(struct redir_t *redir,
   redir_chartohex(challenge, hexchal, REDIR_MD5LEN);                    \
   msg.mtype = msgtype;                                                  \
   memcpy(conn.s_state.redir.uamchal, challenge, REDIR_MD5LEN);          \
-  if (_options.debug) syslog(LOG_DEBUG, "%s(%d): ---->>> resetting challenge: %s", __FUNCTION__, __LINE__, hexchal)
+  if (_options.debug)							\
+    syslog(LOG_DEBUG, "%s(%d): ---->>> resetting challenge: %s", __FUNCTION__, __LINE__, hexchal)
 
 #ifdef USING_IPC_UNIX
 #define redir_msg_send(msgopt)                                          \
diff --git a/src/statusfile.c b/src/statusfile.c
index 8c57f93..dd77fe3 100644
--- a/src/statusfile.c
+++ b/src/statusfile.c
@@ -29,7 +29,7 @@ extern struct ippool_t *ippool;
 #ifdef ENABLE_BINSTATFILE
 static int has_loaded = 0;
 
-int loadstatus() {
+int loadstatus(void) {
   char filedest[512];
   FILE *file;
   char c;
@@ -303,7 +303,7 @@ int loadstatus() {
   return 0;
 }
 
-int printstatus() {
+int printstatus(void) {
   char filedest[512];
   time_t tm;
   FILE *file;
@@ -371,12 +371,12 @@ int printstatus() {
 }
 #else
 #ifdef ENABLE_STATFILE
-int loadstatus() {
+int loadstatus(void) {
   printstatus();
   return 0;
 }
 
-int printstatus() {
+int printstatus(void) {
   FILE *file;
   char filedest[512];
 
diff --git a/src/system.h b/src/system.h
index 5f268ff..257b65b 100644
--- a/src/system.h
+++ b/src/system.h
@@ -112,6 +112,15 @@
 #include <signal.h>
 #endif
 
+#ifdef HAVE_SYS_SYSINFO_H
+#include <sys/sysinfo.h>
+#else
+#ifdef HAVE_LINUX_SYSINFO_H
+#define _LINUX_KERNEL_H
+#include <linux/sysinfo.h>
+#endif
+#endif
+
 #ifdef HAVE_INTTYPES_H
 #define __STDC_FORMAT_MACROS
 #include <inttypes.h>
@@ -129,15 +138,6 @@
 #include <linux/un.h>
 #endif
 
-#ifdef HAVE_SYS_SYSINFO_H
-#include <sys/sysinfo.h>
-#else
-#ifdef HAVE_LINUX_SYSINFO_H
-#define _LINUX_KERNEL_H
-#include <linux/sysinfo.h>
-#endif
-#endif
-
 #elif defined (__FreeBSD__)  || defined (__APPLE__) || defined (__OpenBSD__) || defined (__NetBSD__)
 #include <net/if.h>
 #include <net/bpf.h>
diff --git a/src/tun.c b/src/tun.c
index 7cd5945..2e8aa25 100644
--- a/src/tun.c
+++ b/src/tun.c
@@ -506,14 +506,6 @@ int tun_addaddr(struct tun_t *this, struct in_addr *addr,
   this->addrs++;
   return 0;
 
-#elif defined (__sun__)
-
-  if (!this->addrs) /* Use ioctl for first addr to make ping work */
-    return tun_setaddr(this, addr, dstaddr, netmask);
-
-  syslog(LOG_ERR, "%s: Setting multiple addresses not possible on Solaris", strerror(errno));
-  return -1;
-
 #else
 #error  "Unknown platform!"
 #endif
@@ -540,12 +532,6 @@ int tuntap_interface(struct _net_interface *netif) {
   struct ifaliasreq areq;
   int fd;
 
-#elif defined(__sun__)
-  int if_fd, ppa = -1;
-  static int ip_fd = 0;
-  int muxid;
-  struct ifreq ifr;
-
 #else
 #error  "Unknown platform!"
 #endif
@@ -687,66 +673,6 @@ int tuntap_interface(struct _net_interface *netif) {
   close(fd);
   return 0;
 
-#elif defined(__sun__)
-
-  if ((ip_fd = open("/dev/udp", O_RDWR, 0)) < 0) {
-    syslog(LOG_ERR, "%s: Can't open /dev/udp", strerror(errno));
-    return -1;
-  }
-
-  if ((netif->fd = open("/dev/tun", O_RDWR, 0)) < 0) {
-    syslog(LOG_ERR, "%s: Can't open /dev/tun", strerror(errno));
-    return -1;
-  }
-
-  /* Assign a new PPA and get its unit number. */
-  if ((ppa = ioctl(netif->fd, TUNNEWPPA, -1)) < 0) {
-    syslog(LOG_ERR, "%s: Can't assign new interface", strerror(errno));
-    return -1;
-  }
-
-  if ((if_fd = open("/dev/tun", O_RDWR, 0)) < 0) {
-    syslog(LOG_ERR, "%s: Can't open /dev/tun (2)", strerror(errno));
-    return -1;
-  }
-
-  if (ioctl(if_fd, I_PUSH, "ip") < 0){
-    syslog(LOG_ERR, "%d Can't push IP module");
-    return -1;
-  }
-
-  /* Assign ppa according to the unit number returned by tun device */
-  if (ioctl(if_fd, IF_UNITSEL, (char *)&ppa) < 0) {
-    syslog(LOG_ERR, "%d Can't set PPA %d", ppa);
-    return -1;
-  }
-
-  /* Link the two streams */
-  if ((muxid = ioctl(ip_fd, I_LINK, if_fd)) < 0) {
-    syslog(LOG_ERR, "%d Can't link TUN device to IP");
-    return -1;
-  }
-
-  close (if_fd);
-
-  snprintf(netif->devname, sizeof(netif->devname),
-		"tun%d", ppa);
-
-  memset(&ifr, 0, sizeof(ifr));
-  strlcpy(ifr.ifr_name, netif->devname, sizeof(ifr.ifr_name));
-  ifr.ifr_ip_muxid = muxid;
-
-  if (ioctl(ip_fd, SIOCSIFMUXID, &ifr) < 0) {
-    ioctl(ip_fd, I_PUNLINK, muxid);
-    syslog(LOG_ERR, "%d Can't set multiplexor id");
-    return -1;
-  }
-
-  /*  if (fcntl (fd, F_SETFL, O_NONBLOCK) < 0)
-      msg (M_ERR, "Set file descriptor to non-blocking failed"); */
-
-  return 0;
-
 #else
 #error  "Unknown platform!"
 #endif
@@ -943,29 +869,6 @@ int tun_decaps(struct tun_t *this, int idx) {
   }
 
   return 0;
-
-#elif defined (__sun__)
-  struct pkt_buffer pb;
-  uint8_t packet[PKT_MAX_LEN+4];
-  ssize_t length;
-  struct strbuf sbuf;
-  int f = 0;
-
-  pkt_buffer_init(&pb, packet, sizeof(packet), 4);
-
-  sbuf.maxlen = pkt_buffer_size(&pb);
-  sbuf.buf = pkt_buffer_head(&pb);
-  if (getmsg(tun(this, idx).fd, NULL, &sbuf, &f) < 0) {
-    syslog(LOG_ERR, "%d getmsg() failed");
-    return -1;
-  }
-
-  pb.length = sbuf.len;
-
-  if (this->cb_ind)
-    return this->cb_ind(this, &pb);
-  return 0;
-
 #endif
 }
 
@@ -1007,13 +910,6 @@ int tun_write(struct tun_t *tun, uint8_t *pack, size_t len, int idx) {
 
   return safe_write(tun(tun, idx).fd, pack, len);
 
-#elif defined (__sun__)
-
-  struct strbuf sbuf;
-  sbuf.len = len;
-  sbuf.buf = pack;
-  return putmsg(tun(tun, idx).fd, NULL, &sbuf, 0);
-
 #endif
 }
 
diff --git a/www/ChilliLibrary.js b/www/ChilliLibrary.js
index 02ebd7f..c65e11b 100644
--- a/www/ChilliLibrary.js
+++ b/www/ChilliLibrary.js
@@ -250,7 +250,7 @@ chilliController.logonStep2 = function ( resp ) {
 		return chilliController.onError('Cannot get challenge');
 	}
 
-	if ( resp.clientSate === chilliController.stateCodes.AUTH ) {
+	if ( resp.clientState === chilliController.stateCodes.AUTH ) {
 		log('logonStep2: Already connected. Aborting.');
 		return chilliController.onError('Already connected.');
 	}