]> git.proxmox.com Git - mirror_frr.git/blobdiff - ripngd/ripng_routemap.c
Make route flags a 32bit field
[mirror_frr.git] / ripngd / ripng_routemap.c
index 1c17e6c3c3cd6e4449ebd91a0862b1a6ca28058f..9bda2e260d1f0f743574485bd069cd5e55ea5e3f 100644 (file)
@@ -29,7 +29,7 @@
 #include "sockunion.h"
 
 #include "ripngd/ripngd.h"
-\f
+
 struct rip_metric_modifier
 {
   enum 
@@ -42,8 +42,8 @@ struct rip_metric_modifier
   u_char metric;
 };
 
-\f
-int
+
+static int
 ripng_route_match_add (struct vty *vty, struct route_map_index *index,
                       const char *command, const char *arg)
 {
@@ -55,19 +55,17 @@ ripng_route_match_add (struct vty *vty, struct route_map_index *index,
       switch (ret)
        {
        case RMAP_RULE_MISSING:
-         vty_out (vty, "Can't find rule.%s", VTY_NEWLINE);
+         vty_out (vty, "RIPng Can't find rule.%s", VTY_NEWLINE);
          return CMD_WARNING;
-         break;
        case RMAP_COMPILE_ERROR:
-         vty_out (vty, "Argument is malformed.%s", VTY_NEWLINE);
+         vty_out (vty, "RIPng Argument is malformed.%s", VTY_NEWLINE);
          return CMD_WARNING;
-         break;
        }
     }
   return CMD_SUCCESS;
 }
 
-int
+static int
 ripng_route_match_delete (struct vty *vty, struct route_map_index *index,
                          const char *command, const char *arg)
 {
@@ -79,19 +77,17 @@ ripng_route_match_delete (struct vty *vty, struct route_map_index *index,
       switch (ret)
        {
        case RMAP_RULE_MISSING:
-         vty_out (vty, "Can't find rule.%s", VTY_NEWLINE);
+         vty_out (vty, "RIPng Can't find rule.%s", VTY_NEWLINE);
          return CMD_WARNING;
-         break;
        case RMAP_COMPILE_ERROR:
-         vty_out (vty, "Argument is malformed.%s", VTY_NEWLINE);
+         vty_out (vty, "RIPng Argument is malformed.%s", VTY_NEWLINE);
          return CMD_WARNING;
-         break;
        }
     }
   return CMD_SUCCESS;
 }
 
-int
+static int
 ripng_route_set_add (struct vty *vty, struct route_map_index *index,
                     const char *command, const char *arg)
 {
@@ -103,19 +99,17 @@ ripng_route_set_add (struct vty *vty, struct route_map_index *index,
       switch (ret)
        {
        case RMAP_RULE_MISSING:
-         vty_out (vty, "Can't find rule.%s", VTY_NEWLINE);
+         vty_out (vty, "RIPng Can't find rule.%s", VTY_NEWLINE);
          return CMD_WARNING;
-         break;
        case RMAP_COMPILE_ERROR:
-         vty_out (vty, "Argument is malformed.%s", VTY_NEWLINE);
+         vty_out (vty, "RIPng Argument is malformed.%s", VTY_NEWLINE);
          return CMD_WARNING;
-         break;
        }
     }
   return CMD_SUCCESS;
 }
 
-int
+static int
 ripng_route_set_delete (struct vty *vty, struct route_map_index *index,
                        const char *command, const char *arg)
 {
@@ -127,21 +121,19 @@ ripng_route_set_delete (struct vty *vty, struct route_map_index *index,
       switch (ret)
        {
        case RMAP_RULE_MISSING:
-         vty_out (vty, "Can't find rule.%s", VTY_NEWLINE);
+         vty_out (vty, "RIPng Can't find rule.%s", VTY_NEWLINE);
          return CMD_WARNING;
-         break;
        case RMAP_COMPILE_ERROR:
-         vty_out (vty, "Argument is malformed.%s", VTY_NEWLINE);
+         vty_out (vty, "RIPng Argument is malformed.%s", VTY_NEWLINE);
          return CMD_WARNING;
-         break;
        }
     }
   return CMD_SUCCESS;
 }
-\f
+
 /* `match metric METRIC' */
 /* Match function return 1 if match is success else return zero. */
