Correct PPTP server firewall rules chain.
[tomato/davidwu.git] / release / src / router / pptp-client / orckit_quirks.c
blob1d0373782cbb8c9671410cb5a6e7ef88e1f91d94
1 /* orckit_quirks.c ...... fix quirks in orckit adsl modems
2 * mulix <mulix@actcom.co.il>
4 * $Id: orckit_quirks.c,v 1.3 2002/03/01 01:23:36 quozl Exp $
5 */
7 #include <string.h>
8 #include <sys/types.h>
9 #include <netinet/in.h>
10 #include "pptp_msg.h"
11 #include "pptp_options.h"
12 #include "pptp_ctrl.h"
13 #include "util.h"
17 /* return 0 on success, non zero otherwise */
18 int
19 orckit_atur3_build_hook(struct pptp_out_call_rqst* packet)
21 unsigned int name_length = 10;
23 struct pptp_out_call_rqst fixed_packet = {
24 PPTP_HEADER_CTRL(PPTP_OUT_CALL_RQST),
25 0, /* hton16(call->callid) */
26 0, /* hton16(call->sernum) */
27 hton32(PPTP_BPS_MIN), hton32(PPTP_BPS_MAX),
28 hton32(PPTP_BEARER_DIGITAL), hton32(PPTP_FRAME_ANY),
29 hton16(PPTP_WINDOW), 0, hton16(name_length), 0,
30 {'R','E','L','A','Y','_','P','P','P','1',0}, {0}
33 if (!packet)
34 return -1;
36 memcpy(packet, &fixed_packet, sizeof(*packet));
38 return 0;
41 /* return 0 on success, non zero otherwise */
42 int
43 orckit_atur3_set_link_hook(struct pptp_set_link_info* packet,
44 int peer_call_id)
46 struct pptp_set_link_info fixed_packet = {
47 PPTP_HEADER_CTRL(PPTP_SET_LINK_INFO),
48 hton16(peer_call_id),
50 0xffffffff,
51 0xffffffff};
53 if (!packet)
54 return -1;
56 memcpy(packet, &fixed_packet, sizeof(*packet));
57 return 0;
60 /* return 0 on success, non 0 otherwise */
61 int
62 orckit_atur3_start_ctrl_conn_hook(struct pptp_start_ctrl_conn* packet)
64 struct pptp_start_ctrl_conn fixed_packet = {
65 {0}, /* we'll set the header later */
66 hton16(PPTP_VERSION), 0, 0,
67 hton32(PPTP_FRAME_ASYNC), hton32(PPTP_BEARER_ANALOG),
68 hton16(0) /* max channels */,
69 hton16(0x6021),
70 {'R','E','L','A','Y','_','P','P','P','1',0}, /* hostname */
71 {'M','S',' ','W','i','n',' ','N','T',0} /* vendor */
74 if (!packet)
75 return -1;
77 /* grab the header from the original packet, since we dont
78 know if this is a request or a reply */
79 memcpy(&fixed_packet.header, &packet->header, sizeof(struct pptp_header));
81 /* and now overwrite the full packet, effectively preserving the header */
82 memcpy(packet, &fixed_packet, sizeof(*packet));
83 return 0;