summaryrefslogtreecommitdiff
path: root/zebra/router-id.c
diff options
context:
space:
mode:
Diffstat (limited to 'zebra/router-id.c')
-rw-r--r--zebra/router-id.c56
1 files changed, 20 insertions, 36 deletions
diff --git a/zebra/router-id.c b/zebra/router-id.c
index 0aa1bdc770..318986c1b7 100644
--- a/zebra/router-id.c
+++ b/zebra/router-id.c
@@ -15,10 +15,9 @@
* 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>
@@ -216,41 +215,42 @@ router_id_write (struct vty *vty)
DEFUN (router_id,
router_id_cmd,
- "router-id A.B.C.D",
+ "router-id A.B.C.D [vrf NAME]",
"Manually set the router-id\n"
- "IP address to use for router-id\n")
+ "IP address to use for router-id\n"
+ VRF_CMD_HELP_STR)
{
+ int idx_ipv4 = 1;
+ int idx_name = 3;
+
struct prefix rid;
vrf_id_t vrf_id = VRF_DEFAULT;
- rid.u.prefix4.s_addr = inet_addr (argv[0]);
+ rid.u.prefix4.s_addr = inet_addr (argv[idx_ipv4]->arg);
if (!rid.u.prefix4.s_addr)
return CMD_WARNING;
rid.prefixlen = 32;
rid.family = AF_INET;
- if (argc > 1)
- VRF_GET_ID (vrf_id, argv[1]);
+ if (argc > 2)
+ VRF_GET_ID (vrf_id, argv[idx_name]->arg);
router_id_set (&rid, vrf_id);
return CMD_SUCCESS;
}
-ALIAS (router_id,
- router_id_vrf_cmd,
- "router-id A.B.C.D " VRF_CMD_STR,
- "Manually set the router-id\n"
- "IP address to use for router-id\n"
- VRF_CMD_HELP_STR)
-
DEFUN (no_router_id,
no_router_id_cmd,
- "no router-id",
+ "no router-id [A.B.C.D [vrf NAME]]",
NO_STR
- "Remove the manually configured router-id\n")
+ "Remove the manually configured router-id\n"
+ "IP address to use for router-id\n"
+ VRF_CMD_HELP_STR)
{
+ int idx_name = 4;
+
struct prefix rid;
vrf_id_t vrf_id = VRF_DEFAULT;
@@ -258,28 +258,15 @@ DEFUN (no_router_id,
rid.prefixlen = 0;
rid.family = AF_INET;
- if (argc > 1)
- VRF_GET_ID (vrf_id, argv[1]);
+ if (argc > 3)
+ VRF_GET_ID (vrf_id, argv[idx_name]->arg);
router_id_set (&rid, vrf_id);
return CMD_SUCCESS;
}
-ALIAS (no_router_id,
- no_router_id_val_cmd,
- "no router-id A.B.C.D",
- NO_STR
- "Remove the manually configured router-id\n"
- "IP address to use for router-id\n")
-ALIAS (no_router_id,
- no_router_id_vrf_cmd,
- "no router-id A.B.C.D " VRF_CMD_STR,
- NO_STR
- "Remove the manually configured router-id\n"
- "IP address to use for router-id\n"
- VRF_CMD_HELP_STR)
static int
router_id_cmp (void *a, void *b)
@@ -295,9 +282,6 @@ router_id_cmd_init (void)
{
install_element (CONFIG_NODE, &router_id_cmd);
install_element (CONFIG_NODE, &no_router_id_cmd);
- install_element (CONFIG_NODE, &router_id_vrf_cmd);
- install_element (CONFIG_NODE, &no_router_id_val_cmd);
- install_element (CONFIG_NODE, &no_router_id_vrf_cmd);
}
void