From: Stephen Hemminger <shemminger@linux-foundation.org>
To: hadi@cyberus.ca
Cc: netdev@vger.kernel.org
Subject: Re: [RESEND][PATCH][IPROUTE2] see SAD info
Date: Tue, 19 Jun 2007 16:25:53 -0700 [thread overview]
Message-ID: <20070619162553.2b4babff@localhost.localdomain> (raw)
In-Reply-To: <1178233781.4068.6.camel@localhost>
On Thu, 03 May 2007 19:09:41 -0400
jamal <hadi@cyberus.ca> wrote:
> Stephen,
> Use this patch instead of the one i sent yesterday.
> As before, you will need to pull include/linux/xfrm.h from
> net-2.6 once Dave applies the kernel patch.
>
> cheers,
> jamal
>
Using current xfrm.h from kernel headers, causes conflicts.
Instead of XFRMA_SADCNT, it should be using XFRMA_SAD_CNT.
---
ip/xfrm_policy.c | 18 ++++++++++--------
ip/xfrm_state.c | 31 ++++++++++++++++---------------
2 files changed, 26 insertions(+), 23 deletions(-)
diff --git a/ip/xfrm_policy.c b/ip/xfrm_policy.c
index 07793d8..c1086f1 100644
--- a/ip/xfrm_policy.c
+++ b/ip/xfrm_policy.c
@@ -780,8 +780,6 @@ int print_spdinfo( struct nlmsghdr *n, void *arg)
__u32 *f = NLMSG_DATA(n);
struct rtattr * tb[XFRMA_SPD_MAX+1];
struct rtattr * rta;
- struct xfrmu_spdinfo *si;
- struct xfrmu_spdhinfo *sh;
int len = n->nlmsg_len;
@@ -795,12 +793,14 @@ int print_spdinfo( struct nlmsghdr *n, void *arg)
parse_rtattr(tb, XFRMA_SPD_MAX, rta, len);
fprintf(fp,"\t SPD");
- if (tb[XFRMA_SPDINFO]) {
- if (RTA_PAYLOAD(tb[XFRMA_SPDINFO]) < sizeof(*si)) {
+ if (tb[XFRMA_SPD_INFO]) {
+ struct xfrmu_spdinfo *si;
+
+ if (RTA_PAYLOAD(tb[XFRMA_SPD_INFO]) < sizeof(*si)) {
fprintf(stderr, "SPDinfo: Wrong len %d\n", len);
return -1;
}
- si = (struct xfrmu_spdinfo *)RTA_DATA(tb[XFRMA_SPDINFO]);
+ si = RTA_DATA(tb[XFRMA_SPD_INFO]);
fprintf(fp," IN %d", si->incnt);
fprintf(fp," OUT %d", si->outcnt);
fprintf(fp," FWD %d", si->fwdcnt);
@@ -816,12 +816,14 @@ int print_spdinfo( struct nlmsghdr *n, void *arg)
fprintf(fp,"\n");
}
if (show_stats > 1) {
- if (tb[XFRMA_SPDHINFO]) {
- if (RTA_PAYLOAD(tb[XFRMA_SPDHINFO]) < sizeof(*sh)) {
+ struct xfrmu_spdhinfo *sh;
+
+ if (tb[XFRMA_SPD_HINFO]) {
+ if (RTA_PAYLOAD(tb[XFRMA_SPD_HINFO]) < sizeof(*sh)) {
fprintf(stderr, "SPDinfo: Wrong len %d\n", len);
return -1;
}
- sh = (struct xfrmu_spdhinfo *)RTA_DATA(tb[XFRMA_SPDHINFO]);
+ sh = RTA_DATA(tb[XFRMA_SPD_HINFO]);
fprintf(fp,"\t SPD buckets:");
fprintf(fp," count %d", sh->spdhcnt);
fprintf(fp," Max %d", sh->spdhmcnt);
diff --git a/ip/xfrm_state.c b/ip/xfrm_state.c
index 39b0f27..54e1330 100644
--- a/ip/xfrm_state.c
+++ b/ip/xfrm_state.c
@@ -686,7 +686,7 @@ int xfrm_state_print(const struct sockaddr_nl *who, struct nlmsghdr *n,
fprintf(stderr, "Buggy XFRM_MSG_DELPOLICY: too short XFRMA_POLICY len\n");
return -1;
}
- xsinfo = (struct xfrm_usersa_info *)RTA_DATA(tb[XFRMA_SA]);
+ xsinfo = RTA_DATA(tb[XFRMA_SA]);
}
xfrm_state_info_print(xsinfo, tb, fp, NULL, NULL);
@@ -940,7 +940,6 @@ int print_sadinfo(struct nlmsghdr *n, void *arg)
__u32 *f = NLMSG_DATA(n);
struct rtattr *tb[XFRMA_SAD_MAX+1];
struct rtattr *rta;
- struct xfrmu_sadhinfo *si;
__u32 *cnt;
int len = n->nlmsg_len;
@@ -954,9 +953,9 @@ int print_sadinfo(struct nlmsghdr *n, void *arg)
rta = XFRMSAPD_RTA(f);
parse_rtattr(tb, XFRMA_SAD_MAX, rta, len);
- if (tb[XFRMA_SADCNT]) {
+ if (tb[XFRMA_SAD_CNT]) {
fprintf(fp,"\t SAD");
- cnt = (__u32 *)RTA_DATA(tb[XFRMA_SADCNT]);
+ cnt = (__u32 *)RTA_DATA(tb[XFRMA_SAD_CNT]);
fprintf(fp," count %d", *cnt);
} else {
fprintf(fp,"BAD SAD info returned\n");
@@ -964,18 +963,20 @@ int print_sadinfo(struct nlmsghdr *n, void *arg)
}
if (show_stats) {
- if (!tb[XFRMA_SADHINFO]) {
- }
- if (RTA_PAYLOAD(tb[XFRMA_SADHINFO]) < sizeof(*si)) {
- fprintf(fp,"BAD SAD length returned\n");
- return -1;
- }
+ if (tb[XFRMA_SAD_HINFO]) {
+ struct xfrmu_sadhinfo *si;
- si = (struct xfrmu_sadhinfo *)RTA_DATA(tb[XFRMA_SADHINFO]);
- fprintf(fp," (buckets ");
- fprintf(fp,"count %d", si->sadhcnt);
- fprintf(fp," Max %d", si->sadhmcnt);
- fprintf(fp,")");
+ if (RTA_PAYLOAD(tb[XFRMA_SAD_HINFO]) < sizeof(*si)) {
+ fprintf(fp,"BAD SAD length returned\n");
+ return -1;
+ }
+
+ si = RTA_DATA(tb[XFRMA_SAD_HINFO]);
+ fprintf(fp," (buckets ");
+ fprintf(fp,"count %d", si->sadhcnt);
+ fprintf(fp," Max %d", si->sadhmcnt);
+ fprintf(fp,")");
+ }
}
fprintf(fp,"\n");
--
1.5.2.1
--
Stephen Hemminger <shemminger@linux-foundation.org>
next prev parent reply other threads:[~2007-06-19 23:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-03 23:09 [RESEND][PATCH][IPROUTE2] see SAD info jamal
2007-06-19 23:25 ` Stephen Hemminger [this message]
2007-06-21 15:12 ` jamal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070619162553.2b4babff@localhost.localdomain \
--to=shemminger@linux-foundation.org \
--cc=hadi@cyberus.ca \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.