From owner-freebsd-ipfw@freebsd.org Tue Nov 14 17:49:36 2017 Return-Path: Delivered-To: freebsd-ipfw@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0795CDD9262 for ; Tue, 14 Nov 2017 17:49:36 +0000 (UTC) (envelope-from suever@gatech.edu) Received: from mail-io0-f181.google.com (mail-io0-f181.google.com [209.85.223.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D40FC68056 for ; Tue, 14 Nov 2017 17:49:35 +0000 (UTC) (envelope-from suever@gatech.edu) Received: by mail-io0-f181.google.com with SMTP id u42so7256074ioi.9 for ; Tue, 14 Nov 2017 09:49:35 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=BYgkKXsjOFupaDM/wabh+PAxqFu4fHxZ3h1aGe9h8zQ=; b=PXsxdnxQ7JD2btdtI8f221Jtc0JwpetaDBXg/Dxu2w6yMXvW7/qdniSDkiMKEafpSX dK+phWe9GwOiCu5WgIJdxhYALiQ9R84jGbP5m7iyZ95zgCX2/FMhL4PMMlYEiuUgWbxO cfsZIVoGGj9xdDA77iAo/hATiIexTk5bXBxSkdZebAIkEddjE/eQ0pALzI5vGw93mznx Eib1D+nkI7TCIYjydoPTHXwDwYn2NEvCxYiPdDiE1ofUKQkSyeRiG7sCdKooYlgHiqwR /htiz/vNvkERb7NXBhwv1bmPxXrilOaJLnGGtx+Z7Q44QAv0HWguVns/jMK49WNQytCU Z+jw== X-Gm-Message-State: AJaThX7h3pHrkzypYFxCamwAxScc8a3aIjUzt2NH2apg1BjC6oyeKJVF oMhSMypWCXM3IWDIzunkPp9ayf1WBSXWqM2s7bKP/Z49 X-Google-Smtp-Source: AGs4zMbaMbvH9tnota+UI51j44Ft9IjJPCDM3htCW/ssAdWZ8LpZz3sApXVjBdCrdLxjg02I+2DLWMc3kkoFrr4+I+8= X-Received: by 10.107.131.99 with SMTP id f96mr12750722iod.215.1510681773021; Tue, 14 Nov 2017 09:49:33 -0800 (PST) MIME-Version: 1.0 Received: by 10.79.21.67 with HTTP; Tue, 14 Nov 2017 09:49:32 -0800 (PST) From: Jonathan Suever Date: Tue, 14 Nov 2017 12:49:32 -0500 Message-ID: Subject: Evaluating POSTROUTING hooks on packets after they leave dummynet To: freebsd-ipfw@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: freebsd-ipfw@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: IPFW Technical Discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Nov 2017 17:49:36 -0000 I'm using dummynet/ipfw for Linux on Ubuntu 14.04. I am trying to setup a netfilter POSTROUTING hook that will be evaluated after packets pass through dummynet. The POSTROUTING hook is set to have a lower priority than dummynet, so I would imagine that it would be evaluated after dummynet reinjects the packet into netfilter. I don't have any problems when I don't configure any dummynet rules (IPFW seems to be reinjecting the packet the way I'd expect). Once I add any delays, bandwidth constraints, or packet loss, then the packets never reach the POSTROUTING hook. In digging into the dummynet source to figure out what's going on, I realized that dummynet is reinjecting the packets into netfilter with the NF_STOP flag . As a result, it seems that the rest of the netfilter hooks registered with POSTROUTING are not being evaluated for this packet. If I change the flag to NF_ACCEPT, then the rest of the POSTROUTING hooks are evaluated as I expected. What is the reason to use NF_STOP over NF_ACCEPT in this particular case? Is there any downside to replacing it with NF_ACCEPT for my use case or is there a more elegant way. For reference, NF_STOP *used* to be defined as NF_ACCEPT in older kernel versions . Any insight would be greatly appreciated! Thanks, Jonathan _________________________________ Jonathan Suever, PhD Magnetic Resonance Research Center Department of Biomedical Engineering/Bioengineering, Georgia Institute of Technology