|
|
a4b897 |
From ae646501d67a3c6e5078529f92339ffc87277cea Mon Sep 17 00:00:00 2001
|
|
|
a4b897 |
From: Phil Sutter <psutter@redhat.com>
|
|
|
a4b897 |
Date: Thu, 3 Sep 2015 13:02:02 +0200
|
|
|
a4b897 |
Subject: [PATCH] Revert Changes for BZ#1212026
|
|
|
a4b897 |
|
|
|
a4b897 |
Kernel lacks support for it in RHEL7.2, delivering this would be inconsistent.
|
|
|
a4b897 |
|
|
|
a4b897 |
This is a combination of 2 reverts:
|
|
|
a4b897 |
|
|
|
a4b897 |
Revert "xfrm: add command for configuring SPD hash table"
|
|
|
a4b897 |
Revert "xfrm: revise man page and document ip xfrm policy set"
|
|
|
a4b897 |
---
|
|
|
a4b897 |
ip/xfrm_policy.c | 105 ++---------------------------------------------------
|
|
|
a4b897 |
man/man8/ip-xfrm.8 | 61 +------------------------------
|
|
|
a4b897 |
2 files changed, 5 insertions(+), 161 deletions(-)
|
|
|
a4b897 |
|
|
|
a4b897 |
diff --git a/ip/xfrm_policy.c b/ip/xfrm_policy.c
|
|
|
a4b897 |
index 9ac4a89..36e33c9 100644
|
|
|
a4b897 |
--- a/ip/xfrm_policy.c
|
|
|
a4b897 |
+++ b/ip/xfrm_policy.c
|
|
|
a4b897 |
@@ -64,8 +64,7 @@ static void usage(void)
|
|
|
a4b897 |
fprintf(stderr, " [ index INDEX ] [ ptype PTYPE ] [ action ACTION ] [ priority PRIORITY ]\n");
|
|
|
a4b897 |
fprintf(stderr, " [ flag FLAG-LIST ]\n");
|
|
|
a4b897 |
fprintf(stderr, "Usage: ip xfrm policy flush [ ptype PTYPE ]\n");
|
|
|
a4b897 |
- fprintf(stderr, "Usage: ip xfrm policy count\n");
|
|
|
a4b897 |
- fprintf(stderr, "Usage: ip xfrm policy set [ hthresh4 LBITS RBITS ] [ hthresh6 LBITS RBITS ]\n");
|
|
|
a4b897 |
+ fprintf(stderr, "Usage: ip xfrm count\n");
|
|
|
a4b897 |
fprintf(stderr, "SELECTOR := [ src ADDR[/PLEN] ] [ dst ADDR[/PLEN] ] [ dev DEV ] [ UPSPEC ]\n");
|
|
|
a4b897 |
fprintf(stderr, "UPSPEC := proto { { ");
|
|
|
a4b897 |
fprintf(stderr, "%s | ", strxf_proto(IPPROTO_TCP));
|
|
|
a4b897 |
@@ -936,7 +935,7 @@ static int print_spdinfo( struct nlmsghdr *n, void *arg)
|
|
|
a4b897 |
fprintf(fp,")");
|
|
|
a4b897 |
}
|
|
|
a4b897 |
|
|
|
a4b897 |
- fprintf(fp, "%s", _SL_);
|
|
|
a4b897 |
+ fprintf(fp,"\n");
|
|
|
a4b897 |
}
|
|
|
a4b897 |
if (show_stats > 1) {
|
|
|
a4b897 |
struct xfrmu_spdhinfo *sh;
|
|
|
a4b897 |
@@ -950,109 +949,13 @@ static int print_spdinfo( struct nlmsghdr *n, void *arg)
|
|
|
a4b897 |
fprintf(fp,"\t SPD buckets:");
|
|
|
a4b897 |
fprintf(fp," count %d", sh->spdhcnt);
|
|
|
a4b897 |
fprintf(fp," Max %d", sh->spdhmcnt);
|
|
|
a4b897 |
- fprintf(fp, "%s", _SL_);
|
|
|
a4b897 |
- }
|
|
|
a4b897 |
- if (tb[XFRMA_SPD_IPV4_HTHRESH]) {
|
|
|
a4b897 |
- struct xfrmu_spdhthresh *th;
|
|
|
a4b897 |
- if (RTA_PAYLOAD(tb[XFRMA_SPD_IPV4_HTHRESH]) < sizeof(*th)) {
|
|
|
a4b897 |
- fprintf(stderr, "SPDinfo: Wrong len %d\n", len);
|
|
|
a4b897 |
- return -1;
|
|
|
a4b897 |
- }
|
|
|
a4b897 |
- th = RTA_DATA(tb[XFRMA_SPD_IPV4_HTHRESH]);
|
|
|
a4b897 |
- fprintf(fp,"\t SPD IPv4 thresholds:");
|
|
|
a4b897 |
- fprintf(fp," local %d", th->lbits);
|
|
|
a4b897 |
- fprintf(fp," remote %d", th->rbits);
|
|
|
a4b897 |
- fprintf(fp, "%s", _SL_);
|
|
|
a4b897 |
-
|
|
|
a4b897 |
- }
|
|
|
a4b897 |
- if (tb[XFRMA_SPD_IPV6_HTHRESH]) {
|
|
|
a4b897 |
- struct xfrmu_spdhthresh *th;
|
|
|
a4b897 |
- if (RTA_PAYLOAD(tb[XFRMA_SPD_IPV6_HTHRESH]) < sizeof(*th)) {
|
|
|
a4b897 |
- fprintf(stderr, "SPDinfo: Wrong len %d\n", len);
|
|
|
a4b897 |
- return -1;
|
|
|
a4b897 |
- }
|
|
|
a4b897 |
- th = RTA_DATA(tb[XFRMA_SPD_IPV6_HTHRESH]);
|
|
|
a4b897 |
- fprintf(fp,"\t SPD IPv6 thresholds:");
|
|
|
a4b897 |
- fprintf(fp," local %d", th->lbits);
|
|
|
a4b897 |
- fprintf(fp," remote %d", th->rbits);
|
|
|
a4b897 |
- fprintf(fp, "%s", _SL_);
|
|
|
a4b897 |
}
|
|
|
a4b897 |
}
|
|
|
a4b897 |
-
|
|
|
a4b897 |
- if (oneline)
|
|
|
a4b897 |
- fprintf(fp, "\n");
|
|
|
a4b897 |
+ fprintf(fp,"\n");
|
|
|
a4b897 |
|
|
|
a4b897 |
return 0;
|
|
|
a4b897 |
}
|
|
|
a4b897 |
|
|
|
a4b897 |
-static int xfrm_spd_setinfo(int argc, char **argv)
|
|
|
a4b897 |
-{
|
|
|
a4b897 |
- struct rtnl_handle rth;
|
|
|
a4b897 |
- struct {
|
|
|
a4b897 |
- struct nlmsghdr n;
|
|
|
a4b897 |
- __u32 flags;
|
|
|
a4b897 |
- char buf[RTA_BUF_SIZE];
|
|
|
a4b897 |
- } req;
|
|
|
a4b897 |
-
|
|
|
a4b897 |
- char *thr4 = NULL;
|
|
|
a4b897 |
- char *thr6 = NULL;
|
|
|
a4b897 |
-
|
|
|
a4b897 |
- memset(&req, 0, sizeof(req));
|
|
|
a4b897 |
-
|
|
|
a4b897 |
- req.n.nlmsg_len = NLMSG_LENGTH(sizeof(__u32));
|
|
|
a4b897 |
- req.n.nlmsg_flags = NLM_F_REQUEST;
|
|
|
a4b897 |
- req.n.nlmsg_type = XFRM_MSG_NEWSPDINFO;
|
|
|
a4b897 |
- req.flags = 0XFFFFFFFF;
|
|
|
a4b897 |
-
|
|
|
a4b897 |
- while (argc > 0) {
|
|
|
a4b897 |
- if (strcmp(*argv, "hthresh4") == 0) {
|
|
|
a4b897 |
- struct xfrmu_spdhthresh thr;
|
|
|
a4b897 |
-
|
|
|
a4b897 |
- if (thr4)
|
|
|
a4b897 |
- duparg("hthresh4", *argv);
|
|
|
a4b897 |
- thr4 = *argv;
|
|
|
a4b897 |
- NEXT_ARG();
|
|
|
a4b897 |
- if (get_u8(&thr.lbits, *argv, 0) || thr.lbits > 32)
|
|
|
a4b897 |
- invarg("hthresh4 LBITS value is invalid", *argv);
|
|
|
a4b897 |
- NEXT_ARG();
|
|
|
a4b897 |
- if (get_u8(&thr.rbits, *argv, 0) || thr.rbits > 32)
|
|
|
a4b897 |
- invarg("hthresh4 RBITS value is invalid", *argv);
|
|
|
a4b897 |
-
|
|
|
a4b897 |
- addattr_l(&req.n, sizeof(req), XFRMA_SPD_IPV4_HTHRESH,
|
|
|
a4b897 |
- (void *)&thr, sizeof(thr));
|
|
|
a4b897 |
- } else if (strcmp(*argv, "hthresh6") == 0) {
|
|
|
a4b897 |
- struct xfrmu_spdhthresh thr;
|
|
|
a4b897 |
-
|
|
|
a4b897 |
- if (thr6)
|
|
|
a4b897 |
- duparg("hthresh6", *argv);
|
|
|
a4b897 |
- thr6 = *argv;
|
|
|
a4b897 |
- NEXT_ARG();
|
|
|
a4b897 |
- if (get_u8(&thr.lbits, *argv, 0) || thr.lbits > 128)
|
|
|
a4b897 |
- invarg("hthresh6 LBITS value is invalid", *argv);
|
|
|
a4b897 |
- NEXT_ARG();
|
|
|
a4b897 |
- if (get_u8(&thr.rbits, *argv, 0) || thr.rbits > 128)
|
|
|
a4b897 |
- invarg("hthresh6 RBITS value is invalid", *argv);
|
|
|
a4b897 |
-
|
|
|
a4b897 |
- addattr_l(&req.n, sizeof(req), XFRMA_SPD_IPV6_HTHRESH,
|
|
|
a4b897 |
- (void *)&thr, sizeof(thr));
|
|
|
a4b897 |
- } else {
|
|
|
a4b897 |
- invarg("unknown", *argv);
|
|
|
a4b897 |
- }
|
|
|
a4b897 |
-
|
|
|
a4b897 |
- argc--; argv++;
|
|
|
a4b897 |
- }
|
|
|
a4b897 |
-
|
|
|
a4b897 |
- if (rtnl_open_byproto(&rth, 0, NETLINK_XFRM) < 0)
|
|
|
a4b897 |
- exit(1);
|
|
|
a4b897 |
-
|
|
|
a4b897 |
- if (rtnl_talk(&rth, &req.n, 0, 0, NULL) < 0)
|
|
|
a4b897 |
- exit(2);
|
|
|
a4b897 |
-
|
|
|
a4b897 |
- rtnl_close(&rth);
|
|
|
a4b897 |
-
|
|
|
a4b897 |
- return 0;
|
|
|
a4b897 |
-}
|
|
|
a4b897 |
-
|
|
|
a4b897 |
static int xfrm_spd_getinfo(int argc, char **argv)
|
|
|
a4b897 |
{
|
|
|
a4b897 |
struct rtnl_handle rth;
|
|
|
a4b897 |
@@ -1156,8 +1059,6 @@ int do_xfrm_policy(int argc, char **argv)
|
|
|
a4b897 |
return xfrm_policy_flush(argc-1, argv+1);
|
|
|
a4b897 |
if (matches(*argv, "count") == 0)
|
|
|
a4b897 |
return xfrm_spd_getinfo(argc, argv);
|
|
|
a4b897 |
- if (matches(*argv, "set") == 0)
|
|
|
a4b897 |
- return xfrm_spd_setinfo(argc-1, argv+1);
|
|
|
a4b897 |
if (matches(*argv, "help") == 0)
|
|
|
a4b897 |
usage();
|
|
|
a4b897 |
fprintf(stderr, "Command \"%s\" is unknown, try \"ip xfrm policy help\".\n", *argv);
|
|
|
a4b897 |
diff --git a/man/man8/ip-xfrm.8 b/man/man8/ip-xfrm.8
|
|
|
a4b897 |
index aea4fda..3752c7e 100644
|
|
|
a4b897 |
--- a/man/man8/ip-xfrm.8
|
|
|
a4b897 |
+++ b/man/man8/ip-xfrm.8
|
|
|
a4b897 |
@@ -252,13 +252,6 @@ ip-xfrm \- transform configuration
|
|
|
a4b897 |
.B "ip xfrm policy count"
|
|
|
a4b897 |
|
|
|
a4b897 |
.ti -8
|
|
|
a4b897 |
-.B "ip xfrm policy set"
|
|
|
a4b897 |
-.RB "[ " hthresh4
|
|
|
a4b897 |
-.IR LBITS " " RBITS " ]"
|
|
|
a4b897 |
-.RB "[ " hthresh6
|
|
|
a4b897 |
-.IR LBITS " " RBITS " ]"
|
|
|
a4b897 |
-
|
|
|
a4b897 |
-.ti -8
|
|
|
a4b897 |
.IR SELECTOR " :="
|
|
|
a4b897 |
.RB "[ " src
|
|
|
a4b897 |
.IR ADDR "[/" PLEN "] ]"
|
|
|
a4b897 |
@@ -366,13 +359,6 @@ ip-xfrm \- transform configuration
|
|
|
a4b897 |
|
|
|
|
a4b897 |
.IR LISTofXFRM-OBJECTS " ]"
|
|
|
a4b897 |
|
|
|
a4b897 |
-.ti -8
|
|
|
a4b897 |
-.IR LISTofXFRM-OBJECTS " := [ " LISTofXFRM-OBJECTS " ] " XFRM-OBJECT
|
|
|
a4b897 |
-
|
|
|
a4b897 |
-.ti -8
|
|
|
a4b897 |
-.IR XFRM-OBJECT " := "
|
|
|
a4b897 |
-.BR acquire " | " expire " | " SA " | " policy " | " aevent " | " report
|
|
|
a4b897 |
-
|
|
|
a4b897 |
.in -8
|
|
|
a4b897 |
.ad b
|
|
|
a4b897 |
|
|
|
a4b897 |
@@ -398,6 +384,7 @@ ip xfrm state deleteall delete all existing state in xfrm
|
|
|
a4b897 |
ip xfrm state list print out the list of existing state in xfrm
|
|
|
a4b897 |
ip xfrm state flush flush all state in xfrm
|
|
|
a4b897 |
ip xfrm state count count all existing state in xfrm
|
|
|
a4b897 |
+ip xfrm monitor state monitoring for xfrm objects
|
|
|
a4b897 |
.TE
|
|
|
a4b897 |
|
|
|
a4b897 |
.TP
|
|
|
a4b897 |
@@ -519,9 +506,7 @@ encapsulates packets with protocol
|
|
|
a4b897 |
.BR espinudp " or " espinudp-nonike ","
|
|
|
a4b897 |
.RI "using source port " SPORT ", destination port " DPORT
|
|
|
a4b897 |
.RI ", and original address " OADDR "."
|
|
|
a4b897 |
-
|
|
|
a4b897 |
.sp
|
|
|
a4b897 |
-.PP
|
|
|
a4b897 |
.TS
|
|
|
a4b897 |
l l.
|
|
|
a4b897 |
ip xfrm policy add add a new policy
|
|
|
a4b897 |
@@ -531,6 +516,7 @@ ip xfrm policy get get an existing policy
|
|
|
a4b897 |
ip xfrm policy deleteall delete all existing xfrm policies
|
|
|
a4b897 |
ip xfrm policy list print out the list of xfrm policies
|
|
|
a4b897 |
ip xfrm policy flush flush policies
|
|
|
a4b897 |
+ip xfrm policy count count existing policies
|
|
|
a4b897 |
.TE
|
|
|
a4b897 |
|
|
|
a4b897 |
.TP
|
|
|
a4b897 |
@@ -625,47 +611,6 @@ and inbound trigger
|
|
|
a4b897 |
can be
|
|
|
a4b897 |
.BR required " (default) or " use "."
|
|
|
a4b897 |
|
|
|
a4b897 |
-.sp
|
|
|
a4b897 |
-.PP
|
|
|
a4b897 |
-.TS
|
|
|
a4b897 |
-l l.
|
|
|
a4b897 |
-ip xfrm policy count count existing policies
|
|
|
a4b897 |
-.TE
|
|
|
a4b897 |
-
|
|
|
a4b897 |
-.PP
|
|
|
a4b897 |
-Use one or more -s options to display more details, including policy hash table
|
|
|
a4b897 |
-information.
|
|
|
a4b897 |
-
|
|
|
a4b897 |
-.sp
|
|
|
a4b897 |
-.PP
|
|
|
a4b897 |
-.TS
|
|
|
a4b897 |
-l l.
|
|
|
a4b897 |
-ip xfrm policy set configure the policy hash table
|
|
|
a4b897 |
-.TE
|
|
|
a4b897 |
-
|
|
|
a4b897 |
-.PP
|
|
|
a4b897 |
-Security policies whose address prefix lengths are greater than or equal
|
|
|
a4b897 |
-policy hash table thresholds are hashed. Others are stored in the
|
|
|
a4b897 |
-policy_inexact chained list.
|
|
|
a4b897 |
-
|
|
|
a4b897 |
-.TP
|
|
|
a4b897 |
-.I LBITS
|
|
|
a4b897 |
-specifies the minimum local address prefix length of policies that are
|
|
|
a4b897 |
-stored in the Security Policy Database hash table.
|
|
|
a4b897 |
-
|
|
|
a4b897 |
-.TP
|
|
|
a4b897 |
-.I RBITS
|
|
|
a4b897 |
-specifies the minimum remote address prefix length of policies that are
|
|
|
a4b897 |
-stored in the Security Policy Database hash table.
|
|
|
a4b897 |
-
|
|
|
a4b897 |
-.sp
|
|
|
a4b897 |
-.PP
|
|
|
a4b897 |
-.TS
|
|
|
a4b897 |
-l l.
|
|
|
a4b897 |
-ip xfrm monitor state monitoring for xfrm objects
|
|
|
a4b897 |
-.TE
|
|
|
a4b897 |
-
|
|
|
a4b897 |
-.PP
|
|
|
a4b897 |
The xfrm objects to monitor can be optionally specified.
|
|
|
a4b897 |
|
|
|
a4b897 |
.P
|
|
|
a4b897 |
@@ -684,6 +629,4 @@ originates. Example:
|
|
|
a4b897 |
.SH AUTHOR
|
|
|
a4b897 |
Manpage revised by David Ward <david.ward@ll.mit.edu>
|
|
|
a4b897 |
.br
|
|
|
a4b897 |
-Manpage revised by Christophe Gouault <christophe.gouault@6wind.com>
|
|
|
a4b897 |
-.br
|
|
|
a4b897 |
Manpage revised by Nicolas Dichtel <nicolas.dichtel@6wind.com>
|
|
|
a4b897 |
--
|
|
|
a4b897 |
1.8.3.1
|
|
|
a4b897 |
|