From: alan.c.liddell@gmail.com (Alan Liddell)
To: kernelnewbies@lists.kernelnewbies.org
Subject: Send packets from userspace program to kernel interface
Date: Tue, 16 Aug 2016 20:56:00 +0100 [thread overview]
Message-ID: <2153796.KVbiqTPpqb@localhost.localdomain> (raw)
In-Reply-To: <CADmdLE_HXYynqHL2-CTb+b32f5KRCFHkDJ_78PjCh3PdWJavLg@mail.gmail.com>
On Tuesday 16 August 2016 10:42:13 A.M. IST Bhaskar Upadhyayula wrote:
> Hi Alan,
>
> I am not sure how this will achieve what I want. Can you please
> explain a bit more?
>
> Thanks.
Well, if you're truly sampling and not just capturing every packet, then in theory there's a nonzero probability that sending the packet back out, addressed to 127.0.0.1 but otherwise unchanged, will not be captured again and then traverse up the kernel's networking stack as usual. Is this not what you want?
>
> On Tue, Aug 16, 2016 at 2:11 AM, Alan Liddell <alan.c.liddell@gmail.com> wrote:
> > Would sending the packet back out through the loopback address accomplish
> > what you're looking to do?
> >
> >
> > On Aug 16, 2016 7:51 AM, "Bhaskar Upadhyayula" <bu.kernel@gmail.com> wrote:
> >>
> >> Hello All,
> >>
> >> Summary:
> >> ===
> >> If a userspace program has a well crafted packet (ethernet or IPv4 or
> >> other protocol packet), is there a way for it to send the packet to
> >> kernel's network interface, simulating the behavior that the packet
> >> ingress'ed on that interface? Is this possible?
> >>
> >>
> >> Detailed Problem Description:
> >> ===
> >> I am working on packet sampling feature (sFlow) on OpenSwitch
> >> (www.openswitch.net) Network OS. Currently, this OS is supported on
> >> few Accton switches that has Broadcom's Trident2 chipset. When we
> >> enable packet sampling, the sampled packets are sent to a userspace
> >> program, by passing the kernel network stack. This is a problem if the
> >> packet was supposed to go up the network stack.
> >>
> >> I am investigating options to re-send the packet back to kernel
> >> interface on which packet arrived on the switch. Hence this question.
> >>
> >> A colleague suggested looking at Tuntap interfaces. I did a quick
> >> research and it did not appear that can be done.
> >>
> >> Any suggestions or pointers for further reading will be very helpful.
> >>
> >>
> >> Thanks.
> >>
> >> _______________________________________________
> >> Kernelnewbies mailing list
> >> Kernelnewbies at kernelnewbies.org
> >> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
--
--ACL
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 473 bytes
Desc: This is a digitally signed message part.
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20160816/5f7bfcc0/attachment.bin
next prev parent reply other threads:[~2016-08-16 19:56 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-16 6:30 Send packets from userspace program to kernel interface Bhaskar Upadhyayula
2016-08-16 9:11 ` Alan Liddell
2016-08-16 9:39 ` Gadre Nayan
2016-08-16 17:45 ` Bhaskar Upadhyayula
2016-08-16 17:42 ` Bhaskar Upadhyayula
2016-08-16 19:56 ` Alan Liddell [this message]
2016-08-16 9:39 ` François
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=2153796.KVbiqTPpqb@localhost.localdomain \
--to=alan.c.liddell@gmail.com \
--cc=kernelnewbies@lists.kernelnewbies.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;
as well as URLs for NNTP newsgroup(s).