nft: allow to get the ruleset string without running
Separate string composition of the nftables ruleset from the actual actvation of the ruleset to nftables. For a 'show' VTY command added in upcoming patch, I'd like to be able to vty_out() an nftables rule set. Provide API for that. Change-Id: I0124a68ccf1ac7b90c5cc32d0cbf58d0cc219ccc
This commit is contained in:
parent
9c6a8e32a0
commit
eb8361f4c5
|
@ -49,5 +49,6 @@ struct upf_nft_tunmap_desc {
|
|||
int upf_nft_init();
|
||||
int upf_nft_free();
|
||||
|
||||
char *upf_nft_tunmap_get_ruleset_str(void *ctx, struct upf_nft_tunmap_desc *tunmap);
|
||||
int upf_nft_tunmap_create(struct upf_nft_tunmap_desc *tunmap);
|
||||
int upf_nft_tunmap_delete(struct upf_nft_tunmap_desc *tunmap);
|
||||
|
|
|
@ -215,7 +215,7 @@ static void upf_nft_args_from_tunmap_desc(struct upf_nft_args *args, const struc
|
|||
};
|
||||
}
|
||||
|
||||
int upf_nft_tunmap_create(struct upf_nft_tunmap_desc *tunmap)
|
||||
char *upf_nft_tunmap_get_ruleset_str(void *ctx, struct upf_nft_tunmap_desc *tunmap)
|
||||
{
|
||||
struct upf_nft_args args;
|
||||
|
||||
|
@ -228,7 +228,12 @@ int upf_nft_tunmap_create(struct upf_nft_tunmap_desc *tunmap)
|
|||
}
|
||||
|
||||
upf_nft_args_from_tunmap_desc(&args, tunmap);
|
||||
return upf_nft_run(upf_nft_ruleset_tunmap_create_c(OTC_SELECT, &args));
|
||||
return upf_nft_ruleset_tunmap_create_c(ctx, &args);
|
||||
}
|
||||
|
||||
int upf_nft_tunmap_create(struct upf_nft_tunmap_desc *tunmap)
|
||||
{
|
||||
return upf_nft_run(upf_nft_tunmap_get_ruleset_str(OTC_SELECT, tunmap));
|
||||
}
|
||||
|
||||
int upf_nft_tunmap_delete(struct upf_nft_tunmap_desc *tunmap)
|
||||
|
|
Loading…
Reference in New Issue