* Send packets from userspace program to kernel interface
@ 2016-08-16 6:30 Bhaskar Upadhyayula
2016-08-16 9:11 ` Alan Liddell
2016-08-16 9:39 ` François
0 siblings, 2 replies; 7+ messages in thread
From: Bhaskar Upadhyayula @ 2016-08-16 6:30 UTC (permalink / raw)
To: kernelnewbies
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.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Send packets from userspace program to kernel interface
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:42 ` Bhaskar Upadhyayula
2016-08-16 9:39 ` François
1 sibling, 2 replies; 7+ messages in thread
From: Alan Liddell @ 2016-08-16 9:11 UTC (permalink / raw)
To: kernelnewbies
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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20160816/760c1197/attachment.html
^ permalink raw reply [flat|nested] 7+ messages in thread
* Send packets from userspace program to kernel interface
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 ` François
1 sibling, 0 replies; 7+ messages in thread
From: François @ 2016-08-16 9:39 UTC (permalink / raw)
To: kernelnewbies
On Mon, Aug 15, 2016 at 11:30:56PM -0700, Bhaskar Upadhyayula wrote:
> Hello All,
Hi!
> 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.
I also think tun/tap will do the work you need.
I did not properly understand what exactly you want to achieve.
Anyway, have a look on that tutorial on tun/tap [1]. It's a great
overview of what you can do with this facility.
[1] http://backreference.org/2010/03/26/tuntap-interface-tutorial/
Best regards,
Fran?ois
^ permalink raw reply [flat|nested] 7+ messages in thread
* Send packets from userspace program to kernel interface
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
1 sibling, 1 reply; 7+ messages in thread
From: Gadre Nayan @ 2016-08-16 9:39 UTC (permalink / raw)
To: kernelnewbies
If you have multiple ports on your system, you may connect a cable
directly between two ports and send packets from one port and receive
on another.
On Tue, Aug 16, 2016 at 2:41 PM, 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
>
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Send packets from userspace program to kernel interface
2016-08-16 9:11 ` Alan Liddell
2016-08-16 9:39 ` Gadre Nayan
@ 2016-08-16 17:42 ` Bhaskar Upadhyayula
2016-08-16 19:56 ` Alan Liddell
1 sibling, 1 reply; 7+ messages in thread
From: Bhaskar Upadhyayula @ 2016-08-16 17:42 UTC (permalink / raw)
To: kernelnewbies
Hi Alan,
I am not sure how this will achieve what I want. Can you please
explain a bit more?
Thanks.
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Send packets from userspace program to kernel interface
2016-08-16 9:39 ` Gadre Nayan
@ 2016-08-16 17:45 ` Bhaskar Upadhyayula
0 siblings, 0 replies; 7+ messages in thread
From: Bhaskar Upadhyayula @ 2016-08-16 17:45 UTC (permalink / raw)
To: kernelnewbies
Hi Nayan,
This isn't possible as the switch will be at customer site and ports
are high premium real estate. A software solution is required.
Thx.
On Tue, Aug 16, 2016 at 2:39 AM, Gadre Nayan <gadrenayan@gmail.com> wrote:
> If you have multiple ports on your system, you may connect a cable
> directly between two ports and send packets from one port and receive
> on another.
>
> On Tue, Aug 16, 2016 at 2:41 PM, 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
>>
>>
>> _______________________________________________
>> Kernelnewbies mailing list
>> Kernelnewbies at kernelnewbies.org
>> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Send packets from userspace program to kernel interface
2016-08-16 17:42 ` Bhaskar Upadhyayula
@ 2016-08-16 19:56 ` Alan Liddell
0 siblings, 0 replies; 7+ messages in thread
From: Alan Liddell @ 2016-08-16 19:56 UTC (permalink / raw)
To: kernelnewbies
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
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2016-08-16 19:56 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2016-08-16 9:39 ` François
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).