olsrd-quagga: Fix indentation of source files
authorVasilis Tsiligiannis <b_tsiligiannis@silverton.gr>
Tue, 5 Jun 2012 12:42:16 +0000 (15:42 +0300)
committerVasilis Tsiligiannis <b_tsiligiannis@silverton.gr>
Tue, 5 Jun 2012 12:42:16 +0000 (15:42 +0300)
lib/quagga/src/packet.c
lib/quagga/src/parse.c
lib/quagga/src/plugin.c
lib/quagga/src/quagga.c

index 3743626..d684211 100644 (file)
@@ -36,36 +36,36 @@ unsigned char
 
   t = &cmdopt[2];
   switch (zebra.version) {
-    case 0:
-      *t++ = (unsigned char) cmd;
-      break;
-    case 1:
-    case 2:
-      *t++ = ZEBRA_HEADER_MARKER;
-      *t++ = zebra.version;
-      cmd = htons(cmd);
-      memcpy(t, &cmd, sizeof cmd);
-      t += sizeof cmd;
-      break;
-    default:
-      olsr_exit("(QUAGGA) Unsupported zebra packet version!\n", EXIT_FAILURE);
-      break;
+  case 0:
+    *t++ = (unsigned char) cmd;
+    break;
+  case 1:
+  case 2:
+    *t++ = ZEBRA_HEADER_MARKER;
+    *t++ = zebra.version;
+    cmd = htons(cmd);
+    memcpy(t, &cmd, sizeof cmd);
+    t += sizeof cmd;
+    break;
+  default:
+    olsr_exit("(QUAGGA) Unsupported zebra packet version!\n", EXIT_FAILURE);
+    break;
   }
   *t++ = r->type;
   *t++ = r->flags;
   *t++ = r->message;
   switch (zebra.version) {
-    case 0:
-    case 1:
-      break;
-    case 2:
-      safi = htons(r->safi);
-      memcpy(t, &safi, sizeof safi);
-      t += sizeof safi;
-      break;
-    default:
-      olsr_exit("(QUAGGA) Unsupported zebra packet version!\n", EXIT_FAILURE);
-      break;
+  case 0:
+  case 1:
+    break;
+  case 2:
+    safi = htons(r->safi);
+    memcpy(t, &safi, sizeof safi);
+    t += sizeof safi;
+    break;
+  default:
+    olsr_exit("(QUAGGA) Unsupported zebra packet version!\n", EXIT_FAILURE);
+    break;
   }
   *t++ = r->prefixlen;
   len = (r->prefixlen + 7) / 8;
