pbrms->family = prefix->family;
if (!no) {
- if (prefix_same(pbrms->src, prefix))
- return CMD_SUCCESS;
+ if (pbrms->src) {
+ if (prefix_same(pbrms->src, prefix))
+ return CMD_SUCCESS;
+
+ vty_out(vty,
+ "A `match src-ip XX` command already exists, please remove that first\n");
+ return CMD_WARNING_CONFIG_FAILED;
+ }
- if (!pbrms->src)
- pbrms->src = prefix_new();
+ pbrms->src = prefix_new();
prefix_copy(pbrms->src, prefix);
} else
prefix_free(&pbrms->src);
"[no] match dst-ip <A.B.C.D/M|X:X::X:X/M>$prefix",
NO_STR
"Match the rest of the command\n"
- "Choose the src ip or ipv6 prefix to use\n"
+ "Choose the dst ip or ipv6 prefix to use\n"
"v4 Prefix\n"
"v6 Prefix\n")
{
pbrms->family = prefix->family;
if (!no) {
- if (prefix_same(pbrms->dst, prefix))
- return CMD_SUCCESS;
+ if (pbrms->dst) {
+ if (prefix_same(pbrms->dst, prefix))
+ return CMD_SUCCESS;
+
+ vty_out(vty,
+ "A `match dst-ip XX` command already exists, please remove that first\n");
+ return CMD_WARNING_CONFIG_FAILED;
+ }
- if (!pbrms->dst)
- pbrms->dst = prefix_new();
+ pbrms->dst = prefix_new();
prefix_copy(pbrms->dst, prefix);
} else
prefix_free(&pbrms->dst);
#endif
if (!no) {
- if (pbrms->mark == (uint32_t) mark)
- return CMD_SUCCESS;
- pbrms->mark = (uint32_t) mark;
- } else {
+ if (pbrms->mark) {
+ if (pbrms->mark == (uint32_t)mark)
+ return CMD_SUCCESS;
+
+ vty_out(vty,
+ "A `match mark XX` command already exists, please remove that first\n");
+ return CMD_WARNING_CONFIG_FAILED;
+ }
+
+ pbrms->mark = (uint32_t)mark;
+ } else
pbrms->mark = 0;
- }
pbr_map_check(pbrms);
pbr_map_delete_nexthops(pbrms);
else {
vty_out(vty,
- "Nexthop Group specified: %s does not exist to remove",
+ "Nexthop Group specified: %s does not exist to remove\n",
name);
return CMD_WARNING_CONFIG_FAILED;
}
if (pbrms->nhgrp_name) {
if (strcmp(name, pbrms->nhgrp_name) != 0) {
vty_out(vty,
- "Please delete current nexthop group before modifying current one");
+ "Please delete current nexthop group before modifying current one\n");
return CMD_WARNING_CONFIG_FAILED;
}
if (pbrms->nhgrp_name) {
vty_out(vty,
- "Please unconfigure the nexthop group before adding an individual nexthop");
+ "Please unconfigure the nexthop group before adding an individual nexthop\n");
return CMD_WARNING_CONFIG_FAILED;
}
if (pbrms->nhg->nexthop) {
vty_out(vty,
- "If you would like more than one nexthop please use nexthop-groups");
+ "If you would like more than one nexthop please use nexthop-groups\n");
return CMD_WARNING_CONFIG_FAILED;
}