Re: Send and receive packets with a kernel module via ppp0

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

thank you. The link below helps me a lot. I added a hook_func to my umts
kernel module and can now receive the incoming packets.

Regards

Doris

Parag N(पराग़) wrote:
> hi,
> On 5/7/07, Doris Jung <Doris.Jung@xxxxxxxx> wrote:
>> Hi,
>>
>> I answered your questions below.
>>
>> Regards
>>
>> Doris
>>
>> Parag N(पराग़) wrote:
>> > Hi,
>> > On 5/7/07, Doris Jung <Doris.Jung@xxxxxxxx> wrote:
>> >> Hi,
>> >>
>> >> I have the following problem:
>> >>
>> >> I'm working on a CarPc with Debian 2.6.15.
>> >>
>> >> I have to send and receive packets ( i.e. ping) from an own written
>> >> kernel module (I call it umts with the intercae umts0) to ppp0, which
>> >> has a connection to an umts modem via the nozomi driver.  With
>> each new
>> >> connection with the provider the ppp0 receives a new loacal
>> address i.e.
>> >> 90.187.103.249.
>> >>
>> >> I configured umts 0 with "ifconfig umts0 10.0.0.10 netmask
>> >> 255.255.255.0 "
>> >> and set it as default route with "route add default gw 10.0.0.10"
>> >>
>> >> For sending the packets from umts0 to ppp0 I use the following code:
>> >>
>> >>  struct net_device *dev_ppp0;
>> >>  dev_ppp0 = dev_get_by_name("ppp0");
>> >>  skb->dev = dev_ppp0;
>> >>  skb_pull(skb, 14);
>> >> *((skb->data)+12) = 90;
>> >> *((skb->data)+13) = 187;
>> >> *((skb->data)+14) = 103;
>> >> *((skb->data)+15) = 249;
>> >> skb->nh.iph->check = 0;
>> >> skb->nh.iph->check = ip_fast_csum((unsigned char *)skb->nh.iph,
>> >> skb->nh.iph->ihl);
>> >> skb->pkt_type = PACKET_OUTGOING;
>> >> dev_queue_xmit(skb);
>> >>
>> >> I changed the IP source address from 10.0.0.10 to 90.187.103.249
>> so that
>> >> ppp0 can receive the reply for the ping.
>> >>
>> >> I switch the ip forwarding on:
>> >> echo 1 >> /proc/sys/net/ipv4/ip_forward
>> >> cat /proc/sys/net/ipv4/ip_forward
>> >> 1
>> >>
>> >> With the code above I can receive the reply for the ping at ppp0
>> (seen
>> >> with "tcpdump -i ppp0 -x -e -vvv") but I don't know what I have to
>> do to
>> >> receive the ping reply packet with my umts module.
>> >>
>> >> I read
>> >>
>> http://kernelnewbies.org/Documents/LinuxIPNetworking#head-f204e85ca7561a0a903c6a94273b9ee7a27b4994.
>>
>> >>
>> >> and I have learned the following:
>> >> When a packet is received  the IP layer checks whether the packet is
>> >> for the own host (I think that's my case) or for another host. If
>> it's
>> >> for the own host the packet is sent to the transport layer. But in my
>> >> case the packet shouldn't be sent to the transport layer but to my
>> >> kernel module umts.
>> >
>> > I will need more input to answer this query. You mean you connected
>> > to internet by dialing umts modem and as its umts service each time
>> > you dial modem you are going to receive a new IP right?
>> Yes
>> > Now you
>> > created umts0 new network  interface and trying to send packets from
>> > umts0 to ppp0 to outside network?
>> Yes
>> >
>> >   You may need to use netfilter hooks to check if a packet received
>> > at ppp0 need to be forwarded to umts0 then code it to change
>> > destination IP from 90.187.103.249 to 10.0.0.10
>> >    I assume I understood what you want if not reply with more
>> > explanation.
>> Yes: ppp0 receives the packets and these packets should be transmitted
>> from 90.187.103.249 to 10.0.0.10. If I use netfilter for this, how can I
>> use it and which function of my umts kernel module can receive this
>> packet.
> You would like to go through
> http://www.phrack.org/archives/61/p61-0x0d_Hacking_the_Linux_Kernel_Network_Stack.txt
>
>
>> Is it the hard_start_xmit function of my device? Or can or have
>> I to register an additional function for the packets from outside?
> Regards,
> Parag.


-- 
Doris Jung

Software Engineer                        mm-lab GmbH
Phone: +49-(0)7154-827-321               Stammheimer Strasse 10
Fax:   +49-(0)7154-827-350               70806 Kornwestheim
Doris.Jung@xxxxxxxx                      www.mmlab.de


              Domicile of Company: Kornwestheim, Germany
    District Court - Court of Registration Stuttgart HRB 207257
Managing Directors: Bernd Herrmann, Dr. Michael Koch, Lothar Krank,
                  Michael Meiser, Dr. Andreas Streit


--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux