22,34 → 22,14 |
Payload rb 0 |
ends |
|
struct LCP_frame |
Code db ? |
Identifier db ? |
Length dw ? |
Data rb 0 |
ends |
|
uglobal |
PPPoE_SID dw ? |
PPPoE_MAC dp ? |
endg |
|
LCP_config_request = 1 |
LCP_config_ack = 2 |
LCP_config_nak = 3 |
LCP_config_reject = 4 |
LCP_terminate_request = 5 |
LCP_terminate_ack = 6 |
LCP_code_reject = 7 |
LCP_protocol_reject = 8 |
LCP_echo_request = 9 |
LCP_echo_reply = 10 |
LCP_discard_request = 11 |
|
|
;----------------------------------------------------------------- |
; |
; IPv4_init |
; PPPoE_init |
; |
; This function resets all IP variables |
; |
168,8 → 148,11 |
lea esi, [ebx + ETH_DEVICE.mac] |
movsd |
movsw |
cmp word[edi], ETHER_PPP_SESSION ; Allow only PPP_discovery, or LCP |
je @f |
mov ax, ETHER_PPP_DISCOVERY |
stosw |
@@: |
|
; And send the packet |
call [ebx + NET_DEVICE.transmit] |
221,7 → 204,7 |
je IPv4_input |
|
cmp ax, PPP_LCP |
je LCP_input |
je PPPoE_discovery_input ; Send LCP packets to the PPP dialer |
|
DEBUGF 2,"PPPoE_input: Unknown protocol=%x\n", ax |
|
290,56 → 273,6 |
ret |
|
|
|
|
;----------------------------------------------------------------- |
; |
; LCP_input: |
; |
; IN: Pointer to buffer in [esp] |
; size of buffer in [esp+4] |
; pointer to device struct in ebx |
; pointer to LCP header in edx |
; size of LCP packet in ecx |
; OUT: / |
; |
;----------------------------------------------------------------- |
align 4 |
LCP_input: |
|
DEBUGF 1,"LCP_input\n" |
|
cmp [edx + LCP_frame.Code], LCP_echo_request |
je .echo |
|
jmp .dump |
|
.echo: |
mov [edx + LCP_frame.Code], LCP_echo_reply |
mov esi, [esp] |
|
push dword [esi + ETH_header.DstMAC] |
push dword [esi + ETH_header.SrcMAC] |
pop dword [esi + ETH_header.DstMAC] |
pop dword [esi + ETH_header.SrcMAC] |
push word [esi + ETH_header.DstMAC + 4] |
push word [esi + ETH_header.SrcMAC + 4] |
pop word [esi + ETH_header.DstMAC + 4] |
pop word [esi + ETH_header.SrcMAC + 4] |
|
call [ebx + NET_DEVICE.transmit] |
ret |
|
.dump: |
DEBUGF 2,"LCP_input: dumping\n" |
call kernel_free |
add esp, 4 |
ret |
|
|
|
|
align 4 |
PPPoE_start_connection: |
|
DEBUGF 2,"PPPoE_start_connection: %x\n", cx |