mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-12 14:27:36 +00:00
pbrd: Add ability to set/unset src and dest ports
Add `match src-port (1-65535)` and `match dst-port (1-65535)` commands to allow pbr to pass these values down to zebra. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
parent
0d7b939fd0
commit
a7f0e5c3e3
@ -193,6 +193,50 @@ DEFPY(pbr_map_match_dst, pbr_map_match_dst_cmd,
|
|||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEFPY(pbr_map_match_src_port, pbr_map_match_src_port_cmd,
|
||||||
|
"[no] match src-port (1-65535)$port",
|
||||||
|
NO_STR
|
||||||
|
"Match the rest of the command\n"
|
||||||
|
"Choose the source port to use\n"
|
||||||
|
"The Source Port\n")
|
||||||
|
{
|
||||||
|
struct pbr_map_sequence *pbrms = VTY_GET_CONTEXT(pbr_map_sequence);
|
||||||
|
|
||||||
|
if (!no) {
|
||||||
|
if (pbrms->src_prt == port)
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
else
|
||||||
|
pbrms->src_prt = port;
|
||||||
|
} else
|
||||||
|
pbrms->src_prt = 0;
|
||||||
|
|
||||||
|
pbr_map_check(pbrms, true);
|
||||||
|
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFPY(pbr_map_match_dst_port, pbr_map_match_dst_port_cmd,
|
||||||
|
"[no] match dst-port (1-65535)$port",
|
||||||
|
NO_STR
|
||||||
|
"Match the rest of the command\n"
|
||||||
|
"Choose the destination port to use\n"
|
||||||
|
"The Destination Port\n")
|
||||||
|
{
|
||||||
|
struct pbr_map_sequence *pbrms = VTY_GET_CONTEXT(pbr_map_sequence);
|
||||||
|
|
||||||
|
if (!no) {
|
||||||
|
if (pbrms->dst_prt == port)
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
else
|
||||||
|
pbrms->dst_prt = port;
|
||||||
|
} else
|
||||||
|
pbrms->dst_prt = 0;
|
||||||
|
|
||||||
|
pbr_map_check(pbrms, true);
|
||||||
|
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
DEFPY(pbr_map_match_dscp, pbr_map_match_dscp_cmd,
|
DEFPY(pbr_map_match_dscp, pbr_map_match_dscp_cmd,
|
||||||
"[no] match dscp DSCP$dscp",
|
"[no] match dscp DSCP$dscp",
|
||||||
NO_STR
|
NO_STR
|
||||||
@ -1079,6 +1123,11 @@ static int pbr_vty_map_config_write_sequence(struct vty *vty,
|
|||||||
if (pbrms->dst)
|
if (pbrms->dst)
|
||||||
vty_out(vty, " match dst-ip %pFX\n", pbrms->dst);
|
vty_out(vty, " match dst-ip %pFX\n", pbrms->dst);
|
||||||
|
|
||||||
|
if (pbrms->src_prt)
|
||||||
|
vty_out(vty, " match src-port %u\n", pbrms->src_prt);
|
||||||
|
if (pbrms->dst_prt)
|
||||||
|
vty_out(vty, " match dst-port %u\n", pbrms->dst_prt);
|
||||||
|
|
||||||
if (pbrms->dsfield & PBR_DSFIELD_DSCP)
|
if (pbrms->dsfield & PBR_DSFIELD_DSCP)
|
||||||
vty_out(vty, " match dscp %u\n",
|
vty_out(vty, " match dscp %u\n",
|
||||||
(pbrms->dsfield & PBR_DSFIELD_DSCP) >> 2);
|
(pbrms->dsfield & PBR_DSFIELD_DSCP) >> 2);
|
||||||
@ -1169,6 +1218,8 @@ void pbr_vty_init(void)
|
|||||||
install_element(CONFIG_NODE, &pbr_set_table_range_cmd);
|
install_element(CONFIG_NODE, &pbr_set_table_range_cmd);
|
||||||
install_element(CONFIG_NODE, &no_pbr_set_table_range_cmd);
|
install_element(CONFIG_NODE, &no_pbr_set_table_range_cmd);
|
||||||
install_element(INTERFACE_NODE, &pbr_policy_cmd);
|
install_element(INTERFACE_NODE, &pbr_policy_cmd);
|
||||||
|
install_element(PBRMAP_NODE, &pbr_map_match_src_port_cmd);
|
||||||
|
install_element(PBRMAP_NODE, &pbr_map_match_dst_port_cmd);
|
||||||
install_element(PBRMAP_NODE, &pbr_map_match_src_cmd);
|
install_element(PBRMAP_NODE, &pbr_map_match_src_cmd);
|
||||||
install_element(PBRMAP_NODE, &pbr_map_match_dst_cmd);
|
install_element(PBRMAP_NODE, &pbr_map_match_dst_cmd);
|
||||||
install_element(PBRMAP_NODE, &pbr_map_match_dscp_cmd);
|
install_element(PBRMAP_NODE, &pbr_map_match_dscp_cmd);
|
||||||
|
Loading…
Reference in New Issue
Block a user