|
Lines 639-647
Link Here
|
| 639 |
/* |
639 |
/* |
| 640 |
* The following happens if the packet was not addressed to us, |
640 |
* The following happens if the packet was not addressed to us, |
| 641 |
* and was received on an interface with no IP address. |
641 |
* and was received on an interface with no IP address. |
|
|
642 |
* |
| 643 |
* Prior versions simply set ia = in_ifaddrhead.tqh_first if it |
| 644 |
* was zero here. When in_ifaddrhead.tqh_first is also zero |
| 645 |
* (pointer gets dereferenced below), the kernel panics. It looks |
| 646 |
* like this can happen with PC-card interfaces, but I have not |
| 647 |
* investigated this fully. |
| 648 |
* |
| 649 |
* Instead, iterate over the TAILQ to find the first non-zero |
| 650 |
* interface address, and use that. If none can be found, skip |
| 651 |
* sending the ICMP packet. |
| 652 |
* larse@isi.edu |
| 642 |
*/ |
653 |
*/ |
| 643 |
if (ia == (struct in_ifaddr *)0) |
654 |
if (ia == (struct in_ifaddr *)0) { |
| 644 |
ia = in_ifaddrhead.tqh_first; |
655 |
TAILQ_FOREACH(ia, &in_ifaddrhead, ia_link) |
|
|
656 |
if (ia != (struct in_ifaddr *)0) |
| 657 |
break; |
| 658 |
if (ia == (struct in_ifaddr *)0) |
| 659 |
/* did not find any valid interface address */ |
| 660 |
goto done; |
| 661 |
} |
| 645 |
t = IA_SIN(ia)->sin_addr; |
662 |
t = IA_SIN(ia)->sin_addr; |
| 646 |
ip->ip_src = t; |
663 |
ip->ip_src = t; |
| 647 |
ip->ip_ttl = ip_defttl; |
664 |
ip->ip_ttl = ip_defttl; |