Dukales 0 9 июля, 2012 Опубликовано 9 июля, 2012 (изменено) · Жалоба Не знаю, существуют ли русскоязычные гуру в PPP, но рискну. На STM32F407 крутится FreeRTOS с lwIP. Пытаюсь установить PPP-соединение, но оно не устанавливается до конца. Собрал с выводом диагностической информации (лог - ниже), но интерпретировать не могу. Видел в интернете, что у людей возникают схожие проблемы, но решений и у них нет. Помогите пожалуйста найти решение проблемы. Пакеты фрагментируются, та как приходится перенаправлять траффик с USB-модема, подключённого к компьютеру, на устройство и обратно. Скрипт в режиме поллинга с периодом 0.1 секунды читает и пишет из виртуального COM-порта USB-модема в COM-порт, к которому подключено устройство, и наоборот. Думаю пакеты из байтов должны нормально собираться. sio_read не бесконечно блокирующая, стоит таймаут 1.5 секунды. Иначе вообще ничего не получается. send: 'ATZ0 E0 V0' recv: 0 send: 'ATS0=0' recv: 0 send: 'AT+CGDCONT=1,"IP","internet.mts.ru"' recv: 0 send: 'ATDT*99#' recv: 1 lcp_init: xmit_accm=0 0 0 0 upap_init: 0 pppOverSerialOpen: unit 0: Connecting pppStart: unit 0 ppp_set_xaccm[0]: outACCM=0 0 0 0 ppp_send_config[0]: outACCM=FF FF FF FF ppp_recv_config[0]: inACCM=0 0 0 0 lcp_lowerup: asyncmap=0 0 0 0 LCP: lowerup state 0 (LS_INITIAL) -> 2 (LS_CLOSED) auth_reset: 0 lcp_addci: L opt=2 0 lcp_addci: L opt=5 52181044 lcp_addci: opt=7 lcp_addci: opt=8 pppWrite[0]: len=47 fsm_sdata(LCP): Sent code 1,1,20. LCP: sending Configure-Request, id 1 LCP: open state 2 (LS_CLOSED) -> 6 (LS_REQSENT) pppStart: finished pppInProc[0]: got 154 bytes pppInput[0]: LCP len=25 fsm_input(LCP):1,224,25 fsm 0 lcp_addci: L opt=5 33CF11CE lcp_addci: opt=7 lcp_addci: opt=8 pppWrite[0]: len=46 fsm_sdata(LCP): Sent code 1,2,20. LCP: sending Configure-Request, id 2 lcp_reqci: rcvd ASYNCMAP=0 CHAP C223,5 MAGICNUMBER (19972D3) PCOMPRESSION lcp_reqci: ACCOMPRESSION lcp_reqci: returning CONFACK. pppWrite[0]: len=53 fsm_sdata(LCP): Sent code 2,225,25. pppInput[0]: packet processed pppInProc[0]: got 153 bytes pppInput[0]: LCP len=25 fsm_input(LCP):1,226,25 fs2 0 lcp_addci: L opt=5 F7BDAD33 lcp_addci: opt=7 lcp_addci: opt=8 pppWrite[0]: len=44 fsm_sdata(LCP): Sent code 1,3,20. LCP: sending Configure-Request, id 3 lcp_reqci: rcvd ASYNCMAP=0 CHAP C223,5 MAGICNUMBER (19972D3) PCOMPRESSION lcp_reqci: ACCOMPRESSION lcp_reqci: returning CONFACK. pppWrite[0]: len=52 fsm_sdata(LCP): Sent code 2,227,25. pppInput[0]: packet processed pppInProc[0]: got 151 bytes pppInput[0]: LCP len=25 fsm_input(LCP):1,228,25 fsm 0 lcp_addci: L opt=5 246375C lcp_addci: opt=7 lcp_addci: opt=8 pppWrite[0]: len=45 fsm_sdata(LCP): Sent code 1,4,20. LCP: sending Configure-Request, id 4 lcp_reqci: rcvd ASYNCMAP=0 CHAP C223,5 MAGICNUMBER (19972D3) PCOMPRESSION lcp_reqci: ACCOMPRESSION lcp_reqci: returning CONFACK. pppWrite[0]: len=52 fsm_sdata(LCP): Sent code 2,229,25. pppInput[0]: packet processed pppInProc[0]: got 153 bytes pppInput[0]: LCP len=25 fsm_input(LCP):1,230,25 fs2 0 lcp_addci: L opt=5 E236C5DD lcp_addci: opt=7 lcp_addci: opt=8 pppWrite[0]: len=44 fsm_sdata(LCP): Sent code 1,5,20. LCP: sending Configure-Request, id 5 lcp_reqci: rcvd ASYNCMAP=0 CHAP C223,5 MAGICNUMBER (19972D3) PCOMPRESSION lcp_reqci: ACCOMPRESSION lcp_reqci: returning CONFACK. pppWrite[0]: len=52 fsm_sdata(LCP): Sent code 2,231,25. pppInput[0]: packet processed pppInProc[0]: got 152 bytes pppInput[0]: LCP len=25 fsm_input(LCP):1,232,25 fsm 0 lcp_addci: L opt=5 8E005B91 lcp_addci: opt=7 lcp_addci: opt=8 pppWrite[0]: len=46 fsm_sdata(LCP): Sent code 1,6,20. LCP: sending Configure-Request, id 6 lcp_reqci: rcvd ASYNCMAP=0 CHAP C223,5 MAGICNUMBER (19972D3) PCOMPRESSION lcp_reqci: ACCOMPRESSION lcp_reqci: returning CONFACK. pppWrite[0]: len=52 fsm_sdata(LCP): Sent code 2,233,25. pppInput[0]: packet processed pppInProc[0]: got 153 bytes pppInput[0]: LCP len=25 fsm_input(LCP):1,234,25 fs2 0 lcp_addci: L opt=5 37DA08AA lcp_addci: opt=7 lcp_addci: opt=8 pppWrite[0]: len=45 fsm_sdata(LCP): Sent code 1,7,20. LCP: sending Configure-Request, id 7 lcp_reqci: rcvd ASYNCMAP=0 CHAP C223,5 MAGICNUMBER (19972D3) PCOMPRESSION lcp_reqci: ACCOMPRESSION lcp_reqci: returning CONFACK. pppWrite[0]: len=52 fsm_sdata(LCP): Sent code 2,235,25. pppInput[0]: packet processed pppInProc[0]: got 152 bytes pppInput[0]: LCP len=25 fsm_input(LCP):1,236,25 fsm 0 lcp_addci: L opt=5 7D452883 lcp_addci: opt=7 lcp_addci: opt=8 pppWrite[0]: len=46 fsm_sdata(LCP): Sent code 1,8,20. LCP: sending Configure-Request, id 8 lcp_reqci: rcvd ASYNCMAP=0 CHAP C223,5 MAGICNUMBER (19972D3) PCOMPRESSION lcp_reqci: ACCOMPRESSION lcp_reqci: returning CONFACK. pppWrite[0]: len=52 fsm_sdata(LCP): Sent code 2,237,25. pppInput[0]: packet processed pppInProc[0]: got 154 bytes pppInput[0]: LCP len=25 fsm_input(LCP):1,238,25 fs2 0 lcp_addci: L opt=5 BB77512B lcp_addci: opt=7 lcp_addci: opt=8 pppWrite[0]: len=44 fsm_sdata(LCP): Sent code 1,9,20. LCP: sending Configure-Request, id 9 lcp_reqci: rcvd ASYNCMAP=0 CHAP C223,5 MAGICNUMBER (19972D3) PCOMPRESSION lcp_reqci: ACCOMPRESSION lcp_reqci: returning CONFACK. pppWrite[0]: len=53 fsm_sdata(LCP): Sent code 2,239,25. pppInput[0]: packet processed pppInProc[0]: got 151 bytes pppInput[0]: LCP len=25 fsm_input(LCP):1,240,25 fsm 0 lcp_addci: L opt=5 320709B8 lcp_addci: opt=7 lcp_addci: opt=8 pppWrite[0]: len=47 fsm_sdata(LCP): Sent code 1,10,20. LCP: sending Configure-Request, id 10 lcp_reqci: rcvd ASYNCMAP=0 CHAP C223,5 MAGICNUMBER (19972D3) PCOMPRESSION lcp_reqci: ACCOMPRESSION lcp_reqci: returning CONFACK. pppWrite[0]: len=52 fsm_sdata(LCP): Sent code 2,241,25. pppInput[0]: packet processed pppInProc[0]: got 154 bytes pppInput[0]: LCP len=25 fsm_input(LCP):1,242,25 fst=2 0 lcp_addci: L opt=5 874F608F lcp_addci: opt=7 lcp_addci: opt=8 pppWrite[0]: len=44 fsm_sdata(LCP): Sent code 1,11,20. LCP: sending Configure-Request, id 11 lcp_reqci: rcvd ASYNCMAP=0 CHAP C223,5 MAGICNUMBER (19972D3) PCOMPRESSION lcp_reqci: ACCOMPRESSION lcp_reqci: returning CONFACK. pppWrite[0]: len=52 fsm_sdata(LCP): Sent code 2,243,25. pppInput[0]: packet processed pppInProc[0]: got 2 bytes LCP: timeout resending Config-Request state=8 (LS_ACKSENT) lcp_addci: L opt=2 0 lcp_addci: L opt=5 874F608F lcp_addci: opt=7 lcp_addci: opt=8 pppWrite[0]: len=45 fsm_sdata(LCP): Sent code 1,11,20. LCP: sending Configure-Request, id 11 pppClose() called pppClose: unit 0 kill_link -> pppStop pppStop: unit 0 pppWrite[0]: len=29 fsm_sdata(LCP): Sent code 5,12,16. LCP: close reason=User request state 8 (LS_ACKSENT) -> 4 (LS_CLOSING) pppRecvWakeup: unit 0 LCP: timeout resending Terminate-Requests state=4 (LS_CLOSING) pppWrite[0]: len=29 fsm_sdata(LCP): Sent code 5,13,16. LCP: timeout sending Terminate-Request state=4 (LS_CLOSING) link_terminated: 0 Connection terminated. pppLinkTerminated: unit 0 pppRecvWakeup: unit 0 pppLinkTerminated: unit 0: linkStatusCB=0x800de11 errCode=-5 pppLinkTerminated: finished. Изменено 9 июля, 2012 пользователем IgorKossak [codebox] для длинных простыней!!! Цитата Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты Поделиться
AlexandrY 3 10 июля, 2012 Опубликовано 10 июля, 2012 · Жалоба Такое ощущение, что не договорились про ACCM. Вернее похоже вообще не было факта обмена ACCM. Цитата Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты Поделиться
kan35 7 10 июля, 2012 Опубликовано 10 июля, 2012 · Жалоба Не похоже на мой лог. Попробую пальцем в небо: У вас вроде бы включена CHAP авторизация, но на сколько мне известно то ли не все модемы ее знают то лине все операторы, потому, советую начинать с PAP авторизации. Так же отключить саппорт всевозможных компрессий для начала. Цитата Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты Поделиться
Dukales 0 12 июля, 2012 Опубликовано 12 июля, 2012 (изменено) · Жалоба Не похоже на мой лог. Попробую пальцем в небо: У вас вроде бы включена CHAP авторизация, но на сколько мне известно то ли не все модемы ее знают то лине все операторы, потому, советую начинать с PAP авторизации. Так же отключить саппорт всевозможных компрессий для начала. Уже всё пробовал (а именно: пробовал при сборке lwIP отключать PAP, CHAP по отдельности). lcp_init: xmit_accm=0 0 0 0 upap_init: 0 tx dump (11/11): 41 54 20 5A 30 20 45 30 20 56 30 AT.Z0.E0.V0 rx dump (0/256): tx dump (2/2): 0D 0A .. rx dump (2/256): 30 0D 0. tx dump (7/7): 41 54 20 53 30 3D 30 AT.S0=0 rx dump (0/256): tx dump (2/2): 0D 0A .. rx dump (2/256): 30 0D 0. tx dump (36/36): 41 54 20 2B 43 47 44 43 4F 4E 54 3D 31 2C 22 49 AT.+CGDCONT=1,"I 50 22 2C 22 69 6E 74 65 72 6E 65 74 2E 6D 74 73 P","internet.mts 2E 72 75 22 .ru" rx dump (0/256): tx dump (2/2): 0D 0A .. rx dump (2/256): 30 0D 0. tx dump (9/9): 41 54 20 44 54 2A 39 39 23 AT.DT*99# rx dump (0/256): tx dump (2/2): 0D 0A .. rx dump (2/256): 31 0D 1. pppOverSerialOpen: unit 0: Connecting pppStart: unit 0 ppp_set_xaccm[0]: outACCM=0 0 0 0 ppp_send_config[0]: outACCM=FF FF FF FF ppp_recv_config[0]: inACCM=0 0 0 0 lcp_lowerup: asyncmap=0 0 0 0 LCP: lowerup state 0 (LS_INITIAL) -> 2 (LS_CLOSED) auth_reset: 0 lcp_addci: L opt=2 0 lcp_addci: L opt=5 52181044 lcp_addci: opt=7 lcp_addci: opt=8 pppWrite[0]: len=47 tx dump (47/47): 7E FF 7D 23 C0 21 7D 21 7D 21 7D 20 7D 34 7D 22 ~.}#.!}!}!}.}4}" 7D 26 7D 20 7D 20 7D 20 7D 20 7D 25 7D 26 52 7D }&}.}.}.}.}%}&R} 38 7D 30 44 7D 27 7D 22 7D 28 7D 22 6E E1 7E 8}0D}'}"}(}"n.~ fsm_sdata(LCP): Sent code 1,1,20. LCP: sending Configure-Request, id 1 LCP: open state 2 (LS_CLOSED) -> 6 (LS_REQSENT) pppStart: finished rx dump (101/1504): 7E FF 7D 23 C0 21 7D 21 38 7D 20 7D 39 7D 22 7D ~.}#.!}!8}.}9}"} 26 7D 20 7D 20 7D 20 7D 20 7D 23 7D 25 C2 23 7D &}.}.}.}.}#}%.#} 25 7D 25 7D 26 7D 30 D4 45 7D 24 7D 27 7D 22 7D %}%}&}0.E}$}'}"} 28 7D 22 7C 93 7E 7E FF 7D 23 C0 21 7D 22 7D 21 (}"|.~~.}#.!}"}! 7D 20 7D 34 7D 22 7D 26 7D 20 7D 20 7D 20 7D 20 }.}4}"}&}.}.}.}. 7D 25 7D 26 52 7D 38 7D 30 44 7D 27 7D 22 7D 28 }%}&R}8}0D}'}"}( 7D 22 85 88 7E }"..~ pppInProc[0]: got 101 bytes pppInput[0]: LCP len=25 fsm_input(LCP):1,56,25 fsm_rconfreq(LCP): Rcvd id 56 state=6 (LS_REQSENT) lcp_reqci: rcvd ASYNCMAP=0 CHAP C223,5 MAGICNUMBER (10D44504) PCOMPRESSION lcp_reqci: ACCOMPRESSION lcp_reqci: returning CONFACK. pppWrite[0]: len=54 tx dump (54/54): 7E FF 7D 23 C0 21 7D 22 38 7D 20 7D 39 7D 22 7D ~.}#.!}"8}.}9}"} 26 7D 20 7D 20 7D 20 7D 20 7D 23 7D 25 C2 23 7D &}.}.}.}.}#}%.#} 25 7D 25 7D 26 7D 30 D4 45 7D 24 7D 27 7D 22 7D %}%}&}0.E}$}'}"} 28 7D 22 F1 9F 7E (}"..~ fsm_sdata(LCP): Sent code 2,56,25. pppInput[0]: packet processed pppInput[0]: LCP len=20 fsm_input(LCP):2,1,20 fsm_rconfack(LCP): Rcvd id 1 state=8 (LS_ACKSENT) lcp_acki: Ack ppp_send_config[0]: outACCM=0 0 0 0 ppp_recv_config[0]: inACCM=0 0 0 0 link_established: unit 0; Lowering up all protocols... upap_lowerup: init 0 clientstate s=0 IPCP: lowerup state 0 (LS_INITIAL) -> 2 (LS_CLOSED) pppInput[0]: packet processed rx dump (63/1504): 7E FF 7D 23 C0 21 7D 2B 39 7D 20 7D 28 7D 30 D4 ~.}#.!}+9}.}(}0. 45 7D 24 92 A3 7E 7E C2 23 01 01 00 23 10 CC 3F E}$..~~.#...#..? 30 59 D2 97 AC 6E C2 94 23 05 30 4F FB 62 55 4D 0Y...n..#.0O.bUM 54 53 5F 43 48 41 50 5F 53 52 56 52 B5 2C 7E TS_CHAP_SRVR.,~ pppInProc[0]: got 63 bytes pppInput[0]: LCP len=8 fsm_input(LCP):11,57,8 fsm_input(LCP): default: pppInput[0]: packet processed pppInput[0]: CHAP len=35 ChapReceiveChallenge: Rcvd id 1. ChapReceiveChallenge: received name field 'UMTS_CHAP_SRVR' pppWrite[0]: len=32 tx dump (32/32): 7E FF 03 C2 23 02 01 00 18 10 E0 E0 69 02 0F B6 ~...#.......i... BB 51 56 A0 8A 88 E1 9E EB A2 6D 74 73 4C B8 7E .QV.......mtsL.~ pppInput[0]: packet processed rx dump (10/1504): 7E C2 23 03 01 00 04 C2 BC 7E ~.#......~ pppInProc[0]: got 10 bytes pppInput[0]: CHAP len=4 ChapReceiveSuccess: Rcvd id 1. auth_withpeer_success: 0 proto=C223 pppWrite[0]: len=30 tx dump (30/30): 7E FF 03 80 21 01 01 00 16 03 06 00 00 00 00 81 ~...!........... 06 00 00 00 00 83 06 00 00 00 00 6E DB 7E ...........n.~ fsm_sdata(IPCP): Sent code 1,1,22. IPCP: sending Configure-Request, id 1 IPCP: open state 2 (LS_CLOSED) -> 6 (LS_REQSENT) pppInput[0]: packet processed rx dump (2/1504): 33 0D 3. pppInProc[0]: got 2 bytes rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): IPCP: timeout resending Config-Request state=6 (LS_REQSENT) pppWrite[0]: len=30 tx dump (30/30): 7E FF 03 80 21 01 01 00 16 03 06 00 00 00 00 81 ~...!........... 06 00 00 00 00 83 06 00 00 00 00 6E DB 7E ...........n.~ fsm_sdata(IPCP): Sent code 1,1,22. IPCP: sending Configure-Request, id 1 rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): Изменено 12 июля, 2012 пользователем eisufu Цитата Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты Поделиться
kan35 7 12 июля, 2012 Опубликовано 12 июля, 2012 · Жалоба как я понимаю нужно оставить что то одно или CHAP или PAP, оставьте PAP и дайте лог. Цитата Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты Поделиться
Dukales 0 13 июля, 2012 Опубликовано 13 июля, 2012 · Жалоба как я понимаю нужно оставить что то одно или CHAP или PAP, оставьте PAP и дайте лог. вот лог lcp_init: xmit_accm=0 0 0 0 upap_init: 0 tx dump (11/11): 41 54 20 5A 30 20 45 30 20 56 30 AT.Z0.E0.V0 rx dump (0/256): tx dump (2/2): 0D 0A .. rx dump (2/256): 30 0D 0. tx dump (7/7): 41 54 20 53 30 3D 30 AT.S0=0 rx dump (0/256): tx dump (2/2): 0D 0A .. rx dump (2/256): 30 0D 0. tx dump (36/36): 41 54 20 2B 43 47 44 43 4F 4E 54 3D 31 2C 22 49 AT.+CGDCONT=1,"I 50 22 2C 22 69 6E 74 65 72 6E 65 74 2E 6D 74 73 P","internet.mts 2E 72 75 22 .ru" rx dump (0/256): tx dump (2/2): 0D 0A .. rx dump (2/256): 30 0D 0. tx dump (9/9): 41 54 20 44 54 2A 39 39 23 AT.DT*99# rx dump (0/256): tx dump (2/2): 0D 0A .. rx dump (2/256): 31 0D 1. pppOverSerialOpen: unit 0: Connecting pppStart: unit 0 ppp_set_xaccm[0]: outACCM=0 0 0 0 ppp_send_config[0]: outACCM=FF FF FF FF ppp_recv_config[0]: inACCM=0 0 0 0 lcp_lowerup: asyncmap=0 0 0 0 LCP: lowerup state 0 (LS_INITIAL) -> 2 (LS_CLOSED) auth_reset: 0 lcp_addci: L opt=2 0 lcp_addci: L opt=5 34DE8CCF lcp_addci: opt=7 lcp_addci: opt=8 pppWrite[0]: len=45 tx dump (45/45): 7E FF 7D 23 C0 21 7D 21 7D 21 7D 20 7D 34 7D 22 ~.}#.!}!}!}.}4}" 7D 26 7D 20 7D 20 7D 20 7D 20 7D 25 7D 26 34 DE }&}.}.}.}.}%}&4. 8C CF 7D 27 7D 22 7D 28 7D 22 57 8D 7E ..}'}"}(}"W.~ fsm_sdata(LCP): Sent code 1,1,20. LCP: sending Configure-Request, id 1 LCP: open state 2 (LS_CLOSED) -> 6 (LS_REQSENT) pppStart: finished rx dump (98/1504): 7E FF 7D 23 C0 21 7D 21 66 7D 20 7D 39 7D 22 7D ~.}#.!}!f}.}9}"} 26 7D 20 7D 20 7D 20 7D 20 7D 23 7D 25 C2 23 7D &}.}.}.}.}#}%.#} 25 7D 25 7D 26 7D 34 56 A8 81 7D 27 7D 22 7D 28 %}%}&}4V..}'}"}( 7D 22 21 CA 7E 7E FF 7D 23 C0 21 7D 22 7D 21 7D }"!.~~.}#.!}"}!} 20 7D 34 7D 22 7D 26 7D 20 7D 20 7D 20 7D 20 7D .}4}"}&}.}.}.}.} 25 7D 26 34 DE 8C CF 7D 27 7D 22 7D 28 7D 22 BC %}&4...}'}"}(}". E4 7E .~ pppInProc[0]: got 98 bytes pppInput[0]: LCP len=25 fsm_input(LCP):1,102,25 fsm_rconfreq(LCP): Rcvd id 102 state=6 (LS_REQSENT) lcp_reqci: rcvd ASYNCMAP=0 CHAP C223,5 MAGICNUMBER (1456A881) PCOMPRESSION lcp_reqci: ACCOMPRESSION lcp_reqci: returning CONFACK. pppWrite[0]: len=53 tx dump (53/53): 7E FF 7D 23 C0 21 7D 22 66 7D 20 7D 39 7D 22 7D ~.}#.!}"f}.}9}"} 26 7D 20 7D 20 7D 20 7D 20 7D 23 7D 25 C2 23 7D &}.}.}.}.}#}%.#} 25 7D 25 7D 26 7D 34 56 A8 81 7D 27 7D 22 7D 28 %}%}&}4V..}'}"}( 7D 22 AC C6 7E }"..~ fsm_sdata(LCP): Sent code 2,102,25. pppInput[0]: packet processed pppInput[0]: LCP len=20 fsm_input(LCP):2,1,20 fsm_rconfack(LCP): Rcvd id 1 state=8 (LS_ACKSENT) lcp_acki: Ack ppp_send_config[0]: outACCM=0 0 0 0 ppp_recv_config[0]: inACCM=0 0 0 0 link_established: unit 0; Lowering up all protocols... upap_lowerup: init 0 clientstate s=0 IPCP: lowerup state 0 (LS_INITIAL) -> 2 (LS_CLOSED) pppWrite[0]: len=29 tx dump (29/29): FF 03 80 21 01 01 00 16 03 06 00 00 00 00 81 06 ...!............ 00 00 00 00 83 06 00 00 00 00 6E DB 7E ..........n.~ fsm_sdata(IPCP): Sent code 1,1,22. IPCP: sending Configure-Request, id 1 IPCP: open state 2 (LS_CLOSED) -> 6 (LS_REQSENT) pppInput[0]: packet processed rx dump (65/1504): 7E FF 7D 23 C0 21 7D 2B 67 7D 20 7D 28 7D 34 56 ~.}#.!}+g}.}(}4V A8 81 80 7D 36 7E 7E C2 23 01 01 00 23 10 94 F8 ...}6~~.#...#... 71 E7 40 33 77 EB 84 27 C6 DE 5E BD 4C A3 55 4D q.@3w..'..^.L.UM 54 53 5F 43 48 41 50 5F 53 52 56 52 B8 EF 7E 33 TS_CHAP_SRVR..~3 0D . pppInProc[0]: got 65 bytes pppInput[0]: LCP len=8 fsm_input(LCP):11,103,8 fsm_input(LCP): default: pppInput[0]: packet processed pppInput[0]: rejecting unsupported proto 0xc223 len=35 pppWrite[0]: len=49 tx dump (49/49): 7E FF 03 C0 21 08 02 00 29 C2 23 01 01 00 23 10 ~...!...).#...#. 94 F8 71 E7 40 33 77 EB 84 27 C6 DE 5E BD 4C A3 ..q.@3w..'..^.L. 55 4D 54 53 5F 43 48 41 50 5F 53 52 56 52 59 69 UMTS_CHAP_SRVRYi 7E ~ fsm_sdata(LCP): Sent code 8,2,41. rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): IPCP: timeout resending Config-Request state=6 (LS_REQSENT) pppWrite[0]: len=30 tx dump (30/30): 7E FF 03 80 21 01 01 00 16 03 06 00 00 00 00 81 ~...!........... 06 00 00 00 00 83 06 00 00 00 00 6E DB 7E ...........n.~ fsm_sdata(IPCP): Sent code 1,1,22. IPCP: sending Configure-Request, id 1 rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): это 200 мс таймауты в sio_read отвергает CHAP, а сервер ничего не отвечает FF 03 80 21 01 01 00 16 03 06 00 00 00 00 81 06 ...!............ 00 00 00 00 83 06 00 00 00 00 6E DB 7E ..........n.~ фрейминг нарушен, я правильно понимаю? lcp_init: xmit_accm=0 0 0 0 tx dump (11/11): 41 54 20 5A 30 20 45 30 20 56 30 AT.Z0.E0.V0 rx dump (0/256): tx dump (2/2): 0D 0A .. rx dump (2/256): 30 0D 0. tx dump (7/7): 41 54 20 53 30 3D 30 AT.S0=0 rx dump (0/256): tx dump (2/2): 0D 0A .. rx dump (2/256): 30 0D 0. tx dump (36/36): 41 54 20 2B 43 47 44 43 4F 4E 54 3D 31 2C 22 49 AT.+CGDCONT=1,"I 50 22 2C 22 69 6E 74 65 72 6E 65 74 2E 6D 74 73 P","internet.mts 2E 72 75 22 .ru" rx dump (0/256): tx dump (2/2): 0D 0A .. rx dump (2/256): 30 0D 0. tx dump (9/9): 41 54 20 44 54 2A 39 39 23 AT.DT*99# rx dump (0/256): tx dump (2/2): 0D 0A .. rx dump (2/256): 31 0D 1. pppOverSerialOpen: unit 0: Connecting pppStart: unit 0 ppp_set_xaccm[0]: outACCM=0 0 0 0 ppp_send_config[0]: outACCM=FF FF FF FF ppp_recv_config[0]: inACCM=0 0 0 0 lcp_lowerup: asyncmap=0 0 0 0 LCP: lowerup state 0 (LS_INITIAL) -> 2 (LS_CLOSED) auth_reset: 0 lcp_addci: L opt=2 0 lcp_addci: L opt=5 52181044 lcp_addci: opt=7 lcp_addci: opt=8 pppWrite[0]: len=47 tx dump (47/47): 7E FF 7D 23 C0 21 7D 21 7D 21 7D 20 7D 34 7D 22 ~.}#.!}!}!}.}4}" 7D 26 7D 20 7D 20 7D 20 7D 20 7D 25 7D 26 52 7D }&}.}.}.}.}%}&R} 38 7D 30 44 7D 27 7D 22 7D 28 7D 22 6E E1 7E 8}0D}'}"}(}"n.~ fsm_sdata(LCP): Sent code 1,1,20. LCP: sending Configure-Request, id 1 LCP: open state 2 (LS_CLOSED) -> 6 (LS_REQSENT) pppStart: finished rx dump (100/1504): 7E FF 7D 23 C0 21 7D 21 6C 7D 20 7D 39 7D 22 7D ~.}#.!}!l}.}9}"} 26 7D 20 7D 20 7D 20 7D 20 7D 23 7D 25 C2 23 7D &}.}.}.}.}#}%.#} 25 7D 25 7D 26 7D 34 6B 31 77 7D 27 7D 22 7D 28 %}%}&}4k1w}'}"}( 7D 22 F1 88 7E 7E FF 7D 23 C0 21 7D 22 7D 21 7D }"..~~.}#.!}"}!} 20 7D 34 7D 22 7D 26 7D 20 7D 20 7D 20 7D 20 7D .}4}"}&}.}.}.}.} 25 7D 26 52 7D 38 7D 30 44 7D 27 7D 22 7D 28 7D %}&R}8}0D}'}"}(} 22 85 88 7E "..~ pppInProc[0]: got 100 bytes pppInput[0]: LCP len=25 fsm_input(LCP):1,108,25 fsm_rconfreq(LCP): Rcvd id 108 state=6 (LS_REQSENT) lcp_reqci: rcvd ASYNCMAP=0 CHAP C223,5 MAGICNUMBER (146B3177) PCOMPRESSION lcp_reqci: ACCOMPRESSION lcp_reqci: returning CONFACK. pppWrite[0]: len=53 tx dump (53/53): 7E FF 7D 23 C0 21 7D 22 6C 7D 20 7D 39 7D 22 7D ~.}#.!}"l}.}9}"} 26 7D 20 7D 20 7D 20 7D 20 7D 23 7D 25 C2 23 7D &}.}.}.}.}#}%.#} 25 7D 25 7D 26 7D 34 6B 31 77 7D 27 7D 22 7D 28 %}%}&}4k1w}'}"}( 7D 22 7C 84 7E }"|.~ fsm_sdata(LCP): Sent code 2,108,25. pppInput[0]: packet processed pppInput[0]: LCP len=20 fsm_input(LCP):2,1,20 fsm_rconfack(LCP): Rcvd id 1 state=8 (LS_ACKSENT) lcp_acki: Ack ppp_send_config[0]: outACCM=0 0 0 0 ppp_recv_config[0]: inACCM=0 0 0 0 link_established: unit 0; Lowering up all protocols... IPCP: lowerup state 0 (LS_INITIAL) -> 2 (LS_CLOSED) pppInput[0]: packet processed rx dump (62/1504): 7E FF 7D 23 C0 21 7D 2B 6D 7D 20 7D 28 7D 34 6B ~.}#.!}+m}.}(}4k 31 77 FA DA 7E 7E C2 23 01 01 00 23 10 D0 A0 01 1w..~~.#...#.... 97 22 05 E5 EB 2C 74 B4 08 2A F9 36 7F 55 4D 54 ."...,t..*.6.UMT 53 5F 43 48 41 50 5F 53 52 56 52 EB 09 7E S_CHAP_SRVR..~ pppInProc[0]: got 62 bytes pppInput[0]: LCP len=8 fsm_input(LCP):11,109,8 fsm_input(LCP): default: pppInput[0]: packet processed pppInput[0]: CHAP len=35 ChapReceiveChallenge: Rcvd id 1. ChapReceiveChallenge: received name field 'UMTS_CHAP_SRVR' pppWrite[0]: len=32 tx dump (32/32): 7E FF 03 C2 23 02 01 00 18 10 A3 DA 18 42 B8 5C ~...#........B.\ BA B5 A1 E6 A8 C6 FA 14 1E EA 6D 74 73 2F 9D 7E ..........mts/.~ pppInput[0]: packet processed rx dump (10/1504): 7E C2 23 03 01 00 04 C2 BC 7E ~.#......~ pppInProc[0]: got 10 bytes pppInput[0]: CHAP len=4 ChapReceiveSuccess: Rcvd id 1. auth_withpeer_success: 0 proto=C223 pppWrite[0]: len=30 tx dump (30/30): 7E FF 03 80 21 01 01 00 16 03 06 00 00 00 00 81 ~...!........... 06 00 00 00 00 83 06 00 00 00 00 6E DB 7E ...........n.~ fsm_sdata(IPCP): Sent code 1,1,22. IPCP: sending Configure-Request, id 1 IPCP: open state 2 (LS_CLOSED) -> 6 (LS_REQSENT) pppInput[0]: packet processed rx dump (2/1504): 33 0D 3. pppInProc[0]: got 2 bytes rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): IPCP: timeout resending Config-Request state=6 (LS_REQSENT) pppWrite[0]: len=30 tx dump (30/30): 7E FF 03 80 21 01 01 00 16 03 06 00 00 00 00 81 ~...!........... 06 00 00 00 00 83 06 00 00 00 00 6E DB 7E ...........n.~ fsm_sdata(IPCP): Sent code 1,1,22. IPCP: sending Configure-Request, id 1 rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): — это лог с MD5_SUPPORT=1 PAP_SUPPORT=0 CHAP_SUPPORT=1 33 0D - это уже модем в командном режиме отвечает NO CARRIER извиняюсь, но лог для PAP был снят с pppSetAuth(PPPAUTHTYPE_CHAP, PPP_AUTH_USERNAME, PPP_AUTH_PASSWORD); исправил на pppSetAuth(PPPAUTHTYPE_ANY, PPP_AUTH_USERNAME, PPP_AUTH_PASSWORD); вот он: lcp_init: xmit_accm=0 0 0 0 upap_init: 0 tx dump (11/11): 41 54 20 5A 30 20 45 30 20 56 30 AT.Z0.E0.V0 rx dump (0/256): tx dump (2/2): 0D 0A .. rx dump (2/256): 30 0D 0. tx dump (7/7): 41 54 20 53 30 3D 30 AT.S0=0 rx dump (0/256): tx dump (2/2): 0D 0A .. rx dump (2/256): 30 0D 0. tx dump (36/36): 41 54 20 2B 43 47 44 43 4F 4E 54 3D 31 2C 22 49 AT.+CGDCONT=1,"I 50 22 2C 22 69 6E 74 65 72 6E 65 74 2E 6D 74 73 P","internet.mts 2E 72 75 22 .ru" rx dump (0/256): tx dump (2/2): 0D 0A .. rx dump (2/256): 30 0D 0. tx dump (9/9): 41 54 20 44 54 2A 39 39 23 AT.DT*99# rx dump (0/256): tx dump (2/2): 0D 0A .. rx dump (2/256): 31 0D 1. pppOverSerialOpen: unit 0: Connecting pppStart: unit 0 ppp_set_xaccm[0]: outACCM=0 0 0 0 ppp_send_config[0]: outACCM=FF FF FF FF ppp_recv_config[0]: inACCM=0 0 0 0 lcp_lowerup: asyncmap=0 0 0 0 LCP: lowerup state 0 (LS_INITIAL) -> 2 (LS_CLOSED) auth_reset: 0 lcp_addci: L opt=2 0 lcp_addci: L opt=5 52181044 lcp_addci: opt=7 lcp_addci: opt=8 pppWrite[0]: len=47 tx dump (47/47): 7E FF 7D 23 C0 21 7D 21 7D 21 7D 20 7D 34 7D 22 ~.}#.!}!}!}.}4}" 7D 26 7D 20 7D 20 7D 20 7D 20 7D 25 7D 26 52 7D }&}.}.}.}.}%}&R} 38 7D 30 44 7D 27 7D 22 7D 28 7D 22 6E E1 7E 8}0D}'}"}(}"n.~ fsm_sdata(LCP): Sent code 1,1,20. LCP: sending Configure-Request, id 1 LCP: open state 2 (LS_CLOSED) -> 6 (LS_REQSENT) pppStart: finished rx dump (102/1504): 7E FF 7D 23 C0 21 7D 21 72 7D 20 7D 39 7D 22 7D ~.}#.!}!r}.}9}"} 26 7D 20 7D 20 7D 20 7D 20 7D 23 7D 25 C2 23 7D &}.}.}.}.}#}%.#} 25 7D 25 7D 26 7D 34 81 E6 87 7D 27 7D 22 7D 28 %}%}&}4...}'}"}( 7D 22 7D 34 7D 20 7E 7E FF 7D 23 C0 21 7D 22 7D }"}4}.~~.}#.!}"} 21 7D 20 7D 34 7D 22 7D 26 7D 20 7D 20 7D 20 7D !}.}4}"}&}.}.}.} 20 7D 25 7D 26 52 7D 38 7D 30 44 7D 27 7D 22 7D .}%}&R}8}0D}'}"} 28 7D 22 85 88 7E (}"..~ pppInProc[0]: got 102 bytes pppInput[0]: LCP len=25 fsm_input(LCP):1,114,25 fsm_rconfreq(LCP): Rcvd id 114 state=6 (LS_REQSENT) lcp_reqci: rcvd ASYNCMAP=0 CHAP C223,5 MAGICNUMBER (1481E687) PCOMPRESSION lcp_reqci: ACCOMPRESSION lcp_reqci: returning CONFACK. pppWrite[0]: len=54 tx dump (54/54): 7E FF 7D 23 C0 21 7D 22 72 7D 20 7D 39 7D 22 7D ~.}#.!}"r}.}9}"} 26 7D 20 7D 20 7D 20 7D 20 7D 23 7D 25 C2 23 7D &}.}.}.}.}#}%.#} 25 7D 25 7D 26 7D 34 81 E6 87 7D 27 7D 22 7D 28 %}%}&}4...}'}"}( 7D 22 99 7D 2C 7E }".},~ fsm_sdata(LCP): Sent code 2,114,25. pppInput[0]: packet processed pppInput[0]: LCP len=20 fsm_input(LCP):2,1,20 fsm_rconfack(LCP): Rcvd id 1 state=8 (LS_ACKSENT) lcp_acki: Ack ppp_send_config[0]: outACCM=0 0 0 0 ppp_recv_config[0]: inACCM=0 0 0 0 link_established: unit 0; Lowering up all protocols... upap_lowerup: init 0 clientstate s=0 IPCP: lowerup state 0 (LS_INITIAL) -> 2 (LS_CLOSED) pppWrite[0]: len=29 tx dump (29/29): FF 03 80 21 01 01 00 16 03 06 00 00 00 00 81 06 ...!............ 00 00 00 00 83 06 00 00 00 00 6E DB 7E ..........n.~ fsm_sdata(IPCP): Sent code 1,1,22. IPCP: sending Configure-Request, id 1 IPCP: open state 2 (LS_CLOSED) -> 6 (LS_REQSENT) pppInput[0]: packet processed rx dump (64/1504): 7E FF 7D 23 C0 21 7D 2B 73 7D 20 7D 28 7D 34 81 ~.}#.!}+s}.}(}4. E6 87 75 76 7E 7E C2 23 01 01 00 23 10 BC 8C 6A ..uv~~.#...#...j 58 FC B7 3D BB 6C 61 FA D0 A2 64 12 E6 55 4D 54 X..=.la...d..UMT 53 5F 43 48 41 50 5F 53 52 56 52 A0 F4 7E 33 0D S_CHAP_SRVR..~3. pppInProc[0]: got 64 bytes pppInput[0]: LCP len=8 fsm_input(LCP):11,115,8 fsm_input(LCP): default: pppInput[0]: packet processed pppInput[0]: rejecting unsupported proto 0xc223 len=35 pppWrite[0]: len=49 tx dump (49/49): 7E FF 03 C0 21 08 02 00 29 C2 23 01 01 00 23 10 ~...!...).#...#. BC 8C 6A 58 FC B7 3D BB 6C 61 FA D0 A2 64 12 E6 ..jX..=.la...d.. 55 4D 54 53 5F 43 48 41 50 5F 53 52 56 52 41 72 UMTS_CHAP_SRVRAr 7E ~ fsm_sdata(LCP): Sent code 8,2,41. rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): IPCP: timeout resending Config-Request state=6 (LS_REQSENT) pppWrite[0]: len=30 tx dump (30/30): 7E FF 03 80 21 01 01 00 16 03 06 00 00 00 00 81 ~...!........... 06 00 00 00 00 83 06 00 00 00 00 6E DB 7E ...........n.~ fsm_sdata(IPCP): Sent code 1,1,22. IPCP: sending Configure-Request, id 1 rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): хотя сервер себя повёл точно так же может ему MS CHAP v2 нужен? нет. сервер отверг возвращённый хэш, по-видимому Цитата Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты Поделиться
kan35 7 13 июля, 2012 Опубликовано 13 июля, 2012 · Жалоба Сделайте во первых MD5_SUPPORT=0 PAP_SUPPORT=1 CHAP_SUPPORT=0 потому что во всех ваших логах происходит авторизация chap! и дайте лог!!! Во вторых в sio_read не надо делать 200мс задержек. Я организовал это так. Набиваю queue из прерывания, а в sio_read просто из этой queue вынимаю и отдаю. Если queue пустая - просто сразу выхожу, никаких задержек! при этом задача PPP не грузит проц на 100%, если вы этого опасаетесь. Цитата Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты Поделиться
Dukales 0 13 июля, 2012 Опубликовано 13 июля, 2012 · Жалоба вот. lcp_init: xmit_accm=0 0 0 0 upap_init: 0 tx dump (11/11): 41 54 20 5A 30 20 45 30 20 56 30 AT.Z0.E0.V0 rx dump (0/256): tx dump (2/2): 0D 0A .. rx dump (2/256): 30 0D 0. tx dump (7/7): 41 54 20 53 30 3D 30 AT.S0=0 rx dump (0/256): tx dump (2/2): 0D 0A .. rx dump (2/256): 30 0D 0. tx dump (36/36): 41 54 20 2B 43 47 44 43 4F 4E 54 3D 31 2C 22 49 AT.+CGDCONT=1,"I 50 22 2C 22 69 6E 74 65 72 6E 65 74 2E 6D 74 73 P","internet.mts 2E 72 75 22 .ru" rx dump (0/256): tx dump (2/2): 0D 0A .. rx dump (2/256): 30 0D 0. tx dump (13/13): 41 54 20 44 54 2A 39 39 2A 2A 2A 31 23 AT.DT*99***1# rx dump (0/256): tx dump (2/2): 0D 0A .. rx dump (2/256): 31 0D 1. pppOverSerialOpen: unit 0: Connecting pppStart: unit 0 ppp_set_xaccm[0]: outACCM=0 0 0 0 ppp_send_config[0]: outACCM=FF FF FF FF ppp_recv_config[0]: inACCM=0 0 0 0 lcp_lowerup: asyncmap=0 0 0 0 LCP: lowerup state 0 (LS_INITIAL) -> 2 (LS_CLOSED) auth_reset: 0 lcp_addci: L opt=2 0 lcp_addci: L opt=5 34DE8CCF lcp_addci: opt=7 lcp_addci: opt=8 pppWrite[0]: len=45 tx dump (45/45): 7E FF 7D 23 C0 21 7D 21 7D 21 7D 20 7D 34 7D 22 ~.}#.!}!}!}.}4}" 7D 26 7D 20 7D 20 7D 20 7D 20 7D 25 7D 26 34 DE }&}.}.}.}.}%}&4. 8C CF 7D 27 7D 22 7D 28 7D 22 57 8D 7E ..}'}"}(}"W.~ fsm_sdata(LCP): Sent code 1,1,20. LCP: sending Configure-Request, id 1 LCP: open state 2 (LS_CLOSED) -> 6 (LS_REQSENT) pppStart: finished rx dump (99/1504): 7E FF 7D 23 C0 21 7D 21 7D 20 7D 20 7D 39 7D 22 ~.}#.!}!}.}.}9}" 7D 26 7D 20 7D 20 7D 20 7D 20 7D 23 7D 25 C2 23 }&}.}.}.}.}#}%.# 7D 25 7D 25 7D 26 7D 34 C4 E9 83 7D 27 7D 22 7D }%}%}&}4...}'}"} 28 7D 22 F8 5D 7E 7E FF 7D 23 C0 21 7D 22 7D 21 (}".]~~.}#.!}"}! 7D 20 7D 34 7D 22 7D 26 7D 20 7D 20 7D 20 7D 20 }.}4}"}&}.}.}.}. 7D 25 7D 26 34 DE 8C CF 7D 27 7D 22 7D 28 7D 22 }%}&4...}'}"}(}" BC E4 7E ..~ pppInProc[0]: got 99 bytes pppInput[0]: LCP len=25 fsm_input(LCP):1,0,25 fsm_rconfreq(LCP): Rcvd id 0 state=6 (LS_REQSENT) lcp_reqci: rcvd ASYNCMAP=0 CHAP C223,5 MAGICNUMBER (14C4E983) PCOMPRESSION lcp_reqci: ACCOMPRESSION lcp_reqci: returning CONFACK. pppWrite[0]: len=54 tx dump (54/54): 7E FF 7D 23 C0 21 7D 22 7D 20 7D 20 7D 39 7D 22 ~.}#.!}"}.}.}9}" 7D 26 7D 20 7D 20 7D 20 7D 20 7D 23 7D 25 C2 23 }&}.}.}.}.}#}%.# 7D 25 7D 25 7D 26 7D 34 C4 E9 83 7D 27 7D 22 7D }%}%}&}4...}'}"} 28 7D 22 75 51 7E (}"uQ~ fsm_sdata(LCP): Sent code 2,0,25. pppInput[0]: packet processed pppInput[0]: LCP len=20 fsm_input(LCP):2,1,20 fsm_rconfack(LCP): Rcvd id 1 state=8 (LS_ACKSENT) lcp_acki: Ack ppp_send_config[0]: outACCM=0 0 0 0 ppp_recv_config[0]: inACCM=0 0 0 0 link_established: unit 0; Lowering up all protocols... upap_lowerup: init 0 clientstate s=0 IPCP: lowerup state 0 (LS_INITIAL) -> 2 (LS_CLOSED) pppWrite[0]: len=29 tx dump (29/29): FF 03 80 21 01 01 00 16 03 06 00 00 00 00 81 06 ...!............ 00 00 00 00 83 06 00 00 00 00 6E DB 7E ..........n.~ fsm_sdata(IPCP): Sent code 1,1,22. IPCP: sending Configure-Request, id 1 IPCP: open state 2 (LS_CLOSED) -> 6 (LS_REQSENT) pppInput[0]: packet processed rx dump (65/1504): 7E FF 7D 23 C0 21 7D 2B 7D 21 7D 20 7D 28 7D 34 ~.}#.!}+}!}.}(}4 C4 E9 83 A5 AA 7E 7E C2 23 01 01 00 23 10 AA 1C .....~~.#...#... 69 BC 88 3D D9 98 1C FA 56 DE 4E B6 3E 20 55 4D i..=....V.N.>.UM 54 53 5F 43 48 41 50 5F 53 52 56 52 74 EA 7E 33 TS_CHAP_SRVRt.~3 0D . pppInProc[0]: got 65 bytes pppInput[0]: LCP len=8 fsm_input(LCP):11,1,8 fsm_input(LCP): default: pppInput[0]: packet processed pppInput[0]: rejecting unsupported proto 0xc223 len=35 pppWrite[0]: len=49 tx dump (49/49): 7E FF 03 C0 21 08 02 00 29 C2 23 01 01 00 23 10 ~...!...).#...#. AA 1C 69 BC 88 3D D9 98 1C FA 56 DE 4E B6 3E 20 ..i..=....V.N.>. 55 4D 54 53 5F 43 48 41 50 5F 53 52 56 52 95 6C UMTS_CHAP_SRVR.l 7E ~ fsm_sdata(LCP): Sent code 8,2,41. rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): IPCP: timeout resending Config-Request state=6 (LS_REQSENT) pppWrite[0]: len=30 tx dump (30/30): 7E FF 03 80 21 01 01 00 16 03 06 00 00 00 00 81 ~...!........... 06 00 00 00 00 83 06 00 00 00 00 6E DB 7E ...........n.~ fsm_sdata(IPCP): Sent code 1,1,22. IPCP: sending Configure-Request, id 1 rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): сейчас попробую всё учесть, что вы посоветовали не опасаюсь за загрузку процессора. хорошо представляю как задачи в FreeRTOS работают с очередями Цитата Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты Поделиться
kan35 7 13 июля, 2012 Опубликовано 13 июля, 2012 · Жалоба опять в логе вижу слово CHAP - его быть не должно! уберайте же поддержку CHAPЮ сколько можно... Я про загрузку имел в виду не очереди, а загруку процессора PPP стеком, если посмотрите, то когда sio_read возвращается без данных, то в стеке присутствует задежка для того, чтобы не молотол впустую, а значит ваша задержка в sio_read уже ни к чему. Queue в данном случае просто замена FIFO стека на "ком порту". Цитата Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты Поделиться
Dukales 0 13 июля, 2012 Опубликовано 13 июля, 2012 · Жалоба сделал так: // inet.c #include "inet.h" /*drivers*/ #include "main.h" #include "gate.h" /*kernel*/ #include "FreeRTOS.h" #include "portmacro.h" #include "task.h" #include "queue.h" #include "semphr.h" #include "lwip/mem.h" #include "lwip/memp.h" #include "lwip/inet.h" /*#include "ethernetif.h"*/ /*#include "netconf.h"*/ #include "lwip/tcpip.h" #include "ppp.h" #include "lwip/sio.h" #include <stdio.h> #include <stdarg.h> #include <string.h> #include <ctype.h> #define RX_BUF_SIZE 1504 static xQueueHandle xRxedChars; void COM1_IRQHandler(void) { portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; if (USART_GetITStatus(COM1_USART, USART_IT_RXNE) == SET) { u8_t c = (USART_ReceiveData(COM1_USART) & ((1 << SERIAL_RS485_BITS) - 1)); xQueueSendFromISR(xRxedChars, &c, &xHigherPriorityTaskWoken); } portEND_SWITCHING_ISR(xHigherPriorityTaskWoken); } #define MODEM_TEXT_IO_LENGTH 256 #define SIO_SERIAL_PORT NULL #define PPP_CONNECTION_TIMEOUT 30000 / portTICK_RATE_MS #define MODEM_READ_TIMEOUT 200 / portTICK_RATE_MS static int modem_putchar(int c) { while (USART_GetFlagStatus(COM1_USART, USART_FLAG_TXE) != SET) { continue; } USART_SendData(COM1_USART, c); return c; } /*static int modem_printf(const char * fmt, ...) { static char tx_buf[MODEM_TEXT_IO_LENGTH]; int count; { va_list args; va_start(args, fmt); count = vsnprintf(tx_buf + 0, sizeof(tx_buf), fmt, args); va_end(args); } for (int i = 0; i < count; ++i) { if (modem_putchar(tx_buf[i]) < 0) { return i; } } return count; }*/ static int modem_getch(void) { u8_t c; if (xQueueReceive(xRxedChars, &c, 0) == pdFALSE) { return -1; } return c; } static int modem_exchange(char * AT_command) { static u8 rx_buf[MODEM_TEXT_IO_LENGTH]; int len; sio_write(SIO_SERIAL_PORT, (u8 *) AT_command, strlen(AT_command)); sio_read(SIO_SERIAL_PORT, rx_buf + 0, sizeof(rx_buf)); // discard echo if present sio_write(SIO_SERIAL_PORT, (u8 *) "\r\n", 2); len = sio_read(SIO_SERIAL_PORT, rx_buf + 0, sizeof(rx_buf)); if (len > 0) { int code; if (sscanf((char *) &rx_buf, "%i", &code) == 1) { vTaskDelay(100 / portTICK_RATE_MS); return code; } } return -1; } static int connected; static void linkStatusCB(void * ctx, int errCode, void * arg) { int * connected = (int *) ctx; struct ppp_addrs * addrs = arg; switch (errCode) { case PPPERR_NONE: { /* We are connected */ *connected = 1; printf("ip_addr = %s\r\n", inet_ntoa(addrs->our_ipaddr)); printf("netmask = %s\r\n", inet_ntoa(addrs->netmask)); printf("dns1 = %s\r\n", inet_ntoa(addrs->dns1)); printf("dns2 = %s\r\n", inet_ntoa(addrs->dns2)); break; } case PPPERR_CONNECT: { printf("lost connection\r\n"); /* just wait */ break; } default: { /* We have lost connection */ *connected = 0; break; } } } static void hw_init(void) { USART_InitTypeDef USART_InitStructure; USART_InitStructure.USART_BaudRate = 57600; USART_InitStructure.USART_WordLength = USART_WordLength_8b; USART_InitStructure.USART_StopBits = USART_StopBits_1; USART_InitStructure.USART_Parity = USART_Parity_No; USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None; USART_InitStructure.USART_Mode = (USART_Mode_Rx | USART_Mode_Tx); com_init(COM1, &USART_InitStructure); USART_ITConfig(COM1_USART, USART_IT_RXNE, ENABLE); } static void tcpip_init_done(void * arg) { if (arg != NULL) { *((int *) arg) = 1; } } #define PPP_AUTH_USERNAME "mts" #define PPP_AUTH_PASSWORD "mts" static void inetTask(void * pvParameters) { (void) pvParameters; int setup = 0; int pd = -1; tcpip_init(tcpip_init_done, &setup); while (setup == 0) { vTaskDelay(100 / portTICK_RATE_MS); } pppInit(); hw_init(); for (;;) { vTaskDelay(1000 / portTICK_RATE_MS); if (modem_exchange("AT Z0 E0 V0") != 0) { // OK continue; } if (modem_exchange("AT S0=0") != 0) { // OK continue; } if (modem_exchange("AT +CGDCONT=1,\"IP\",\"internet.mts.ru\"") != 0) { // OK continue; } if (modem_exchange("AT DT*99***1#") != 1) { // CONNECT continue; } pppSetAuth(PPPAUTHTYPE_ANY, PPP_AUTH_USERNAME, PPP_AUTH_PASSWORD); connected = 0; pd = pppOverSerialOpen(SIO_SERIAL_PORT, linkStatusCB, &connected); if (!(pd < 0)) { portTickType ticks = xTaskGetTickCount(); do { vTaskDelay(100 / portTICK_RATE_MS); if (connected != 0) { printf("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\r\n"); break; } } while (xTaskGetTickCount() < ticks + PPP_CONNECTION_TIMEOUT); if (connected != 0) { printf("can run\r\n"); } pppClose(pd); } else { printf("could not connect\r\n"); } printf("RECONNECT\r\n"); } #if 0 for (;;) { vTaskDelay(100 / portTICK_RATE_MS); } #else vTaskDelete(NULL); #endif } void inet_init(void) { xRxedChars = xQueueCreate(RX_BUF_SIZE, sizeof(u8_t)); xTaskCreate(inetTask, (signed char *) "inetTask", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, (xTaskHandle *) NULL); } u32_t sys_jiffies(void) { return xTaskGetTickCount(); } static __attribute__ ((noinline)) void print_dump(u8_t * data, u32_t len, const char * prefix) { int i, r, l, p; static u8_t line[0x10]; u8_t c; l = 0; for (i = 0; i < len; ++i) { c = *(data + i); r = (i % 0x10); if (isgraph© != 0) { *(line + r) = c; } else { *(line + r) = '.'; } if (i == 0) { p = printf("%s", prefix); } else if (r == 0) { printf("%*s", p, ""); } if (i + 1 == len) { printf("%02hhX %*.*s", c, r + 1 + (46 - l), r + 1, line + 0); l = 0; } else if (r == 0x0F) { printf("%02hhX %.16s\r\n", c, line + 0); l = 0; } else if (r == 7) { l += printf("%02hhX ", c); } else { l += printf("%02hhX ", c); } } } static int read_abort = 0; u32_t sio_read(sio_fd_t fd, u8_t * data, u32_t len) { (void) fd; int i; for (i = 0; i < len; ++i) { int c = modem_getch(); if (c < 0) { break; } data[i] = c; if (read_abort != 0) { read_abort = 0; break; } } printf("rx dump (%d/%d):\r\n", i, len); print_dump(data, i, ""); // "rcvd " ~pppdump format printf("\r\n"); return i; } void sio_read_abort(sio_fd_t fd) { read_abort = 1; } u32_t sio_write(sio_fd_t fd, u8_t * data, u32_t len) { (void) fd; printf("tx dump (%d/%d):\r\n", len, len); print_dump(data, len, ""); // "sent " printf("\r\n"); for (u32_t i = 0; i < len; ++i) { modem_putchar(data[i]); } return len; } /** ****************************************************************************** * @file lwipopts.h * @author MCD Application Team * @version V1.0.0 * @date 31-October-2011 * @brief lwIP Options Configuration. * This file is based on Utilities\lwip_v1.3.2\src\include\lwip\opt.h * and contains the lwIP configuration for the STM32F4x7 demonstration. ****************************************************************************** * @attention * * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. * * <h2><center>© COPYRIGHT 2011 STMicroelectronics</center></h2> ****************************************************************************** */ #ifndef __LWIPOPTS_H__ #define __LWIPOPTS_H__ /** * SYS_LIGHTWEIGHT_PROT==1: if you want inter-task protection for certain * critical regions during buffer allocation, deallocation and memory * allocation and deallocation. */ #define SYS_LIGHTWEIGHT_PROT 1 #define ETHARP_TRUST_IP_MAC 0 #define IP_REASSEMBLY 1 #define IP_FRAG 0 #define ARP_QUEUEING 0 /** * NO_SYS==1: Provides VERY minimal functionality. Otherwise, * use lwIP facilities. */ #define NO_SYS 0 /* ---------- Memory options ---------- */ /* MEM_ALIGNMENT: should be set to the alignment of the CPU for which lwIP is compiled. 4 byte alignment -> define MEM_ALIGNMENT to 4, 2 byte alignment -> define MEM_ALIGNMENT to 2. */ #define MEM_ALIGNMENT 4 /* MEM_SIZE: the size of the heap memory. If the application will send a lot of data that needs to be copied, this should be set high. */ #define MEM_SIZE (4*1024) /* MEMP_NUM_PBUF: the number of memp struct pbufs. If the application sends a lot of data out of ROM (or other static memory), this should be set high. */ #define MEMP_NUM_PBUF 8 /* MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One per active UDP "connection". */ #define MEMP_NUM_UDP_PCB 2 /* MEMP_NUM_TCP_PCB: the number of simulatenously active TCP connections. */ #define MEMP_NUM_TCP_PCB 2 /* MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP connections. */ #define MEMP_NUM_TCP_PCB_LISTEN 5 /* MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP segments. */ #define MEMP_NUM_TCP_SEG 16 /* MEMP_NUM_SYS_TIMEOUT: the number of simulateously active timeouts. */ #define MEMP_NUM_SYS_TIMEOUT 6 /* ---------- Pbuf options ---------- */ /* PBUF_POOL_SIZE: the number of buffers in the pbuf pool. */ #define PBUF_POOL_SIZE 24 /* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. */ #define PBUF_POOL_BUFSIZE 512 /* ---------- TCP options ---------- */ #define LWIP_TCP 1 #define TCP_TTL 255 /* Controls if TCP should queue segments that arrive out of order. Define to 0 if your device is low on memory. */ #define TCP_QUEUE_OOSEQ 1 /* TCP Maximum segment size. */ #define TCP_MSS (1500 - 40) /* TCP_MSS = (Ethernet MTU - IP header size - TCP header size) */ /* TCP sender buffer space (bytes). */ #define TCP_SND_BUF (5*TCP_MSS) /* TCP_SND_QUEUELEN: TCP sender buffer space (pbufs). This must be at least as much as (2 * TCP_SND_BUF/TCP_MSS) for things to work. */ #define TCP_SND_QUEUELEN (2* TCP_SND_BUF/TCP_MSS) /* TCP receive window. */ #define TCP_WND (2*TCP_MSS) /* ---------- ICMP options ---------- */ #define LWIP_ICMP 1 /* ---------- DHCP options ---------- */ /* Define LWIP_DHCP to 1 if you want DHCP configuration of interfaces. DHCP is not implemented in lwIP 0.5.1, however, so turning this on does currently not work. */ #define LWIP_DHCP 0 /* ---------- UDP options ---------- */ #define LWIP_UDP 1 #define UDP_TTL 255 /* ---------- Statistics options ---------- */ #define LWIP_STATS 0 #define LWIP_PROVIDE_ERRNO 1 /* -------------------------------------- ---------- Checksum options ---------- -------------------------------------- */ /* The STM32F4x7 allows computing and verifying the IP, UDP, TCP and ICMP checksums by hardware: - To use this feature let the following define uncommented. - To disable it and process by CPU comment the the checksum. */ #define CHECKSUM_BY_HARDWARE #ifdef CHECKSUM_BY_HARDWARE /* CHECKSUM_GEN_IP==0: Generate checksums by hardware for outgoing IP packets.*/ #define CHECKSUM_GEN_IP 0 /* CHECKSUM_GEN_UDP==0: Generate checksums by hardware for outgoing UDP packets.*/ #define CHECKSUM_GEN_UDP 0 /* CHECKSUM_GEN_TCP==0: Generate checksums by hardware for outgoing TCP packets.*/ #define CHECKSUM_GEN_TCP 0 /* CHECKSUM_CHECK_IP==0: Check checksums by hardware for incoming IP packets.*/ #define CHECKSUM_CHECK_IP 0 /* CHECKSUM_CHECK_UDP==0: Check checksums by hardware for incoming UDP packets.*/ #define CHECKSUM_CHECK_UDP 0 /* CHECKSUM_CHECK_TCP==0: Check checksums by hardware for incoming TCP packets.*/ #define CHECKSUM_CHECK_TCP 0 #else /* CHECKSUM_GEN_IP==1: Generate checksums in software for outgoing IP packets.*/ #define CHECKSUM_GEN_IP 1 /* CHECKSUM_GEN_UDP==1: Generate checksums in software for outgoing UDP packets.*/ #define CHECKSUM_GEN_UDP 1 /* CHECKSUM_GEN_TCP==1: Generate checksums in software for outgoing TCP packets.*/ #define CHECKSUM_GEN_TCP 1 /* CHECKSUM_CHECK_IP==1: Check checksums in software for incoming IP packets.*/ #define CHECKSUM_CHECK_IP 1 /* CHECKSUM_CHECK_UDP==1: Check checksums in software for incoming UDP packets.*/ #define CHECKSUM_CHECK_UDP 1 /* CHECKSUM_CHECK_TCP==1: Check checksums in software for incoming TCP packets.*/ #define CHECKSUM_CHECK_TCP 1 #endif /* ---------------------------------------------- ---------- Sequential layer options ---------- ---------------------------------------------- */ /** * LWIP_NETCONN==1: Enable Netconn API (require to use api_lib.c) */ #define LWIP_NETCONN 1 /* ------------------------------------ ---------- Socket options ---------- ------------------------------------ */ /** * LWIP_SOCKET==1: Enable Socket API (require to use sockets.c) */ #define LWIP_SOCKET 0 /* ----------------------------------- ---------- DEBUG options ---------- ----------------------------------- */ #define LWIP_DEBUG 1 /* --------------------------------- ---------- OS options ---------- --------------------------------- */ #define TCPIP_THREAD_STACKSIZE configMINIMAL_STACK_SIZE #define TCPIP_MBOX_SIZE 5 #define DEFAULT_UDP_RECVMBOX_SIZE 2000 #define DEFAULT_TCP_RECVMBOX_SIZE 2000 #define DEFAULT_ACCEPTMBOX_SIZE 2000 #define DEFAULT_THREAD_STACKSIZE configMINIMAL_STACK_SIZE #define TCPIP_THREAD_PRIO (configMAX_PRIORITIES - 3) #define LWIP_COMPAT_MUTEX 1 #define LWIP_SO_RCVTIMEO 1 #define PPP_SUPPORT 1 #define PAP_SUPPORT 1 #define CHAP_SUPPORT 0 #define MD5_SUPPORT 0 #define PPP_THREAD_PRIO (configMAX_PRIORITIES - 3) #define PPP_THREAD_STACKSIZE configMINIMAL_STACK_SIZE #define PPP_DEBUG LWIP_DBG_ON #endif /* __LWIPOPTS_H__ */ /******************* © COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ на что лог следующий: lcp_init: xmit_accm=0 0 0 0 upap_init: 0 tx dump (11/11): 41 54 20 5A 30 20 45 30 20 56 30 AT.Z0.E0.V0 rx dump (0/256): tx dump (2/2): 0D 0A .. rx dump (0/256): tx dump (11/11): 41 54 20 5A 30 20 45 30 20 56 30 AT.Z0.E0.V0 rx dump (2/256): 30 0D 0. tx dump (2/2): 0D 0A .. rx dump (0/256): tx dump (11/11): 41 54 20 5A 30 20 45 30 20 56 30 AT.Z0.E0.V0 rx dump (2/256): 30 0D 0. tx dump (2/2): 0D 0A .. rx dump (0/256): tx dump (11/11): 41 54 20 5A 30 20 45 30 20 56 30 AT.Z0.E0.V0 rx dump (2/256): 30 0D 0. tx dump (2/2): 0D 0A .. rx dump (0/256): tx dump (11/11): 41 54 20 5A 30 20 45 30 20 56 30 AT.Z0.E0.V0 rx dump (2/256): 30 0D 0. tx dump (2/2): 0D 0A .. rx dump (0/256): tx dump (11/11): 41 54 20 5A 30 20 45 30 20 56 30 AT.Z0.E0.V0 rx dump (2/256): 30 0D 0. tx dump (2/2): 0D 0A .. rx dump (0/256): tx dump (11/11): 41 54 20 5A 30 20 45 30 20 56 30 AT.Z0.E0.V0 rx dump (2/256): 30 0D 0. tx dump (2/2): 0D 0A .. rx dump (0/256): tx dump (11/11): 41 54 20 5A 30 20 45 30 20 56 30 AT.Z0.E0.V0 rx dump (2/256): 30 0D 0. tx dump (2/2): 0D 0A .. rx dump (0/256): tx dump (11/11): 41 54 20 5A 30 20 45 30 20 56 30 AT.Z0.E0.V0 rx dump (2/256): 30 0D 0. tx dump (2/2): 0D 0A .. rx dump (0/256): не катит отсутствие задержки не успевает ответить модем вот кусок ppp.c: static void pppInputThread(void *arg) { int count; PPPControlRx *pcrx = arg; while (lcp_phase[pcrx->pd] != PHASE_DEAD) { count = sio_read(pcrx->fd, pcrx->rxbuf, PPPOS_RX_BUFSIZE); if(count > 0) { pppInProc(pcrx, pcrx->rxbuf, count); } else { /* nothing received, give other tasks a chance to run */ sys_msleep(2); } } vTaskDelete(NULL); } #endif /* PPPOS_SUPPORT && PPP_INPROC_OWNTHREAD */ вообще если верить lwip/sio.h, то sio_read должна блокировать до победного, пока другой поток не сделает read_abort = 0; *точнее не вызовет sio_read_abort(); до этого делал кольцевой буфер на COM-порту, но тоже с таймаутом - хоть обмен шёл разбирался с протоколом - выяснил, что провайдер отвечает NAK, а каковы причины - не ясно если ставить 0xFFFF таймаут на ожидание символов, то поток с FSM залипает навечно, если 0, то ничего не получает из канала связи. так что оставил 200. картина следующая: lcp_init: xmit_accm=0 0 0 0 upap_init: 0 tx dump (11/11): 41 54 20 5A 30 20 45 30 20 56 30 AT.Z0.E0.V0 rx dump (0/256): tx dump (2/2): 0D 0A .. rx dump (2/256): 33 0D 3. tx dump (11/11): 41 54 20 5A 30 20 45 30 20 56 30 AT.Z0.E0.V0 rx dump (0/256): tx dump (2/2): 0D 0A .. rx dump (2/256): 30 0D 0. tx dump (7/7): 41 54 20 53 30 3D 30 AT.S0=0 rx dump (0/256): tx dump (2/2): 0D 0A .. rx dump (2/256): 30 0D 0. tx dump (36/36): 41 54 20 2B 43 47 44 43 4F 4E 54 3D 31 2C 22 49 AT.+CGDCONT=1,"I 50 22 2C 22 69 6E 74 65 72 6E 65 74 2E 6D 74 73 P","internet.mts 2E 72 75 22 .ru" rx dump (0/256): tx dump (2/2): 0D 0A .. rx dump (2/256): 30 0D 0. tx dump (13/13): 41 54 20 44 54 2A 39 39 2A 2A 2A 31 23 AT.DT*99***1# rx dump (0/256): tx dump (2/2): 0D 0A .. rx dump (2/256): 31 0D 1. pppOverSerialOpen: unit 0: Connecting pppStart: unit 0 ppp_set_xaccm[0]: outACCM=0 0 0 0 ppp_send_config[0]: outACCM=FF FF FF FF ppp_recv_config[0]: inACCM=0 0 0 0 lcp_lowerup: asyncmap=0 0 0 0 LCP: lowerup state 0 (LS_INITIAL) -> 2 (LS_CLOSED) auth_reset: 0 lcp_addci: L opt=2 0 lcp_addci: L opt=5 34DE8CCF lcp_addci: opt=7 lcp_addci: opt=8 pppWrite[0]: len=45 tx dump (45/45): 7E FF 7D 23 C0 21 7D 21 7D 21 7D 20 7D 34 7D 22 ~.}#.!}!}!}.}4}" 7D 26 7D 20 7D 20 7D 20 7D 20 7D 25 7D 26 34 DE }&}.}.}.}.}%}&4. 8C CF 7D 27 7D 22 7D 28 7D 22 57 8D 7E ..}'}"}(}"W.~ fsm_sdata(LCP): Sent code 1,1,20. LCP: sending Configure-Request, id 1 LCP: open state 2 (LS_CLOSED) -> 6 (LS_REQSENT) pppStart: finished rx dump (99/1504): 7E FF 7D 23 C0 21 7D 21 7D 24 7D 20 7D 39 7D 22 ~.}#.!}!}$}.}9}" 7D 26 7D 20 7D 20 7D 20 7D 20 7D 23 7D 25 C2 23 }&}.}.}.}.}#}%.# 7D 25 7D 25 7D 26 7D 35 55 54 3D 7D 27 7D 22 7D }%}%}&}5UT=}'}"} 28 7D 22 D6 DD 7E 7E FF 7D 23 C0 21 7D 22 7D 21 (}"..~~.}#.!}"}! 7D 20 7D 34 7D 22 7D 26 7D 20 7D 20 7D 20 7D 20 }.}4}"}&}.}.}.}. 7D 25 7D 26 34 DE 8C CF 7D 27 7D 22 7D 28 7D 22 }%}&4...}'}"}(}" BC E4 7E ..~ pppInProc[0]: got 99 bytes pppInput[0]: LCP len=25 fsm_input(LCP):1,4,25 fsm_rconfreq(LCP): Rcvd id 4 state=6 (LS_REQSENT) lcp_reqci: rcvd ASYNCMAP=0 CHAP C223,5 MAGICNUMBER (1555543D) PCOMPRESSION lcp_reqci: ACCOMPRESSION lcp_reqci: returning CONFACK. pppWrite[0]: len=54 tx dump (54/54): 7E FF 7D 23 C0 21 7D 22 7D 24 7D 20 7D 39 7D 22 ~.}#.!}"}$}.}9}" 7D 26 7D 20 7D 20 7D 20 7D 20 7D 23 7D 25 C2 23 }&}.}.}.}.}#}%.# 7D 25 7D 25 7D 26 7D 35 55 54 3D 7D 27 7D 22 7D }%}%}&}5UT=}'}"} 28 7D 22 5B D1 7E (}"[.~ fsm_sdata(LCP): Sent code 2,4,25. pppInput[0]: packet processed pppInput[0]: LCP len=20 fsm_input(LCP):2,1,20 fsm_rconfack(LCP): Rcvd id 1 state=8 (LS_ACKSENT) lcp_acki: Ack ppp_send_config[0]: outACCM=0 0 0 0 ppp_recv_config[0]: inACCM=0 0 0 0 link_established: unit 0; Lowering up all protocols... upap_lowerup: init 0 clientstate s=0 IPCP: lowerup state 0 (LS_INITIAL) -> 2 (LS_CLOSED) pppWrite[0]: len=29 tx dump (29/29): FF 03 80 21 01 01 00 16 03 06 00 00 00 00 81 06 ...!............ 00 00 00 00 83 06 00 00 00 00 6E DB 7E ..........n.~ fsm_sdata(IPCP): Sent code 1,1,22. IPCP: sending Configure-Request, id 1 IPCP: open state 2 (LS_CLOSED) -> 6 (LS_REQSENT) pppInput[0]: packet processed rx dump (65/1504): 7E FF 7D 23 C0 21 7D 2B 7D 25 7D 20 7D 28 7D 35 ~.}#.!}+}%}.}(}5 55 54 3D 2E DC 7E 7E C2 23 01 01 00 23 10 B0 2C UT=..~~.#...#.., 46 E2 DE 4A 20 6D CA 6C 13 63 96 74 4B 90 55 4D F..J.m.l.c.tK.UM 54 53 5F 43 48 41 50 5F 53 52 56 52 B0 4D 7E 33 TS_CHAP_SRVR.M~3 0D . pppInProc[0]: got 65 bytes pppInput[0]: LCP len=8 fsm_input(LCP):11,5,8 fsm_input(LCP): default: pppInput[0]: packet processed pppInput[0]: rejecting unsupported proto 0xc223 len=35 pppWrite[0]: len=49 tx dump (49/49): 7E FF 03 C0 21 08 02 00 29 C2 23 01 01 00 23 10 ~...!...).#...#. B0 2C 46 E2 DE 4A 20 6D CA 6C 13 63 96 74 4B 90 .,F..J.m.l.c.tK. 55 4D 54 53 5F 43 48 41 50 5F 53 52 56 52 51 CB UMTS_CHAP_SRVRQ. 7E ~ fsm_sdata(LCP): Sent code 8,2,41. rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): IPCP: timeout resending Config-Request state=6 (LS_REQSENT) pppWrite[0]: len=30 tx dump (30/30): 7E FF 03 80 21 01 01 00 16 03 06 00 00 00 00 81 ~...!........... 06 00 00 00 00 83 06 00 00 00 00 6E DB 7E ...........n.~ rx dump (0/1504): fsm_sdata(IPCP): Sent code 1,1,22. IPCP: sending Configure-Request, id 1 rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): Цитата Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты Поделиться
Dukales 0 13 июля, 2012 Опубликовано 13 июля, 2012 · Жалоба спасибо за попытку помочь. Цитата Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты Поделиться
kan35 7 13 июля, 2012 Опубликовано 13 июля, 2012 · Жалоба спасибо за попытку помочь. да не за что... count = sio_read(pcrx->fd, pcrx->rxbuf, PPPOS_RX_BUFSIZE); if(count > 0) { pppInProc(pcrx, pcrx->rxbuf, count); } else { /* nothing received, give other tasks a chance to run */ sys_msleep(2); Тут как раз и есть задержка 2мс на случай когда sio_read возвращает 0 байт. Так как вы сделали - сейчас выглядит правильно. Конечно дебаг-лог данных выплевывается некрасивый. А сути проблемы я не понял - что то с АТ командами не пошло, то тут советы излишни, наладите. А на уровне lwip сделано как надо. Вы правы, такое ощущение, что сервер просит chap авторизацию полюбому... В принципе CHAP я тестировал и он работал, только вот на каком то определенном модеме только получалось, кажется WISMO228. Осталось только посоветовать поменять модем (временно) на какой нибудь ходовой и не 3G. Например на SIMCOM или SierraWireless или quectel. Цитата Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты Поделиться
Dukales 0 16 июля, 2012 Опубликовано 16 июля, 2012 · Жалоба у меня на данный момент модем Huawei E173. проблема оказалась в том, что интернет на той SIM-карте был не оплачен. после оплаты PPP-переговоры заканчиваются удачно, но lwIP потребовалось поправить: src/netif/ppp/ipcp.c | 4 ++-- src/netif/ppp/ppp.c | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/netif/ppp/ipcp.c b/src/netif/ppp/ipcp.c index f0ab2e0..da4d99c 100644 --- a/src/netif/ppp/ipcp.c +++ b/src/netif/ppp/ipcp.c @@ -1234,11 +1234,11 @@ ipcp_up(fsm *f) ho->hisaddr = wo->hisaddr; } - if (ho->hisaddr == 0) { + /*if (ho->hisaddr == 0) { IPCPDEBUG(LOG_ERR, ("Could not determine remote IP address\n")); ipcp_close(f->unit, "Could not determine remote IP address"); return; - } + }*/ if (go->ouraddr == 0) { IPCPDEBUG(LOG_ERR, ("Could not determine local IP address\n")); ipcp_close(f->unit, "Could not determine local IP address"); diff --git a/src/netif/ppp/ppp.c b/src/netif/ppp/ppp.c index 2a34657..fbd0156 100644 --- a/src/netif/ppp/ppp.c +++ b/src/netif/ppp/ppp.c @@ -1525,6 +1525,7 @@ pppInputThread(void *arg) sys_msleep(1); } } + vTaskDelete(NULL); } #endif /* PPPOS_SUPPORT && PPP_INPROC_OWNTHREAD */ дело в том, что P-t-P интерфейсу по IPCP возвращается адрес точки провайдера 0.0.0.0, что нормально, насколько я понимаю. однако TCP-коннект не удаётся установить. Цитата Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты Поделиться
Dukales 0 17 июля, 2012 Опубликовано 17 июля, 2012 (изменено) · Жалоба мда. ступенька на каждом шагу. уважаемый kan35, не могли бы вы намекнуть на причины следующей проблемы: после переговоров PPP (после получения IP-адресов в IPCP переговорах) lwIP уже создан ppp-интерфейс, потому я создаю netconn TCP соединение (например на порт 80 одного из IP google.com), но IP соединение не создаётся, так как нет ответа от сайта. вот лог: lcp_init: xmit_accm=0 0 0 0 upap_init: 0 tx dump (2/2): 41 54 AT rx dump (0/256): tx dump (2/2): 0D 0A .. rx dump (3/256): 30 00 0D 0.. tx dump (11/11): 41 54 20 5A 30 20 45 30 20 56 30 AT.Z0.E0.V0 rx dump (0/256): tx dump (2/2): 0D 0A .. rx dump (3/256): 30 00 0D 0.. tx dump (7/7): 41 54 20 53 30 3D 30 AT.S0=0 rx dump (0/256): tx dump (2/2): 0D 0A .. rx dump (3/256): 30 00 0D 0.. tx dump (36/36): 41 54 20 2B 43 47 44 43 4F 4E 54 3D 31 2C 22 49 AT.+CGDCONT=1,"I 50 22 2C 22 69 6E 74 65 72 6E 65 74 2E 6D 74 73 P","internet.mts 2E 72 75 22 .ru" rx dump (0/256): tx dump (2/2): 0D 0A .. rx dump (3/256): 30 00 0D 0.. tx dump (13/13): 41 54 20 44 54 2A 39 39 2A 2A 2A 31 23 AT.DT*99***1# rx dump (0/256): tx dump (2/2): 0D 0A .. rx dump (3/256): 31 00 0D 1.. pppOverSerialOpen: unit 0: Connecting pppStart: unit 0 ppp_set_xaccm[0]: outACCM=0 0 0 0 ppp_send_config[0]: outACCM=FF FF FF FF ppp_recv_config[0]: inACCM=0 0 0 0 lcp_lowerup: asyncmap=0 0 0 0 LCP: lowerup state 0 (LS_INITIAL) -> 2 (LS_CLOSED) auth_reset: 0 lcp_addci: L opt=2 0 lcp_addci: L opt=5 52181044 lcp_addci: opt=7 lcp_addci: opt=8 pppWrite[0]: len=47 tx dump (47/47): 7E FF 7D 23 C0 21 7D 21 7D 21 7D 20 7D 34 7D 22 ~.}#.!}!}!}.}4}" 7D 26 7D 20 7D 20 7D 20 7D 20 7D 25 7D 26 52 7D }&}.}.}.}.}%}&R} 38 7D 30 44 7D 27 7D 22 7D 28 7D 22 6E E1 7E 8}0D}'}"}(}"n.~ fsm_sdata(LCP): Sent code 1,1,20. LCP: sending Configure-Request, id 1 LCP: open state 2 (LS_CLOSED) -> 6 (LS_REQSENT) pppStart: finished rx dump (103/1504): 7E FF 7D 23 C0 21 7D 21 7D 24 7D 20 7D 39 7D 22 ~.}#.!}!}$}.}9}" 7D 26 7D 20 7D 20 7D 20 7D 20 7D 23 7D 25 C2 23 }&}.}.}.}.}#}%.# 7D 25 7D 25 7D 26 7D 24 34 21 7D 26 7D 27 7D 22 }%}%}&}$4!}&}'}" 7D 28 7D 22 FA 7D 5E 7E 7E FF 7D 23 C0 21 7D 22 }(}".}^~~.}#.!}" 7D 21 7D 20 7D 34 7D 22 7D 26 7D 20 7D 20 7D 20 }!}.}4}"}&}.}.}. 7D 20 7D 25 7D 26 52 7D 38 7D 30 44 7D 27 7D 22 }.}%}&R}8}0D}'}" 7D 28 7D 22 85 88 7E }(}"..~ pppInProc[0]: got 103 bytes pppInput[0]: LCP len=25 fsm_input(LCP):1,4,25 fsm_rconfreq(LCP): Rcvd id 4 state=6 (LS_REQSENT) lcp_reqci: rcvd ASYNCMAP=0 CHAP C223,5 MAGICNUMBER (4342106) PCOMPRESSION lcp_reqci: ACCOMPRESSION lcp_reqci: returning CONFACK. pppWrite[0]: len=55 tx dump (55/55): 7E FF 7D 23 C0 21 7D 22 7D 24 7D 20 7D 39 7D 22 ~.}#.!}"}$}.}9}" 7D 26 7D 20 7D 20 7D 20 7D 20 7D 23 7D 25 C2 23 }&}.}.}.}.}#}%.# 7D 25 7D 25 7D 26 7D 24 34 21 7D 26 7D 27 7D 22 }%}%}&}$4!}&}'}" 7D 28 7D 22 77 72 7E }(}"wr~ fsm_sdata(LCP): Sent code 2,4,25. pppInput[0]: packet processed pppInput[0]: LCP len=20 fsm_input(LCP):2,1,20 fsm_rconfack(LCP): Rcvd id 1 state=8 (LS_ACKSENT) lcp_acki: Ack ppp_send_config[0]: outACCM=0 0 0 0 ppp_recv_config[0]: inACCM=0 0 0 0 link_established: unit 0; Lowering up all protocols... upap_lowerup: init 0 clientstate s=0 IPCP: lowerup state 0 (LS_INITIAL) -> 2 (LS_CLOSED) pppInput[0]: packet processed rx dump (64/1504): 7E FF 7D 23 C0 21 7D 2B 7D 25 7D 20 7D 28 7D 24 ~.}#.!}+}%}.}(}$ 34 21 7D 26 89 5D 7E 7E C2 23 01 01 00 23 10 C0 4!}&.]~~.#...#.. 8F 0D FD 0A 08 59 85 EA 0C 1F 98 AC 24 89 1E 55 .....Y......$..U 4D 54 53 5F 43 48 41 50 5F 53 52 56 52 15 EE 7E MTS_CHAP_SRVR..~ pppInProc[0]: got 64 bytes pppInput[0]: LCP len=8 fsm_input(LCP):11,5,8 fsm_input(LCP): default: pppInput[0]: packet processed pppInput[0]: CHAP len=35 ChapReceiveChallenge: Rcvd id 1. ChapReceiveChallenge: received name field 'UMTS_CHAP_SRVR' pppWrite[0]: len=32 tx dump (32/32): 7E FF 03 C2 23 02 01 00 18 10 C8 E8 44 8E 6D ED ~...#.......D.m. C0 92 00 AC 08 B6 90 6C 94 A5 6D 74 73 65 8A 7E .......l..mtse.~ pppInput[0]: packet processed rx dump (10/1504): 7E C2 23 03 01 00 04 C2 BC 7E ~.#......~ pppInProc[0]: got 10 bytes pppInput[0]: CHAP len=4 ChapReceiveSuccess: Rcvd id 1. auth_withpeer_success: 0 proto=C223 pppWrite[0]: len=30 tx dump (30/30): 7E FF 03 80 21 01 01 00 16 03 06 00 00 00 00 81 ~...!........... 06 00 00 00 00 83 06 00 00 00 00 6E DB 7E ...........n.~ fsm_sdata(IPCP): Sent code 1,1,22. IPCP: sending Configure-Request, id 1 IPCP: open state 2 (LS_CLOSED) -> 6 (LS_REQSENT) pppInput[0]: packet processed rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (34/1504): 7E 80 21 03 01 00 1C 81 06 0A 0B 0C 0D 83 06 0A ~.!............. 0B 0C 0E 82 06 0A 0B 0C 0D 84 06 0A 0B 0C 0E 41 ...............A 03 7E .~ pppInProc[0]: got 34 bytes pppInput[0]: IPCP len=28 fsm_input(IPCP):3,1,28 fsm_rconfnakrej(IPCP): Rcvd id 1 state=6 (LS_REQSENT) primary DNS address 10.11.12.13 secondary DNS address 10.11.12.14 pppWrite[0]: len=30 tx dump (30/30): 7E FF 03 80 21 01 02 00 16 03 06 00 00 00 00 81 ~...!........... 06 0A 0B 0C 0D 83 06 0A 0B 0C 0E 8B BA 7E .............~ fsm_sdata(IPCP): Sent code 1,2,22. IPCP: sending Configure-Request, id 2 pppInput[0]: packet processed rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): rx dump (34/1504): 7E 80 21 03 02 00 1C 81 06 0A 0B 0C 0D 83 06 0A ~.!............. 0B 0C 0E 82 06 0A 0B 0C 0D 84 06 0A 0B 0C 0E 99 ................ F5 7E .~ pppInProc[0]: got 34 bytes pppInput[0]: IPCP len=28 fsm_input(IPCP):3,2,28 fsm_rconfnakrej(IPCP): Rcvd id 2 state=6 (LS_REQSENT) primary DNS address 10.11.12.13 secondary DNS address 10.11.12.14 pppWrite[0]: len=30 tx dump (30/30): 7E FF 03 80 21 01 03 00 16 03 06 00 00 00 00 81 ~...!........... 06 0A 0B 0C 0D 83 06 0A 0B 0C 0E E7 8D 7E .............~ fsm_sdata(IPCP): Sent code 1,3,22. IPCP: sending Configure-Request, id 3 pppInput[0]: packet processed rx dump (66/1504): 7E 80 21 01 04 00 04 06 A0 7E 7E 80 21 03 02 00 ~.!......~~.!... 16 03 06 0A 41 BA A7 81 06 D5 57 4B 63 83 06 D5 ....A.....WKc... 57 48 9B 0E EB 7E 7E 80 21 03 03 00 16 03 06 0A WH...~~.!....... 41 BA A7 81 06 D5 57 4B 63 83 06 D5 57 48 9B 62 A.....WKc...WH.b DC 7E .~ pppInProc[0]: got 66 bytes pppInput[0]: IPCP len=4 fsm_input(IPCP):1,4,4 fsm_rconfreq(IPCP): Rcvd id 4 state=6 (LS_REQSENT) ipcp_reqci: Requesting peer address ipcp_reqci: returning Configure-NAK pppWrite[0]: len=18 tx dump (18/18): 7E FF 03 80 21 03 04 00 0A 03 06 00 00 00 00 45 ~...!..........E 02 7E .~ fsm_sdata(IPCP): Sent code 3,4,10. pppInput[0]: packet processed pppInput[0]: IPCP len=22 fsm_input(IPCP):3,2,22 fsm_rconfnakrej(IPCP): Rcvd id 2 state=6 (LS_REQSENT) pppInput[0]: packet processed pppInput[0]: IPCP len=22 fsm_input(IPCP):3,3,22 fsm_rconfnakrej(IPCP): Rcvd id 3 state=6 (LS_REQSENT) local IP address 10.65.186.167 primary DNS address 213.87.75.99 secondary DNS address 213.87.72.155 pppWrite[0]: len=29 tx dump (29/29): FF 03 80 21 01 04 00 16 03 06 0A 41 BA A7 81 06 ...!.......A.... D5 57 4B 63 83 06 D5 57 48 9B AD 92 7E .WKc...WH...~ fsm_sdata(IPCP): Sent code 1,4,22. IPCP: sending Configure-Request, id 4 pppInput[0]: packet processed rx dump (38/1504): 7E 80 21 01 05 00 04 DA FA 7E 7E 80 21 02 04 00 ~.!......~~.!... 16 03 06 0A 41 BA A7 81 06 D5 57 4B 63 83 06 D5 ....A.....WKc... 57 48 9B 3B F1 7E WH.;.~ pppInProc[0]: got 38 bytes pppInput[0]: IPCP len=4 fsm_input(IPCP):1,5,4 fsm_rconfreq(IPCP): Rcvd id 5 state=6 (LS_REQSENT) ipcp_reqci: returning Configure-ACK pppWrite[0]: len=12 tx dump (12/12): 7E FF 03 80 21 02 05 00 04 AC F1 7E ~...!......~ fsm_sdata(IPCP): Sent code 2,5,4. pppInput[0]: packet processed pppInput[0]: IPCP len=22 fsm_input(IPCP):2,4,22 fsm_rconfack(IPCP): Rcvd id 4 state=8 (LS_ACKSENT) np_up: 0 proto=21 np_up: maxconnect=0 idle_time_limit=0 ipcp: up sifup: unit 0: linkStatusCB=0x800de59 errCode=0 ip_addr = 10.65.186.167 netmask = 255.255.255.0 dns1 = 213.87.75.99 dns2 = 213.87.72.155 local IP address 10.65.186.167 remote IP address 0.0.0.0 primary DNS address 213.87.75.99 secondary DNS address 213.87.72.155 pppInput[0]: packet processed lwIP PPP connected tcp_bind: bind to port 49153 tcp_connect to port 80 pppifOutput[0]: proto=0x21 tx dump (48/48): 21 45 00 00 2C 00 00 00 00 FF 06 00 00 0A 41 BA !E..,.........A. A7 AD C2 23 C3 C0 01 00 50 00 00 19 6D 00 00 00 ...#....P...m... 00 60 02 0B 68 00 00 00 00 02 04 05 B4 6B BE 7E .`..h........k.~ rx dump (0/1504): tcp_slowtmr: processing active pcb rx dump (0/1504): rx dump (0/1504): tcp_slowtmr: processing active pcb rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): tcp_slowtmr: processing active pcb rx dump (0/1504): rx dump (0/1504): tcp_slowtmr: processing active pcb tcp_slowtmr: polling application rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): tcp_slowtmr: processing active pcb rx dump (0/1504): rx dump (0/1504): tcp_slowtmr: processing active pcb pppifOutput[0]: proto=0x21 tx dump (49/49): 7E 21 45 00 00 2C 00 01 00 00 FF 06 00 00 0A 41 ~!E..,.........A BA A7 AD C2 23 C3 C0 01 00 50 00 00 19 6D 00 00 ....#....P...m.. 00 00 60 02 0B 68 00 00 00 00 02 04 05 B4 85 F4 ..`..h.......... 7E ~ rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): tcp_slowtmr: processing active pcb rx dump (0/1504): rx dump (0/1504): tcp_slowtmr: processing active pcb tcp_slowtmr: polling application rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): tcp_slowtmr: processing active pcb rx dump (0/1504): rx dump (0/1504): tcp_slowtmr: processing active pcb rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): tcp_slowtmr: processing active pcb rx dump (0/1504): rx dump (0/1504): tcp_slowtmr: processing active pcb pppifOutput[0]: proto=0x21 tx dump (49/49): 7E 21 45 00 00 2C 00 02 00 00 FF 06 00 00 0A 41 ~!E..,.........A BA A7 AD C2 23 C3 C0 01 00 50 00 00 19 6D 00 00 ....#....P...m.. 00 00 60 02 0B 68 00 00 00 00 02 04 05 B4 B7 2B ..`..h.........+ 7E ~ tcp_slowtmr: polling application rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): tcp_slowtmr: processing active pcb rx dump (0/1504): rx dump (0/1504): tcp_slowtmr: processing active pcb rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): tcp_slowtmr: processing active pcb rx dump (0/1504): rx dump (0/1504): tcp_slowtmr: processing active pcb tcp_slowtmr: polling application rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): tcp_slowtmr: processing active pcb rx dump (0/1504): rx dump (0/1504): tcp_slowtmr: processing active pcb pppifOutput[0]: proto=0x21 tx dump (49/49): 7E 21 45 00 00 2C 00 03 00 00 FF 06 00 00 0A 41 ~!E..,.........A BA A7 AD C2 23 C3 C0 01 00 50 00 00 19 6D 00 00 ....#....P...m.. 00 00 60 02 0B 68 00 00 00 00 02 04 05 B4 59 61 ..`..h........Ya 7E ~ rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): tcp_slowtmr: processing active pcb rx dump (0/1504): rx dump (0/1504): tcp_slowtmr: processing active pcb tcp_slowtmr: polling application rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): tcp_slowtmr: processing active pcb rx dump (0/1504): rx dump (0/1504): tcp_slowtmr: processing active pcb rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): tcp_slowtmr: processing active pcb rx dump (0/1504): rx dump (0/1504): tcp_slowtmr: processing active pcb pppifOutput[0]: proto=0x21 tx dump (49/49): 7E 21 45 00 00 2C 00 04 00 00 FF 06 00 00 0A 41 ~!E..,.........A BA A7 AD C2 23 C3 C0 01 00 50 00 00 19 6D 00 00 ....#....P...m.. 00 00 60 02 0B 68 00 00 00 00 02 04 05 B4 C2 9D ..`..h.......... 7E ~ tcp_slowtmr: polling application rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): tcp_slowtmr: processing active pcb rx dump (0/1504): rx dump (0/1504): tcp_slowtmr: processing active pcb rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): tcp_slowtmr: processing active pcb rx dump (0/1504): rx dump (0/1504): tcp_slowtmr: processing active pcb tcp_slowtmr: polling application rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): tcp_slowtmr: processing active pcb rx dump (0/1504): rx dump (0/1504): tcp_slowtmr: processing active pcb pppifOutput[0]: proto=0x21 tx dump (49/49): 7E 21 45 00 00 2C 00 05 00 00 FF 06 00 00 0A 41 ~!E..,.........A BA A7 AD C2 23 C3 C0 01 00 50 00 00 19 6D 00 00 ....#....P...m.. 00 00 60 02 0B 68 00 00 00 00 02 04 05 B4 2C D7 ..`..h........,. 7E ~ rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): tcp_slowtmr: processing active pcb rx dump (0/1504): rx dump (0/1504): tcp_slowtmr: processing active pcb tcp_slowtmr: polling application rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): tcp_slowtmr: processing active pcb rx dump (0/1504): rx dump (0/1504): tcp_slowtmr: processing active pcb rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): tcp_slowtmr: processing active pcb rx dump (0/1504): rx dump (0/1504): tcp_slowtmr: processing active pcb pppifOutput[0]: proto=0x21 tx dump (49/49): 7E 21 45 00 00 2C 00 06 00 00 FF 06 00 00 0A 41 ~!E..,.........A BA A7 AD C2 23 C3 C0 01 00 50 00 00 19 6D 00 00 ....#....P...m.. 00 00 60 02 0B 68 00 00 00 00 02 04 05 B4 1E 08 ..`..h.......... 7E ~ tcp_slowtmr: polling application rx dump (0/1504): rx dump (0/1504): rx dump (0/1504): tcp_slowtmr: processing active pcb tcp_slowtmr: max SYN retries reached tcp_pcb_purge tcp_pcb_purge: data left on ->unacked could not connect to remote host pppClose() called pppClose: unit 0 kill_link -> pppStop pppStop: unit 0 link_down: 0 upap_lowerdown: 0 s=1 ipcp: down np_down: 0 proto=21 sifdown: unit 0: linkStatusCB=0x800de59 errCode=-5 lost connection IPCP: lowerdown state 9 (LS_OPENED) -> 1 (LS_STARTING) IPCP: close reason=LCP down state 1 (LS_STARTING) -> 0 (LS_INITIAL) pppLinkDown: unit 0 pppRecvWakeup: unit 0 ppp_send_config[0]: outACCM=FF FF FF FF ppp_recv_config[0]: inACCM=0 0 0rx dump (0/1504): 0 pppWrite[0]: len=29 tx dump (29/29): 7E FF 7D 23 C0 21 7D 25 7D 22 7D 20 7D 30 55 73 ~.}#.!}%}"}.}0Us 65 72 20 72 65 71 75 65 73 74 53 33 7E er.requestS3~ fsm_sdata(LCP): Sent code 5,2,16. LCP: close reason=User request state 9 (LS_OPENED) -> 4 (LS_CLOSING) pppRecvWakeup: unit 0 RECONNECT rx dump (0/1504): rx dump (18/1504): 7E FF 7D 23 C0 21 7D 26 7D 22 7D 20 7D 24 94 7D ~.}#.!}&}"}.}$.} 2D 7E -~ pppInProc[0]: got 18 bytes pppInput[0]: LCP len=4 fsm_input(LCP):6,2,4 fsm_rtermack(LCP): state=4 (LS_CLOSING) link_terminated: 0 Connection terminated. pppLinkTerminated: unit 0 pppRecvWakeup: unit 0 pppLinkTerminated: unit 0: linkStatusCB=0x800de59 errCode=-5 pppLinkTerminated: finished. pppInput[0]: packet processed rx dump (0/1504): tx dump (2/2): 41 54 AT rx dump (0/256): tx dump (2/2): 0D 0A .. вот код: #include "inet.h" /*drivers*/ #include "main.h" #include "gate.h" /*kernel*/ #include "FreeRTOS.h" #include "portmacro.h" #include "task.h" #include "queue.h" #include "semphr.h" /*computer networking protocol suite*/ #include "lwip/mem.h" #include "lwip/memp.h" #include "lwip/inet.h" /*#include "ethernetif.h"*/ /*#include "netconf.h"*/ #include "lwip/tcpip.h" #include "ppp.h" #include "lwip/sio.h" /*libc/libg libm libgcc*/ #include <stdio.h> #include <stdarg.h> #include <string.h> #include <ctype.h> #define RX_BUF_SIZE 1540 static xQueueHandle xRxedChars; void COM1_IRQHandler(void) { portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; if (USART_GetITStatus(COM1_USART, USART_IT_RXNE) == SET) { u8_t c = (USART_ReceiveData(COM1_USART) & ((1 << SERIAL_RS485_BITS) - 1)); xQueueSendFromISR(xRxedChars, &c, &xHigherPriorityTaskWoken); } portEND_SWITCHING_ISR(xHigherPriorityTaskWoken); } #define MODEM_TEXT_IO_LENGTH 256 #define SIO_SERIAL_PORT NULL #define PPP_CONNECTION_TIMEOUT 20000 / portTICK_RATE_MS #define MODEM_READ_TIMEOUT 200 / portTICK_RATE_MS static int modem_putchar(int c) { while (USART_GetFlagStatus(COM1_USART, USART_FLAG_TXE) != SET) { continue; } USART_SendData(COM1_USART, c); return c; } /*static int modem_printf(const char * fmt, ...) { static char tx_buf[MODEM_TEXT_IO_LENGTH]; int count; { va_list args; va_start(args, fmt); count = vsnprintf(tx_buf + 0, sizeof(tx_buf), fmt, args); va_end(args); } for (int i = 0; i < count; ++i) { if (modem_putchar(tx_buf[i]) < 0) { return i; } } return count; }*/ static int modem_getch(void) { u8_t c; if (xQueueReceive(xRxedChars, &c, 1 / portTICK_RATE_MS) == pdFALSE) { return -1; } return c; } static int modem_exchange(char * AT_command) { static u8 rx_buf[MODEM_TEXT_IO_LENGTH]; int len; sio_write(SIO_SERIAL_PORT, (u8 *) AT_command, strlen(AT_command)); sio_read(SIO_SERIAL_PORT, rx_buf + 0, sizeof(rx_buf)); // discard echo if present sio_write(SIO_SERIAL_PORT, (u8 *) "\r\n", 2); len = sio_read(SIO_SERIAL_PORT, rx_buf + 0, sizeof(rx_buf)); if (len > 0) { int code; if (sscanf((char *) &rx_buf, "%i", &code) == 1) { vTaskDelay(100 / portTICK_RATE_MS); return code; } } return -1; } static int connected; static void linkStatusCB(void * ctx, int errCode, void * arg) { int * connected = (int *) ctx; struct ppp_addrs * addrs = arg; switch (errCode) { case PPPERR_NONE: { /* We are connected */ *connected = 1; printf("ip_addr = %s\r\n", inet_ntoa(addrs->our_ipaddr)); printf("netmask = %s\r\n", inet_ntoa(addrs->netmask)); printf("dns1 = %s\r\n", inet_ntoa(addrs->dns1)); printf("dns2 = %s\r\n", inet_ntoa(addrs->dns2)); break; } case PPPERR_CONNECT: { printf("lost connection\r\n"); /* just wait */ break; } default: { /* We have lost connection */ *connected = 0; break; } } } static void hw_init(void) { USART_InitTypeDef USART_InitStructure; USART_InitStructure.USART_BaudRate = 57600; USART_InitStructure.USART_WordLength = USART_WordLength_8b; USART_InitStructure.USART_StopBits = USART_StopBits_1; USART_InitStructure.USART_Parity = USART_Parity_No; USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None; USART_InitStructure.USART_Mode = (USART_Mode_Rx | USART_Mode_Tx); com_init(COM1, &USART_InitStructure); USART_ITConfig(COM1_USART, USART_IT_RXNE, ENABLE); } static void tcpip_init_done(void * arg) { if (arg != NULL) { *((int *) arg) = 1; } } static void connection_task(void) { struct netconn * conn; struct netbuf * buf; struct ip_addr remote; err_t err; IP4_ADDR(&remote, 173, 194, 35, 195); conn = netconn_new(NETCONN_TCP); if (conn != NULL) { err = netconn_bind(conn, IP_ADDR_ANY, 0); // IP_ADDR_ANY if (ERR_OK == err) { err = netconn_connect(conn, &remote, 80); // IP_ADDR_BROADCAST if (ERR_OK == err) { printf("netconn_connect OK\r\n"); for (;;) { printf("tick\r\n"); vTaskDelay(1000 / portTICK_RATE_MS); char x[] = "test data\r\n"; /*if (x == EOF) { continue; } else if (c == '.') { printf("about to close connection\r\n"); err = netconn_disconnect(conn); LWIP_UNUSED_ARG(err); break; } else { printf("local echo: %s\r\n", x); }*/ buf = netbuf_new(); if (buf != NULL) { char * data = netbuf_alloc(buf, sizeof(x)); if (buf != NULL) { memcpy(data, x, sizeof(x)); if (netconn_send(conn, buf) != ERR_OK) { printf("cannot send the data\r\n"); } else { printf("data is sent\r\n"); } } else { printf("memory cannot be allocated\r\n"); } netbuf_delete(buf); } else { printf("lack of memory\r\n"); } } } else { printf("could not connect to remote host\r\n"); } netconn_disconnect(conn); } else { printf("could not bind to local interface\r\n"); } netconn_delete(conn); } } #define PPP_AUTH_USERNAME "mts" #define PPP_AUTH_PASSWORD "mts" static void inetTask(void * pvParameters) { (void) pvParameters; int setup = 0; int pd = -1; tcpip_init(tcpip_init_done, &setup); while (setup == 0) { vTaskDelay(100 / portTICK_RATE_MS); } pppInit(); hw_init(); for (;;) { vTaskDelay(1000 / portTICK_RATE_MS); modem_exchange("AT"); if (modem_exchange("AT Z0 E0 V0") != 0) { // OK continue; } if (modem_exchange("AT S0=0") != 0) { // OK continue; } if (modem_exchange("AT +CGDCONT=1,\"IP\",\"internet.mts.ru\"") != 0) { // OK continue; } if (modem_exchange("AT DT*99***1#") != 1) { // CONNECT continue; } pppSetAuth(PPPAUTHTYPE_ANY, PPP_AUTH_USERNAME, PPP_AUTH_PASSWORD); connected = 0; pd = pppOverSerialOpen(SIO_SERIAL_PORT, linkStatusCB, &connected); if (!(pd < 0)) { portTickType ticks = xTaskGetTickCount(); do { vTaskDelay(100 / portTICK_RATE_MS); if (connected != 0) { printf("lwIP PPP connected\r\n"); break; } } while (xTaskGetTickCount() < ticks + PPP_CONNECTION_TIMEOUT); if (connected != 0) { connection_task(); } pppClose(pd); } else { printf("could not connect\r\n"); } printf("RECONNECT\r\n"); } #if 0 for (;;) { vTaskDelay(100 / portTICK_RATE_MS); } #else vTaskDelete(NULL); #endif } void inet_init(void) { xRxedChars = xQueueCreate(RX_BUF_SIZE, sizeof(u8_t)); xTaskCreate(inetTask, (signed char *) "inetTask", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, (xTaskHandle *) NULL); } u32_t sys_jiffies(void) { return xTaskGetTickCount(); } static __attribute__ ((noinline)) void print_dump(u8_t * data, u32_t len, const char * prefix) { int i, r, l, p; static u8_t line[0x10]; u8_t c; l = 0; for (i = 0; i < len; ++i) { c = *(data + i); r = (i % 0x10); if (isgraph© != 0) { *(line + r) = c; } else { *(line + r) = '.'; } if (i == 0) { p = printf("%s", prefix); } else if (r == 0) { printf("%*s", p, ""); } if (i + 1 == len) { printf("%02hhX %*.*s", c, r + 1 + (46 - l), r + 1, line + 0); l = 0; } else if (r == 0x0F) { printf("%02hhX %.16s\r\n", c, line + 0); l = 0; } else if (r == 7) { l += printf("%02hhX ", c); } else { l += printf("%02hhX ", c); } } } static int read_abort = 0; u32_t sio_read(sio_fd_t fd, u8_t * data, u32_t len) { LWIP_UNUSED_ARG(fd); int i; portTickType ticks = xTaskGetTickCount(); read_abort = 0; for (i = 0; i < len; ++i) { int c; do { c = modem_getch(); if (read_abort != 0) { break; } if (!(c < 0)) { data[i] = c; break; } } while (xTaskGetTickCount() < ticks + MODEM_READ_TIMEOUT); if (read_abort != 0) { read_abort = 0; break; } if (c < 0) { break; } } #if PPP_DEBUG == LWIP_DBG_ON printf("rx dump (%d/%d):\r\n", i, len); print_dump(data, i, ""); // "rcvd " ~pppdump format printf("\r\n"); #endif return i; } void sio_read_abort(sio_fd_t fd) { LWIP_UNUSED_ARG(fd); read_abort = 1; } u32_t sio_write(sio_fd_t fd, u8_t * data, u32_t len) { LWIP_UNUSED_ARG(fd); #if PPP_DEBUG == LWIP_DBG_ON printf("tx dump (%d/%d):\r\n", len, len); print_dump(data, len, ""); // "sent " printf("\r\n"); #endif for (u32_t i = 0; i < len; ++i) { modem_putchar(data[i]); } return len; } похоже на syn (если он в правильном формате отправляется) нет ответа. я пробовал разные сайты, кроме того на собственном сервере с белым IP запускал nc -l 80, но нет ответа ни от кого. в чём может быть проблема? Изменено 17 июля, 2012 пользователем eisufu Цитата Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты Поделиться
kan35 7 17 июля, 2012 Опубликовано 17 июля, 2012 · Жалоба Да, интернет на SIM карте надо было проверить в первую очередь :-) renote ip у меня выдавался на simcom и wismo, на остальных модемах - нет. В стеке надо отключать эту проверку. Порядок открытия соединения такой, никаких bind не нужно: ... conn = netconn_new(NETCONN_TCP); struct ip_addr addr; addr.addr = inet_addr("здесь строка с IP адресом"); if ( netconn_connect(conn, &addr, server_port) == ERR_OK ) { // соединение открыто - можно работать } На всякий случай, как у меня выглядит RX ISR от модема: void GPRS_Rx(unsigned char usart_byte) { if (queue_gprs_bytes) { portBASE_TYPE xHigherPriorityTaskWoken; xHigherPriorityTaskWoken = pdTRUE; if (xQueueSendFromISR(queue_gprs_bytes, &usart_byte, &xHigherPriorityTaskWoken) == errQUEUE_FULL) { /* putchar_usart(USART_MODEM, XOFF); rx_en = 0;*/ } } } и sio_read volatile unsigned char stop = 0; u32_t sio_read(sio_fd_t fd, u8_t *data, u32_t len) { unsigned long i = 0; while (xQueueReceive(queue_gprs_bytes, &data[i], 0) == pdTRUE ) // { i++; if (stop || (i == len) ) { stop = 0; return i; } } return i; } Цитата Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты Поделиться