From 12409b31b02370636e116ac5f7cfd9499e2d2e8f Mon Sep 17 00:00:00 2001 From: hidnplayr Date: Tue, 28 Aug 2012 18:37:10 +0000 Subject: [PATCH] Fixed bugs in PPPoE discovery git-svn-id: svn://kolibrios.org@2950 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/branches/net/network/PPPoE.inc | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/kernel/branches/net/network/PPPoE.inc b/kernel/branches/net/network/PPPoE.inc index 684a738d6e..aad061e9b3 100644 --- a/kernel/branches/net/network/PPPoE.inc +++ b/kernel/branches/net/network/PPPoE.inc @@ -86,20 +86,25 @@ PPPoE_discovery_input: ; ; Send discovery packet ; -; ebx (ecx in app) = device -; ecx (edx in app) = size packet -; edx (esi in app) = pointer to packet +; IN: eax = socket pointer +; ecx = number of bytes to send +; esi = pointer to data ; ;-------------------------------------- + align 4 PPPoE_discovery_output: + DEBUGF 2,"PPPoE_discovery_output: socket=%x buffer=%x size=%d\n", eax, esi, ecx + ; RFC2516: An entire PADI packet (including the PPPoE header) MUST NOT ; exceed 1484 octets. cmp ecx, 1484 + 14 ja .bad ; Check that device exists and is ethernet device + mov ebx, [eax + SOCKET.device] + cmp ebx, MAX_NET_DEVICES ja .bad @@ -110,16 +115,26 @@ PPPoE_discovery_output: cmp [ebx + NET_DEVICE.type], NET_TYPE_ETH jne .bad + DEBUGF 2,"PPPoE_discovery_output: device=%x\n", ebx + ; Create packet. + push ecx esi stdcall kernel_alloc, 1500 + pop esi ecx test eax, eax jz .bad - push ecx eax - + mov edx, ecx mov edi, eax rep movsb + cmp edx, 60 ; Min ETH size + ja @f + mov edx, 60 + @@: + + push edx eax ; size and packet ptr for driver send proc + ; Overwrite source MAC and protocol type lea edi, [eax + ETH_header.SrcMAC] lea esi, [ebx + ETH_DEVICE.mac]