Clean up the code that checks the types of address so that it is
done by understandable macros. Fix the bug that prevented the system from responding on interfaces with link local addresses assigned. PR: 120958 Submitted by: James Snow <snow at teardrop.org> MFC after: 2 weeks
This commit is contained in:
parent
9d9a12b8d1
commit
6b9ff6b7a7
@ -383,6 +383,8 @@ __END_DECLS
|
||||
#define IN_BADCLASS(i) (((u_int32_t)(i) & 0xf0000000) == 0xf0000000)
|
||||
|
||||
#define IN_LINKLOCAL(i) (((u_int32_t)(i) & 0xffff0000) == 0xa9fe0000)
|
||||
#define IN_LOOPBACK(i) (((u_int32_t)(i) & 0xff000000) == 0x7f000000)
|
||||
#define IN_ZERONET(i) (((u_int32_t)(i) & 0xff000000) == 0)
|
||||
|
||||
#define IN_PRIVATE(i) ((((u_int32_t)(i) & 0xff000000) == 0x0a000000) || \
|
||||
(((u_int32_t)(i) & 0xfff00000) == 0xac100000) || \
|
||||
|
@ -622,13 +622,14 @@ icmp_reflect(struct mbuf *m)
|
||||
struct mbuf *opts = 0;
|
||||
int optlen = (ip->ip_hl << 2) - sizeof(struct ip);
|
||||
|
||||
if (!in_canforward(ip->ip_src) &&
|
||||
((ntohl(ip->ip_src.s_addr) & IN_CLASSA_NET) !=
|
||||
(IN_LOOPBACKNET << IN_CLASSA_NSHIFT))) {
|
||||
if (IN_MULTICAST(ntohl(ip->ip_src.s_addr)) ||
|
||||
IN_EXPERIMENTAL(ntohl(ip->ip_src.s_addr)) ||
|
||||
IN_ZERONET(ntohl(ip->ip_src.s_addr)) ) {
|
||||
m_freem(m); /* Bad return address */
|
||||
icmpstat.icps_badaddr++;
|
||||
goto done; /* Ip_output() will check for broadcast */
|
||||
}
|
||||
|
||||
t = ip->ip_dst;
|
||||
ip->ip_dst = ip->ip_src;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user