diff options
Diffstat (limited to 'babeld')
| -rw-r--r-- | babeld/babel_interface.c | 110 | ||||
| -rw-r--r-- | babeld/babel_main.c | 6 | ||||
| -rw-r--r-- | babeld/babel_zebra.c | 20 | ||||
| -rw-r--r-- | babeld/babeld.c | 15 | 
4 files changed, 72 insertions, 79 deletions
diff --git a/babeld/babel_interface.c b/babeld/babel_interface.c index 3f589df0a0..fe8fde92e6 100644 --- a/babeld/babel_interface.c +++ b/babeld/babel_interface.c @@ -290,8 +290,8 @@ DEFUN (babel_network,          ret = babel_enable_if_add (argv[1]->arg);      if (ret < 0) { -        vty_out (vty, "There is same network configuration %s%s", argv[1]->arg, -                 VTY_NEWLINE); +        vty_outln (vty, "There is same network configuration %s", +                   argv[1]->arg);          return CMD_WARNING;      } @@ -318,8 +318,7 @@ DEFUN (no_babel_network,          ret = babel_enable_if_delete (argv[2]->arg);      if (ret < 0) { -        vty_out (vty, "can't find network %s%s", argv[2]->arg, -                 VTY_NEWLINE); +        vty_outln (vty, "can't find network %s",argv[2]->arg);          return CMD_WARNING;      } @@ -862,30 +861,31 @@ show_babel_interface_sub (struct vty *vty, struct interface *ifp)    int is_up;    babel_interface_nfo *babel_ifp; -  vty_out (vty, "%s is %s%s", ifp->name, -    ((is_up = if_is_operative(ifp)) ? "up" : "down"), VTY_NEWLINE); -  vty_out (vty, "  ifindex %u, MTU %u bytes %s%s", -    ifp->ifindex, MIN(ifp->mtu, ifp->mtu6), if_flag_dump(ifp->flags), VTY_NEWLINE); +  vty_outln (vty, "%s is %s", ifp->name, +    ((is_up = if_is_operative(ifp)) ? "up" : "down")); +  vty_outln (vty, "  ifindex %u, MTU %u bytes %s", +    ifp->ifindex, MIN(ifp->mtu, ifp->mtu6), if_flag_dump(ifp->flags));    if (!IS_ENABLE(ifp))    { -    vty_out (vty, "  Babel protocol is not enabled on this interface%s", VTY_NEWLINE); +    vty_outln (vty, "  Babel protocol is not enabled on this interface");      return;    }    if (!is_up)    { -    vty_out (vty, "  Babel protocol is enabled, but not running on this interface%s", VTY_NEWLINE); +    vty_outln (vty, +               "  Babel protocol is enabled, but not running on this interface");      return;    }    babel_ifp = babel_get_if_nfo (ifp); -  vty_out (vty, "  Babel protocol is running on this interface%s", VTY_NEWLINE); -  vty_out (vty, "  Operating mode is \"%s\"%s", -           CHECK_FLAG (babel_ifp->flags, BABEL_IF_WIRED) ? "wired" : "wireless", VTY_NEWLINE); -  vty_out (vty, "  Split horizon mode is %s%s", -           CHECK_FLAG (babel_ifp->flags, BABEL_IF_SPLIT_HORIZON) ? "On" : "Off", VTY_NEWLINE); -  vty_out (vty, "  Hello interval is %u ms%s", babel_ifp->hello_interval, VTY_NEWLINE); -  vty_out (vty, "  Update interval is %u ms%s", babel_ifp->update_interval, VTY_NEWLINE); -  vty_out (vty, "  Rxcost multiplier is %u%s", babel_ifp->cost, VTY_NEWLINE); +  vty_outln (vty, "  Babel protocol is running on this interface"); +  vty_outln (vty, "  Operating mode is \"%s\"", +           CHECK_FLAG(babel_ifp->flags, BABEL_IF_WIRED) ? "wired" : "wireless"); +  vty_outln (vty, "  Split horizon mode is %s", +           CHECK_FLAG(babel_ifp->flags, BABEL_IF_SPLIT_HORIZON) ? "On" : "Off"); +  vty_outln (vty, "  Hello interval is %u ms", babel_ifp->hello_interval); +  vty_outln (vty, "  Update interval is %u ms", babel_ifp->update_interval); +  vty_outln (vty, "  Rxcost multiplier is %u", babel_ifp->cost);  }  DEFUN (show_babel_interface, @@ -907,7 +907,7 @@ DEFUN (show_babel_interface,    }    if ((ifp = if_lookup_by_name (argv[3]->arg, VRF_DEFAULT)) == NULL)    { -    vty_out (vty, "No such interface name%s", VTY_NEWLINE); +    vty_outln (vty, "No such interface name");      return CMD_WARNING;    }    show_babel_interface_sub (vty, ifp); @@ -917,9 +917,9 @@ DEFUN (show_babel_interface,  static void  show_babel_neighbour_sub (struct vty *vty, struct neighbour *neigh)  { -    vty_out (vty, +    vty_outln (vty,               "Neighbour %s dev %s reach %04x rxcost %d txcost %d " -             "rtt %s rttcost %d%s.%s", +             "rtt %s rttcost %d%s.",               format_address(neigh->address),               neigh->ifp->name,               neigh->reach, @@ -927,8 +927,7 @@ show_babel_neighbour_sub (struct vty *vty, struct neighbour *neigh)               neigh->txcost,               format_thousands(neigh->rtt),               neighbour_rttcost(neigh), -             if_up(neigh->ifp) ? "" : " (down)", -             VTY_NEWLINE); +             if_up(neigh->ifp) ? "" : " (down)");  }  DEFUN (show_babel_neighbour, @@ -950,7 +949,7 @@ DEFUN (show_babel_neighbour,      }      if ((ifp = if_lookup_by_name (argv[3]->arg, VRF_DEFAULT)) == NULL)      { -        vty_out (vty, "No such interface name%s", VTY_NEWLINE); +        vty_outln (vty, "No such interface name");          return CMD_WARNING;      }      FOR_ALL_NEIGHBOURS(neigh) { @@ -1010,9 +1009,9 @@ show_babel_routes_sub(struct babel_route *route, struct vty *vty,              channels[0] = '\0';      } -    vty_out(vty, +    vty_outln (vty,              "%s metric %d refmetric %d id %s seqno %d%s age %d " -            "via %s neigh %s%s%s%s%s", +            "via %s neigh %s%s%s%s",              format_prefix(route->src->prefix, route->src->plen),              route_metric(route), route->refmetric,              format_eui64(route->src->id), @@ -1023,9 +1022,7 @@ show_babel_routes_sub(struct babel_route *route, struct vty *vty,              format_address(route->neigh->address),              nexthop ? " nexthop " : "",              nexthop ? format_address(nexthop) : "", -            route->installed ? " (installed)" : -            route_feasible(route) ? " (feasible)" : "", -            VTY_NEWLINE); +            route->installed ? " (installed)" : route_feasible(route) ? " (feasible)" : "");  }  static void @@ -1035,10 +1032,9 @@ show_babel_xroutes_sub (struct xroute *xroute, struct vty *vty,      if(prefix && !babel_prefix_eq(prefix, xroute->prefix, xroute->plen))          return; -    vty_out(vty, "%s metric %d (exported)%s", +    vty_outln (vty, "%s metric %d (exported)",              format_prefix(xroute->prefix, xroute->plen), -            xroute->metric, -            VTY_NEWLINE); +            xroute->metric);  }  DEFUN (show_babel_route, @@ -1093,7 +1089,7 @@ DEFUN (show_babel_route_prefix,      ret = str2prefix(argv[3]->arg, &prefix);      if(ret == 0) { -      vty_out (vty, "%% Malformed address%s", VTY_NEWLINE); +      vty_outln (vty, "%% Malformed address");        return CMD_WARNING;      } @@ -1142,7 +1138,7 @@ DEFUN (show_babel_route_addr,      ret = inet_aton (argv[3]->arg, &addr);      if (ret <= 0) { -        vty_out (vty, "%% Malformed address%s", VTY_NEWLINE); +        vty_outln (vty, "%% Malformed address");          return CMD_WARNING;      } @@ -1151,7 +1147,7 @@ DEFUN (show_babel_route_addr,      ret = str2prefix(buf, &prefix);      if (ret == 0) { -        vty_out (vty, "%% Parse error -- this shouldn't happen%s", VTY_NEWLINE); +        vty_outln (vty, "%% Parse error -- this shouldn't happen");          return CMD_WARNING;      } @@ -1200,7 +1196,7 @@ DEFUN (show_babel_route_addr6,      ret = inet_pton (AF_INET6, argv[3]->arg, &addr);      if (ret <= 0) { -        vty_out (vty, "%% Malformed address%s", VTY_NEWLINE); +        vty_outln (vty, "%% Malformed address");          return CMD_WARNING;      } @@ -1210,7 +1206,7 @@ DEFUN (show_babel_route_addr6,      ret = str2prefix(buf, &prefix);      if (ret == 0) { -        vty_out (vty, "%% Parse error -- this shouldn't happen%s", VTY_NEWLINE); +        vty_outln (vty, "%% Parse error -- this shouldn't happen");          return CMD_WARNING;      } @@ -1248,9 +1244,9 @@ DEFUN (show_babel_parameters,         "Babel information\n"         "Configuration information\n")  { -    vty_out(vty, "    -- Babel running configuration --%s", VTY_NEWLINE); +    vty_outln (vty, "    -- Babel running configuration --");      show_babel_main_configuration(vty); -    vty_out(vty, "    -- distribution lists --%s", VTY_NEWLINE); +    vty_outln (vty, "    -- distribution lists --");      config_show_distribute(vty);      return CMD_SUCCESS; @@ -1325,65 +1321,63 @@ interface_config_write (struct vty *vty)      int write = 0;      for (ALL_LIST_ELEMENTS_RO (vrf_iflist(VRF_DEFAULT), node, ifp)) { -        vty_out (vty, "interface %s%s", ifp->name, -                 VTY_NEWLINE); +        vty_outln (vty, "interface %s",ifp->name);          if (ifp->desc) -            vty_out (vty, " description %s%s", ifp->desc, -                     VTY_NEWLINE); +            vty_outln (vty, " description %s",ifp->desc);          babel_interface_nfo *babel_ifp = babel_get_if_nfo (ifp);          /* wireless is the default*/          if (CHECK_FLAG (babel_ifp->flags, BABEL_IF_WIRED))          { -            vty_out (vty, " babel wired%s", VTY_NEWLINE); +            vty_outln (vty, " babel wired");              write++;          }          if (babel_ifp->hello_interval != BABEL_DEFAULT_HELLO_INTERVAL)          { -            vty_out (vty, " babel hello-interval %u%s", babel_ifp->hello_interval, VTY_NEWLINE); +            vty_outln (vty, " babel hello-interval %u", +                       babel_ifp->hello_interval);              write++;          }          if (babel_ifp->update_interval != BABEL_DEFAULT_UPDATE_INTERVAL)          { -            vty_out (vty, " babel update-interval %u%s", babel_ifp->update_interval, VTY_NEWLINE); +            vty_outln (vty, " babel update-interval %u", +                       babel_ifp->update_interval);              write++;          }          /* Some parameters have different defaults for wired/wireless. */          if (CHECK_FLAG (babel_ifp->flags, BABEL_IF_WIRED)) {              if (!CHECK_FLAG (babel_ifp->flags, BABEL_IF_SPLIT_HORIZON)) { -                vty_out (vty, " no babel split-horizon%s", VTY_NEWLINE); +                vty_outln (vty, " no babel split-horizon");                  write++;              }              if (babel_ifp->cost != BABEL_DEFAULT_RXCOST_WIRED) { -                vty_out (vty, " babel rxcost %u%s", babel_ifp->cost, VTY_NEWLINE); +                vty_outln (vty, " babel rxcost %u", babel_ifp->cost);                  write++;              }              if (babel_ifp->channel == BABEL_IF_CHANNEL_INTERFERING) { -                vty_out (vty, " babel channel interfering%s", VTY_NEWLINE); +                vty_outln (vty, " babel channel interfering");                  write++;              } else if(babel_ifp->channel != BABEL_IF_CHANNEL_NONINTERFERING) { -                vty_out (vty, " babel channel %d%s", babel_ifp->channel, -                         VTY_NEWLINE); +                vty_outln (vty, " babel channel %d",babel_ifp->channel);                  write++;              }          } else {              if (CHECK_FLAG (babel_ifp->flags, BABEL_IF_SPLIT_HORIZON)) { -                vty_out (vty, " babel split-horizon%s", VTY_NEWLINE); +                vty_outln (vty, " babel split-horizon");                  write++;              }              if (babel_ifp->cost != BABEL_DEFAULT_RXCOST_WIRELESS) { -                vty_out (vty, " babel rxcost %u%s", babel_ifp->cost, VTY_NEWLINE); +                vty_outln (vty, " babel rxcost %u", babel_ifp->cost);                  write++;              }              if (babel_ifp->channel == BABEL_IF_CHANNEL_NONINTERFERING) { -                vty_out (vty, " babel channel noninterfering%s", VTY_NEWLINE); +                vty_outln (vty, " babel channel noninterfering");                  write++;              } else if(babel_ifp->channel != BABEL_IF_CHANNEL_INTERFERING) { -                vty_out (vty, " babel channel %d%s", babel_ifp->channel, -                         VTY_NEWLINE); +                vty_outln (vty, " babel channel %d",babel_ifp->channel);                  write++;              }          } -        vty_out (vty, "!%s", VTY_NEWLINE); +        vty_outln (vty, "!");          write++;      }      return write; @@ -1399,7 +1393,7 @@ babel_enable_if_config_write (struct vty * vty)      for (i = 0; i < vector_active (babel_enable_if); i++)          if ((str = vector_slot (babel_enable_if, i)) != NULL)          { -            vty_out (vty, " network %s%s", str, VTY_NEWLINE); +            vty_outln (vty, " network %s", str);              lines++;          }      return lines; diff --git a/babeld/babel_main.c b/babeld/babel_main.c index 472bad849b..84973fa5c3 100644 --- a/babeld/babel_main.c +++ b/babeld/babel_main.c @@ -377,7 +377,7 @@ babel_save_state_file(void)  void  show_babel_main_configuration (struct vty *vty)  { -    vty_out(vty, +    vty_outln (vty,              "state file              = %s%s"              "configuration file      = %s%s"              "protocol informations:%s" @@ -386,7 +386,7 @@ show_babel_main_configuration (struct vty *vty)              "vty address             = %s%s"              "vty port                = %d%s"              "id                      = %s%s" -            "kernel_metric           = %d%s", +            "kernel_metric           = %d",              state_file, VTY_NEWLINE,              babel_config_file ? babel_config_file : babel_config_default,              VTY_NEWLINE, @@ -397,5 +397,5 @@ show_babel_main_configuration (struct vty *vty)              VTY_NEWLINE,              babel_vty_port, VTY_NEWLINE,              format_eui64(myid), VTY_NEWLINE, -            kernel_metric, VTY_NEWLINE); +            kernel_metric);  } diff --git a/babeld/babel_zebra.c b/babeld/babel_zebra.c index f54f5b3469..d8b8919e21 100644 --- a/babeld/babel_zebra.c +++ b/babeld/babel_zebra.c @@ -222,7 +222,7 @@ DEFUN (babel_redistribute_type,      type = babel_proto_redistnum(argv[1]->arg);      if (type < 0) { -        vty_out(vty, "Invalid type %s%s", argv[1]->arg, VTY_NEWLINE); +        vty_outln (vty, "Invalid type %s", argv[1]->arg);          return CMD_WARNING;      } @@ -243,7 +243,7 @@ DEFUN (no_babel_redistribute_type,      type = babel_proto_redistnum(argv[2]->arg);      if (type < 0) { -        vty_out(vty, "Invalid type %s%s", argv[2]->arg, VTY_NEWLINE); +        vty_outln (vty, "Invalid type %s", argv[2]->arg);          return CMD_WARNING;      } @@ -277,7 +277,7 @@ DEFUN (debug_babel,          }      } -    vty_out(vty, "Invalid type %s%s", argv[2]->arg, VTY_NEWLINE); +    vty_outln (vty, "Invalid type %s", argv[2]->arg);      return CMD_WARNING;  } @@ -307,7 +307,7 @@ DEFUN (no_debug_babel,          }      } -    vty_out(vty, "Invalid type %s%s", argv[3]->arg, VTY_NEWLINE); +    vty_outln (vty, "Invalid type %s", argv[3]->arg);      return CMD_WARNING;  } @@ -324,7 +324,7 @@ debug_babel_config_write (struct vty * vty)      if (debug == BABEL_DEBUG_ALL)      { -        vty_out (vty, "debug babel all%s", VTY_NEWLINE); +        vty_outln (vty, "debug babel all");          lines++;      }      else @@ -335,12 +335,12 @@ debug_babel_config_write (struct vty * vty)                  && CHECK_FLAG (debug, debug_type[i].type)              )              { -                vty_out (vty, "debug babel %s%s", debug_type[i].str, VTY_NEWLINE); +                vty_outln (vty, "debug babel %s", debug_type[i].str);                  lines++;              }      if (lines)      { -        vty_out (vty, "!%s", VTY_NEWLINE); +        vty_outln (vty, "!");          lines++;      }      return lines; @@ -384,13 +384,13 @@ zebra_config_write (struct vty *vty)  {      if (! zclient->enable)      { -        vty_out (vty, "no router zebra%s", VTY_NEWLINE); +        vty_outln (vty, "no router zebra");          return 1;      }      else if (! vrf_bitmap_check (zclient->redist[AFI_IP][ZEBRA_ROUTE_BABEL], VRF_DEFAULT))      { -        vty_out (vty, "router zebra%s", VTY_NEWLINE); -        vty_out (vty, " no redistribute babel%s", VTY_NEWLINE); +        vty_outln (vty, "router zebra"); +        vty_outln (vty, " no redistribute babel");          return 1;      }      return 0; diff --git a/babeld/babeld.c b/babeld/babeld.c index e7d4e51376..b44b25ab4e 100644 --- a/babeld/babeld.c +++ b/babeld/babeld.c @@ -83,27 +83,26 @@ babel_config_write (struct vty *vty)      if (!babel_routing_process)          return lines; -    vty_out (vty, "router babel%s", VTY_NEWLINE); +    vty_outln (vty, "router babel");      if (diversity_kind != DIVERSITY_NONE)      { -        vty_out (vty, " babel diversity%s", VTY_NEWLINE); +        vty_outln (vty, " babel diversity");          lines++;      }      if (diversity_factor != BABEL_DEFAULT_DIVERSITY_FACTOR)      { -        vty_out (vty, " babel diversity-factor %d%s", diversity_factor, -                 VTY_NEWLINE); +        vty_outln (vty, " babel diversity-factor %d",diversity_factor);          lines++;      }      if (resend_delay != BABEL_DEFAULT_RESEND_DELAY)      { -        vty_out (vty, " babel resend-delay %u%s", resend_delay, VTY_NEWLINE); +        vty_outln (vty, " babel resend-delay %u", resend_delay);          lines++;      }      if (smoothing_half_life != BABEL_DEFAULT_SMOOTHING_HALF_LIFE)      { -        vty_out (vty, " babel smoothing-half-life %u%s", -                 smoothing_half_life, VTY_NEWLINE); +        vty_outln (vty, " babel smoothing-half-life %u", +                 smoothing_half_life);          lines++;      }      /* list enabled interfaces */ @@ -113,7 +112,7 @@ babel_config_write (struct vty *vty)          if (i != zclient->redist_default &&  	    vrf_bitmap_check (zclient->redist[AFI_IP][i], VRF_DEFAULT))          { -            vty_out (vty, " redistribute %s%s", zebra_route_string (i), VTY_NEWLINE); +            vty_outln (vty, " redistribute %s", zebra_route_string(i));              lines++;          }  | 
