]> git.proxmox.com Git - mirror_frr.git/blobdiff - lib/if_rmap.c
zebra: Allow ns delete to happen after under/over flow checks
[mirror_frr.git] / lib / if_rmap.c
index 1ce2a43c59a72148baf8d52a1656e4e359db2597..108ab7ec6b5dacc737970eae4fb60dbbf766938e 100644 (file)
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * General Public License for more details.
  *
- * You should have received a copy of the GNU General Public License
- * along with GNU Zebra; see the file COPYING.  If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * You should have received a copy of the GNU General Public License along
+ * with this program; see the file COPYING; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include <zebra.h>
@@ -118,7 +117,7 @@ static unsigned int if_rmap_hash_make(void *data)
        return string_hash_make(if_rmap->ifname);
 }
 
-static int if_rmap_hash_cmp(const void *arg1, const void *arg2)
+static bool if_rmap_hash_cmp(const void *arg1, const void *arg2)
 {
        const struct if_rmap *if_rmap1 = arg1;
        const struct if_rmap *if_rmap2 = arg2;
@@ -214,9 +213,8 @@ DEFUN (if_rmap,
        else if (strncmp(argv[idx_in_out]->text, "out", 1) == 0)
                type = IF_RMAP_OUT;
        else {
-               vty_out(vty, "route-map direction must be [in|out]%s",
-                       VTY_NEWLINE);
-               return CMD_WARNING;
+               vty_out(vty, "route-map direction must be [in|out]\n");
+               return CMD_WARNING_CONFIG_FAILED;
        }
 
        if_rmap_set(argv[idx_ifname]->arg, type, argv[idx_rmap_name]->arg);
@@ -245,16 +243,15 @@ DEFUN (no_if_rmap,
        else if (strncmp(argv[idx_in_out]->arg, "o", 1) == 0)
                type = IF_RMAP_OUT;
        else {
-               vty_out(vty, "route-map direction must be [in|out]%s",
-                       VTY_NEWLINE);
-               return CMD_WARNING;
+               vty_out(vty, "route-map direction must be [in|out]\n");
+               return CMD_WARNING_CONFIG_FAILED;
        }
 
        ret = if_rmap_unset(argv[idx_ifname]->arg, type,
                            argv[idx_routemap_name]->arg);
        if (!ret) {
-               vty_out(vty, "route-map doesn't exist%s", VTY_NEWLINE);
-               return CMD_WARNING;
+               vty_out(vty, "route-map doesn't exist\n");
+               return CMD_WARNING_CONFIG_FAILED;
        }
        return CMD_SUCCESS;
 }
@@ -274,16 +271,16 @@ int config_write_if_rmap(struct vty *vty)
                        if_rmap = mp->data;
 
                        if (if_rmap->routemap[IF_RMAP_IN]) {
-                               vty_out(vty, " route-map %s in %s%s",
+                               vty_out(vty, " route-map %s in %s\n",
                                        if_rmap->routemap[IF_RMAP_IN],
-                                       if_rmap->ifname, VTY_NEWLINE);
+                                       if_rmap->ifname);
                                write++;
                        }
 
                        if (if_rmap->routemap[IF_RMAP_OUT]) {
-                               vty_out(vty, " route-map %s out %s%s",
+                               vty_out(vty, " route-map %s out %s\n",
                                        if_rmap->routemap[IF_RMAP_OUT],
-                                       if_rmap->ifname, VTY_NEWLINE);
+                                       if_rmap->ifname);
                                write++;
                        }
                }
@@ -297,7 +294,8 @@ void if_rmap_reset()
 
 void if_rmap_init(int node)
 {
-       ifrmaphash = hash_create(if_rmap_hash_make, if_rmap_hash_cmp);
+       ifrmaphash = hash_create_size(4, if_rmap_hash_make, if_rmap_hash_cmp,
+                                     "Interface Route-Map Hash");
        if (node == RIPNG_NODE) {
        } else if (node == RIP_NODE) {
                install_element(RIP_NODE, &if_rmap_cmd);