|
Lines 165-176
check_ip_options(int sock, char *ipaddr)
Link Here
|
| 165 |
option_size = sizeof(options); |
165 |
option_size = sizeof(options); |
| 166 |
if (getsockopt(sock, ipproto, IP_OPTIONS, options, |
166 |
if (getsockopt(sock, ipproto, IP_OPTIONS, options, |
| 167 |
&option_size) >= 0 && option_size != 0) { |
167 |
&option_size) >= 0 && option_size != 0) { |
| 168 |
text[0] = '\0'; |
168 |
i = 0; |
| 169 |
for (i = 0; i < option_size; i++) |
169 |
do { |
| 170 |
snprintf(text + i*3, sizeof(text) - i*3, |
170 |
switch (options[i]) { |
| 171 |
" %2.2x", options[i]); |
171 |
case 0: |
| 172 |
fatal("Connection from %.100s with IP options:%.800s", |
172 |
case 1: |
| 173 |
ipaddr, text); |
173 |
++i; |
|
|
174 |
break; |
| 175 |
case 130: |
| 176 |
case 133: |
| 177 |
case 134: |
| 178 |
i += options[i + 1]; |
| 179 |
break; |
| 180 |
default: |
| 181 |
/* Fail, fatally, if we detect either loose or strict |
| 182 |
* source routing options. */ |
| 183 |
text[0] = '\0'; |
| 184 |
for (i = 0; i < option_size; i++) |
| 185 |
snprintf(text + i*3, sizeof(text) - i*3, |
| 186 |
" %2.2x", options[i]); |
| 187 |
fatal("Connection from %.100s with IP options:%.800s", |
| 188 |
ipaddr, text); |
| 189 |
} |
| 190 |
} while (i < option_size); |
| 174 |
} |
191 |
} |
| 175 |
#endif /* IP_OPTIONS */ |
192 |
#endif /* IP_OPTIONS */ |
| 176 |
} |
193 |
} |