Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: ilker <ilkery@gmail.com>
Cc: netfilter@vger.kernel.org
Subject: Re: nfqueue ethernet packet frame capture
Date: Wed, 17 Mar 2021 16:54:14 +0100	[thread overview]
Message-ID: <20210317155414.GA1197@salvia> (raw)
In-Reply-To: <20210317155309.GB1140@salvia>

On Wed, Mar 17, 2021 at 04:53:09PM +0100, Pablo Neira Ayuso wrote:
> On Wed, Mar 17, 2021 at 05:41:53PM +0300, ilker wrote:
> > it only gives the source MAC address:(
> > I need the destination MAC address.. I will use
> > src_mac+dst_mac+ethertype and reconstruct the full ETH header.
> > I tried
> > nfq_get_physindev_name
> > nfq_get_physoutdev_name
> > nfq_get_indev_name
> > nfq_get_outdev_name
> > 
> > but neither of them gave me a MAC.
> > A libpcap fanboy said that netfilter can not and libpcap can give.. I
> > don't want to convert my code to pcap that is why I am looking for a
> > solution.
> 
> nfq_get_indev_name provides the input device. From userspace, you can
> retrieve the destination MAC from the indev. The ethernet protocol is
> coming in the ->hw_protocol field.

I'm assuming your setup is a router, then destination MAC can be
infered.

  reply	other threads:[~2021-03-17 15:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-17 12:35 nfqueue ethernet packet frame capture ilker
2021-03-17 14:37 ` Pablo Neira Ayuso
     [not found]   ` <CADtAAp7Da8BtAK2zvhnT-RTG1myzbZ6k0xZgmifhsuYLAukDCQ@mail.gmail.com>
     [not found]     ` <20210317155251.GA1140@salvia>
2021-03-17 15:53       ` Pablo Neira Ayuso
2021-03-17 15:54         ` Pablo Neira Ayuso [this message]
2021-03-17 17:49           ` ilker
2021-03-18  0:39             ` Pablo Neira Ayuso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210317155414.GA1197@salvia \
    --to=pablo@netfilter.org \
    --cc=ilkery@gmail.com \
    --cc=netfilter@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox