summaryrefslogtreecommitdiffstats
path: root/gatchat/ppp_cp.c
diff options
context:
space:
mode:
authorCaiwen Zhang <caiwen.zhang@windriver.com>2011-05-11 16:15:19 +0800
committerDenis Kenzior <denkenz@gmail.com>2011-05-11 13:29:30 -0500
commit37d04bee15cf2e339de04ecb26031b11b7fe28f5 (patch)
tree80ab1abecf59e5d9a4c372027424ac11bb2c4d78 /gatchat/ppp_cp.c
parent652f2963ae82f6dfd202b514fd364a307a19b82c (diff)
downloadofono-37d04bee15cf2e339de04ecb26031b11b7fe28f5.tar.bz2
gatppp: fix ppp protocol-reject constructing error
In PPP Protocol-Reject package the 'rejected data field' should be a copy of the rejected package, the copy starts from the data field. besides, Protocol-Reject package include a 'rejected protocol field', it is the same as the protocol field of the rejected package. Protocol-Reject package structure is: | PPP_header | rejected protocol | rejected data The rejected package structure is: | Addr | Control | protocol | data So the Protocol-Reject package data field is copied from the 3rd byte of the rejected package.
Diffstat (limited to 'gatchat/ppp_cp.c')
-rw-r--r--gatchat/ppp_cp.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/gatchat/ppp_cp.c b/gatchat/ppp_cp.c
index 6e4a9c52..bef83d2c 100644
--- a/gatchat/ppp_cp.c
+++ b/gatchat/ppp_cp.c
@@ -922,7 +922,8 @@ void pppcp_send_protocol_reject(struct pppcp_data *data,
* info should contain the old packet info, plus the 16bit
* protocol number we are rejecting.
*/
- packet = pppcp_packet_new(data, PPPCP_CODE_TYPE_PROTOCOL_REJECT, len);
+ packet = pppcp_packet_new(data, PPPCP_CODE_TYPE_PROTOCOL_REJECT,
+ len - 2);
/*
* Identifier must be changed for each Protocol-Reject sent
@@ -933,8 +934,7 @@ void pppcp_send_protocol_reject(struct pppcp_data *data,
* rejected packet should be copied in, but it should be
* truncated if it needs to be to comply with mtu requirement
*/
- memcpy(packet->data, rejected_packet,
- (ntohs(packet->length) - CP_HEADER_SZ));
+ memcpy(packet->data, rejected_packet + 2, len - 2);
ppp_transmit(data->ppp, pppcp_to_ppp_packet(packet),
ntohs(packet->length));