get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/1148471/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 1148471,
    "url": "http://patchwork.ozlabs.org/api/patches/1148471/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/1565992424-22379-2-git-send-email-tom@herbertland.com/",
    "project": {
        "id": 46,
        "url": "http://patchwork.ozlabs.org/api/projects/46/?format=api",
        "name": "Intel Wired Ethernet development",
        "link_name": "intel-wired-lan",
        "list_id": "intel-wired-lan.osuosl.org",
        "list_email": "intel-wired-lan@osuosl.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<1565992424-22379-2-git-send-email-tom@herbertland.com>",
    "list_archive_url": null,
    "date": "2019-08-16T21:53:38",
    "name": "[v2,net-next,1/7] ipeh: Create exthdrs_options.c and ipeh.h",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "064eb18210e150ea37e592c775879fdd741406c7",
    "submitter": {
        "id": 65986,
        "url": "http://patchwork.ozlabs.org/api/people/65986/?format=api",
        "name": "Tom Herbert",
        "email": "tom@herbertland.com"
    },
    "delegate": {
        "id": 68,
        "url": "http://patchwork.ozlabs.org/api/users/68/?format=api",
        "username": "jtkirshe",
        "first_name": "Jeff",
        "last_name": "Kirsher",
        "email": "jeffrey.t.kirsher@intel.com"
    },
    "mbox": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/1565992424-22379-2-git-send-email-tom@herbertland.com/mbox/",
    "series": [
        {
            "id": 125682,
            "url": "http://patchwork.ozlabs.org/api/series/125682/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=125682",
            "date": "2019-08-16T21:53:37",
            "name": "ipv6: Extension header infrastructure",
            "version": 2,
            "mbox": "http://patchwork.ozlabs.org/series/125682/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/1148471/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/1148471/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<intel-wired-lan-bounces@osuosl.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "Intel-wired-lan@lists.osuosl.org"
        ],
        "Delivered-To": [
            "patchwork-incoming@bilbo.ozlabs.org",
            "Intel-wired-lan@lists.osuosl.org"
        ],
        "Authentication-Results": [
            "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=osuosl.org\n\t(client-ip=140.211.166.136; helo=silver.osuosl.org;\n\tenvelope-from=intel-wired-lan-bounces@osuosl.org;\n\treceiver=<UNKNOWN>)",
            "ozlabs.org; dmarc=none (p=none dis=none)\n\theader.from=herbertland.com",
            "ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=herbertland-com.20150623.gappssmtp.com\n\theader.i=@herbertland-com.20150623.gappssmtp.com\n\theader.b=\"yYHADRry\"; dkim-atps=neutral"
        ],
        "Received": [
            "from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 469HCj3K1kz9sML\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat, 17 Aug 2019 07:54:24 +1000 (AEST)",
            "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id 23FBE207A1;\n\tFri, 16 Aug 2019 21:54:22 +0000 (UTC)",
            "from silver.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id 6QvGAxcRTvUh; Fri, 16 Aug 2019 21:54:15 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby silver.osuosl.org (Postfix) with ESMTP id C6DEB20656;\n\tFri, 16 Aug 2019 21:54:15 +0000 (UTC)",
            "from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\n\tby ash.osuosl.org (Postfix) with ESMTP id 3B3591BF35B\n\tfor <Intel-wired-lan@lists.osuosl.org>;\n\tFri, 16 Aug 2019 21:54:08 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 3677F85BBA\n\tfor <Intel-wired-lan@lists.osuosl.org>;\n\tFri, 16 Aug 2019 21:54:08 +0000 (UTC)",
            "from whitealder.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id zNThqXAOGvG9 for <Intel-wired-lan@lists.osuosl.org>;\n\tFri, 16 Aug 2019 21:54:06 +0000 (UTC)",
            "from mail-pl1-f194.google.com (mail-pl1-f194.google.com\n\t[209.85.214.194])\n\tby whitealder.osuosl.org (Postfix) with ESMTPS id D9D0C8589A\n\tfor <Intel-wired-lan@lists.osuosl.org>;\n\tFri, 16 Aug 2019 21:54:06 +0000 (UTC)",
            "by mail-pl1-f194.google.com with SMTP id m9so2949970pls.8\n\tfor <Intel-wired-lan@lists.osuosl.org>;\n\tFri, 16 Aug 2019 14:54:06 -0700 (PDT)",
            "from localhost.localdomain (c-73-202-182-113.hsd1.ca.comcast.net.\n\t[73.202.182.113]) by smtp.gmail.com with ESMTPSA id\n\tr12sm7151355pgb.73.2019.08.16.14.54.04\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tFri, 16 Aug 2019 14:54:05 -0700 (PDT)"
        ],
        "X-Virus-Scanned": [
            "amavisd-new at osuosl.org",
            "amavisd-new at osuosl.org"
        ],
        "X-Greylist": "from auto-whitelisted by SQLgrey-1.7.6",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=herbertland-com.20150623.gappssmtp.com; s=20150623;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=J2awf6DxfAPRYmNb4uTZLyy9ofd79PjGQpLr7Z4iRJw=;\n\tb=yYHADRryEFRlg+rwawlHFy4qU++/XgiRJKXr26AQVBzGYHy+FaSJwbKFywuWQdwzIT\n\tjkOPJ+D6oG8Ef7ZfeNqucBKpna/TqRiwUmP2jKq+9B82hERILYoqmLcMCQRYJRzqvQlT\n\taAo+Uob0BFe6uursDLHGAE2FlhPMx6s0GuDEnST0oOzbDLX6f6Rdqg5cgNqGNFuX8xRE\n\tN3VFRJJ9JZt48qij6ym7pH9Kh5cAet8xJ5650daxOzJmZejJN7onyCz/tZsR9Ho13Syr\n\tN1XAOlqMnicRSW/dGy+aKApSQITuvEYMi/EIQyp2EDA16EdpU3pVOcxaGm7hgmUV7WA4\n\tshFA==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=J2awf6DxfAPRYmNb4uTZLyy9ofd79PjGQpLr7Z4iRJw=;\n\tb=XRsSJVNVgRrXvKrI6JsqWxFszVIXK31HSEKRgzemODwobtHKmSXlLHRbRFwna5vPqd\n\t7Da3+Egn8YIKDmeq+uv2h7j9hw6QMV/nX3wmuNIMqx1klrkWLA2VK4AH9eSHuMSTldcj\n\tzC3H/yIdZp6XJFVx1fw3KEP0D1Fx90Z7o/jgPzmZJ0ATQaXgFqFojVntEZQdC0mLc5yE\n\tGtm6qmfbT2MXY/CM1iiV+FeXiVfEtcs2Tb4mZ0TG/Im5Fb2a7OJtzRrbGsgl29Jcka0n\n\ta5NzUq7jNXLibivfh2upF8Jw1CiuViD0P3pHXn/m5gy5/eODW2DI8dDlnmqs4Aor3k/S\n\tmOFQ==",
        "X-Gm-Message-State": "APjAAAXCUaHq5Gy+A9vaWS46Qi+zBo3w0L4LwPisaK6mSKY3U3UobaiJ\n\tb9b3PS5kCo1P4/xOM9+vAaDyluY/x5o=",
        "X-Google-Smtp-Source": "APXvYqwsRVTZAYi762zMvUBmsKX0E9pTzQw++uNupzSgFR458dODsSWEk89gUk/5n9uk9SHmNFfIiA==",
        "X-Received": "by 2002:a17:902:684f:: with SMTP id\n\tf15mr11393503pln.332.1565992445819; \n\tFri, 16 Aug 2019 14:54:05 -0700 (PDT)",
        "From": "Tom Herbert <tom@herbertland.com>",
        "To": "Intel-wired-lan@lists.osuosl.org",
        "Date": "Fri, 16 Aug 2019 14:53:38 -0700",
        "Message-Id": "<1565992424-22379-2-git-send-email-tom@herbertland.com>",
        "X-Mailer": "git-send-email 2.7.4",
        "In-Reply-To": "<1565992424-22379-1-git-send-email-tom@herbertland.com>",
        "References": "<1565992424-22379-1-git-send-email-tom@herbertland.com>",
        "Subject": "[Intel-wired-lan] [PATCH v2 net-next 1/7] ipeh: Create\n\texthdrs_options.c and ipeh.h",
        "X-BeenThere": "intel-wired-lan@osuosl.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "Intel Wired Ethernet Linux Kernel Driver Development\n\t<intel-wired-lan.osuosl.org>",
        "List-Unsubscribe": "<https://lists.osuosl.org/mailman/options/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@osuosl.org?subject=unsubscribe>",
        "List-Archive": "<http://lists.osuosl.org/pipermail/intel-wired-lan/>",
        "List-Post": "<mailto:intel-wired-lan@osuosl.org>",
        "List-Help": "<mailto:intel-wired-lan-request@osuosl.org?subject=help>",
        "List-Subscribe": "<https://lists.osuosl.org/mailman/listinfo/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@osuosl.org?subject=subscribe>",
        "Cc": "Tom Herbert <tom@herbertland.com>, Tom Herbert <tom@quantonium.net>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Errors-To": "intel-wired-lan-bounces@osuosl.org",
        "Sender": "\"Intel-wired-lan\" <intel-wired-lan-bounces@osuosl.org>"
    },
    "content": "From: Tom Herbert <tom@quantonium.net>\n\nCreate exthdrs_options.c to hold code related to specific Hop-by-Hop\nand Destination extension header options. Move related functions in\nexthdrs.c to the new file.\n\nCreate include net/ipeh.h to contain common definitions for IP extension\nheaders.\n\nSigned-off-by: Tom Herbert <tom@quantonium.net>\nSigned-off-by: Tom Herbert <tom@herbertland.com>\n---\n include/net/ipeh.h         |  22 +++++\n include/net/ipv6.h         |   1 +\n net/ipv6/Makefile          |   2 +-\n net/ipv6/exthdrs.c         | 204 ---------------------------------------------\n net/ipv6/exthdrs_options.c | 201 ++++++++++++++++++++++++++++++++++++++++++++\n 5 files changed, 225 insertions(+), 205 deletions(-)\n create mode 100644 include/net/ipeh.h\n create mode 100644 net/ipv6/exthdrs_options.c",
    "diff": "diff --git a/include/net/ipeh.h b/include/net/ipeh.h\nnew file mode 100644\nindex 0000000..ec2d186\n--- /dev/null\n+++ b/include/net/ipeh.h\n@@ -0,0 +1,22 @@\n+/* SPDX-License-Identifier: GPL-2.0 */\n+#ifndef _NET_IPEH_H\n+#define _NET_IPEH_H\n+\n+#include <linux/skbuff.h>\n+\n+/*\n+ *     Parsing tlv encoded headers.\n+ *\n+ *     Parsing function \"func\" returns true, if parsing succeed\n+ *     and false, if it failed.\n+ *     It MUST NOT touch skb->h.\n+ */\n+struct tlvtype_proc {\n+\tint\ttype;\n+\tbool\t(*func)(struct sk_buff *skb, int offset);\n+};\n+\n+extern const struct tlvtype_proc tlvprocdestopt_lst[];\n+extern const struct tlvtype_proc tlvprochopopt_lst[];\n+\n+#endif /* _NET_IPEH_H */\ndiff --git a/include/net/ipv6.h b/include/net/ipv6.h\nindex 8dfc656..ec10fca 100644\n--- a/include/net/ipv6.h\n+++ b/include/net/ipv6.h\n@@ -20,6 +20,7 @@\n #include <net/flow_dissector.h>\n #include <net/snmp.h>\n #include <net/netns/hash.h>\n+#include <net/ipeh.h>\n \n #define SIN6_LEN_RFC2133\t24\n \ndiff --git a/net/ipv6/Makefile b/net/ipv6/Makefile\nindex 8ccf355..df3919b 100644\n--- a/net/ipv6/Makefile\n+++ b/net/ipv6/Makefile\n@@ -10,7 +10,7 @@ ipv6-objs :=\taf_inet6.o anycast.o ip6_output.o ip6_input.o addrconf.o \\\n \t\troute.o ip6_fib.o ipv6_sockglue.o ndisc.o udp.o udplite.o \\\n \t\traw.o icmp.o mcast.o reassembly.o tcp_ipv6.o ping.o \\\n \t\texthdrs.o datagram.o ip6_flowlabel.o inet6_connection_sock.o \\\n-\t\tudp_offload.o seg6.o fib6_notifier.o\n+\t\tudp_offload.o seg6.o fib6_notifier.o exthdrs_options.o\n \n ipv6-offload :=\tip6_offload.o tcpv6_offload.o exthdrs_offload.o\n \ndiff --git a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c\nindex ab5add0..664491e 100644\n--- a/net/ipv6/exthdrs.c\n+++ b/net/ipv6/exthdrs.c\n@@ -39,7 +39,6 @@\n #include <net/ndisc.h>\n #include <net/ip6_route.h>\n #include <net/addrconf.h>\n-#include <net/calipso.h>\n #if IS_ENABLED(CONFIG_IPV6_MIP6)\n #include <net/xfrm.h>\n #endif\n@@ -51,19 +50,6 @@\n \n #include <linux/uaccess.h>\n \n-/*\n- *\tParsing tlv encoded headers.\n- *\n- *\tParsing function \"func\" returns true, if parsing succeed\n- *\tand false, if it failed.\n- *\tIt MUST NOT touch skb->h.\n- */\n-\n-struct tlvtype_proc {\n-\tint\ttype;\n-\tbool\t(*func)(struct sk_buff *skb, int offset);\n-};\n-\n /*********************\n   Generic functions\n  *********************/\n@@ -200,80 +186,6 @@ static bool ip6_parse_tlv(const struct tlvtype_proc *procs,\n \treturn false;\n }\n \n-/*****************************\n-  Destination options header.\n- *****************************/\n-\n-#if IS_ENABLED(CONFIG_IPV6_MIP6)\n-static bool ipv6_dest_hao(struct sk_buff *skb, int optoff)\n-{\n-\tstruct ipv6_destopt_hao *hao;\n-\tstruct inet6_skb_parm *opt = IP6CB(skb);\n-\tstruct ipv6hdr *ipv6h = ipv6_hdr(skb);\n-\tint ret;\n-\n-\tif (opt->dsthao) {\n-\t\tnet_dbg_ratelimited(\"hao duplicated\\n\");\n-\t\tgoto discard;\n-\t}\n-\topt->dsthao = opt->dst1;\n-\topt->dst1 = 0;\n-\n-\thao = (struct ipv6_destopt_hao *)(skb_network_header(skb) + optoff);\n-\n-\tif (hao->length != 16) {\n-\t\tnet_dbg_ratelimited(\"hao invalid option length = %d\\n\",\n-\t\t\t\t    hao->length);\n-\t\tgoto discard;\n-\t}\n-\n-\tif (!(ipv6_addr_type(&hao->addr) & IPV6_ADDR_UNICAST)) {\n-\t\tnet_dbg_ratelimited(\"hao is not an unicast addr: %pI6\\n\",\n-\t\t\t\t    &hao->addr);\n-\t\tgoto discard;\n-\t}\n-\n-\tret = xfrm6_input_addr(skb, (xfrm_address_t *)&ipv6h->daddr,\n-\t\t\t       (xfrm_address_t *)&hao->addr, IPPROTO_DSTOPTS);\n-\tif (unlikely(ret < 0))\n-\t\tgoto discard;\n-\n-\tif (skb_cloned(skb)) {\n-\t\tif (pskb_expand_head(skb, 0, 0, GFP_ATOMIC))\n-\t\t\tgoto discard;\n-\n-\t\t/* update all variable using below by copied skbuff */\n-\t\thao = (struct ipv6_destopt_hao *)(skb_network_header(skb) +\n-\t\t\t\t\t\t  optoff);\n-\t\tipv6h = ipv6_hdr(skb);\n-\t}\n-\n-\tif (skb->ip_summed == CHECKSUM_COMPLETE)\n-\t\tskb->ip_summed = CHECKSUM_NONE;\n-\n-\tswap(ipv6h->saddr, hao->addr);\n-\n-\tif (skb->tstamp == 0)\n-\t\t__net_timestamp(skb);\n-\n-\treturn true;\n-\n- discard:\n-\tkfree_skb(skb);\n-\treturn false;\n-}\n-#endif\n-\n-static const struct tlvtype_proc tlvprocdestopt_lst[] = {\n-#if IS_ENABLED(CONFIG_IPV6_MIP6)\n-\t{\n-\t\t.type\t= IPV6_TLV_HAO,\n-\t\t.func\t= ipv6_dest_hao,\n-\t},\n-#endif\n-\t{-1,\t\t\tNULL}\n-};\n-\n static int ipv6_destopt_rcv(struct sk_buff *skb)\n {\n \tstruct inet6_dev *idev = __in6_dev_get(skb->dev);\n@@ -702,122 +614,6 @@ void ipv6_exthdrs_exit(void)\n \tinet6_del_protocol(&rthdr_protocol, IPPROTO_ROUTING);\n }\n \n-/**********************************\n-  Hop-by-hop options.\n- **********************************/\n-\n-/*\n- * Note: we cannot rely on skb_dst(skb) before we assign it in ip6_route_input().\n- */\n-static inline struct inet6_dev *ipv6_skb_idev(struct sk_buff *skb)\n-{\n-\treturn skb_dst(skb) ? ip6_dst_idev(skb_dst(skb)) : __in6_dev_get(skb->dev);\n-}\n-\n-static inline struct net *ipv6_skb_net(struct sk_buff *skb)\n-{\n-\treturn skb_dst(skb) ? dev_net(skb_dst(skb)->dev) : dev_net(skb->dev);\n-}\n-\n-/* Router Alert as of RFC 2711 */\n-\n-static bool ipv6_hop_ra(struct sk_buff *skb, int optoff)\n-{\n-\tconst unsigned char *nh = skb_network_header(skb);\n-\n-\tif (nh[optoff + 1] == 2) {\n-\t\tIP6CB(skb)->flags |= IP6SKB_ROUTERALERT;\n-\t\tmemcpy(&IP6CB(skb)->ra, nh + optoff + 2, sizeof(IP6CB(skb)->ra));\n-\t\treturn true;\n-\t}\n-\tnet_dbg_ratelimited(\"ipv6_hop_ra: wrong RA length %d\\n\",\n-\t\t\t    nh[optoff + 1]);\n-\tkfree_skb(skb);\n-\treturn false;\n-}\n-\n-/* Jumbo payload */\n-\n-static bool ipv6_hop_jumbo(struct sk_buff *skb, int optoff)\n-{\n-\tconst unsigned char *nh = skb_network_header(skb);\n-\tstruct inet6_dev *idev = __in6_dev_get_safely(skb->dev);\n-\tstruct net *net = ipv6_skb_net(skb);\n-\tu32 pkt_len;\n-\n-\tif (nh[optoff + 1] != 4 || (optoff & 3) != 2) {\n-\t\tnet_dbg_ratelimited(\"ipv6_hop_jumbo: wrong jumbo opt length/alignment %d\\n\",\n-\t\t\t\t    nh[optoff+1]);\n-\t\t__IP6_INC_STATS(net, idev, IPSTATS_MIB_INHDRERRORS);\n-\t\tgoto drop;\n-\t}\n-\n-\tpkt_len = ntohl(*(__be32 *)(nh + optoff + 2));\n-\tif (pkt_len <= IPV6_MAXPLEN) {\n-\t\t__IP6_INC_STATS(net, idev, IPSTATS_MIB_INHDRERRORS);\n-\t\ticmpv6_param_prob(skb, ICMPV6_HDR_FIELD, optoff+2);\n-\t\treturn false;\n-\t}\n-\tif (ipv6_hdr(skb)->payload_len) {\n-\t\t__IP6_INC_STATS(net, idev, IPSTATS_MIB_INHDRERRORS);\n-\t\ticmpv6_param_prob(skb, ICMPV6_HDR_FIELD, optoff);\n-\t\treturn false;\n-\t}\n-\n-\tif (pkt_len > skb->len - sizeof(struct ipv6hdr)) {\n-\t\t__IP6_INC_STATS(net, idev, IPSTATS_MIB_INTRUNCATEDPKTS);\n-\t\tgoto drop;\n-\t}\n-\n-\tif (pskb_trim_rcsum(skb, pkt_len + sizeof(struct ipv6hdr)))\n-\t\tgoto drop;\n-\n-\tIP6CB(skb)->flags |= IP6SKB_JUMBOGRAM;\n-\treturn true;\n-\n-drop:\n-\tkfree_skb(skb);\n-\treturn false;\n-}\n-\n-/* CALIPSO RFC 5570 */\n-\n-static bool ipv6_hop_calipso(struct sk_buff *skb, int optoff)\n-{\n-\tconst unsigned char *nh = skb_network_header(skb);\n-\n-\tif (nh[optoff + 1] < 8)\n-\t\tgoto drop;\n-\n-\tif (nh[optoff + 6] * 4 + 8 > nh[optoff + 1])\n-\t\tgoto drop;\n-\n-\tif (!calipso_validate(skb, nh + optoff))\n-\t\tgoto drop;\n-\n-\treturn true;\n-\n-drop:\n-\tkfree_skb(skb);\n-\treturn false;\n-}\n-\n-static const struct tlvtype_proc tlvprochopopt_lst[] = {\n-\t{\n-\t\t.type\t= IPV6_TLV_ROUTERALERT,\n-\t\t.func\t= ipv6_hop_ra,\n-\t},\n-\t{\n-\t\t.type\t= IPV6_TLV_JUMBO,\n-\t\t.func\t= ipv6_hop_jumbo,\n-\t},\n-\t{\n-\t\t.type\t= IPV6_TLV_CALIPSO,\n-\t\t.func\t= ipv6_hop_calipso,\n-\t},\n-\t{ -1, }\n-};\n-\n int ipv6_parse_hopopts(struct sk_buff *skb)\n {\n \tstruct inet6_skb_parm *opt = IP6CB(skb);\ndiff --git a/net/ipv6/exthdrs_options.c b/net/ipv6/exthdrs_options.c\nnew file mode 100644\nindex 0000000..032e072\n--- /dev/null\n+++ b/net/ipv6/exthdrs_options.c\n@@ -0,0 +1,201 @@\n+// SPDX-License-Identifier: GPL-2.0\n+#include <linux/errno.h>\n+#include <linux/in6.h>\n+#include <linux/net.h>\n+#include <linux/netdevice.h>\n+#include <linux/socket.h>\n+#include <linux/types.h>\n+#include <net/calipso.h>\n+#include <net/ipv6.h>\n+#include <net/ip6_route.h>\n+#if IS_ENABLED(CONFIG_IPV6_MIP6)\n+#include <net/xfrm.h>\n+#endif\n+\n+/* Destination options header */\n+\n+#if IS_ENABLED(CONFIG_IPV6_MIP6)\n+static bool ipv6_dest_hao(struct sk_buff *skb, int optoff)\n+{\n+\tstruct ipv6_destopt_hao *hao;\n+\tstruct inet6_skb_parm *opt = IP6CB(skb);\n+\tstruct ipv6hdr *ipv6h = ipv6_hdr(skb);\n+\tint ret;\n+\n+\tif (opt->dsthao) {\n+\t\tnet_dbg_ratelimited(\"hao duplicated\\n\");\n+\t\tgoto discard;\n+\t}\n+\topt->dsthao = opt->dst1;\n+\topt->dst1 = 0;\n+\n+\thao = (struct ipv6_destopt_hao *)(skb_network_header(skb) + optoff);\n+\n+\tif (hao->length != 16) {\n+\t\tnet_dbg_ratelimited(\"hao invalid option length = %d\\n\",\n+\t\t\t\t    hao->length);\n+\t\tgoto discard;\n+\t}\n+\n+\tif (!(ipv6_addr_type(&hao->addr) & IPV6_ADDR_UNICAST)) {\n+\t\tnet_dbg_ratelimited(\"hao is not an unicast addr: %pI6\\n\",\n+\t\t\t\t    &hao->addr);\n+\t\tgoto discard;\n+\t}\n+\n+\tret = xfrm6_input_addr(skb, (xfrm_address_t *)&ipv6h->daddr,\n+\t\t\t       (xfrm_address_t *)&hao->addr, IPPROTO_DSTOPTS);\n+\tif (unlikely(ret < 0))\n+\t\tgoto discard;\n+\n+\tif (skb_cloned(skb)) {\n+\t\tif (pskb_expand_head(skb, 0, 0, GFP_ATOMIC))\n+\t\t\tgoto discard;\n+\n+\t\t/* update all variable using below by copied skbuff */\n+\t\thao = (struct ipv6_destopt_hao *)(skb_network_header(skb) +\n+\t\t\t\t\t\t  optoff);\n+\t\tipv6h = ipv6_hdr(skb);\n+\t}\n+\n+\tif (skb->ip_summed == CHECKSUM_COMPLETE)\n+\t\tskb->ip_summed = CHECKSUM_NONE;\n+\n+\tswap(ipv6h->saddr, hao->addr);\n+\n+\tif (skb->tstamp == 0)\n+\t\t__net_timestamp(skb);\n+\n+\treturn true;\n+\n+ discard:\n+\tkfree_skb(skb);\n+\treturn false;\n+}\n+#endif\n+\n+const struct tlvtype_proc tlvprocdestopt_lst[] = {\n+#if IS_ENABLED(CONFIG_IPV6_MIP6)\n+\t{\n+\t\t.type\t= IPV6_TLV_HAO,\n+\t\t.func\t= ipv6_dest_hao,\n+\t},\n+#endif\n+\t{-1,\t\t\tNULL}\n+};\n+\n+/* Hop-by-hop options */\n+\n+/* Note: we cannot rely on skb_dst(skb) before we assign it in\n+ * ip6_route_input().\n+ */\n+static inline struct inet6_dev *ipv6_skb_idev(struct sk_buff *skb)\n+{\n+\treturn skb_dst(skb) ? ip6_dst_idev(skb_dst(skb)) :\n+\t    __in6_dev_get(skb->dev);\n+}\n+\n+static inline struct net *ipv6_skb_net(struct sk_buff *skb)\n+{\n+\treturn skb_dst(skb) ? dev_net(skb_dst(skb)->dev) : dev_net(skb->dev);\n+}\n+\n+/* Router Alert as of RFC 2711 */\n+\n+static bool ipv6_hop_ra(struct sk_buff *skb, int optoff)\n+{\n+\tconst unsigned char *nh = skb_network_header(skb);\n+\n+\tif (nh[optoff + 1] == 2) {\n+\t\tIP6CB(skb)->flags |= IP6SKB_ROUTERALERT;\n+\t\tmemcpy(&IP6CB(skb)->ra, nh + optoff + 2,\n+\t\t       sizeof(IP6CB(skb)->ra));\n+\t\treturn true;\n+\t}\n+\tnet_dbg_ratelimited(\"%s: wrong RA length %d\\n\",\n+\t\t\t    __func__, nh[optoff + 1]);\n+\tkfree_skb(skb);\n+\treturn false;\n+}\n+\n+/* Jumbo payload */\n+\n+static bool ipv6_hop_jumbo(struct sk_buff *skb, int optoff)\n+{\n+\tconst unsigned char *nh = skb_network_header(skb);\n+\tstruct inet6_dev *idev = __in6_dev_get_safely(skb->dev);\n+\tstruct net *net = ipv6_skb_net(skb);\n+\tu32 pkt_len;\n+\n+\tif (nh[optoff + 1] != 4 || (optoff & 3) != 2) {\n+\t\tnet_dbg_ratelimited(\"%s: wrong jumbo opt length/alignment %d\\n\",\n+\t\t\t\t    __func__, nh[optoff + 1]);\n+\t\t__IP6_INC_STATS(net, idev, IPSTATS_MIB_INHDRERRORS);\n+\t\tgoto drop;\n+\t}\n+\n+\tpkt_len = ntohl(*(__be32 *)(nh + optoff + 2));\n+\tif (pkt_len <= IPV6_MAXPLEN) {\n+\t\t__IP6_INC_STATS(net, idev, IPSTATS_MIB_INHDRERRORS);\n+\t\ticmpv6_param_prob(skb, ICMPV6_HDR_FIELD, optoff + 2);\n+\t\treturn false;\n+\t}\n+\tif (ipv6_hdr(skb)->payload_len) {\n+\t\t__IP6_INC_STATS(net, idev, IPSTATS_MIB_INHDRERRORS);\n+\t\ticmpv6_param_prob(skb, ICMPV6_HDR_FIELD, optoff);\n+\t\treturn false;\n+\t}\n+\n+\tif (pkt_len > skb->len - sizeof(struct ipv6hdr)) {\n+\t\t__IP6_INC_STATS(net, idev, IPSTATS_MIB_INTRUNCATEDPKTS);\n+\t\tgoto drop;\n+\t}\n+\n+\tif (pskb_trim_rcsum(skb, pkt_len + sizeof(struct ipv6hdr)))\n+\t\tgoto drop;\n+\n+\tIP6CB(skb)->flags |= IP6SKB_JUMBOGRAM;\n+\treturn true;\n+\n+drop:\n+\tkfree_skb(skb);\n+\treturn false;\n+}\n+\n+/* CALIPSO RFC 5570 */\n+\n+static bool ipv6_hop_calipso(struct sk_buff *skb, int optoff)\n+{\n+\tconst unsigned char *nh = skb_network_header(skb);\n+\n+\tif (nh[optoff + 1] < 8)\n+\t\tgoto drop;\n+\n+\tif (nh[optoff + 6] * 4 + 8 > nh[optoff + 1])\n+\t\tgoto drop;\n+\n+\tif (!calipso_validate(skb, nh + optoff))\n+\t\tgoto drop;\n+\n+\treturn true;\n+\n+drop:\n+\tkfree_skb(skb);\n+\treturn false;\n+}\n+\n+const struct tlvtype_proc tlvprochopopt_lst[] = {\n+\t{\n+\t\t.type\t= IPV6_TLV_ROUTERALERT,\n+\t\t.func\t= ipv6_hop_ra,\n+\t},\n+\t{\n+\t\t.type\t= IPV6_TLV_JUMBO,\n+\t\t.func\t= ipv6_hop_jumbo,\n+\t},\n+\t{\n+\t\t.type\t= IPV6_TLV_CALIPSO,\n+\t\t.func\t= ipv6_hop_calipso,\n+\t},\n+\t{ -1, }\n+};\n",
    "prefixes": [
        "v2",
        "net-next",
        "1/7"
    ]
}