get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 63124,
    "url": "http://patches.dpdk.org/api/patches/63124/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20191119234258.41004-1-frank.li.65@gmail.com/",
    "project": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<20191119234258.41004-1-frank.li.65@gmail.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20191119234258.41004-1-frank.li.65@gmail.com",
    "date": "2019-11-19T23:42:58",
    "name": "[pktgen] Fix IPv6 addressing for set/sequence/save commands, packet headers, UI printing",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "16d92da28b8c9b75905e6b2090ed3f0c6f37d1fd",
    "submitter": {
        "id": 1510,
        "url": "http://patches.dpdk.org/api/people/1510/?format=api",
        "name": "Frank Li",
        "email": "frank.li.65@gmail.com"
    },
    "delegate": null,
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20191119234258.41004-1-frank.li.65@gmail.com/mbox/",
    "series": [
        {
            "id": 7529,
            "url": "http://patches.dpdk.org/api/series/7529/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=7529",
            "date": "2019-11-19T23:42:58",
            "name": "[pktgen] Fix IPv6 addressing for set/sequence/save commands, packet headers, UI printing",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/7529/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/63124/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/63124/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id E262EA04C1;\n\tWed, 20 Nov 2019 00:43:17 +0100 (CET)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id BBDB1A69;\n\tWed, 20 Nov 2019 00:43:16 +0100 (CET)",
            "from mail-pf1-f196.google.com (mail-pf1-f196.google.com\n [209.85.210.196]) by dpdk.org (Postfix) with ESMTP id 21AC223D\n for <dev@dpdk.org>; Wed, 20 Nov 2019 00:43:15 +0100 (CET)",
            "by mail-pf1-f196.google.com with SMTP id n13so13227390pff.1\n for <dev@dpdk.org>; Tue, 19 Nov 2019 15:43:15 -0800 (PST)",
            "from localhost ([2620:10d:c090:200::b473])\n by smtp.gmail.com with ESMTPSA id y16sm8213586pff.137.2019.11.19.15.43.12\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Tue, 19 Nov 2019 15:43:13 -0800 (PST)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n h=from:to:cc:subject:date:message-id;\n bh=UQtB8ljVoi7P0azV/+yqK7Ut1qZrCo0C4PzYdLGy71A=;\n b=NrZwJFDeBzZHvn3KxK+2mVQ91/K1gLJ0C7l7Zcch6Ex4pgDmD+zS5flHQwYH+wERNG\n +amdpwN3qiN7hVzMRq6VhCk93KH+MsTXGL00N0RaKPOE3iNxORtljXVleHhiURP7hu5F\n iYE2myMca60kJzDk9c+CB1pOMKPRsNGJhmAY8Gv9wrGg0o6t88UzzhI1aDEMYGgPHKiA\n tEoxVL8EKuFcsOiRXUa27YQW3EYBh5jP1yiRXRHLVMDHIlhf9ggRF7qL5k6SG5ZT0FHD\n uDMM2mMjZWK0BoU5gM7F4dgBITrJJGbBCBJu/gObJv08QZULQHRXk6zcfbGcEbzGioLc\n 3pyQ==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20161025;\n h=x-gm-message-state:from:to:cc:subject:date:message-id;\n bh=UQtB8ljVoi7P0azV/+yqK7Ut1qZrCo0C4PzYdLGy71A=;\n b=emX+zXwDyv6ilsJm+0/gJOYoxOabpbeJt7Yu7XyrTd5ZLkI6fpB0yle6claL/pTV94\n ImkjM8THCmeDxyV/yZvgIqf98crpb+k8ezujX730n4/l4BAqYPNwcmnBpQXyH9YB2BaV\n V5x95jZhHFXJqhHEr6Hr1fNI5wz5NLmNHn7d7nIu0F0wfHoURPoBKzbf0XRvd0wg3VcT\n zUT+/Xbv11CdXKS7roBQDHMR9qyBgUmFniUTxihloYoA+cDCYRFHuvkPMlEWCBAdMg4c\n PglIQtySi8xdPywQXyKOLLxBz5wbuiC7zeFSADIKx+MuVOmhCcnZQoIOzeH5+DAksF9G\n SVsg==",
        "X-Gm-Message-State": "APjAAAXZqJfleTWtVhUDkf5T+EmYv/0sGsmbdASh9v11VH0onW91IzdZ\n gDPtz408OhoZhch9k9zoWHb+ylFN",
        "X-Google-Smtp-Source": "\n APXvYqy/IeRm583W60al3dVCwovyvFjP62zP70i2Oq19gjg2DXDRgPAjR6+puJA+RVkhN5B5zY6gOA==",
        "X-Received": "by 2002:a63:9a12:: with SMTP id o18mr8378809pge.379.1574206993589;\n Tue, 19 Nov 2019 15:43:13 -0800 (PST)",
        "From": "Frank Li <frank.li.65@gmail.com>",
        "To": "dev@dpdk.org",
        "Cc": "Frank Li <frank.li.65@gmail.com>",
        "Date": "Tue, 19 Nov 2019 15:42:58 -0800",
        "Message-Id": "<20191119234258.41004-1-frank.li.65@gmail.com>",
        "X-Mailer": "git-send-email 2.13.5",
        "Subject": "[dpdk-dev] [PATCH] [pktgen] Fix IPv6 addressing for\n\tset/sequence/save commands, packet headers, UI printing",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Current IPv6 functionality in pktgen is broken. This fix makes it so that IPv6 \naddresses are properly set when using the set, sequence, and save commands and \nthat the IP header and UDP/TCP psuedo-header IPV6 addresses are properly set.\n\nTo preserve the runtime commands, the `_atoip` function no longer takes in \nflags to specify converting IPv4/6 addresses, and will try both. It returns \n4, 6, or -1 for a valid IPv4/6, invalid address, respectively.\n\nAlso print IPv6 addresses in UI properly.\n\nCo-Authored-By: Valentin Andrei <vandrei@fb.com>\n\nSigned-off-by: Frank Li <frank.li.65@gmail.com>\n---\n app/cli-functions.c | 42 +++++++++++++++++-------------------------\n app/lpktgenlib.c    | 26 +++++++++-----------------\n app/pktgen-cmds.c   | 38 +++++++++++++++++++++++++++++++++-----\n app/pktgen-cmds.h   |  3 ++-\n app/pktgen-ipv6.c   |  9 ++++-----\n app/pktgen-stats.c  | 17 +++++++++++------\n app/pktgen-tcp.c    |  9 ++++-----\n app/pktgen-udp.c    |  9 ++++-----\n lib/utils/_atoip.c  | 39 +++++++++++++++++++++------------------\n lib/utils/_atoip.h  |  2 +-\n 10 files changed, 106 insertions(+), 88 deletions(-)",
    "diff": "diff --git a/app/cli-functions.c b/app/cli-functions.c\nindex f104781..2629147 100644\n--- a/app/cli-functions.c\n+++ b/app/cli-functions.c\n@@ -214,7 +214,7 @@ range_cmd(int argc, char **argv)\n \t\t\tp = strchr(argv[4], '/');\n \t\t\tif (p)\n \t\t\t\t*p = '\\0';\n-\t\t\t_atoip(val, PG_IPADDR_V4, &ip, sizeof(ip));\n+\t\t\t_atoip(val, 0, &ip, sizeof(ip));\n \t\t\tforeach_port(portlist,\n \t\t\t     range_set_dst_ip(info, what, &ip));\n \t\t\tbreak;\n@@ -223,7 +223,7 @@ range_cmd(int argc, char **argv)\n \t\t\tp = strchr(argv[4], '/');\n \t\t\tif (p)\n \t\t\t\t*p = '\\0';\n-\t\t\t_atoip(argv[5], PG_IPADDR_V4, &ip, sizeof(ip));\n+\t\t\t_atoip(argv[5], 0, &ip, sizeof(ip));\n \t\t\tforeach_port(portlist,\n \t\t\t     range_set_src_ip(info, what, &ip));\n \t\t\tbreak;\n@@ -463,6 +463,7 @@ set_cmd(int argc, char **argv)\n \tstruct pg_ipaddr ip;\n \tuint16_t id1, id2;\n \tuint32_t u1;\n+\tint ip_ver;\n \n \tm = cli_mapping(set_map, argc, argv);\n \tif (!m)\n@@ -527,13 +528,10 @@ set_cmd(int argc, char **argv)\n \t\tcase 30:\n \t\t\tp = strchr(argv[4], '/');\n \t\t\tif (!p) {\n-\t\t\t\tchar buf[32];\n-\t\t\t\tsnprintf(buf, sizeof(buf), \"%s/32\", argv[4]);\n-\t\t\t\tcli_printf(\"src IP address should contain /NN subnet value, default /32\\n\");\n-\t\t\t\t_atoip(buf, PG_IPADDR_V4 | PG_IPADDR_NETWORK, &ip, sizeof(ip));\n-\t\t\t} else\n-\t\t\t\t_atoip(argv[4], PG_IPADDR_V4 | PG_IPADDR_NETWORK, &ip, sizeof(ip));\n-\t\t\tforeach_port(portlist, single_set_ipaddr(info, 's', &ip));\n+\t\t\t\tcli_printf(\"src IP address should contain subnet value, default /32 for IPv4, /128 for IPv6\\n\");\n+\t\t\t}\n+\t\t\tip_ver = _atoip(argv[4], PG_IPADDR_V4 | PG_IPADDR_NETWORK, &ip, sizeof(ip));\n+\t\t\tforeach_port(portlist, single_set_ipaddr(info, 's', &ip, ip_ver));\n \t\t\tbreak;\n \t\tcase 31:\n \t\t\t/* Remove the /XX mask value if supplied */\n@@ -542,8 +540,8 @@ set_cmd(int argc, char **argv)\n \t\t\t\tcli_printf(\"Subnet mask not required, removing subnet mask value\\n\");\n \t\t\t\t*p = '\\0';\n \t\t\t}\n-\t\t\t_atoip(argv[4], PG_IPADDR_V4, &ip, sizeof(ip));\n-\t\t\tforeach_port(portlist, single_set_ipaddr(info, 'd', &ip));\n+\t\t\tip_ver = _atoip(argv[4], 0, &ip, sizeof(ip));\n+\t\t\tforeach_port(portlist, single_set_ipaddr(info, 'd', &ip, ip_ver));\n \t\t\tbreak;\n \t\tcase 40:\n \t\t\tpktgen_set_page_size(atoi(argv[2]));\n@@ -1116,15 +1114,12 @@ seq_1_set_cmd(int argc __rte_unused, char **argv)\n \tp = strchr(argv[5], '/'); /* remove subnet if found */\n \tif (p)\n \t\t*p = '\\0';\n-\t_atoip(argv[5], PG_IPADDR_V4, &dst, sizeof(dst));\n+\t_atoip(argv[5], 0, &dst, sizeof(dst));\n \tp = strchr(argv[6], '/');\n \tif (!p) {\n-\t\tchar buf[32];\n-\t\tcli_printf(\"src IP address should contain /NN subnet value, default /32\\n\");\n-\t\tsnprintf(buf, sizeof(buf), \"%s/32\", argv[6]);\n-\t\t_atoip(buf, PG_IPADDR_V4 | PG_IPADDR_NETWORK, &src, sizeof(src));\n-\t} else\n-\t\t_atoip(argv[6], PG_IPADDR_V4 | PG_IPADDR_NETWORK, &src, sizeof(src));\n+\t\tcli_printf(\"src IP address should contain subnet value, default /32 for IPv4, /128 for IPv6\\n\");\n+\t}\n+\t_atoip(argv[6], PG_IPADDR_NETWORK, &src, sizeof(src));\n \tportlist_parse(argv[2], &portlist);\n \tpg_ether_aton(argv[3], &dmac);\n \tpg_ether_aton(argv[4], &smac);\n@@ -1179,15 +1174,12 @@ seq_2_set_cmd(int argc __rte_unused, char **argv)\n \tp = strchr(argv[8], '/'); /* remove subnet if found */\n \tif (p)\n \t\t*p = '\\0';\n-\t_atoip(argv[8], PG_IPADDR_V4, &dst, sizeof(dst));\n+\t_atoip(argv[8], 0, &dst, sizeof(dst));\n \tp = strchr(argv[10], '/');\n \tif (p == NULL) {\n-\t\tchar buf[32];\n-\t\tsnprintf(buf, sizeof(buf), \"%s/32\", argv[10]);\n-\t\tcli_printf(\"src IP address should contain /NN subnet value, default /32\");\n-\t\t_atoip(buf, PG_IPADDR_V4 | PG_IPADDR_NETWORK, &src, sizeof(src));\n-\t} else\n-\t\t_atoip(argv[10], PG_IPADDR_V4 | PG_IPADDR_NETWORK, &src, sizeof(src));\n+\t\tcli_printf(\"src IP address should contain subnet value, default /32 for IPv4, /128 for IPv6\\n\");\n+\t}\n+\t_atoip(argv[10], PG_IPADDR_NETWORK, &src, sizeof(src));\n \tportlist_parse(argv[2], &portlist);\n \tpg_ether_aton(argv[4], &dmac);\n \tpg_ether_aton(argv[6], &smac);\ndiff --git a/app/lpktgenlib.c b/app/lpktgenlib.c\nindex c29e6ac..2b75a80 100644\n--- a/app/lpktgenlib.c\n+++ b/app/lpktgenlib.c\n@@ -295,19 +295,11 @@ set_seq(lua_State *L, uint32_t seqnum)\n \n \t/* Determine if we are IPv4 or IPv6 packets */\n \tip      = (char *)luaL_checkstring(L, 9);\n-\tif (ip[3] == '6') {\n-\t\t_atoip(luaL_checkstring(L, 5), PG_IPADDR_V6,\n-\t\t\t\t  &ip_daddr, sizeof(struct pg_ipaddr));\n-\t\t_atoip(luaL_checkstring(L, 6),\n-\t\t\t\t  PG_IPADDR_NETWORK | PG_IPADDR_V6,\n-\t\t\t\t  &ip_saddr, sizeof(struct pg_ipaddr));\n-\t} else {\n-\t\t_atoip(luaL_checkstring(L, 5), PG_IPADDR_V4,\n-\t\t\t\t  &ip_daddr, sizeof(struct pg_ipaddr));\n-\t\t_atoip(luaL_checkstring(L, 6),\n-\t\t\t\t  PG_IPADDR_NETWORK | PG_IPADDR_V4,\n-\t\t\t\t  &ip_saddr, sizeof(struct pg_ipaddr));\n-\t}\n+\t_atoip(luaL_checkstring(L, 5), 0,\n+\t\t\t&ip_daddr, sizeof(struct pg_ipaddr));\n+\t_atoip(luaL_checkstring(L, 6),\n+\t\t\tPG_IPADDR_NETWORK,\n+\t\t\t&ip_saddr, sizeof(struct pg_ipaddr));\n \tproto   = (char *)luaL_checkstring(L, 10);\n \tvlanid  = luaL_checkinteger(L, 11);\n \tpktsize = luaL_checkinteger(L, 12);\n@@ -657,6 +649,7 @@ pktgen_set_ip_addr(lua_State *L) {\n \tstruct pg_ipaddr ipaddr;\n \tint flags;\n \tchar      *type;\n+\tint ip_ver;\n \n \tswitch (lua_gettop(L) ) {\n \tdefault: return luaL_error(L, \"set_ipaddr, wrong number of arguments\");\n@@ -665,14 +658,13 @@ pktgen_set_ip_addr(lua_State *L) {\n \t}\n \ttype = (char *)luaL_checkstring(L, 2);\n \tportlist_parse(luaL_checkstring(L, 1), &portlist);\n-\tflags = PG_IPADDR_V4;\n \tif (type[0] == 's')\n-\t\tflags |= PG_IPADDR_NETWORK;\n-\t_atoip(luaL_checkstring(L, 3), flags,\n+\t\tflags = PG_IPADDR_NETWORK;\n+\tip_ver = _atoip(luaL_checkstring(L, 3), flags,\n \t\t\t  &ipaddr, sizeof(struct pg_ipaddr));\n \n \tforeach_port(portlist,\n-\t             single_set_ipaddr(info, type[0], &ipaddr) );\n+\t             single_set_ipaddr(info, type[0], &ipaddr, ip_ver) );\n \n \tpktgen_update_display();\n \treturn 0;\ndiff --git a/app/pktgen-cmds.c b/app/pktgen-cmds.c\nindex 0e9af7c..8e2e1f5 100644\n--- a/app/pktgen-cmds.c\n+++ b/app/pktgen-cmds.c\n@@ -173,10 +173,14 @@ pktgen_script_save(char *path)\n \t\t\t(pkt->ipProto == PG_IPPROTO_TCP) ? \"tcp\" :\n \t\t\t(pkt->ipProto == PG_IPPROTO_ICMP) ? \"icmp\" : \"udp\");\n \t\tfprintf(fd, \"set %d dst ip %s\\n\", i,\n+\t\t\t(pkt->ethType == ETHER_TYPE_IPv6) ?\n+\t\t\tinet_ntop6(buff, sizeof(buff), pkt->ip_dst_addr.addr.ipv6.s6_addr) :\n \t\t\tinet_ntop4(buff, sizeof(buff),\n \t\t\t\t   ntohl(pkt->ip_dst_addr.addr.ipv4.s_addr),\n \t\t\t\t   0xFFFFFFFF));\n \t\tfprintf(fd, \"set %d src ip %s\\n\", i,\n+\t\t(pkt->ethType == ETHER_TYPE_IPv6) ?\n+\t\t\tinet_ntop6(buff, sizeof(buff), pkt->ip_src_addr.addr.ipv6.s6_addr) :\n \t\t\tinet_ntop4(buff, sizeof(buff),\n \t\t\t\t   ntohl(pkt->ip_src_addr.addr.ipv4.s_addr),\n \t\t\t\t   pkt->ip_mask));\n@@ -370,11 +374,15 @@ pktgen_script_save(char *path)\n \t\t\t\t\t  sizeof(buff),\n \t\t\t\t\t  &pkt->eth_src_addr));\n \t\t\tfprintf(fd, \"%s \",\n+\t\t\t\t(pkt->ethType == ETHER_TYPE_IPv6) ?\n+\t\t\t\tinet_ntop6(buff, sizeof(buff), pkt->ip_dst_addr.addr.ipv6.s6_addr) :\n \t\t\t\tinet_ntop4(buff, sizeof(buff),\n \t\t\t\t\t   htonl(pkt->ip_dst_addr.addr.ipv4.\n \t\t\t\t\t\t s_addr),\n \t\t\t\t\t   0xFFFFFFFF));\n \t\t\tfprintf(fd, \"%s \",\n+\t\t\t\t(pkt->ethType == ETHER_TYPE_IPv6) ?\n+\t\t\t\tinet_ntop6(buff, sizeof(buff), pkt->ip_src_addr.addr.ipv6.s6_addr) :\n \t\t\t\tinet_ntop4(buff, sizeof(buff),\n \t\t\t\t\t   htonl(pkt->ip_src_addr.addr.ipv4.\n \t\t\t\t\t\t s_addr),\n@@ -537,10 +545,14 @@ pktgen_lua_save(char *path)\n \t\t\t(pkt->ipProto == PG_IPPROTO_TCP) ? \"tcp\" :\n \t\t\t(pkt->ipProto == PG_IPPROTO_ICMP) ? \"icmp\" : \"udp\");\n \t\tfprintf(fd, \"pktgen.set_ipaddr('%d', 'dst', '%s');\\n\", i,\n+\t\t\t(pkt->ethType == ETHER_TYPE_IPv6) ?\n+\t\t\tinet_ntop6(buff, sizeof(buff), pkt->ip_dst_addr.addr.ipv6.s6_addr) :\n \t\t\tinet_ntop4(buff, sizeof(buff),\n \t\t\t\t   ntohl(pkt->ip_dst_addr.addr.ipv4.s_addr),\n \t\t\t\t   0xFFFFFFFF));\n \t\tfprintf(fd, \"pktgen.set_ipaddr('%d', 'src','%s');\\n\", i,\n+\t\t\t(pkt->ethType == ETHER_TYPE_IPv6) ?\n+\t\t\tinet_ntop6(buff, sizeof(buff), pkt->ip_src_addr.addr.ipv6.s6_addr) :\n \t\t\tinet_ntop4(buff, sizeof(buff),\n \t\t\t\t   ntohl(pkt->ip_src_addr.addr.ipv4.s_addr),\n \t\t\t\t   pkt->ip_mask));\n@@ -729,11 +741,15 @@ pktgen_lua_save(char *path)\n \t\t\t\t\t\t  sizeof(buff),\n \t\t\t\t\t\t  &pkt->eth_src_addr));\n \t\t\t\tfprintf(fd, \"'%s', \",\n+\t\t\t\t\t(pkt->ethType == ETHER_TYPE_IPv6) ?\n+\t\t\t\t\tinet_ntop6(buff, sizeof(buff), pkt->ip_dst_addr.addr.ipv6.s6_addr) :\n \t\t\t\t\tinet_ntop4(buff, sizeof(buff),\n \t\t\t\t\t\t   htonl(pkt->ip_dst_addr.addr.ipv4.\n \t\t\t\t\t\t\t s_addr),\n \t\t\t\t\t\t   0xFFFFFFFF));\n \t\t\t\tfprintf(fd, \"'%s', \",\n+\t\t\t\t\t(pkt->ethType == ETHER_TYPE_IPv6) ?\n+\t\t\t\t\tinet_ntop6(buff, sizeof(buff), pkt->ip_src_addr.addr.ipv6.s6_addr) :\n \t\t\t\t\tinet_ntop4(buff, sizeof(buff),\n \t\t\t\t\t\t   htonl(pkt->ip_src_addr.addr.ipv4.\n \t\t\t\t\t\t\t s_addr),\n@@ -762,10 +778,14 @@ pktgen_lua_save(char *path)\n \t\t\t\tfprintf(fd, \"  ['eth_src_addr'] = '%s',\\n\",\n \t\t\t\t\tinet_mtoa(buff, sizeof(buff), &pkt->eth_src_addr));\n \t\t\t\tfprintf(fd, \"  ['ip_dst_addr'] = '%s',\\n\",\n+\t\t\t\t\t(pkt->ethType == ETHER_TYPE_IPv6) ?\n+\t\t\t\t\tinet_ntop6(buff, sizeof(buff), pkt->ip_dst_addr.addr.ipv6.s6_addr) :\n \t\t\t\t\tinet_ntop4(buff, sizeof(buff),\n \t\t\t\t\t\t   htonl(pkt->ip_dst_addr.addr.ipv4.s_addr),\n \t\t\t\t\t\t   0xFFFFFFFF));\n \t\t\t\tfprintf(fd, \"  ['ip_src_addr'] = '%s',\\n\",\n+\t\t\t\t\t(pkt->ethType == ETHER_TYPE_IPv6) ?\n+\t\t\t\t\tinet_ntop6(buff, sizeof(buff), pkt->ip_src_addr.addr.ipv6.s6_addr) :\n \t\t\t\t\tinet_ntop4(buff, sizeof(buff),\n \t\t\t\t\t\t   htonl(pkt->ip_src_addr.addr.ipv4.s_addr),\n \t\t\t\t\t\t   0xFFFFFFFF));\n@@ -3037,15 +3057,23 @@ single_set_tx_rate(port_info_t *info, const char *r)\n  */\n \n void\n-single_set_ipaddr(port_info_t *info, char type, struct pg_ipaddr *ip)\n+single_set_ipaddr(port_info_t* info, char type, struct pg_ipaddr* ip,\n+\t\t\tint ip_ver)\n {\n-\tif (type == 's') {\n+\tif (type == 's' && ip_ver == 4) {\n \t\tinfo->seq_pkt[SINGLE_PKT].ip_mask = size_to_mask(ip->prefixlen);\n \t\tinfo->seq_pkt[SINGLE_PKT].ip_src_addr.addr.ipv4.s_addr = ntohl(\n-\t\t                ip->ipv4.s_addr);\n-\t} else\n+\t\t\t\t\t\t\t\t\t\tip->ipv4.s_addr);\n+\t} else if (type == 'd' && ip_ver == 4) {\n \t\tinfo->seq_pkt[SINGLE_PKT].ip_dst_addr.addr.ipv4.s_addr = ntohl(\n-\t\t                ip->ipv4.s_addr);\n+\t\t\t\t\t\t\t\t\t\tip->ipv4.s_addr);\n+\t} else if (type == 's' && ip_ver == 6) {\n+\t\trte_memcpy(info->seq_pkt[SINGLE_PKT].ip_src_addr.addr.ipv6.s6_addr,\n+\t\t\tip->ipv6.s6_addr, sizeof(struct in6_addr));\n+\t} else if (type == 'd' && ip_ver == 6){\n+\t\trte_memcpy(info->seq_pkt[SINGLE_PKT].ip_dst_addr.addr.ipv6.s6_addr,\n+\t\t\tip->ipv6.s6_addr, sizeof(struct in6_addr));\n+\t}\n \tpktgen_packet_ctor(info, SINGLE_PKT, -1);\n \tpktgen_set_tx_update(info);\n }\ndiff --git a/app/pktgen-cmds.h b/app/pktgen-cmds.h\nindex 46055fe..033c1b9 100644\n--- a/app/pktgen-cmds.h\n+++ b/app/pktgen-cmds.h\n@@ -66,7 +66,8 @@ void pktgen_port_defaults(uint32_t pid, uint8_t seq);\n struct pg_ipaddr;\n \n /* Single */\n-void single_set_ipaddr(port_info_t *info, char type, struct pg_ipaddr *ip);\n+void single_set_ipaddr(port_info_t *info, char type,\n+\t\t\t\t\tstruct pg_ipaddr *ip, int ip_ver);\n void single_set_proto(port_info_t *info, char *type);\n void single_set_vlan_id(port_info_t *info, uint16_t vlanid);\n void single_set_cos(port_info_t *info, uint8_t cos);\ndiff --git a/app/pktgen-ipv6.c b/app/pktgen-ipv6.c\nindex e8d3874..0430e7f 100644\n--- a/app/pktgen-ipv6.c\n+++ b/app/pktgen-ipv6.c\n@@ -29,7 +29,6 @@ void\n pktgen_ipv6_ctor(pkt_seq_t *pkt, void *hdr)\n {\n \tstruct pg_ipv6_hdr *ip = hdr;\n-\tuint32_t addr;\n \tuint16_t tlen;\n \n \t/* IPv6 Header constructor */\n@@ -42,10 +41,10 @@ pktgen_ipv6_ctor(pkt_seq_t *pkt, void *hdr)\n \tip->hop_limits = 4;\n \tip->proto = pkt->ipProto;\n \n-\taddr = htonl(pkt->ip_dst_addr.addr.ipv4.s_addr);\n-\t(void)rte_memcpy(&ip->dst_addr[8], &addr, sizeof(uint32_t));\n-\taddr = htonl(pkt->ip_src_addr.addr.ipv4.s_addr);\n-\t(void)rte_memcpy(&ip->src_addr[8], &addr, sizeof(uint32_t));\n+\trte_memcpy(&ip->dst_addr, pkt->ip_dst_addr.addr.ipv6.s6_addr,\n+\t\t\tsizeof(struct in6_addr));\n+\trte_memcpy(&ip->src_addr, pkt->ip_src_addr.addr.ipv6.s6_addr,\n+\t\t\tsizeof(struct in6_addr));\n }\n \n /**************************************************************************//**\ndiff --git a/app/pktgen-stats.c b/app/pktgen-stats.c\nindex 572b10d..0e00a04 100644\n--- a/app/pktgen-stats.c\n+++ b/app/pktgen-stats.c\n@@ -168,12 +168,17 @@ pktgen_print_static_data(void)\n \t\tscrn_printf(row++, col, \"%*s\", COLUMN_WIDTH_1, buff);\n \n \t\tpktgen_display_set_color(\"stats.ip\");\n-\t\tscrn_printf(row++, col, \"%*s\", COLUMN_WIDTH_1,\n-\t\t            inet_ntop4(buff, sizeof(buff),\n-\t\t                       htonl(pkt->ip_dst_addr.addr.ipv4.s_addr), 0xFFFFFFFF));\n-\t\tscrn_printf(row++, col, \"%*s\", COLUMN_WIDTH_1,\n-\t\t            inet_ntop4(buff, sizeof(buff),\n-\t\t                       htonl(pkt->ip_src_addr.addr.ipv4.s_addr), pkt->ip_mask));\n+\t\tif (pkt->ethType == PG_ETHER_TYPE_IPv6) {\n+\t\t\tscrn_printf(row++, col, \"%*s\", COLUMN_WIDTH_1, inet_ntop6(buff,\n+\t\t\t\t\tsizeof(buff), pkt->ip_dst_addr.addr.ipv6.s6_addr));\n+\t\t\tscrn_printf(row++, col, \"%*s\", COLUMN_WIDTH_1, inet_ntop6(buff,\n+\t\t\t\t\tsizeof(buff), pkt->ip_src_addr.addr.ipv6.s6_addr));\n+\t\t} else {\n+\t\t\tscrn_printf(row++, col, \"%*s\", COLUMN_WIDTH_1, inet_ntop4(buff,\n+\t\t\t\t\tsizeof(buff), htonl(pkt->ip_dst_addr.addr.ipv4.s_addr), 0xFFFFFFFF));\n+\t\t\tscrn_printf(row++, col, \"%*s\", COLUMN_WIDTH_1, inet_ntop4(buff,\n+\t\t\t\t\tsizeof(buff), htonl(pkt->ip_src_addr.addr.ipv4.s_addr), pkt->ip_mask));\n+\t\t}\n \t\tpktgen_display_set_color(\"stats.mac\");\n \t\tscrn_printf(row++, col, \"%*s\", COLUMN_WIDTH_1,\n \t\t            inet_mtoa(buff, sizeof(buff), &pkt->eth_dst_addr));\ndiff --git a/app/pktgen-tcp.c b/app/pktgen-tcp.c\nindex 7c31960..089c93a 100644\n--- a/app/pktgen-tcp.c\n+++ b/app/pktgen-tcp.c\n@@ -55,15 +55,14 @@ pktgen_tcp_hdr_ctor(pkt_seq_t *pkt, void * hdr, int type)\n \t} else {\n \t\tstruct pg_ipv6_hdr *ipv6 = (struct pg_ipv6_hdr *)hdr;\n \t\tstruct pg_tcp_hdr *tcp = (struct pg_tcp_hdr *)&ipv6[1];\n-\t\tuint32_t addr;\n \n \t\t/* Create the pseudo header and TCP information */\n \t\tmemset(ipv6->dst_addr, 0, sizeof(struct in6_addr));\n \t\tmemset(ipv6->src_addr, 0, sizeof(struct in6_addr));\n-\t\taddr = htonl(pkt->ip_dst_addr.addr.ipv4.s_addr);\n-\t\t(void)rte_memcpy(&ipv6->dst_addr[8], &addr, sizeof(uint32_t));\n-\t\taddr = htonl(pkt->ip_src_addr.addr.ipv4.s_addr);\n-\t\t(void)rte_memcpy(&ipv6->src_addr[8], &addr, sizeof(uint32_t));\n+\t\trte_memcpy(ipv6->dst_addr, &pkt->ip_dst_addr.addr.ipv6.s6_addr,\n+\t\t\t\tsizeof(struct in6_addr));\n+\t\trte_memcpy(ipv6->src_addr, &pkt->ip_src_addr.addr.ipv6.s6_addr,\n+\t\t\t\tsizeof(struct in6_addr));\n \n \t\ttlen = pkt->pktSize - (pkt->ether_hdr_size + sizeof(struct pg_ipv6_hdr));\n \t\tipv6->payload_len = htons(tlen);\ndiff --git a/app/pktgen-udp.c b/app/pktgen-udp.c\nindex 41bb5c6..6e5dd03 100644\n--- a/app/pktgen-udp.c\n+++ b/app/pktgen-udp.c\n@@ -59,17 +59,16 @@ pktgen_udp_hdr_ctor(pkt_seq_t *pkt, void *hdr, int type)\n \t\tif (udp->dgram_cksum == 0)\n \t\t\tudp->dgram_cksum = 0xFFFF;\n \t} else {\n-\t\tuint32_t addr;\n \t\tstruct pg_ipv6_hdr *ipv6 = hdr;\n \t\tstruct pg_udp_hdr *udp = (struct pg_udp_hdr *)&ipv6[1];\n \n \t\t/* Create the pseudo header and TCP information */\n \t\tmemset(ipv6->dst_addr, 0, sizeof(struct in6_addr));\n \t\tmemset(ipv6->src_addr, 0, sizeof(struct in6_addr));\n-\t\taddr = htonl(pkt->ip_dst_addr.addr.ipv4.s_addr);\n-\t\t(void)rte_memcpy(&ipv6->dst_addr[8], &addr, sizeof(uint32_t));\n-\t\taddr = htonl(pkt->ip_src_addr.addr.ipv4.s_addr);\n-\t\t(void)rte_memcpy(&ipv6->src_addr[8], &addr, sizeof(uint32_t));\n+\t\trte_memcpy(ipv6->dst_addr, &pkt->ip_dst_addr.addr.ipv6.s6_addr,\n+\t\t\t\tsizeof(struct in6_addr));\n+\t\trte_memcpy(ipv6->src_addr, &pkt->ip_src_addr.addr.ipv6.s6_addr,\n+\t\t\t\tsizeof(struct in6_addr));\n \n \t\ttlen = pkt->pktSize - (pkt->ether_hdr_size +\n \t\t\t\t       sizeof(struct pg_ipv6_hdr));\ndiff --git a/lib/utils/_atoip.c b/lib/utils/_atoip.c\nindex c33e6ae..1ba142c 100644\n--- a/lib/utils/_atoip.c\n+++ b/lib/utils/_atoip.c\n@@ -228,6 +228,7 @@ _atoip(const char *buf, int flags, void *res, unsigned ressize)\n \tstruct rte_ipaddr ipaddr;\n \tchar *prefix, *prefix_end;\n \tlong prefixlen = 0;\n+\tint default_max_prefix = 0;\n \n \tif (res && ressize < sizeof(struct rte_ipaddr))\n \t\treturn -1;\n@@ -247,35 +248,37 @@ _atoip(const char *buf, int flags, void *res, unsigned ressize)\n \t/* convert the network prefix */\n \tif (flags & RTE_IPADDR_NETWORK) {\n \t\tprefix = strrchr(ip_str, '/');\n-\t\tif (prefix == NULL)\n-\t\t\treturn -1;\n-\t\t*prefix = '\\0';\n-\t\tprefix++;\n-\t\terrno = 0;\n-\t\tprefixlen = strtol(prefix, &prefix_end, 10);\n-\t\tif (errno || (*prefix_end != '\\0')\n-\t\t    || prefixlen < 0 || prefixlen > RTE_PREFIXMAX)\n-\t\t\treturn -1;\n-\t\tipaddr.prefixlen = prefixlen;\n+\t\tif (prefix == NULL) {\n+\t\t\tdefault_max_prefix = 1;\n+\t\t}\telse {\n+\t\t\t*prefix = '\\0';\n+\t\t\tprefix++;\n+\t\t\terrno = 0;\n+\t\t\tprefixlen = strtol(prefix, &prefix_end, 10);\n+\t\t\tif (errno || (*prefix_end != '\\0')\n+\t\t\t    || prefixlen < 0 || prefixlen > RTE_PREFIXMAX)\n+\t\t\t\treturn -1;\n+\t\t\tipaddr.prefixlen = prefixlen;\n+\t\t}\n \t} else\n \t\tipaddr.prefixlen = 0;\n \n \t/* convert the IP addr */\n-\tif ((flags & RTE_IPADDR_V4) &&\n-\t    inet_ipton(AF_INET, ip_str, &ipaddr.ipv4) == 1 &&\n+\tif (inet_ipton(AF_INET, ip_str, &ipaddr.ipv4) == 1 &&\n \t    prefixlen <= RTE_V4PREFIXMAX) {\n+\t\tif (default_max_prefix)\n+\t\t\tipaddr.prefixlen = RTE_V4PREFIXMAX;\n \t\tipaddr.family = AF_INET;\n \t\tif (res)\n \t\t\tmemcpy(res, &ipaddr, sizeof(ipaddr));\n-\t\treturn token_len;\n-\t}\n-\n-\tif ((flags & RTE_IPADDR_V6) &&\n-\t    inet_ipton(AF_INET6, ip_str, &ipaddr.ipv6) == 1) {\n+\t\treturn 4;\n+\t} else if (inet_ipton(AF_INET6, ip_str, &ipaddr.ipv6) == 1) {\n \t\tipaddr.family = AF_INET6;\n+\t\tif (default_max_prefix)\n+\t\t\tipaddr.prefixlen = RTE_PREFIXMAX;\n \t\tif (res)\n \t\t\tmemcpy(res, &ipaddr, sizeof(ipaddr));\n-\t\treturn token_len;\n+\t\treturn 6;\n \t}\n \treturn -1;\n \ndiff --git a/lib/utils/_atoip.h b/lib/utils/_atoip.h\nindex c03093a..322ee2d 100644\n--- a/lib/utils/_atoip.h\n+++ b/lib/utils/_atoip.h\n@@ -49,7 +49,7 @@ struct rte_ipaddr {\n  * @param ressize\n  *   Length of res in bytes.\n  * @return\n- *   0 on OK and -1 on error\n+ *   4 or 6 on OK, indicating an IPv4/v6 address, respectively, and -1 on error\n  */\n int _atoip(const char *buf, int flags, void *res, unsigned ressize);\n \n",
    "prefixes": [
        "pktgen"
    ]
}