-route_map_result_t
+static route_map_result_t
 route_match_metric (void *rule, struct prefix *prefix, 
                    route_map_object_t type, void *object)
 {
@@ -162,7 +154,7 @@ route_match_metric (void *rule, struct prefix *prefix,
 }
 
 /* Route map `match metric' match statement. `arg' is METRIC value */
-void *
+static void *
 route_match_metric_compile (const char *arg)
 {
   u_int32_t *metric;
@@ -178,24 +170,24 @@ route_match_metric_compile (const char *arg)
 }
 
 /* Free route map's compiled `match metric' value. */
-void
+static void
 route_match_metric_free (void *rule)
 {
   XFREE (MTYPE_ROUTE_MAP_COMPILED, rule);
 }
 
 /* Route map commands for metric matching. */
-struct route_map_rule_cmd route_match_metric_cmd =
+static struct route_map_rule_cmd route_match_metric_cmd =
 {
   "metric",
   route_match_metric,
   route_match_metric_compile,
   route_match_metric_free
 };
-\f
+
 /* `match interface IFNAME' */
 /* Match function return 1 if match is success else return zero. */
-route_map_result_t
+static route_map_result_t
 route_match_interface (void *rule, struct prefix *prefix,
                       route_map_object_t type, void *object)
 {
@@ -222,19 +214,19 @@ route_match_interface (void *rule, struct prefix *prefix,
 }
 
 /* Route map `match interface' match statement. `arg' is IFNAME value */
-void *
+static void *
 route_match_interface_compile (const char *arg)
 {
   return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED, arg);
 }
 
-void
+static void
 route_match_interface_free (void *rule)
 {
   XFREE (MTYPE_ROUTE_MAP_COMPILED, rule);
 }
 
-struct route_map_rule_cmd route_match_interface_cmd =
+static struct route_map_rule_cmd route_match_interface_cmd =
 {
   "interface",
   route_match_interface,
@@ -244,7 +236,7 @@ struct route_map_rule_cmd route_match_interface_cmd =
 
 /* `match tag TAG' */
 /* Match function return 1 if match is success else return zero. */
-route_map_result_t
+static route_map_result_t
 route_match_tag (void *rule, struct prefix *prefix, 
                    route_map_object_t type, void *object)
 {
@@ -266,7 +258,7 @@ route_match_tag (void *rule, struct prefix *prefix,
 }
 
 /* Route map `match tag' match statement. `arg' is TAG value */
-void *
+static void *
 route_match_tag_compile (const char *arg)
 {
   u_short *tag;
@@ -278,25 +270,25 @@ route_match_tag_compile (const char *arg)
 }
 
 /* Free route map's compiled `match tag' value. */
-void
+static void
 route_match_tag_free (void *rule)
 {
   XFREE (MTYPE_ROUTE_MAP_COMPILED, rule);
 }
 
 /* Route map commands for tag matching. */
-struct route_map_rule_cmd route_match_tag_cmd =
+static struct route_map_rule_cmd route_match_tag_cmd =
 {
   "tag",
   route_match_tag,
   route_match_tag_compile,
   route_match_tag_free
 };
-\f
+
 /* `set metric METRIC' */
 
 /* Set metric to attribute. */
-route_map_result_t
+static route_map_result_t
 route_set_metric (void *rule, struct prefix *prefix, 
                  route_map_object_t type, void *object)
 {
@@ -326,7 +318,7 @@ route_set_metric (void *rule, struct prefix *prefix,
 }
 
 /* set metric compilation. */
-void *
+static void *
 route_set_metric_compile (const char *arg)
 {
   int len;
@@ -379,13 +371,13 @@ route_set_metric_compile (const char *arg)
 }
 
 /* Free route map's compiled `set metric' value. */
-void
+static void
 route_set_metric_free (void *rule)
 {
   XFREE (MTYPE_ROUTE_MAP_COMPILED, rule);
 }
 
-struct route_map_rule_cmd route_set_metric_cmd = 
+static struct route_map_rule_cmd route_set_metric_cmd = 
 {
   "metric",
   route_set_metric,
@@ -396,7 +388,7 @@ struct route_map_rule_cmd route_set_metric_cmd =
 /* `set ipv6 next-hop local IP_ADDRESS' */
 
 /* Set nexthop to object.  ojbect must be pointer to struct attr. */
-route_map_result_t
+static route_map_result_t
 route_set_ipv6_nexthop_local (void *rule, struct prefix *prefix, 
                      route_map_object_t type, void *object)
 {
@@ -418,13 +410,13 @@ route_set_ipv6_nexthop_local (void *rule, struct prefix *prefix,
 
 /* Route map `ipv6 nexthop local' compile function.  Given string is converted
    to struct in6_addr structure. */
-void *
+static void *
 route_set_ipv6_nexthop_local_compile (const char *arg)
 {
   int ret;
   struct in6_addr *address;
 
-  address = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (struct in_addr));
+  address = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (struct in6_addr));
 
   ret = inet_pton (AF_INET6, arg, address);
 
@@ -438,14 +430,14 @@ route_set_ipv6_nexthop_local_compile (const char *arg)
 }
 
 /* Free route map's compiled `ipv6 nexthop local' value. */
-void
+static void
 route_set_ipv6_nexthop_local_free (void *rule)
 {
   XFREE (MTYPE_ROUTE_MAP_COMPILED, rule);
 }
 
 /* Route map commands for ipv6 nexthop local set. */
-struct route_map_rule_cmd route_set_ipv6_nexthop_local_cmd =
+static struct route_map_rule_cmd route_set_ipv6_nexthop_local_cmd =
 {
   "ipv6 next-hop local",
   route_set_ipv6_nexthop_local,
@@ -456,7 +448,7 @@ struct route_map_rule_cmd route_set_ipv6_nexthop_local_cmd =
 /* `set tag TAG' */
 
 /* Set tag to object.  ojbect must be pointer to struct attr. */
-route_map_result_t
+static route_map_result_t
 route_set_tag (void *rule, struct prefix *prefix, 
                      route_map_object_t type, void *object)
 {
@@ -478,7 +470,7 @@ route_set_tag (void *rule, struct prefix *prefix,
 
 /* Route map `tag' compile function.  Given string is converted
    to u_short. */
-void *
+static void *
 route_set_tag_compile (const char *arg)
 {
   u_short *tag;
@@ -490,21 +482,21 @@ route_set_tag_compile (const char *arg)
 }
 
 /* Free route map's compiled `ip nexthop' value. */
-void
+static void
 route_set_tag_free (void *rule)
 {
   XFREE (MTYPE_ROUTE_MAP_COMPILED, rule);
 }
 
 /* Route map commands for tag set. */
-struct route_map_rule_cmd route_set_tag_cmd =
+static struct route_map_rule_cmd route_set_tag_cmd =
 {
   "tag",
   route_set_tag,
   route_set_tag_compile,
   route_set_tag_free
 };
-\f
+
 #define MATCH_STR "Match values from routing table\n"
 #define SET_STR "Set values in destination routing protocol\n"
 
@@ -572,7 +564,7 @@ ALIAS (no_match_interface,
 
 DEFUN (match_tag,
        match_tag_cmd,
-       "match tag <0-65535>",
+       "match tag <1-65535>",
        MATCH_STR
        "Match tag of route\n"
        "Metric value\n")
@@ -595,7 +587,7 @@ DEFUN (no_match_tag,
 
 ALIAS (no_match_tag,
        no_match_tag_val_cmd,
-       "no match tag <0-65535>",
+       "no match tag <1-65535>",
        NO_STR
        MATCH_STR
        "Match tag of route\n"
@@ -653,6 +645,12 @@ DEFUN (set_ipv6_nexthop_local,
       return CMD_WARNING;
     }
 
+  if (!IN6_IS_ADDR_LINKLOCAL(&su.sin6.sin6_addr))
+    {
+      vty_out (vty, "%% Invalid link-local nexthop address%s", VTY_NEWLINE);
+      return CMD_WARNING;
+    }
+
   return ripng_route_set_add (vty, vty->index, "ipv6 next-hop local", argv[0]);
 }
 
@@ -683,7 +681,7 @@ ALIAS (no_set_ipv6_nexthop_local,
 
 DEFUN (set_tag,
        set_tag_cmd,
-       "set tag <0-65535>",
+       "set tag <1-65535>",
        SET_STR
        "Tag value for routing protocol\n"
        "Tag value\n")
@@ -706,7 +704,7 @@ DEFUN (no_set_tag,
 
 ALIAS (no_set_tag,
        no_set_tag_val_cmd,
-       "no set tag <0-65535>",
+       "no set tag <1-65535>",
        NO_STR
        SET_STR
        "Tag value for routing protocol\n"