Rev 2931 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2931 | Rev 2950 | ||
---|---|---|---|
Line 84... | Line 84... | ||
84 | 84 | ||
85 | ;-------------------------------------- |
85 | ;-------------------------------------- |
86 | ; |
86 | ; |
87 | ; Send discovery packet |
87 | ; Send discovery packet |
88 | ; |
88 | ; |
89 | ; ebx (ecx in app) = device |
89 | ; IN: eax = socket pointer |
90 | ; ecx (edx in app) = size packet |
90 | ; ecx = number of bytes to send |
91 | ; edx (esi in app) = pointer to packet |
91 | ; esi = pointer to data |
92 | ; |
92 | ; |
- | 93 | ;-------------------------------------- |
|
93 | ;-------------------------------------- |
94 | |
94 | align 4 |
95 | align 4 |
Line -... | Line 96... | ||
- | 96 | PPPoE_discovery_output: |
|
- | 97 | ||
95 | PPPoE_discovery_output: |
98 | DEBUGF 2,"PPPoE_discovery_output: socket=%x buffer=%x size=%d\n", eax, esi, ecx |
96 | 99 | ||
97 | ; RFC2516: An entire PADI packet (including the PPPoE header) MUST NOT |
100 | ; RFC2516: An entire PADI packet (including the PPPoE header) MUST NOT |
98 | ; exceed 1484 octets. |
101 | ; exceed 1484 octets. |
Line 99... | Line 102... | ||
99 | cmp ecx, 1484 + 14 |
102 | cmp ecx, 1484 + 14 |
- | 103 | ja .bad |
|
- | 104 | ||
100 | ja .bad |
105 | ; Check that device exists and is ethernet device |
101 | 106 | mov ebx, [eax + SOCKET.device] |
|
Line 102... | Line 107... | ||
102 | ; Check that device exists and is ethernet device |
107 | |
103 | cmp ebx, MAX_NET_DEVICES |
108 | cmp ebx, MAX_NET_DEVICES |
104 | ja .bad |
109 | ja .bad |
Line 105... | Line 110... | ||
105 | 110 | ||
106 | mov ebx, [NET_DRV_LIST + 4*ebx] |
111 | mov ebx, [NET_DRV_LIST + 4*ebx] |
Line -... | Line 112... | ||
- | 112 | test ebx, ebx |
|
- | 113 | jz .bad |
|
107 | test ebx, ebx |
114 | |
- | 115 | cmp [ebx + NET_DEVICE.type], NET_TYPE_ETH |
|
108 | jz .bad |
116 | jne .bad |
- | 117 | ||
109 | 118 | DEBUGF 2,"PPPoE_discovery_output: device=%x\n", ebx |
|
110 | cmp [ebx + NET_DEVICE.type], NET_TYPE_ETH |
119 | |
Line 111... | Line 120... | ||
111 | jne .bad |
120 | ; Create packet. |
112 | - | ||
113 | ; Create packet. |
121 | push ecx esi |
114 | stdcall kernel_alloc, 1500 |
122 | stdcall kernel_alloc, 1500 |
Line -... | Line 123... | ||
- | 123 | pop esi ecx |
|
- | 124 | test eax, eax |
|
- | 125 | jz .bad |
|
- | 126 | ||
- | 127 | mov edx, ecx |
|
- | 128 | mov edi, eax |
|
- | 129 | rep movsb |
|
115 | test eax, eax |
130 | |
116 | jz .bad |
131 | cmp edx, 60 ; Min ETH size |
117 | 132 | ja @f |
|
118 | push ecx eax |
133 | mov edx, 60 |
119 | 134 | @@: |