public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Reinjecting IP Packets
@ 2003-08-22 14:41 Patrick Sodre Carlos
  2003-08-22 16:14 ` Ben Greear
  0 siblings, 1 reply; 7+ messages in thread
From: Patrick Sodre Carlos @ 2003-08-22 14:41 UTC (permalink / raw)
  To: lkml

Hi Guys,
   I'm trying to figure out what is the best way to reinject IP packets
into the stack. Does anyone have good/right/left ideas on this?

Thanks,
Patrick Sodre

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Reinjecting IP Packets
  2003-08-22 14:41 Reinjecting IP Packets Patrick Sodre Carlos
@ 2003-08-22 16:14 ` Ben Greear
  2003-08-22 16:24   ` Patrick Sodre Carlos
  2003-08-22 18:32   ` Parmer
  0 siblings, 2 replies; 7+ messages in thread
From: Ben Greear @ 2003-08-22 16:14 UTC (permalink / raw)
  To: Patrick Sodre Carlos; +Cc: lkml

Patrick Sodre Carlos wrote:
> Hi Guys,
>    I'm trying to figure out what is the best way to reinject IP packets
> into the stack. Does anyone have good/right/left ideas on this?

Maybe netif_rx() in net/core/dev.c ?

Ben



-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Reinjecting IP Packets
  2003-08-22 16:14 ` Ben Greear
@ 2003-08-22 16:24   ` Patrick Sodre Carlos
  2003-08-22 16:53     ` Ben Greear
  2003-08-22 16:55     ` Richard B. Johnson
  2003-08-22 18:32   ` Parmer
  1 sibling, 2 replies; 7+ messages in thread
From: Patrick Sodre Carlos @ 2003-08-22 16:24 UTC (permalink / raw)
  To: Ben Greear; +Cc: lkml


   My mistake... I forgot to mention that the packet will be coming from
user-space.

Patrick

On Fri, 2003-08-22 at 12:14, Ben Greear wrote:
> Patrick Sodre Carlos wrote:
> > Hi Guys,
> >    I'm trying to figure out what is the best way to reinject IP packets
> > into the stack. Does anyone have good/right/left ideas on this?
> 
> Maybe netif_rx() in net/core/dev.c ?
> 
> Ben
> 
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Reinjecting IP Packets
  2003-08-22 16:24   ` Patrick Sodre Carlos
@ 2003-08-22 16:53     ` Ben Greear
  2003-08-22 16:54       ` Ben Greear
  2003-08-22 16:55     ` Richard B. Johnson
  1 sibling, 1 reply; 7+ messages in thread
From: Ben Greear @ 2003-08-22 16:53 UTC (permalink / raw)
  To: Patrick Sodre Carlos; +Cc: lkml

Patrick Sodre Carlos wrote:
>    My mistake... I forgot to mention that the packet will be coming from
> user-space.
> 
> Patrick

Maybe net_queue_xmit() then?

If not, you need to explain more where the pkt is coming from, and
where you want it re-injected into the stack.

Ben

> 
> On Fri, 2003-08-22 at 12:14, Ben Greear wrote:
> 
>>Patrick Sodre Carlos wrote:
>>
>>>Hi Guys,
>>>   I'm trying to figure out what is the best way to reinject IP packets
>>>into the stack. Does anyone have good/right/left ideas on this?
>>
>>Maybe netif_rx() in net/core/dev.c ?
>>
>>Ben
>>
>>
> 
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 


-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Reinjecting IP Packets
  2003-08-22 16:53     ` Ben Greear
@ 2003-08-22 16:54       ` Ben Greear
  0 siblings, 0 replies; 7+ messages in thread
From: Ben Greear @ 2003-08-22 16:54 UTC (permalink / raw)
  To: Patrick Sodre Carlos; +Cc: lkml

Ben Greear wrote:
> Patrick Sodre Carlos wrote:
> 
>>    My mistake... I forgot to mention that the packet will be coming from
>> user-space.
>>
>> Patrick
> 
> 
> Maybe net_queue_xmit() then?
I meant dev_queue_xmit()

-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Reinjecting IP Packets
  2003-08-22 16:24   ` Patrick Sodre Carlos
  2003-08-22 16:53     ` Ben Greear
@ 2003-08-22 16:55     ` Richard B. Johnson
  1 sibling, 0 replies; 7+ messages in thread
From: Richard B. Johnson @ 2003-08-22 16:55 UTC (permalink / raw)
  To: Patrick Sodre Carlos; +Cc: Ben Greear, lkml

On Fri, 22 Aug 2003, Patrick Sodre Carlos wrote:

>
>    My mistake... I forgot to mention that the packet will be coming from
> user-space.
>
> Patrick

Then just use raw packets. Find the source of 'ping' and send
packets just like it does...

    ld->icp.net.icmp_id    = ld->ident;
    ld->icp.net.icmp_cksum = 0;
    ld->icp.net.icmp_cksum = chksum(&ld->icp, len);
    if(sendto(ld->s, &ld->icp, len, 0, &ld->where, sizeof(ld->where)) != len)
        perror("ping: sendto");
}


Cheers,
Dick Johnson
Penguin : Linux version 2.4.20 on an i686 machine (797.90 BogoMips).
            Note 96.31% of all statistics are fiction.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Reinjecting IP Packets
  2003-08-22 16:14 ` Ben Greear
  2003-08-22 16:24   ` Patrick Sodre Carlos
@ 2003-08-22 18:32   ` Parmer
  1 sibling, 0 replies; 7+ messages in thread
From: Parmer @ 2003-08-22 18:32 UTC (permalink / raw)
  To: Ben Greear; +Cc: Patrick Sodre Carlos, lkml

On Fri, 22 Aug 2003, Ben Greear wrote:

> Patrick Sodre Carlos wrote:
> > Hi Guys,
> >    I'm trying to figure out what is the best way to reinject IP packets
> > into the stack. Does anyone have good/right/left ideas on this?
>
> Maybe netif_rx() in net/core/dev.c ?

If you want an example of how this is done, look in /net/ipv4/ipip.c and
(I'm pretty sure) /net/ipv4/ip_gre.c.  I only know 2.4.*, but the files
still exist in 2.6, and they probably do it the same way.

Fairly elegant way to strip some headers and send it though again.

Hope that helps,
Gabe

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2003-08-22 18:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-08-22 14:41 Reinjecting IP Packets Patrick Sodre Carlos
2003-08-22 16:14 ` Ben Greear
2003-08-22 16:24   ` Patrick Sodre Carlos
2003-08-22 16:53     ` Ben Greear
2003-08-22 16:54       ` Ben Greear
2003-08-22 16:55     ` Richard B. Johnson
2003-08-22 18:32   ` Parmer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox