@@ -895,8 +895,10 @@ void xfrm_xfrma_print(struct rtattr *tb[], __u16 family,
xuo = (struct xfrm_user_offload *)
RTA_DATA(tb[XFRMA_OFFLOAD_DEV]);
- fprintf(fp, "dev %s dir %s", ll_index_to_name(xuo->ifindex),
- (xuo->flags & XFRM_OFFLOAD_INBOUND) ? "in" : "out");
+ fprintf(fp, "dev %s dir %s mode %s",
+ ll_index_to_name(xuo->ifindex),
+ (xuo->flags & XFRM_OFFLOAD_INBOUND) ? "in" : "out",
+ (xuo->flags & XFRM_OFFLOAD_FULL) ? "full" : "crypto");
fprintf(fp, "%s", _SL_);
}
if (tb[XFRMA_IF_ID]) {
@@ -61,7 +61,7 @@ static void usage(void)
" [ replay-seq-hi SEQ ] [ replay-oseq-hi SEQ ]\n"
" [ flag FLAG-LIST ] [ sel SELECTOR ] [ LIMIT-LIST ] [ encap ENCAP ]\n"
" [ coa ADDR[/PLEN] ] [ ctx CTX ] [ extra-flag EXTRA-FLAG-LIST ]\n"
- " [ offload dev DEV dir DIR ]\n"
+ " [ offload [ crypto | full ] dev DEV dir DIR ]\n"
" [ output-mark OUTPUT-MARK [ mask MASK ] ]\n"
" [ if_id IF_ID ] [ tfcpad LENGTH ]\n"
"Usage: ip xfrm state allocspi ID [ mode MODE ] [ mark MARK [ mask MASK ] ]\n"
@@ -312,7 +312,7 @@ static int xfrm_state_modify(int cmd, unsigned int flags, int argc, char **argv)
struct xfrm_user_offload xuo = {};
unsigned int ifindex = 0;
__u8 dir = 0;
- bool is_offload = false;
+ bool is_offload = false, is_full_offload = false;
__u32 replay_window = 0;
__u32 seq = 0, oseq = 0, seq_hi = 0, oseq_hi = 0;
char *idp = NULL;
@@ -430,6 +430,16 @@ static int xfrm_state_modify(int cmd, unsigned int flags, int argc, char **argv)
(void *)&ctx, ctx.sctx.len);
} else if (strcmp(*argv, "offload") == 0) {
NEXT_ARG();
+ /* If user doesn't provide offload mode, treat it as
+ * crypto one for the backward compatibility.
+ */
+ if (strcmp(*argv, "crypto") == 0)
+ NEXT_ARG();
+ else if (strcmp(*argv, "full") == 0) {
+ is_full_offload = true;
+ NEXT_ARG();
+ }
+
if (strcmp(*argv, "dev") == 0) {
NEXT_ARG();
ifindex = ll_name_to_index(*argv);
@@ -613,6 +623,8 @@ static int xfrm_state_modify(int cmd, unsigned int flags, int argc, char **argv)
if (is_offload) {
xuo.ifindex = ifindex;
xuo.flags = dir;
+ if (is_full_offload)
+ xuo.flags |= XFRM_OFFLOAD_FULL;
addattr_l(&req.n, sizeof(req.buf), XFRMA_OFFLOAD_DEV, &xuo,
sizeof(xuo));
}
@@ -66,6 +66,7 @@ ip-xfrm \- transform configuration
.RB "[ " if_id
.IR IF-ID " ]"
.RB "[ " offload
+.RB "[ " crypto | full " ]"
.RB dev
.IR DEV "
.RB dir