mirror of
https://git.kernel.org/pub/scm/network/iproute2/iproute2.git
synced 2024-11-16 06:25:35 +08:00
Switch to parse_rtattr and use XFRMA_MAX directly instead of a easly
forgetable magic define (Logical change 1.129)
This commit is contained in:
parent
ebb4e4376a
commit
2534613eeb
@ -337,8 +337,7 @@ static int xfrm_policy_print(const struct sockaddr_nl *who,
|
||||
FILE *fp = (FILE*)arg;
|
||||
struct xfrm_userpolicy_info *xpinfo = NLMSG_DATA(n);
|
||||
int len = n->nlmsg_len;
|
||||
struct rtattr * tb[XFRM_MAX_DEPTH];
|
||||
int ntb;
|
||||
struct rtattr * tb[XFRMA_MAX+1];
|
||||
|
||||
if (n->nlmsg_type != XFRM_MSG_NEWPOLICY &&
|
||||
n->nlmsg_type != XFRM_MSG_DELPOLICY) {
|
||||
@ -356,8 +355,7 @@ static int xfrm_policy_print(const struct sockaddr_nl *who,
|
||||
if (!xfrm_policy_filter_match(xpinfo))
|
||||
return 0;
|
||||
|
||||
memset(tb, 0, sizeof(tb));
|
||||
ntb = parse_rtattr_byindex(tb, XFRM_MAX_DEPTH, XFRMP_RTA(xpinfo), len);
|
||||
parse_rtattr(tb, XFRMA_MAX, XFRMP_RTA(xpinfo), len);
|
||||
|
||||
if (n->nlmsg_type == XFRM_MSG_DELPOLICY)
|
||||
fprintf(fp, "Deleted ");
|
||||
@ -407,7 +405,7 @@ static int xfrm_policy_print(const struct sockaddr_nl *who,
|
||||
if (show_stats > 0)
|
||||
xfrm_lifetime_print(&xpinfo->lft, &xpinfo->curlft, fp, "\t");
|
||||
|
||||
xfrm_xfrma_print(tb, ntb, xpinfo->sel.family, fp, "\t");
|
||||
xfrm_xfrma_print(tb, xpinfo->sel.family, fp, "\t");
|
||||
|
||||
if (oneline)
|
||||
fprintf(fp, "\n");
|
||||
|
@ -43,7 +43,7 @@
|
||||
* data = struct xfrm_usersa_info
|
||||
* rtattr
|
||||
* rtattr
|
||||
* ... (max count of rtattr is XFRM_MAX_DEPTH)
|
||||
* ... (max count of rtattr is XFRM_MAX+1
|
||||
*
|
||||
* each rtattr data = struct xfrm_algo(dynamic size) or xfrm_address_t
|
||||
*/
|
||||
@ -397,7 +397,6 @@ static int xfrm_state_print(const struct sockaddr_nl *who,
|
||||
struct xfrm_usersa_info *xsinfo = NLMSG_DATA(n);
|
||||
int len = n->nlmsg_len;
|
||||
struct rtattr * tb[XFRMA_MAX+1];
|
||||
int ntb;
|
||||
|
||||
if (n->nlmsg_type != XFRM_MSG_NEWSA &&
|
||||
n->nlmsg_type != XFRM_MSG_DELSA) {
|
||||
@ -415,8 +414,7 @@ static int xfrm_state_print(const struct sockaddr_nl *who,
|
||||
if (!xfrm_state_filter_match(xsinfo))
|
||||
return 0;
|
||||
|
||||
memset(tb, 0, sizeof(tb));
|
||||
ntb = parse_rtattr_byindex(tb, XFRM_MAX_DEPTH, XFRMS_RTA(xsinfo), len);
|
||||
parse_rtattr(tb, XFRMA_MAX, XFRMS_RTA(xsinfo), len);
|
||||
|
||||
if (n->nlmsg_type == XFRM_MSG_DELSA)
|
||||
fprintf(fp, "Deleted ");
|
||||
@ -441,7 +439,7 @@ static int xfrm_state_print(const struct sockaddr_nl *who,
|
||||
}
|
||||
fprintf(fp, "%s", _SL_);
|
||||
|
||||
xfrm_xfrma_print(tb, ntb, xsinfo->family, fp, "\t");
|
||||
xfrm_xfrma_print(tb, xsinfo->family, fp, "\t");
|
||||
|
||||
if (!xfrm_selector_iszero(&xsinfo->sel))
|
||||
xfrm_selector_print(&xsinfo->sel, xsinfo->family, fp, "\tsel ");
|
||||
|
Loading…
Reference in New Issue
Block a user