From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf0-f43.google.com (mail-lf0-f43.google.com [209.85.215.43]) by dpdk.org (Postfix) with ESMTP id EA5C32BDE for ; Sat, 9 Apr 2016 12:34:37 +0200 (CEST) Received: by mail-lf0-f43.google.com with SMTP id g184so104452342lfb.3 for ; Sat, 09 Apr 2016 03:34:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=colorado-edu.20150623.gappssmtp.com; s=20150623; h=mime-version:reply-to:date:message-id:subject:from:to; bh=Zt8Nf5jih/2Ii5d2PcIyIUzlwU5rUcI0pAK7+ADjZ2w=; b=0iWhMF4FLFu9/Datsr29JbXvGhm4tyX53Pm2glqmaPi9kSch2xsLbW5kshEVMhMWp4 AmUjzHk+4U+F2zkdJ+lsmFXXvPirDD72xcdSdr6MW+uoyPfPM60sRuquMvg/Efecqe5T VdyXeX0bD7CeMyLy4JSZBpwW3zR897fKtNkkg2+84J/LaZlrTV7iqm48Ak8dEeDlH3d9 S9It6g9x3j/VarzJ25M2mXwJ7M6kzrwfxrXY6lFnqyFUe1ry444kruiir6OHgdChDygr ZaiUXR6L8qIunIZQdDp5RLhsLoju6n+4EwM8h+OMxCEBnYc6JVweiOYYfKsfOU4VclT2 8NbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:reply-to:date:message-id:subject :from:to; bh=Zt8Nf5jih/2Ii5d2PcIyIUzlwU5rUcI0pAK7+ADjZ2w=; b=lZjsxy5JK8ZjFdAG4yZ+diQFUR61QkbuMC5B0wIO2QytTS2hSFuMBqkEDZLMRuo9/y ftzRdR3X0QgXXet/IT6+HjSQivjoXi+PdLUH7EmMdXTKc8u15OVLRXGnyfa7vYAJhfbp lqDmF+3yPnNZ8nllziH9A8C5LKksp29c/LUL7UC8rwM60d3C56qnbZr+hXfqp4k0ZdZd /6HV7azxAYoYPW/9PBoBhvbhlhz3DG0UkAwbBLPvKEsAChn2/03IEUhSgfEsawM0gcEa 3mw9h36H9ODmXpXjgZJMfYXLp93Vw+IUhNF5pD+K5JuDhrcsH5xyZGg2WxIL9w7GiDU5 Nmnw== X-Gm-Message-State: AD7BkJLXCJAmp5s9NseO4nzpyETVWHHmpelOUyIbdGdmZkF/opXnN63YqUcSFcnMgkNohWc7aNtpYIRcG0aUCQGJ MIME-Version: 1.0 X-Received: by 10.25.39.210 with SMTP id n201mr2551445lfn.121.1460198077484; Sat, 09 Apr 2016 03:34:37 -0700 (PDT) Received: by 10.112.200.74 with HTTP; Sat, 9 Apr 2016 03:34:37 -0700 (PDT) Date: Sat, 9 Apr 2016 04:34:37 -0600 Message-ID: From: Murad Kablan To: users Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: [dpdk-users] How to change IP and port in packet header and recalculate checksum X-BeenThere: users@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Murad.Kablan@Colorado.EDU List-Id: usage discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Apr 2016 10:34:38 -0000 Hi, I'm trying to change the IP and port of packets before sending them out. The captured packet in the receiving machines seems to be corrupted as the port is different than the one I inserted. Am I doing the checksum right? And do I need to do other HW configurations? This is my code: struct udp_hdr *udp_h; struct ipv4_hdr *ipv4_h; struct ether_hdr *eth_hdr; eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); ipv4_h = (struct ipv4_hdr *)(eth_hdr + 1); udp_h = (struct udp_hdr *)((unsigned char *)ipv4_h + sizeof(struct ipv4_hdr)); ipv4_h->dst_addr = 6777226 //(gateway-ip 10.77.0.51) udp_h->src_port = 88 ipv4_h->hdr_checksum = 0; udp_h->dgram_cksum = 0; udp_h->dgram_cksum = rte_ipv4_udptcp_cksum(ipv4_h, udp_h); ipv4_h->hdr_checksum = rte_ipv4_cksum(ipv4_h); l2fwd_simple_forward(m, 0); Thanks, Murad