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 D271E2C59 for ; Sat, 9 Apr 2016 17:36:35 +0200 (CEST) Received: by mail-lf0-f43.google.com with SMTP id j11so109139605lfb.1 for ; Sat, 09 Apr 2016 08:36:35 -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:in-reply-to:references:date:message-id :subject:from:to:cc; bh=+08/NYw5H5odRGRQqOyKJWu6TaNYt2aeTZrjdY2j3PM=; b=ESwtG3lAaKKUU1nVAMRwRegYXo9Rq/C47gIGZSaynfDppq4vvncp+XIc1H10He0ws6 cS68Yla4qpkjV+g/cJElR0PFRtEqi+IdnB1Q2OPfjWa8Qw5M4pTclGGnIV7e/LQlPam2 4Njao1AYKJX/1CSUPex41mmLVEcel15IVsS9FOoNEW0utsPNKJU9jti1LEQdyvpaE9GX JNBevsQl3Ogs2pUrZUPG3zUTl/uJIp+jaljMjAYPE9aKgCxTTUyQ9uotgmt6tZPKTrkq QmOYcmDgO77qjsAte8OCBEFg4iSz+xx0vR954IqH7dPAG6pxJ6NRe37GEOfMfjKbb8MS ZQ0w== 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:in-reply-to:references :date:message-id:subject:from:to:cc; bh=+08/NYw5H5odRGRQqOyKJWu6TaNYt2aeTZrjdY2j3PM=; b=lfwoT/ocVq2yFREkbbNJfrjp0xDio77JybLMH+qyZG8TGIn7wrzDetjnekS5iAt3Dy kf2JzaP0CEvbnMXpYMVwnkXjd8RHiy4dkE6PMco3Ba3cW39aTFotYISnrJj6gaHZ1JVS vupcUjjPOyfvUVhS8j+P/wV/8qg1tcCdiQwabsmfNcOPje3WYgbXcOFDXxtevxTuF5k5 cmOwYPlT7MMW94915d7cXk5jLJKGAhsdYdE83bXYaQEDnQadmJI+EDtn50kkix135MMV 6moVBF+3M0S8addhBq8/kzfngChKBDXyyEsaRC8PfFHB9VXtXRTLwv+kP47WbjPgU40z 1PbQ== X-Gm-Message-State: AD7BkJKBvWKDXZDcd7zBpHh+rhILGSOMz5Go9KQ4u40n3X9Xwciz3sPYYrdr5PxZg2SukvdlFjOHpyesw+lC3Qpj MIME-Version: 1.0 X-Received: by 10.25.86.144 with SMTP id k138mr5699325lfb.59.1460216195417; Sat, 09 Apr 2016 08:36:35 -0700 (PDT) Received: by 10.112.200.74 with HTTP; Sat, 9 Apr 2016 08:36:35 -0700 (PDT) Received: by 10.112.200.74 with HTTP; Sat, 9 Apr 2016 08:36:35 -0700 (PDT) In-Reply-To: References: Date: Sat, 9 Apr 2016 09:36:35 -0600 Message-ID: From: Murad Kablan To: Jesper Wramberg Cc: users Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [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 15:36:36 -0000 Hi Jesper, I'm not running DPDK on the receiving side. Just tcpdump. Can you please be more specific? What and how to convert to network byte order? Thanks On Apr 9, 2016 7:45 AM, "Jesper Wramberg" wrote: > Hey Murad, > > Are you running DPDK on the receiving end as well ? > In any case, I'm guessing you forgot to convert to network byte order ? :-) > > > > 2016-04-09 12:34 GMT+02:00 Murad Kablan : > >> 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 >> > >