Clean up messages a little
authorDavid Woodhouse <David.Woodhouse@intel.com>
Tue, 30 Sep 2008 03:31:59 +0000 (04:31 +0100)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Tue, 30 Sep 2008 03:31:59 +0000 (04:31 +0100)
dtls.c
main.c
ssl.c

diff --git a/dtls.c b/dtls.c
index 69e8888..be29c95 100644 (file)
--- a/dtls.c
+++ b/dtls.c
@@ -249,17 +249,17 @@ int setup_dtls(struct anyconnect_info *vpninfo)
 
 int dtls_mainloop(struct anyconnect_info *vpninfo, int *timeout)
 {
-       char buf[2000];
+       unsigned char buf[2000];
        int len;
        int work_done = 0;
 
        while ( (len = SSL_read(vpninfo->dtls_ssl, buf, sizeof(buf))) > 0 ) {
-               if (verbose) {
-                       printf("Received DTLS packet of %d bytes\n", len);
-                       printf("Packet starts %02x %02x %02x %02x %02x %02x %02x %02x\n",
-                              buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6], buf[7]);
-               }
+               if (verbose)
+                       printf("Received DTLS packet 0x%02x of %d bytes\n",
+                              len, buf[0]);
+
                vpninfo->last_dtls_rx = time(NULL);
+
                switch(buf[0]) {
                case 0:
                        queue_new_packet(&vpninfo->incoming_queue, AF_INET, buf+1, len-1);
diff --git a/main.c b/main.c
index 896eee7..192b68f 100644 (file)
--- a/main.c
+++ b/main.c
@@ -187,7 +187,9 @@ int main(int argc, char **argv)
        if (setup_dtls(vpninfo))
                fprintf(stderr, "Set up DTLS failed; using SSL instead\n");
 
-       printf("Connected\n");
+       printf("Connected as %s, using %s\n", vpninfo->vpn_addr,
+              (vpninfo->dtls_fd==-1)?"SSL":"DTLS");
+
        vpn_mainloop(vpninfo);
        exit(1);
 }
diff --git a/ssl.c b/ssl.c
index 76fa7ba..6515db0 100644 (file)
--- a/ssl.c
+++ b/ssl.c
@@ -436,6 +436,9 @@ static int start_ssl_connection(struct anyconnect_info *vpninfo)
                *next_cstp_option = new_option;
                next_cstp_option = &new_option->next;
 
+               if (verbose)
+                       printf("DTLS option %s : %s\n", buf, colon);
+
                if (!strcmp(buf + 7, "Keepalive")) {
                        vpninfo->ssl_keepalive = atol(colon);
                } else if (!strcmp(buf + 7, "DPD")) {