From patchwork Fri Aug 9 13:14:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Iurman X-Patchwork-Id: 13758807 X-Patchwork-Delegate: dsahern@gmail.com Received: from serv108.segi.ulg.ac.be (serv108.segi.ulg.ac.be [139.165.32.111]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1DB90194AFB for ; Fri, 9 Aug 2024 13:14:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=139.165.32.111 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723209272; cv=none; b=i6yzOo7YkLyNBZMSSnj6/FnX8OheIgp44RdHTUnJiGiE6x8dY9Fpl3RXKlUnJq4RPsoGzs/ZPZ7cGaCv7mvAZgIoJtWZkaQmskGoI6WPlMXYtb9IfM+DvgsMfFE1vd6lvDk5O5HSEt7sfAuByyJzZJbgIqg4oVADKqqz0HWAfp0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723209272; c=relaxed/simple; bh=erw+R1kjKGRctwnn9LXAlr8JVA/jIKECrm2CKtmOylk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=RkAD3IkBvoe+1fxtJBVSXiOYmIeBsFF20fkSFly/Ok22HajbT4LjPfqWwlJyt/5uGOpVW0TOfxTeeaYXTtsowErmNvOYO4zlFLaaOrAmhwsj7WVG+NF8XeC3RzG6oYPjavo2Kj1vGyle3x6oQoWGGJ/HJbt+feqvb+22lMo0QQs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=uliege.be; spf=pass smtp.mailfrom=uliege.be; dkim=pass (2048-bit key) header.d=uliege.be header.i=@uliege.be header.b=VyAqTc8g; arc=none smtp.client-ip=139.165.32.111 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=uliege.be Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=uliege.be Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=uliege.be header.i=@uliege.be header.b="VyAqTc8g" Received: from localhost.localdomain (220.24-245-81.adsl-dyn.isp.belgacom.be [81.245.24.220]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by serv108.segi.ulg.ac.be (Postfix) with ESMTPSA id 95522200CCEF; Fri, 9 Aug 2024 15:14:28 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 serv108.segi.ulg.ac.be 95522200CCEF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uliege.be; s=ulg20190529; t=1723209268; bh=y7ZVPN/EWbg8gF97pR4EKPOTDgcM0wlrD0hT+SU+x/E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VyAqTc8gSOq23dTKJqVXQAz1XW2YWmRszasjzfc2v0iFHtPLpyUVkhDIafcJZfymB oT4VLUPDc4koF1dXSbji84rpT9HyzqrETRn+Moa4i4R0dv/0VBmxhr6zLiZXNAzzyA /JaNZO6oV7tiklkJKmGhuAXlBL3SRnbt6cZ9tjbJqvILBv+6UDVe2rUyLOkHhkCvLO 43PbbEAZ1+u0oBtexrwnUqTwNZ6BS3Q1hVDOOw/gW9dDDG8PU8mQj0Re7Jl2p6jSzH i93ce5U0UxzW3nnl4xGMo1N9RgSJiTogFFtXvUzzxxTeEE3Gq2al0YmIf3JiAL9mCj GOXJXMWP59srA== From: Justin Iurman To: netdev@vger.kernel.org Cc: dsahern@kernel.org, justin.iurman@uliege.be Subject: [PATCH iproute2-next 1/3] uapi: tunsrc support Date: Fri, 9 Aug 2024 15:14:17 +0200 Message-Id: <20240809131419.30732-2-justin.iurman@uliege.be> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240809131419.30732-1-justin.iurman@uliege.be> References: <20240809131419.30732-1-justin.iurman@uliege.be> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: dsahern@gmail.com Add support for "tunsrc" in the api. Note: either include this commit or pull uapi from net-next. Signed-off-by: Justin Iurman --- include/uapi/linux/ioam6_iptunnel.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/uapi/linux/ioam6_iptunnel.h b/include/uapi/linux/ioam6_iptunnel.h index 750357b7..9c6171ea 100644 --- a/include/uapi/linux/ioam6_iptunnel.h +++ b/include/uapi/linux/ioam6_iptunnel.h @@ -50,6 +50,13 @@ enum { IOAM6_IPTUNNEL_FREQ_K, /* u32 */ IOAM6_IPTUNNEL_FREQ_N, /* u32 */ + /* Tunnel src address. + * For encap,auto modes. + * Optional (automatic if + * not provided). + */ + IOAM6_IPTUNNEL_SRC, /* struct in6_addr */ + __IOAM6_IPTUNNEL_MAX, }; From patchwork Fri Aug 9 13:14:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Iurman X-Patchwork-Id: 13758809 X-Patchwork-Delegate: dsahern@gmail.com Received: from serv108.segi.ulg.ac.be (serv108.segi.ulg.ac.be [139.165.32.111]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5D0E3194C62 for ; Fri, 9 Aug 2024 13:14:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=139.165.32.111 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723209272; cv=none; b=YYSWxn+0Xtg5l2ZdgPgAUh1dGpE4qz+3vQV8xVRqAM0JhQ1keXAWeo9muNGpZdVyVJ6BtSFumsAhLXc6/ibU1NERdU6WO3Pg/qhoLtd77CWxPrHDBsUYFf7XFvSWOVlhrnhs/Yh8KGJf9UY7RjV6K3Fi2sdiqxgCHzQRLeciXn8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723209272; c=relaxed/simple; bh=FXgm0jPdjRz5aJthT2/oXv7RKfTjgUJFtusz6JcOeGQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=S8StO0g9sY1wrgEg1DVl1VnfMyVVMiKL/lUiu+VKkaKgVFMy5gTj6uzOzsFN47fF3V/LGCDbSbJk1961Ejz5KEE8aJ57IhcnTDCJJNI3J8FUhsh9Rvzf0M/OCgJP8rFqpTMvdIrWBEfAEDcsjkfQ9ZoVhYumpKcI6Oe98KEe5yY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=uliege.be; spf=pass smtp.mailfrom=uliege.be; dkim=pass (2048-bit key) header.d=uliege.be header.i=@uliege.be header.b=uGkrEs2f; arc=none smtp.client-ip=139.165.32.111 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=uliege.be Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=uliege.be Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=uliege.be header.i=@uliege.be header.b="uGkrEs2f" Received: from localhost.localdomain (220.24-245-81.adsl-dyn.isp.belgacom.be [81.245.24.220]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by serv108.segi.ulg.ac.be (Postfix) with ESMTPSA id B29AB200CCF0; Fri, 9 Aug 2024 15:14:28 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 serv108.segi.ulg.ac.be B29AB200CCF0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uliege.be; s=ulg20190529; t=1723209268; bh=fREqxI9gSJIBGlM4uJEIlKc0lTk8GAJP0kbkGkjfLf4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uGkrEs2fCriqMGN388aQK5NLfl8DPYwZ7c8UQHg7jVnJamZBF+5kNJYY/2vuVWhfc Jqh19koTUR6Ok/PxtXw7TGo6lnppTIjOX4JA4WhF+Yf/Ng79juz2tnH1/l/n8VMC6e l9HX5ss4rFWyE8L4p35eEKsxNtJLK8serQEAl58Nw7om2r/dQWK4loperhG+pi4rAh 7nbZ3qMj4FaNxp0TXqINwjMBpcOTL3qiVN6DjNR1nN0gV1TbyG4HkZduWEnf3iMiD9 6eg3C1EElPIElM1yWD+Aa/wBUcORhRKmtjkZUtOyST6g/7B5/gsyKRhfHIeggbsdSV 8bVThBo6OADkg== From: Justin Iurman To: netdev@vger.kernel.org Cc: dsahern@kernel.org, justin.iurman@uliege.be Subject: [PATCH iproute2-next 2/3] ip: lwtunnel: tunsrc support Date: Fri, 9 Aug 2024 15:14:18 +0200 Message-Id: <20240809131419.30732-3-justin.iurman@uliege.be> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240809131419.30732-1-justin.iurman@uliege.be> References: <20240809131419.30732-1-justin.iurman@uliege.be> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: dsahern@gmail.com Add support for setting/getting the new "tunsrc" feature. Signed-off-by: Justin Iurman --- ip/iproute_lwtunnel.c | 40 ++++++++++++++++++++++++++++++++++------ 1 file changed, 34 insertions(+), 6 deletions(-) diff --git a/ip/iproute_lwtunnel.c b/ip/iproute_lwtunnel.c index b4df4348..009045cb 100644 --- a/ip/iproute_lwtunnel.c +++ b/ip/iproute_lwtunnel.c @@ -352,14 +352,22 @@ static void print_encap_ioam6(FILE *fp, struct rtattr *encap) print_uint(PRINT_ANY, "freqn", "/%u ", freq_n); mode = rta_getattr_u8(tb[IOAM6_IPTUNNEL_MODE]); - if (!tb[IOAM6_IPTUNNEL_DST] && mode != IOAM6_IPTUNNEL_MODE_INLINE) + if ((tb[IOAM6_IPTUNNEL_SRC] && mode == IOAM6_IPTUNNEL_MODE_INLINE) || + (!tb[IOAM6_IPTUNNEL_DST] && mode != IOAM6_IPTUNNEL_MODE_INLINE)) return; print_string(PRINT_ANY, "mode", "mode %s ", format_ioam6mode_type(mode)); - if (mode != IOAM6_IPTUNNEL_MODE_INLINE) + if (mode != IOAM6_IPTUNNEL_MODE_INLINE) { + if (tb[IOAM6_IPTUNNEL_SRC]) { + print_string(PRINT_ANY, "tunsrc", "tunsrc %s ", + rt_addr_n2a_rta(AF_INET6, + tb[IOAM6_IPTUNNEL_SRC])); + } + print_string(PRINT_ANY, "tundst", "tundst %s ", rt_addr_n2a_rta(AF_INET6, tb[IOAM6_IPTUNNEL_DST])); + } trace = RTA_DATA(tb[IOAM6_IPTUNNEL_TRACE]); @@ -1111,11 +1119,12 @@ static int parse_encap_ioam6(struct rtattr *rta, size_t len, int *argcp, int ns_found = 0, argc = *argcp; __u16 trace_ns, trace_size = 0; struct ioam6_trace_hdr *trace; + inet_prefix saddr, daddr; char **argv = *argvp; __u32 trace_type = 0; __u32 freq_k, freq_n; char buf[16] = {0}; - inet_prefix addr; + bool has_src; __u8 mode; if (strcmp(*argv, "freq") != 0) { @@ -1158,6 +1167,23 @@ static int parse_encap_ioam6(struct rtattr *rta, size_t len, int *argcp, NEXT_ARG(); } + if (strcmp(*argv, "tunsrc") != 0) { + has_src = false; + } else { + has_src = true; + + if (mode == IOAM6_IPTUNNEL_MODE_INLINE) + invarg("Inline mode does not need tunsrc", *argv); + + NEXT_ARG(); + + get_addr(&saddr, *argv, AF_INET6); + if (saddr.family != AF_INET6 || saddr.bytelen != 16) + invarg("Invalid IPv6 address for tunsrc", *argv); + + NEXT_ARG(); + } + if (strcmp(*argv, "tundst") != 0) { if (mode != IOAM6_IPTUNNEL_MODE_INLINE) missarg("tundst"); @@ -1167,8 +1193,8 @@ static int parse_encap_ioam6(struct rtattr *rta, size_t len, int *argcp, NEXT_ARG(); - get_addr(&addr, *argv, AF_INET6); - if (addr.family != AF_INET6 || addr.bytelen != 16) + get_addr(&daddr, *argv, AF_INET6); + if (daddr.family != AF_INET6 || daddr.bytelen != 16) invarg("Invalid IPv6 address for tundst", *argv); NEXT_ARG(); @@ -1239,8 +1265,10 @@ static int parse_encap_ioam6(struct rtattr *rta, size_t len, int *argcp, if (rta_addattr32(rta, len, IOAM6_IPTUNNEL_FREQ_K, freq_k) || rta_addattr32(rta, len, IOAM6_IPTUNNEL_FREQ_N, freq_n) || rta_addattr8(rta, len, IOAM6_IPTUNNEL_MODE, mode) || + (mode != IOAM6_IPTUNNEL_MODE_INLINE && has_src && + rta_addattr_l(rta, len, IOAM6_IPTUNNEL_SRC, &saddr.data, saddr.bytelen)) || (mode != IOAM6_IPTUNNEL_MODE_INLINE && - rta_addattr_l(rta, len, IOAM6_IPTUNNEL_DST, &addr.data, addr.bytelen)) || + rta_addattr_l(rta, len, IOAM6_IPTUNNEL_DST, &daddr.data, daddr.bytelen)) || rta_addattr_l(rta, len, IOAM6_IPTUNNEL_TRACE, trace, sizeof(*trace))) { free(trace); return -1; From patchwork Fri Aug 9 13:14:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Iurman X-Patchwork-Id: 13758808 X-Patchwork-Delegate: dsahern@gmail.com Received: from serv108.segi.ulg.ac.be (serv108.segi.ulg.ac.be [139.165.32.111]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5D1A6194C75 for ; Fri, 9 Aug 2024 13:14:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=139.165.32.111 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723209272; cv=none; b=LOjZYl3kSYGVSMFXteatkd7NWJVsH62b52PWr3EqvcYswlOmDqP3dtVuqLb/L/xe3JwL+lyRcY6AwamW6Q3dUclZas+TM7NSG+2cTtUpsU/ag2WWYWV8ASeqYOBDfLHoOhlADxc8IcccPXxGeY2cfDtQdWYHtDRNnlTqNWj5kbM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723209272; c=relaxed/simple; bh=bEolJSCCdLQnijiAHENGikR4W9YgQCYail9qjfENyV0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=e408j5ceCtaXtwTpjrQJH6glFN0OZ/31ttiWZ5VUU7IObyTB1Gp/NTSz1r6dQYmktc5gre2wD4xK2RrESGhGR0JZiKrEs8Biy0iSPff7MQrgTkw6ob1M0qZdonJhAN9oh3Mgl6uLrBDbgr8mFx/6gAqQfgeTfvLbUnnWsoJNfmY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=uliege.be; spf=pass smtp.mailfrom=uliege.be; dkim=pass (2048-bit key) header.d=uliege.be header.i=@uliege.be header.b=Fw/ltevn; arc=none smtp.client-ip=139.165.32.111 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=uliege.be Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=uliege.be Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=uliege.be header.i=@uliege.be header.b="Fw/ltevn" Received: from localhost.localdomain (220.24-245-81.adsl-dyn.isp.belgacom.be [81.245.24.220]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by serv108.segi.ulg.ac.be (Postfix) with ESMTPSA id CFB55200CCF2; Fri, 9 Aug 2024 15:14:28 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 serv108.segi.ulg.ac.be CFB55200CCF2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uliege.be; s=ulg20190529; t=1723209268; bh=nJUAxlFWAHHNJToyYWUBw0GVs/2O/iv+y4XtUkvqwKQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Fw/ltevn1xggvmQJgWQo0gD5ypUUR5TRTGeqkObPcALDRNS0xfbG0AdQ1SY1E4if4 u/eLkyzMtukBYLxSAiNwZEgTz+PgseTGj5hPjlouF+u3F9qs4jQHzkqZHSFS7RIIZO iZFVZpoOsFVFFC+HCNDldo7wsrBCc1Y22z+H5ApjTDFRo1G3ybNvFyEElC0Pr7vE62 VpqP5e2weaEHrHQ+qi7xzWn0oEKleCeYNiqAVyNq116qPKxjXIlHtIk0ZE7rfmB82D qC+AG3rQMgBgYqd61aqcutr/VoEbWfv6pL1E0S9FSj2buSLUz8wngpMMH8EKhJ+TkX yPUQtwqnkjOjg== From: Justin Iurman To: netdev@vger.kernel.org Cc: dsahern@kernel.org, justin.iurman@uliege.be Subject: [PATCH iproute2-next 3/3] man8: ip-route: update documentation Date: Fri, 9 Aug 2024 15:14:19 +0200 Message-Id: <20240809131419.30732-4-justin.iurman@uliege.be> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240809131419.30732-1-justin.iurman@uliege.be> References: <20240809131419.30732-1-justin.iurman@uliege.be> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: dsahern@gmail.com Include "tunsrc" in the man page. Signed-off-by: Justin Iurman --- man/man8/ip-route.8.in | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/man/man8/ip-route.8.in b/man/man8/ip-route.8.in index df49f8b0..676f289a 100644 --- a/man/man8/ip-route.8.in +++ b/man/man8/ip-route.8.in @@ -253,6 +253,8 @@ throw " | " unreachable " | " prohibit " | " blackhole " | " nat " ]" .IR K "/" N " ] " .BR mode " [ " .BR inline " | " encap " | " auto " ] [" +.B tunsrc +.IR ADDRESS " ] [" .B tundst .IR ADDRESS " ] " .B trace @@ -1037,6 +1039,12 @@ divisible by 8. This attribute can be used only with NEXT-C-SID flavor. packets. .sp +.B tunsrc +.I ADDRESS +- IPv6 address of the tunnel source (outer header), not used with inline mode. +It is optional: if not provided, the tunnel source address is chosen +automatically. + .B tundst .I ADDRESS - IPv6 address of the tunnel destination (outer header), not used with inline