@@ -78,23 +78,23 @@ unsigned char
   if (r->message & ZAPI_MESSAGE_NEXTHOP) {
     *t++ = r->nexthop_num + r->ifindex_num;
 
-      for (count = 0; count < r->nexthop_num; count++) {
-        if (olsr_cnf->ip_version == AF_INET) {
-          *t++ = ZEBRA_NEXTHOP_IPV4;
-          memcpy(t, &r->nexthop[count].v4.s_addr, sizeof r->nexthop[count].v4.s_addr);
-          t += sizeof r->nexthop[count].v4.s_addr;
-        } else {
-          *t++ = ZEBRA_NEXTHOP_IPV6;
-          memcpy(t, r->nexthop[count].v6.s6_addr, sizeof r->nexthop[count].v6.s6_addr);
-          t += sizeof r->nexthop[count].v6.s6_addr;
-        }
-      }
-      for (count = 0; count < r->ifindex_num; count++) {
-        *t++ = ZEBRA_NEXTHOP_IFINDEX;
-        ind = htonl(r->ifindex[count]);
-        memcpy(t, &ind, sizeof ind);
-        t += sizeof ind;
+    for (count = 0; count < r->nexthop_num; count++) {
+      if (olsr_cnf->ip_version == AF_INET) {
+        *t++ = ZEBRA_NEXTHOP_IPV4;
+        memcpy(t, &r->nexthop[count].v4.s_addr, sizeof r->nexthop[count].v4.s_addr);
+        t += sizeof r->nexthop[count].v4.s_addr;
+      } else {
+        *t++ = ZEBRA_NEXTHOP_IPV6;
+        memcpy(t, r->nexthop[count].v6.s6_addr, sizeof r->nexthop[count].v6.s6_addr);
+        t += sizeof r->nexthop[count].v6.s6_addr;
       }
+    }
+    for (count = 0; count < r->ifindex_num; count++) {
+      *t++ = ZEBRA_NEXTHOP_IFINDEX;
+      ind = htonl(r->ifindex[count]);
+      memcpy(t, &ind, sizeof ind);
+      t += sizeof ind;
+    }
   }
   if ((r->message & ZAPI_MESSAGE_DISTANCE) > 0)
     *t++ = r->distance;
@@ -119,20 +119,20 @@ unsigned char
 
   pnt = &data[2];
   switch (zebra.version) {
-    case 0:
-      *pnt++ = (unsigned char) cmd;
-      break;
-    case 1:
-    case 2:
-      *pnt++ = ZEBRA_HEADER_MARKER;
-      *pnt++ = zebra.version;
-      cmd = htons(cmd);
-      memcpy(pnt, &cmd, sizeof cmd);
-      pnt += sizeof cmd;
-      break;
-    default:
-      olsr_exit("(QUAGGA) Unsupported zebra packet version!\n", EXIT_FAILURE);
-      break;
+  case 0:
+    *pnt++ = (unsigned char) cmd;
+    break;
+  case 1:
+  case 2:
+    *pnt++ = ZEBRA_HEADER_MARKER;
+    *pnt++ = zebra.version;
+    cmd = htons(cmd);
+    memcpy(pnt, &cmd, sizeof cmd);
+    pnt += sizeof cmd;
+    break;
+  default:
+    olsr_exit("(QUAGGA) Unsupported zebra packet version!\n", EXIT_FAILURE);
+    break;
   }
   *pnt++ = type;
   size = htons(pnt - data);
index a21d45e..aa9c6c9 100644 (file)
@@ -54,15 +54,15 @@ static struct zroute
   r = olsr_malloc(sizeof *r, "QUAGGA: New zebra route");
   pnt = &opt[3];
   switch (zebra.version) {
-    case 0:
-      break;
-    case 1:
-    case 2:
-      pnt = &opt[6];
-      break;
-    default:
-      olsr_exit("(QUAGGA) Unsupported zebra packet version!\n", EXIT_FAILURE);
-      break;
+  case 0:
+    break;
+  case 1:
+  case 2:
+    pnt = &opt[6];
+    break;
+  default:
+    olsr_exit("(QUAGGA) Unsupported zebra packet version!\n", EXIT_FAILURE);
+    break;
   }
   r->type = *pnt++;
   r->flags = *pnt++;
@@ -100,13 +100,13 @@ static struct zroute
     }
   }
   switch (zebra.version) {
-    case 0:
-    case 1:
-    case 2:
-      break;
-    default:
-      olsr_exit("(QUAGGA) Unsupported zebra packet version!\n", EXIT_FAILURE);
-      break;
+  case 0:
+  case 1:
+  case 2:
+    break;
+  default:
+    olsr_exit("(QUAGGA) Unsupported zebra packet version!\n", EXIT_FAILURE);
+    break;
   }
 
   if (r->message & ZAPI_MESSAGE_DISTANCE) {
@@ -151,52 +151,52 @@ zparse(void *foo __attribute__ ((unused)))
         olsr_exit("(QUAGGA) Zero message length!", EXIT_FAILURE);
       command = f[2];
       switch (zebra.version) {
-        case 0:
+      case 0:
+        break;
+      case 1:
+      case 2:
+        if ((f[2] != ZEBRA_HEADER_MARKER) || (f[3] != zebra.version))
+          olsr_exit("(QUAGGA) Invalid zebra header received!", EXIT_FAILURE);
+        memcpy(&command, &f[4], sizeof command);
+        command = ntohs (command);
+        break;
+      default:
+        olsr_exit("(QUAGGA) Unsupported zebra packet version!\n", EXIT_FAILURE);
+        break;
+      }
+      if (olsr_cnf->ip_version == AF_INET) {
+        switch (command) {
+        case ZEBRA_IPV4_ROUTE_ADD:
+          route = zparse_route(f);
+          ip_prefix_list_add(&olsr_cnf->hna_entries, &route->prefix, route->prefixlen);
+          free_zroute(route);
+          free(route);
           break;
-        case 1:
-        case 2:
-          if ((f[2] != ZEBRA_HEADER_MARKER) || (f[3] != zebra.version))
-            olsr_exit("(QUAGGA) Invalid zebra header received!", EXIT_FAILURE);
-          memcpy(&command, &f[4], sizeof command);
-          command = ntohs (command);
+        case ZEBRA_IPV4_ROUTE_DELETE:
+          route = zparse_route(f);
+          ip_prefix_list_remove(&olsr_cnf->hna_entries, &route->prefix, route->prefixlen);
+          free_zroute(route);
+          free(route);
           break;
         default:
-          olsr_exit("(QUAGGA) Unsupported zebra packet version!\n", EXIT_FAILURE);
           break;
-      }
-      if (olsr_cnf->ip_version == AF_INET) {
-        switch (command) {
-          case ZEBRA_IPV4_ROUTE_ADD:
-            route = zparse_route(f);
-            ip_prefix_list_add(&olsr_cnf->hna_entries, &route->prefix, route->prefixlen);
-            free_zroute(route);
-            free(route);
-            break;
-          case ZEBRA_IPV4_ROUTE_DELETE:
-            route = zparse_route(f);
-            ip_prefix_list_remove(&olsr_cnf->hna_entries, &route->prefix, route->prefixlen);
-            free_zroute(route);
-            free(route);
-            break;
-          default:
-            break;
         }
       } else {
         switch (command) {
-          case ZEBRA_IPV6_ROUTE_ADD:
-            route = zparse_route(f);
-            ip_prefix_list_add(&olsr_cnf->hna_entries, &route->prefix, route->prefixlen);
-            free_zroute(route);
-            free(route);
-            break;
-          case ZEBRA_IPV6_ROUTE_DELETE:
-            route = zparse_route(f);
-            ip_prefix_list_remove(&olsr_cnf->hna_entries, &route->prefix, route->prefixlen);
-            free_zroute(route);
-            free(route);
-            break;
-          default:
-            break;
+        case ZEBRA_IPV6_ROUTE_ADD:
+          route = zparse_route(f);
+          ip_prefix_list_add(&olsr_cnf->hna_entries, &route->prefix, route->prefixlen);
+          free_zroute(route);
+          free(route);
+          break;
+        case ZEBRA_IPV6_ROUTE_DELETE:
+          route = zparse_route(f);
+          ip_prefix_list_remove(&olsr_cnf->hna_entries, &route->prefix, route->prefixlen);
+          free_zroute(route);
+          free(route);
+          break;
+        default:
+          break;
         }
       }
 
index 79eeb19..c7784c9 100644 (file)
@@ -49,8 +49,8 @@ int
 zplugin_redistribute(const char *value, void *data __attribute__ ((unused)), set_plugin_parameter_addon addon __attribute__ ((unused)))
 {
   const char *zroute_types[] = { "system", "kernel", "connect",
-    "static", "rip", "ripng", "ospf", "ospf6", "isis", "bgp",
-    "hsls", "olsr", "batman", "babel"
+                                 "static", "rip", "ripng", "ospf", "ospf6", "isis", "bgp",
+                                 "hsls", "olsr", "batman", "babel"
   };
   unsigned int i;
 
index f7e2a53..394581c 100644 (file)
@@ -75,10 +75,10 @@ zebra_addroute(const struct rt_entry *r)
   route.nexthop = NULL;
 
   if ((olsr_cnf->ip_version == AF_INET && r->rt_best->rtp_nexthop.gateway.v4.s_addr == r->rt_dst.prefix.v4.s_addr &&
-        route.prefixlen == 32) ||
+       route.prefixlen == 32) ||
       (olsr_cnf->ip_version == AF_INET6 &&
-        !memcmp(r->rt_best->rtp_nexthop.gateway.v6.s6_addr, r->rt_dst.prefix.v6.s6_addr, sizeof r->rt_best->rtp_nexthop.gateway.v6.s6_addr) &&
-        route.prefixlen == 128)) {
+       !memcmp(r->rt_best->rtp_nexthop.gateway.v6.s6_addr, r->rt_dst.prefix.v6.s6_addr, sizeof r->rt_best->rtp_nexthop.gateway.v6.s6_addr) &&
+       route.prefixlen == 128)) {
     route.ifindex_num++;
     route.ifindex = olsr_malloc(sizeof *route.ifindex, "QUAGGA: New zebra route ifindex");
     *route.ifindex = r->rt_best->rtp_nexthop.iif_index;
@@ -125,10 +125,10 @@ zebra_delroute(const struct rt_entry *r)
   route.nexthop = NULL;
 
   if ((olsr_cnf->ip_version == AF_INET && r->rt_nexthop.gateway.v4.s_addr == r->rt_dst.prefix.v4.s_addr &&
-        route.prefixlen == 32) ||
-       (olsr_cnf->ip_version == AF_INET6 &&
-        !memcmp(r->rt_nexthop.gateway.v6.s6_addr, r->rt_dst.prefix.v6.s6_addr, sizeof r->rt_nexthop.gateway.v6.s6_addr) &&
-        route.prefixlen == 128)) {
+       route.prefixlen == 32) ||
+      (olsr_cnf->ip_version == AF_INET6 &&
+       !memcmp(r->rt_nexthop.gateway.v6.s6_addr, r->rt_dst.prefix.v6.s6_addr, sizeof r->rt_nexthop.gateway.v6.s6_addr) &&
+       route.prefixlen == 128)) {
     route.ifindex_num++;
     route.ifindex = olsr_malloc(sizeof *route.ifindex, "QUAGGA: New zebra route ifindex");
     *route.ifindex = r->rt_nexthop.iif_index;