gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r37443 - gnunet/src/vpn


From: gnunet
Subject: [GNUnet-SVN] r37443 - gnunet/src/vpn
Date: Sat, 2 Jul 2016 21:58:12 +0200

Author: grothoff
Date: 2016-07-02 21:58:12 +0200 (Sat, 02 Jul 2016)
New Revision: 37443

Modified:
   gnunet/src/vpn/gnunet-helper-vpn.c
Log:
-reindent

Modified: gnunet/src/vpn/gnunet-helper-vpn.c
===================================================================
--- gnunet/src/vpn/gnunet-helper-vpn.c  2016-07-02 19:45:39 UTC (rev 37442)
+++ gnunet/src/vpn/gnunet-helper-vpn.c  2016-07-02 19:58:12 UTC (rev 37443)
@@ -91,7 +91,9 @@
 
   if (-1 == (fd = open ("/dev/net/tun", O_RDWR)))
   {
-    fprintf (stderr, "Error opening `%s': %s\n", "/dev/net/tun",
+    fprintf (stderr,
+             "Error opening `%s': %s\n",
+             "/dev/net/tun",
              strerror (errno));
     return -1;
   }
@@ -98,7 +100,9 @@
 
   if (fd >= FD_SETSIZE)
   {
-    fprintf (stderr, "File descriptor to large: %d", fd);
+    fprintf (stderr,
+             "File descriptor to large: %d",
+             fd);
     (void) close (fd);
     return -1;
   }
@@ -107,9 +111,13 @@
   ifr.ifr_flags = IFF_TUN;
 
   if ('\0' != *dev)
-    strncpy (ifr.ifr_name, dev, IFNAMSIZ);
+    strncpy (ifr.ifr_name,
+             dev,
+             IFNAMSIZ);
 
-  if (-1 == ioctl (fd, TUNSETIFF, (void *) &ifr))
+  if (-1 == ioctl (fd,
+                   TUNSETIFF,
+                   (void *) &ifr))
   {
     fprintf (stderr,
              "Error with ioctl on `%s': %s\n",
@@ -131,7 +139,9 @@
  * @param prefix_len the length of the network-prefix
  */
 static void
-set_address6 (const char *dev, const char *address, unsigned long prefix_len)
+set_address6 (const char *dev,
+              const char *address,
+              unsigned long prefix_len)
 {
   struct ifreq ifr;
   struct in6_ifreq ifr6;
@@ -163,10 +173,17 @@
   /*
    * Get the index of the if
    */
-  strncpy (ifr.ifr_name, dev, IFNAMSIZ);
-  if (-1 == ioctl (fd, SIOGIFINDEX, &ifr))
+  strncpy (ifr.ifr_name,
+           dev,
+           IFNAMSIZ);
+  if (-1 == ioctl (fd,
+                   SIOGIFINDEX,
+                   &ifr))
   {
-    fprintf (stderr, "ioctl failed at %d: %s\n", __LINE__, strerror (errno));
+    fprintf (stderr,
+             "ioctl failed at %d: %s\n",
+             __LINE__,
+             strerror (errno));
     (void) close (fd);
     exit (1);
   }
@@ -179,9 +196,13 @@
   /*
    * Set the address
    */
-  if (-1 == ioctl (fd, SIOCSIFADDR, &ifr6))
+  if (-1 == ioctl (fd,
+                   SIOCSIFADDR,
+                   &ifr6))
   {
-    fprintf (stderr, "ioctl failed at line %d: %s\n", __LINE__,
+    fprintf (stderr,
+             "ioctl failed at line %d: %s\n",
+             __LINE__,
              strerror (errno));
     (void) close (fd);
     exit (1);
@@ -190,9 +211,13 @@
   /*
    * Get the flags
    */
-  if (-1 == ioctl (fd, SIOCGIFFLAGS, &ifr))
+  if (-1 == ioctl (fd,
+                   SIOCGIFFLAGS,
+                   &ifr))
   {
-    fprintf (stderr, "ioctl failed at line %d: %s\n", __LINE__,
+    fprintf (stderr,
+             "ioctl failed at line %d: %s\n",
+             __LINE__,
              strerror (errno));
     (void) close (fd);
     exit (1);
@@ -202,9 +227,13 @@
    * Add the UP and RUNNING flags
    */
   ifr.ifr_flags |= IFF_UP | IFF_RUNNING;
-  if (-1 == ioctl (fd, SIOCSIFFLAGS, &ifr))
+  if (-1 == ioctl (fd,
+                   SIOCSIFFLAGS,
+                   &ifr))
   {
-    fprintf (stderr, "ioctl failed at line %d: %s\n", __LINE__,
+    fprintf (stderr,
+             "ioctl failed at line %d: %s\n",
+             __LINE__,
              strerror (errno));
     (void) close (fd);
     exit (1);
@@ -212,7 +241,9 @@
 
   if (0 != close (fd))
   {
-    fprintf (stderr, "close failed: %s\n", strerror (errno));
+    fprintf (stderr,
+             "close failed: %s\n",
+             strerror (errno));
     exit (1);
   }
 }
@@ -226,7 +257,9 @@
  * @param mask the netmask
  */
 static void
-set_address4 (const char *dev, const char *address, const char *mask)
+set_address4 (const char *dev,
+              const char *address,
+              const char *mask)
 {
   int fd;
   struct sockaddr_in *addr;
@@ -239,7 +272,9 @@
   /*
    * Parse the address
    */
-  if (1 != inet_pton (AF_INET, address, &addr->sin_addr.s_addr))
+  if (1 != inet_pton (AF_INET,
+                      address,
+                      &addr->sin_addr.s_addr))
   {
     fprintf (stderr,
              "Failed to parse IPv4 address `%s'\n",
@@ -274,7 +309,9 @@
    * Parse the netmask
    */
   addr = (struct sockaddr_in *) &(ifr.ifr_netmask);
-  if (1 != inet_pton (AF_INET, mask, &addr->sin_addr.s_addr))
+  if (1 != inet_pton (AF_INET,
+                      mask,
+                      &addr->sin_addr.s_addr))
   {
     fprintf (stderr,
              "Failed to parse IPv4 address mask `%s'\n",
@@ -301,7 +338,9 @@
    */
   if (-1 == ioctl (fd, SIOCGIFFLAGS, &ifr))
   {
-    fprintf (stderr, "ioctl failed at line %d: %s\n", __LINE__,
+    fprintf (stderr,
+             "ioctl failed at line %d: %s\n",
+             __LINE__,
              strerror (errno));
     (void) close (fd);
     exit (1);
@@ -313,7 +352,9 @@
   ifr.ifr_flags |= IFF_UP | IFF_RUNNING;
   if (-1 == ioctl (fd, SIOCSIFFLAGS, &ifr))
   {
-    fprintf (stderr, "ioctl failed at line %d: %s\n", __LINE__,
+    fprintf (stderr,
+             "ioctl failed at line %d: %s\n",
+             __LINE__,
              strerror (errno));
     (void) close (fd);
     exit (1);
@@ -321,7 +362,9 @@
 
   if (0 != close (fd))
   {
-    fprintf (stderr, "close failed: %s\n", strerror (errno));
+    fprintf (stderr,
+             "close failed: %s\n",
+             strerror (errno));
     (void) close (fd);
     exit (1);
   }
@@ -399,7 +442,9 @@
     {
       if (EINTR == errno)
         continue;
-      fprintf (stderr, "select failed: %s\n", strerror (errno));
+      fprintf (stderr,
+               "select failed: %s\n",
+               strerror (errno));
       exit (1);
     }
 
@@ -440,7 +485,9 @@
       }
       else if (FD_ISSET (1, &fds_w))
       {
-        ssize_t written = write (1, buftun_read, buftun_size);
+        ssize_t written = write (1,
+                                 buftun_read,
+                                 buftun_size);
 
         if (-1 == written)
         {
@@ -457,7 +504,8 @@
         }
         else if (0 == written)
         {
-          fprintf (stderr, "write returned 0!?\n");
+          fprintf (stderr,
+                   "write returned 0!?\n");
           exit (1);
         }
         else
@@ -501,7 +549,8 @@
           hdr = (struct GNUNET_MessageHeader *) bufin;
           if (ntohs (hdr->type) != GNUNET_MESSAGE_TYPE_VPN_HELPER)
           {
-            fprintf (stderr, "protocol violation!\n");
+            fprintf (stderr,
+                     "protocol violation!\n");
             exit (1);
           }
           if (ntohs (hdr->size) > bufin_rpos)
@@ -513,11 +562,15 @@
       }
       else if (FD_ISSET (fd_tun, &fds_w))
       {
-        ssize_t written = write (fd_tun, bufin_read, bufin_size);
+        ssize_t written = write (fd_tun,
+                                 bufin_read,
+                                 bufin_size);
 
         if (-1 == written)
         {
-          fprintf (stderr, "write-error to tun: %s\n", strerror (errno));
+          fprintf (stderr,
+                   "write-error to tun: %s\n",
+                   strerror (errno));
           shutdown (0, SHUT_RD);
           shutdown (fd_tun, SHUT_WR);
           write_open = 0;
@@ -570,12 +623,15 @@
     return 1;
   }
 
-  strncpy (dev, argv[1], IFNAMSIZ);
+  strncpy (dev,
+           argv[1],
+           IFNAMSIZ);
   dev[IFNAMSIZ - 1] = '\0';
 
   if (-1 == (fd_tun = init_tun (dev)))
   {
-    fprintf (stderr, "Fatal: could not initialize tun-interface `%s'  with 
IPv6 %s/%s and IPv4 %s/%s\n",
+    fprintf (stderr,
+             "Fatal: could not initialize tun-interface `%s'  with IPv6 %s/%s 
and IPv4 %s/%s\n",
             dev,
             argv[2],
             argv[3],
@@ -591,11 +647,14 @@
 
     if ((prefix_len < 1) || (prefix_len > 127))
     {
-      fprintf (stderr, "Fatal: prefix_len out of range\n");
+      fprintf (stderr,
+               "Fatal: prefix_len out of range\n");
       return 1;
     }
 
-    set_address6 (dev, address, prefix_len);
+    set_address6 (dev,
+                  address,
+                  prefix_len);
   }
 
   if (0 != strcmp (argv[4], "-"))
@@ -610,7 +669,9 @@
 #ifdef HAVE_SETRESUID
   if (0 != setresuid (uid, uid, uid))
   {
-    fprintf (stderr, "Failed to setresuid: %s\n", strerror (errno));
+    fprintf (stderr,
+             "Failed to setresuid: %s\n",
+             strerror (errno));
     global_ret = 2;
     goto cleanup;
   }
@@ -617,7 +678,9 @@
 #else
   if (0 != (setuid (uid) | seteuid (uid)))
   {
-    fprintf (stderr, "Failed to setuid: %s\n", strerror (errno));
+    fprintf (stderr,
+             "Failed to setuid: %s\n",
+             strerror (errno));
     global_ret = 2;
     goto cleanup;
   }
@@ -625,7 +688,8 @@
 
   if (SIG_ERR == signal (SIGPIPE, SIG_IGN))
   {
-    fprintf (stderr, "Failed to protect against SIGPIPE: %s\n",
+    fprintf (stderr,
+             "Failed to protect against SIGPIPE: %s\n",
              strerror (errno));
     /* no exit, we might as well die with SIGPIPE should it ever happen */
   }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]