Fixed conversion from Rx 'permit in' flow rule to Gx 'permit out' flow rule

This commit is contained in:
Supreeth Herle 2019-12-27 13:01:19 +01:00 committed by Sukchan Lee
parent 6a470c8881
commit 768e4d9eb3
1 changed files with 13 additions and 2 deletions

View File

@ -1278,6 +1278,7 @@ static int encode_pcc_rule_definition(
static int flow_rx_to_gx(ogs_flow_t *rx_flow, ogs_flow_t *gx_flow)
{
int len;
char *from_str, *to_str;
ogs_assert(rx_flow);
ogs_assert(gx_flow);
@ -1298,8 +1299,18 @@ static int flow_rx_to_gx(ogs_flow_t *rx_flow, ogs_flow_t *gx_flow)
len = strlen(rx_flow->description)+2;
gx_flow->description = ogs_malloc(len);
strcpy(gx_flow->description, "permit out");
strcat(gx_flow->description,
&rx_flow->description[strlen("permit in")]);
from_str = strstr(&rx_flow->description[strlen("permit in")], "from");
to_str = strstr(&rx_flow->description[strlen("permit in")], "to");
strncat(gx_flow->description,
&rx_flow->description[strlen("permit in")],
strlen(rx_flow->description) - strlen("permit in") - strlen(from_str));
strcat(gx_flow->description, "from");
strcat(gx_flow->description, &to_str[strlen("to")]);
strcat(gx_flow->description, " to");
strncat(gx_flow->description, &from_str[strlen("from")],
strlen(from_str) - strlen(to_str) - strlen("from") - 1);
// strcat(gx_flow->description,
// &rx_flow->description[strlen("permit in")]);
ogs_assert(len == strlen(gx_flow->description)+1);
} else {
ogs_error("Invalid Flow Descripton : [%s]", rx_flow->description);