Rev 1529 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1529 | Rev 1530 | ||
---|---|---|---|
Line 14... | Line 14... | ||
14 | ;; GNU GENERAL PUBLIC LICENSE ;; |
14 | ;; GNU GENERAL PUBLIC LICENSE ;; |
15 | ;; Version 2, June 1991 ;; |
15 | ;; Version 2, June 1991 ;; |
16 | ;; ;; |
16 | ;; ;; |
17 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
17 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
Line 18... | Line 18... | ||
18 | 18 | ||
Line 19... | Line 19... | ||
19 | $Revision: 1529 $ |
19 | $Revision: 1530 $ |
20 | 20 | ||
21 | MAX_FRAGMENTS equ 64 |
21 | MAX_FRAGMENTS equ 64 |
Line 52... | Line 52... | ||
52 | rb 2 ; to match ethernet header size ; TODO: fix this hack |
52 | rb 2 ; to match ethernet header size ; TODO: fix this hack |
53 | .Data: ; Ip header begins here (we will need the IP header to re-construct the complete packet) |
53 | .Data: ; Ip header begins here (we will need the IP header to re-construct the complete packet) |
54 | ends |
54 | ends |
Line -... | Line 55... | ||
- | 55 | ||
- | 56 | ||
- | 57 | align 4 |
|
- | 58 | uglobal |
|
- | 59 | ||
- | 60 | IP_LIST rd MAX_IP |
|
- | 61 | SUBNET_LIST rd MAX_IP |
|
- | 62 | DNS_LIST rd MAX_IP |
|
- | 63 | GATEWAY_LIST rd MAX_IP |
|
- | 64 | ||
- | 65 | IP_PACKETS_TX rd MAX_IP |
|
- | 66 | IP_PACKETS_RX rd MAX_IP |
|
- | 67 | ||
- | 68 | FRAGMENT_LIST rb MAX_FRAGMENTS*FRAGMENT_slot.size |
|
- | 69 | endg |
|
- | 70 | ||
- | 71 | ||
- | 72 | ;----------------------------------------------------------------- |
|
- | 73 | ; |
|
- | 74 | ; IPv4_init |
|
- | 75 | ; |
|
- | 76 | ; This function resets all IP variables |
|
- | 77 | ; |
|
- | 78 | ;----------------------------------------------------------------- |
|
- | 79 | macro IPv4_init { |
|
- | 80 | ||
- | 81 | xor eax, eax |
|
- | 82 | mov edi, IP_LIST |
|
- | 83 | mov ecx, 4*MAX_IP |
|
- | 84 | rep stosd |
|
- | 85 | ||
- | 86 | mov edi, FRAGMENT_LIST |
|
- | 87 | mov ecx, FRAGMENT_slot.size*MAX_FRAGMENTS/4 + 2*MAX_IP |
|
- | 88 | rep stosd |
|
- | 89 | ||
- | 90 | } |
|
- | 91 | ||
- | 92 | ||
- | 93 | ;----------------------------------------------------------------- |
|
- | 94 | ; |
|
- | 95 | ; Decrease TimeToLive of all fragment slots |
|
- | 96 | ; |
|
- | 97 | ;----------------------------------------------------------------- |
|
- | 98 | macro IPv4_decrease_fragment_ttls { |
|
- | 99 | ||
- | 100 | local .loop |
|
- | 101 | ||
- | 102 | mov esi, FRAGMENT_LIST |
|
- | 103 | mov ecx, MAX_FRAGMENTS |
|
- | 104 | .loop: |
|
- | 105 | cmp [esi + FRAGMENT_slot.ttl], 0 |
|
- | 106 | je .try_next |
|
- | 107 | dec [esi + FRAGMENT_slot.ttl] |
|
- | 108 | jnz .try_next |
|
- | 109 | DEBUGF 1,"Fragment slot timed-out!\n" |
|
- | 110 | ;;; TODO: clear all entry's of timed-out slot |
|
- | 111 | .try_next: |
|
- | 112 | add esi, 4 |
|
- | 113 | loop .loop |
|
Line 55... | Line 114... | ||
55 | 114 | } |
|
Line 56... | Line 115... | ||
56 | 115 | ||
Line 118... | Line 177... | ||
118 | 177 | ||
Line 119... | Line -... | ||
119 | } |
- | |
120 | - | ||
121 | - | ||
122 | - | ||
123 | align 4 |
- | |
124 | uglobal |
- | |
125 | - | ||
126 | IP_LIST rd MAX_IP |
- | |
127 | SUBNET_LIST rd MAX_IP |
- | |
128 | DNS_LIST rd MAX_IP |
- | |
129 | GATEWAY_LIST rd MAX_IP |
- | |
130 | - | ||
131 | IP_PACKETS_TX rd MAX_IP |
- | |
132 | IP_PACKETS_RX rd MAX_IP |
- | |
133 | - | ||
134 | FRAGMENT_LIST rb MAX_FRAGMENTS*FRAGMENT_slot.size |
- | |
135 | endg |
- | |
136 | - | ||
137 | - | ||
138 | ;----------------------------------------------------------------- |
- | |
139 | ; |
- | |
140 | ; IPv4_init |
- | |
141 | ; |
- | |
142 | ; This function resets all IP variables |
- | |
143 | ; |
- | |
144 | ;----------------------------------------------------------------- |
- | |
145 | macro IPv4_init { |
- | |
146 | - | ||
147 | xor eax, eax |
- | |
148 | mov edi, IP_LIST |
- | |
149 | mov ecx, 4*MAX_IP |
- | |
150 | rep stosd |
- | |
151 | - | ||
152 | mov edi, FRAGMENT_LIST |
- | |
153 | mov ecx, FRAGMENT_slot.size*MAX_FRAGMENTS/4 + 2*MAX_IP |
- | |
154 | rep stosd |
- | |
155 | - | ||
156 | } |
- | |
157 | - | ||
158 | - | ||
159 | ;----------------------------------------------------------------- |
- | |
160 | ; |
- | |
161 | ; Decrease TimeToLive of all fragment slots |
- | |
162 | ; |
- | |
163 | ;----------------------------------------------------------------- |
- | |
164 | macro IPv4_decrease_fragment_ttls { |
- | |
165 | - | ||
166 | local .loop |
- | |
167 | - | ||
168 | mov esi, FRAGMENT_LIST |
- | |
169 | mov ecx, MAX_FRAGMENTS |
- | |
170 | .loop: |
- | |
171 | cmp [esi + FRAGMENT_slot.ttl], 0 |
- | |
172 | je .try_next |
- | |
173 | dec [esi + FRAGMENT_slot.ttl] |
- | |
174 | jnz .try_next |
- | |
175 | DEBUGF 1,"Fragment slot timed-out!\n" |
- | |
176 | ;;; TODO: clear all entry's of timed-out slot |
- | |
177 | .try_next: |
- | |
178 | add esi, 4 |
- | |
179 | loop .loop |
- | |
180 | } |
178 | } |
181 | 179 | ||
182 | 180 | ||
183 | 181 | ||
184 | ;----------------------------------------------------------------- |
182 | ;----------------------------------------------------------------- |
Line 606... | Line 604... | ||
606 | call ARP_IP_to_MAC |
604 | call ARP_IP_to_MAC |
Line 607... | Line 605... | ||
607 | 605 | ||
608 | test eax, 0xffff0000 ; error bits |
606 | test eax, 0xffff0000 ; error bits |
Line -... | Line 607... | ||
- | 607 | jnz .arp_error |
|
- | 608 | ||
609 | jnz .arp_error |
609 | .continue: |
610 | 610 | ||
Line 611... | Line 611... | ||
611 | push ebx ; push the mac |
611 | push ebx ; push the mac |
612 | push ax |
612 | push ax |