Subversion Repositories Kolibri OS

Rev

Rev 2961 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2961 Rev 2962
Line 20... Line 20...
20
        SessionID       dw ?
20
        SessionID       dw ?
21
        Length          dw ?            ; Length of payload, does NOT include the length PPPoE header.
21
        Length          dw ?            ; Length of payload, does NOT include the length PPPoE header.
22
        Payload         rb 0
22
        Payload         rb 0
23
ends
23
ends
Line 24... Line -...
24
 
-
 
25
struct  LCP_frame
-
 
26
        Code            db ?
-
 
27
        Identifier      db ?
-
 
28
        Length          dw ?
-
 
29
        Data            rb 0
-
 
30
ends
-
 
31
 
24
 
32
uglobal
25
uglobal
33
        PPPoE_SID       dw ?
26
        PPPoE_SID       dw ?
34
        PPPoE_MAC       dp ?
27
        PPPoE_MAC       dp ?
Line 35... Line -...
35
endg
-
 
36
 
-
 
37
LCP_config_request      = 1
-
 
38
LCP_config_ack          = 2
-
 
39
LCP_config_nak          = 3
-
 
40
LCP_config_reject       = 4
-
 
41
LCP_terminate_request   = 5
-
 
42
LCP_terminate_ack       = 6
-
 
43
LCP_code_reject         = 7
-
 
44
LCP_protocol_reject     = 8
-
 
45
LCP_echo_request        = 9
-
 
46
LCP_echo_reply          = 10
-
 
47
LCP_discard_request     = 11
-
 
48
 
28
endg
49
 
29
 
50
;-----------------------------------------------------------------
30
;-----------------------------------------------------------------
51
;
31
;
52
; IPv4_init
32
; PPPoE_init
53
;
33
;
54
;  This function resets all IP variables
34
;  This function resets all IP variables
55
;
35
;
Line 166... Line 146...
166
; Overwrite source MAC and protocol type
146
; Overwrite source MAC and protocol type
167
        lea     edi, [eax + ETH_header.SrcMAC]
147
        lea     edi, [eax + ETH_header.SrcMAC]
168
        lea     esi, [ebx + ETH_DEVICE.mac]
148
        lea     esi, [ebx + ETH_DEVICE.mac]
169
        movsd
149
        movsd
170
        movsw
150
        movsw
-
 
151
        cmp     word[edi], ETHER_PPP_SESSION    ; Allow only PPP_discovery, or LCP
-
 
152
        je      @f
171
        mov     ax, ETHER_PPP_DISCOVERY
153
        mov     ax, ETHER_PPP_DISCOVERY
172
        stosw
154
        stosw
-
 
155
       @@:
Line 173... Line 156...
173
 
156
 
174
; And send the packet
157
; And send the packet
Line 175... Line 158...
175
        call    [ebx + NET_DEVICE.transmit]
158
        call    [ebx + NET_DEVICE.transmit]
Line 219... Line 202...
219
 
202
 
220
        cmp     ax, PPP_IPv4
203
        cmp     ax, PPP_IPv4
Line 221... Line 204...
221
        je      IPv4_input
204
        je      IPv4_input
222
 
205
 
Line 223... Line 206...
223
        cmp     ax, PPP_LCP
206
        cmp     ax, PPP_LCP
Line 224... Line 207...
224
        je      LCP_input
207
        je      PPPoE_discovery_input   ; Send LCP packets to the PPP dialer
225
 
208
 
Line 288... Line 271...
288
        xor     edi, edi
271
        xor     edi, edi
Line 289... Line 272...
289
 
272
 
Line 290... Line -...
290
        ret
-
 
291
 
-
 
292
 
-
 
293
 
-
 
294
 
-
 
295
;-----------------------------------------------------------------
-
 
296
;
-
 
297
; LCP_input:
-
 
298
;
-
 
299
;  IN:  Pointer to buffer in [esp]
-
 
300
;       size of buffer in [esp+4]
-
 
301
;       pointer to device struct in ebx
-
 
302
;       pointer to LCP header in edx
-
 
303
;       size of LCP packet in ecx
-
 
304
;  OUT: /
-
 
305
;
-
 
306
;-----------------------------------------------------------------
-
 
307
align 4
-
 
308
LCP_input:
-
 
309
 
-
 
310
        DEBUGF  1,"LCP_input\n"
-
 
311
 
-
 
312
        cmp     [edx + LCP_frame.Code], LCP_echo_request
-
 
313
        je      .echo
-
 
314
 
-
 
315
        jmp     .dump
-
 
316
 
-
 
317
  .echo:
-
 
318
        mov     [edx + LCP_frame.Code], LCP_echo_reply
-
 
319
        mov     esi, [esp]
-
 
320
 
-
 
321
        push    dword [esi + ETH_header.DstMAC]
-
 
322
        push    dword [esi + ETH_header.SrcMAC]
-
 
323
        pop     dword [esi + ETH_header.DstMAC]
-
 
324
        pop     dword [esi + ETH_header.SrcMAC]
-
 
325
        push    word [esi + ETH_header.DstMAC + 4]
-
 
326
        push    word [esi + ETH_header.SrcMAC + 4]
-
 
327
        pop     word [esi + ETH_header.DstMAC + 4]
-
 
328
        pop     word [esi + ETH_header.SrcMAC + 4]
-
 
329
 
-
 
330
        call    [ebx + NET_DEVICE.transmit]
-
 
331
        ret
-
 
332
 
-
 
333
  .dump:
-
 
334
        DEBUGF  2,"LCP_input: dumping\n"
-
 
335
        call    kernel_free
-
 
336
        add     esp, 4
-
 
337
        ret
-
 
338
 
-
 
339
 
-
 
340
 
273
        ret
Line 341... Line 274...
341
 
274
 
Line 342... Line 275...
342
align 4
275