pppoe problem on an arm-based device.

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

 



Hi, all
I encountered a problem with pppoe on an arm-based device.

The target environment is arm-linux 2.4.18, glibc 2.3.3.
The cross-compiler is armv4l-linux-gnu-gcc 3.4.2.

I have cross-compiled pppd 2.4.3 and rp-pppoe 3.8 to device.
I can dial the normal 56K modem correctly by pppd. I think that the pppd
should be correct.

When I dial the ADSL modem, I found that the PADI packet was incorrect.
The PADI header generated by device is bigger than the correct one,
which is generated by PC. After checking the code, I found the ethhdr in
PPPoEPacketStruct was aligned incorrectly. So, I changed the
PPPoEPacketStruct as the following codes.

--------------------code modification-----------------------
typedef struct __attribute__ ((packed)) PPPoEPacketStruct {
    struct __attribute__ ((packed)){
        unsigned char   h_dest[ETH_ALEN];       /* destination eth addr
*/
        unsigned char   h_source[ETH_ALEN];     /* source ether addr
*/
        unsigned short  h_proto;                /* packet type ID field
*/
    } ethHdr;   /* Ethernet header */
#ifdef PACK_BITFIELDS_REVERSED
    unsigned int type:4;        /* PPPoE Type (must be 1) */
    unsigned int ver:4;         /* PPPoE Version (must be 1) */
#else
    unsigned int ver:4;         /* PPPoE Version (must be 1) */
    unsigned int type:4;        /* PPPoE Type (must be 1) */
#endif
    unsigned int code:8;        /* PPPoE code */
    unsigned int session:16;    /* PPPoE session */
    unsigned int length:16;     /* Payload length */
    unsigned char payload[ETH_DATA_LEN]; /* A bit of room to spare */
} PPPoEPacket;
--------------end of code modification----------
After changing that, the pppoe discovery process can be executed
correctly. The following message is output of pppd. 
-------output of pppd----------
using channel 29
Using interface ppp0
Connect: ppp0 <--> /dev/pts/1
Warning - secret file /etc/ppp/pap-secrets has world and/or group access
sent [LCP ConfReq id=0x1 <mru 1400> <magic 0xeed28429>]
rcvd [LCP ConfAck id=0x1 <mru 1400> <magic 0xeed28429>]
rcvd [LCP ConfReq id=0x2 <mru 1492> <auth pap> <magic 0x808bab9c>]
sent [LCP ConfAck id=0x2 <mru 1492> <auth pap> <magic 0x808bab9c>]
sent [LCP EchoReq id=0x0 magic=0xeed28429]
Warning - secret file /etc/ppp/pap-secrets has world and/or group access
sent [PAP AuthReq id=0x1 user="200000094404" password=<hidden>]
rcvd [LCP EchoRep id=0x0 magic=0x808bab9c]
rcvd [PAP AuthAck id=0x1 ""]
PAP authentication succeeded
sent [IPCP ConfReq id=0x1 <addr 0.0.0.0> <ms-dns1 0.0.0.0> <ms-dns3 0.0.0.0>]
rcvd [IPCP ConfReq id=0x1 <addr 61.148.2.2>]
sent [IPCP ConfAck id=0x1 <addr 61.148.2.2>]
rcvd [IPCP ConfNak id=0x1 <addr 221.218.186.182> <ms-dns1 202.106.46.151> <ms-dn
s3 202.106.0.20>]
sent [IPCP ConfReq id=0x2 <addr 221.218.186.182> <ms-dns1 202.106.46.151> <ms-dn
s3 202.106.0.20>]
rcvd [IPCP ConfAck id=0x2 <addr 221.218.186.182> <ms-dns1 202.106.46.151> <ms-dn
s3 202.106.0.20>]
local  IP address 221.218.186.182
remote IP address 61.148.2.2
primary   DNS address 202.106.46.151
secondary DNS address 202.106.0.20
-----------end of pppd output---------------

And the ifconfig and netstat also showed the ppp0 device had been set up
and the default gateway also had been added.

--------------command output------------------------
3.00# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:11:24:D2:F7:FF
          inet addr:192.168.0.111  Bcast:192.168.0.255
Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:578 errors:0 dropped:0 overruns:0 frame:0
          TX packets:444 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:2 Base address:0x300

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:12 errors:0 dropped:0 overruns:0 frame:0
          TX packets:12 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:840 (840.0 B)  TX bytes:840 (840.0 B)

ppp0      Link encap:Point-Point Protocol
          inet addr:222.130.210.110  P-t-P:61.148.2.2
Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1492  Metric:1
          RX packets:3 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:3
          RX bytes:54 (54.0 B)  TX bytes:54 (54.0 B)
3.00# netstat -nr
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt
Iface
61.148.2.2      0.0.0.0         255.255.255.255 UH       40 0          0
ppp0
192.168.0.0     0.0.0.0         255.255.255.0   U        40 0          0
eth0
0.0.0.0         61.148.2.2      0.0.0.0         UG       40 0          0
ppp0

3.00# ping 61.148.2.2
PING 61.148.2.2 (61.148.2.2): 56 data bytes
64 bytes from 61.148.2.2: icmp_seq=0 ttl=255 time=29.8 ms
64 bytes from 61.148.2.2: icmp_seq=1 ttl=255 time=29.5 ms
64 bytes from 61.148.2.2: icmp_seq=2 ttl=255 time=30.4 ms

------------end of command output------------

It seemed that the ADSL connection had been set up. But it can not
communicate with any host outsize the gateway. When I ping some IP
address, I found the ICMP packet had been sent, and the dest host had
also responded. Those incoming ICMP packets can be captured by the
packet capture tool, like ethereal. But the pppoe can not receive any of
them. (I have added the -D option to the pppoe command line.)

It seems that there must be something wrong within linux kernel, or some
additional kernel options should be turned on. But I don't know which
options are needed. 

Does anyone can help me? Thanks a lot!



Richard R. Zhang
20060705


-
To unsubscribe from this list: send the line "unsubscribe linux-ppp" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Audio Users]     [Linux for Hams]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Fedora Users]

  Powered by Linux