/kernel/trunk/network/PPPoE.inc |
---|
1,6 → 1,6 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;; ;; |
;; Copyright (C) KolibriOS team 2012-2019. All rights reserved. ;; |
;; Copyright (C) KolibriOS team 2012-2021. All rights reserved. ;; |
;; Distributed under terms of the GNU General Public License ;; |
;; ;; |
;; PPPoE.INC ;; |
141,38 → 141,41 |
DEBUGF DEBUG_NETWORK_VERBOSE, "PPPoE_discovery_output: device=%x\n", ebx |
; Create packet. |
push ecx esi |
;;;; FIXME stdcall kernel_alloc, 1500 |
pop esi ecx |
stdcall net_buff_alloc, 1514 + NET_BUFF.data |
test eax, eax |
jz .bad |
; Net buffer header |
mov [eax + NET_BUFF.type], NET_BUFF_ETH |
mov [eax + NET_BUFF.device], ebx |
mov [eax + NET_BUFF.offset], NET_BUFF.data |
; Packet data |
mov edx, ecx |
mov edi, eax |
lea edi, [eax + NET_BUFF.data] |
rep movsb |
cmp edx, 60 ; Min ETH size |
; Packet size |
cmp edx, 60 |
ja @f |
mov edx, 60 |
@@: |
mov [eax + NET_BUFF.length], edx |
push edx eax ; size and packet ptr for driver send proc |
; Overwrite source MAC and protocol type |
lea edi, [eax + ETH_header.SrcMAC] |
; Overwrite ETH source MAC with our own |
lea esi, [ebx + ETH_DEVICE.mac] |
lea edi, [eax + NET_BUFF.data + ETH_header.SrcMAC] |
movsd |
movsw |
cmp word[edi], ETHER_PROTO_PPP_SESSION ; Allow only PPP_discovery, or LCP |
; Allow only PPP_discovery, or LCP |
cmp word[edi], ETHER_PROTO_PPP_SESSION |
je @f |
mov ax, ETHER_PROTO_PPP_DISCOVERY |
stosw |
mov word[edi], ETHER_PROTO_PPP_DISCOVERY |
@@: |
; And send the packet |
call [ebx + NET_DEVICE.transmit] |
xor eax, eax |
stdcall [ebx + NET_DEVICE.transmit], eax |
ret |
.bad: |
/kernel/trunk/network/socket.inc |
---|
332,8 → 332,8 |
cmp ecx, AF_PPP |
jne .no_ppp |
cmp esi, PPP_PROTO_ETHERNET |
je .pppoe |
; cmp esi, PPP_PROTO_ETHERNET |
; je .pppoe |
.no_ppp: |
.unsupported: |
404,17 → 404,17 |
mov [eax + SOCKET.connect_proc], ipv4_connect |
ret |
align 4 |
.pppoe: |
push eax |
init_queue (eax + SOCKET_QUEUE_LOCATION) ; Set up data receiving queue |
pop eax |
;align 4 |
; .pppoe: |
; push eax |
; init_queue (eax + SOCKET_QUEUE_LOCATION) ; Set up data receiving queue |
; pop eax |
; |
; mov [eax + SOCKET.snd_proc], socket_send_pppoe |
; mov [eax + SOCKET.rcv_proc], socket_receive_dgram |
; ret |
mov [eax + SOCKET.snd_proc], socket_send_pppoe |
mov [eax + SOCKET.rcv_proc], socket_receive_dgram |
ret |
;-----------------------------------------------------------------; |
; ; |
; socket_bind: Bind to a local port. ; |
774,7 → 774,7 |
; ; |
; IN: ecx = socket number ; |
; edx = addr to application buffer ; |
; edx = length of application buffer ; |
; esi = length of application buffer ; |
; edi = flags ; |
; ; |
; OUT: eax = number of bytes copied ; |
792,6 → 792,9 |
test eax, eax |
jz .invalid |
stdcall is_region_userspace, edx, esi |
jnz .invalid |
.loop: |
push edi |
call [eax + SOCKET.rcv_proc] |
998,6 → 1001,9 |
test eax, eax |
jz .invalid |
stdcall is_region_userspace, edx, esi |
jnz .invalid |
mov ecx, esi |
mov esi, edx |
1080,26 → 1086,26 |
ret |
align 4 |
socket_send_pppoe: |
;align 4 |
;socket_send_pppoe: |
; |
; DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_send: PPPoE\n" |
; |
; mov [esp+32], ecx |
; mov ebx, [eax + SOCKET.device] |
; |
; call pppoe_discovery_output ; FIXME: errorcodes |
; cmp eax, -1 |
; je .error |
; ret |
; |
; .error: |
; mov dword[esp+32], -1 |
; mov dword[esp+20], EMSGSIZE |
; ret |
DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_send: PPPoE\n" |
mov [esp+32], ecx |
mov ebx, [eax + SOCKET.device] |
call pppoe_discovery_output ; FIXME: errorcodes |
cmp eax, -1 |
je .error |
ret |
.error: |
mov dword[esp+32], -1 |
mov dword[esp+20], EMSGSIZE |
ret |
align 4 |
socket_send_local: |
1383,6 → 1389,9 |
test eax, eax |
jz .invalid |
stdcall is_region_userspace, edi, SOCKET_STRUCT_SIZE |
jnz .invalid |
mov esi, eax |
mov ecx, SOCKET_STRUCT_SIZE/4 |
rep movsd |
/kernel/trunk/network/stack.inc |
---|
243,11 → 243,11 |
include "loopback.inc" |
include "ethernet.inc" |
include "PPPoE.inc" |
;include "PPPoE.inc" |
include "ARP.inc" |
include "IPv4.inc" |
include "IPv6.inc" |
;include "IPv6.inc" |
include "icmp.inc" |
include "udp.inc" |
319,7 → 319,7 |
eth_init |
pppoe_init |
; pppoe_init |
ipv4_init |
; ipv6_init |
828,10 → 828,9 |
ret |
.get_dev_name: |
mov ebx, eax |
stdcall is_region_userspace, ecx, 64 |
jnz .bad_buffer |
mov esi, [ebx + NET_DEVICE.name] |
mov esi, [eax + NET_DEVICE.name] |
mov edi, ecx |
mov ecx, 64/4 ; max length |
968,11 → 967,11 |
cmp ax, API_ARP |
je arp_api |
cmp ax, API_PPPOE |
je pppoe_api |
; cmp ax, API_PPPOE |
; je pppoe_api |
cmp ax, API_IPv6 |
je ipv6_api |
; cmp ax, API_IPv6 |
; je ipv6_api |
add esp, 4 ; if we reached here, no function was called, so we need to balance stack |