请教关于adsl在嵌入式系统中的一些问题
我用的开发板是s3c2410,系统是arm-linux,内核是"2.4.18-rmk7-hzh-yaffs.tar.bz2"。adsl modem是硬置modem,IP是192.168.1.1。
刚开始时用rp-pppoe-3.6无法获得IP,adsl modem不识别我所发送的PADI包。经过检查发现2410与PC对int等数据所占的内存字节数的规定好像并不相同,所以我发送的PADI包总是在中间多出两个字节,导致adsl modem不识别这个包。后来我将pppoe.h中的结构体
typedef struct PPPoEPacketStruct {
struct ethhdr 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;
修改了一下。其中struct ethhdr ethHdr是系统定义的以太网包头。我重新写了一个结构体来替换原来的:
typedef struct PPPoEPacketStruct {
u_int8_t h_dest[ETH_ALEN];
u_int8_t h_source[ETH_ALEN];
u_int16_t h_proto;
#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;
这里只是重新规定了以太网包头各类数据所占的字节数,其他都没有修改,发现问题解决了!终于可以从ISP服务商那里分配到IP了。
但当我ping一些网站时,发现modem有响应,也有数据的交换,但目标板却接收不到数据包。我用一个抓包工具来抓包,发现目标板的网卡上也有adsl modem所发送过来的数据包。我怀疑这可能又是哪里没定义好,导致目标板的网卡对adsl modem所发送过来的数据包不识别。
好郁闷啊,先是adsl modem不识别数据包,现在目标板又犯同样的问题,我都不知道该怎么办了。哪位高手帮我解答一下呀!
[ 本帖最后由 txb777 于 2006-4-3 12:34 编辑 ]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
以下是pppoe在2410下连网时的信息:
Connect: ppp0 <--> /dev/pts/0
Warning - secret file /etc/ppp/pap-secrets has world and/or group access
sent [LCP ConfReq id=0x1 <mru 1492> <magic 0xe7971296>]
rcvd [LCP ConfReq id=0x1 <mru 1492> <auth pap> <magic 0x75170000>]
sent [LCP ConfAck id=0x1 <mru 1492> <auth pap> <magic 0x75170000>]
rcvd [LCP ConfAck id=0x1 <mru 1492> <magic 0xe7971296>]
sent [LCP EchoReq id=0x0 magic=0xe7971296]
Warning - secret file /etc/ppp/pap-secrets has world and/or group access
sent [PAP AuthReq id=0x1 user="100001398172" password=<hidden>]
rcvd [LCP EchoRep id=0x0 magic=0x75170000]
rcvd [IPCP ConfReq id=0x0 <addr 61.51.120.1>]
discarding proto 0x8021 in phase 5
sent [PAP AuthReq id=0x2 user="100001398172" password=<hidden>]
rcvd [PAP AuthAck id=0x2 ""]
PAP authentication succeeded
sent [IPCP ConfReq id=0x1 <addr 0.0.0.0>]
rcvd [IPCP ConfNak id=0x1 <addr 61.51.123.14>]
sent [IPCP ConfReq id=0x2 <addr 61.51.123.14>]
rcvd [IPCP ConfAck id=0x2 <addr 61.51.123.14>]
rcvd [IPCP ConfReq id=0x1 <addr 61.51.120.1>]
sent [IPCP ConfAck id=0x1 <addr 61.51.120.1>]
local IP address 61.51.123.14
remote IP address 61.51.120.1
其中discarding proto 0x8021 in phase 5是什么意思呀?这对上网有什么影响吗?望指教!