]> git.proxmox.com Git - mirror_frr.git/blobdiff - ripngd/ripng_offset.c
Merge pull request #3120 from opensourcerouting/remove-list-delete
[mirror_frr.git] / ripngd / ripng_offset.c
index 9d163e3f8fca808afbbfb51779b4af5e37fb145a..32b81b54802bf911d8c2c4c3d15f6cd48c2c045c 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
  */
 
 /* RIPng support by Vincent Jardin <vincent.jardin@6wind.com>
@@ -117,16 +116,15 @@ static int ripng_offset_list_set(struct vty *vty, const char *alist,
        else if (strncmp(direct_str, "o", 1) == 0)
                direct = RIPNG_OFFSET_LIST_OUT;
        else {
-               vty_out(vty, "Invalid direction: %s%s", direct_str,
-                       VTY_NEWLINE);
-               return CMD_WARNING;
+               vty_out(vty, "Invalid direction: %s\n", direct_str);
+               return CMD_WARNING_CONFIG_FAILED;
        }
 
        /* Check metric. */
        metric = atoi(metric_str);
        if (metric < 0 || metric > 16) {
-               vty_out(vty, "Invalid metric: %s%s", metric_str, VTY_NEWLINE);
-               return CMD_WARNING;
+               vty_out(vty, "Invalid metric: %s\n", metric_str);
+               return CMD_WARNING_CONFIG_FAILED;
        }
 
        /* Get offset-list structure with interface name. */
@@ -154,16 +152,15 @@ static int ripng_offset_list_unset(struct vty *vty, const char *alist,
        else if (strncmp(direct_str, "o", 1) == 0)
                direct = RIPNG_OFFSET_LIST_OUT;
        else {
-               vty_out(vty, "Invalid direction: %s%s", direct_str,
-                       VTY_NEWLINE);
-               return CMD_WARNING;
+               vty_out(vty, "Invalid direction: %s\n", direct_str);
+               return CMD_WARNING_CONFIG_FAILED;
        }
 
        /* Check metric. */
        metric = atoi(metric_str);
        if (metric < 0 || metric > 16) {
-               vty_out(vty, "Invalid metric: %s%s", metric_str, VTY_NEWLINE);
-               return CMD_WARNING;
+               vty_out(vty, "Invalid metric: %s\n", metric_str);
+               return CMD_WARNING_CONFIG_FAILED;
        }
 
        /* Get offset-list structure with interface name. */
@@ -183,8 +180,8 @@ static int ripng_offset_list_unset(struct vty *vty, const char *alist,
                        ripng_offset_list_free(offset);
                }
        } else {
-               vty_out(vty, "Can't find offset-list%s", VTY_NEWLINE);
-               return CMD_WARNING;
+               vty_out(vty, "Can't find offset-list\n");
+               return CMD_WARNING_CONFIG_FAILED;
        }
        return CMD_SUCCESS;
 }
@@ -197,7 +194,7 @@ static int ripng_offset_list_unset(struct vty *vty, const char *alist,
 
 /* If metric is modifed return 1. */
 int ripng_offset_list_apply_in(struct prefix_ipv6 *p, struct interface *ifp,
-                              u_char *metric)
+                              uint8_t *metric)
 {
        struct ripng_offset_list *offset;
        struct access_list *alist;
@@ -235,7 +232,7 @@ int ripng_offset_list_apply_in(struct prefix_ipv6 *p, struct interface *ifp,
 
 /* If metric is modifed return 1. */
 int ripng_offset_list_apply_out(struct prefix_ipv6 *p, struct interface *ifp,
-                               u_char *metric)
+                               uint8_t *metric)
 {
        struct ripng_offset_list *offset;
        struct access_list *alist;
@@ -378,7 +375,7 @@ void ripng_offset_init(void)
 
 void ripng_offset_clean(void)
 {
-       list_delete(ripng_offset_list_master);
+       list_delete(&ripng_offset_list_master);
 
        ripng_offset_list_master = list_new();
        ripng_offset_list_master->cmp =
@@ -394,34 +391,32 @@ int config_write_ripng_offset_list(struct vty *vty)
        for (ALL_LIST_ELEMENTS(ripng_offset_list_master, node, nnode, offset)) {
                if (!offset->ifname) {
                        if (offset->direct[RIPNG_OFFSET_LIST_IN].alist_name)
-                               vty_out(vty, " offset-list %s in %d%s",
+                               vty_out(vty, " offset-list %s in %d\n",
                                        offset->direct[RIPNG_OFFSET_LIST_IN]
                                                .alist_name,
                                        offset->direct[RIPNG_OFFSET_LIST_IN]
-                                               .metric,
-                                       VTY_NEWLINE);
+                                               .metric);
                        if (offset->direct[RIPNG_OFFSET_LIST_OUT].alist_name)
-                               vty_out(vty, " offset-list %s out %d%s",
+                               vty_out(vty, " offset-list %s out %d\n",
                                        offset->direct[RIPNG_OFFSET_LIST_OUT]
                                                .alist_name,
                                        offset->direct[RIPNG_OFFSET_LIST_OUT]
-                                               .metric,
-                                       VTY_NEWLINE);
+                                               .metric);
                } else {
                        if (offset->direct[RIPNG_OFFSET_LIST_IN].alist_name)
-                               vty_out(vty, " offset-list %s in %d %s%s",
+                               vty_out(vty, " offset-list %s in %d %s\n",
                                        offset->direct[RIPNG_OFFSET_LIST_IN]
                                                .alist_name,
                                        offset->direct[RIPNG_OFFSET_LIST_IN]
                                                .metric,
-                                       offset->ifname, VTY_NEWLINE);
+                                       offset->ifname);
                        if (offset->direct[RIPNG_OFFSET_LIST_OUT].alist_name)
-                               vty_out(vty, " offset-list %s out %d %s%s",
+                               vty_out(vty, " offset-list %s out %d %s\n",
                                        offset->direct[RIPNG_OFFSET_LIST_OUT]
                                                .alist_name,
                                        offset->direct[RIPNG_OFFSET_LIST_OUT]
                                                .metric,
-                                       offset->ifname, VTY_NEWLINE);
+                                       offset->ifname);
                }
        }