Project

General

Profile

Submit #3085 ยป pf-inet6.patch

liweitianux, 10/20/2017 11:31 PM

View differences:

sys/net/pf/pf.c
* If the packet is too large for the outgoing interface,
* send back an icmp6 error.
*/
if (IN6_IS_ADDR_LINKLOCAL(&dst->sin6_addr))
if (IN6_IS_SCOPE_EMBED(&dst->sin6_addr))
dst->sin6_addr.s6_addr16[1] = htons(ifp->if_index);
if ((u_long)m0->m_pkthdr.len <= ifp->if_mtu) {
nd6_output(ifp, ifp, m0, dst, NULL);
-
sys/net/pf/pf.c
break;
#ifdef INET6
case AF_INET6:
/*
* Skip check for addresses with embedded interface scope,
* as they would always match anyway.
*/
if (IN6_IS_SCOPE_EMBED(&addr->v6))
goto out;
dst6 = (struct sockaddr_in6 *)&ro.ro_dst;
dst6->sin6_family = AF_INET6;
dst6->sin6_len = sizeof(*dst6);
-
sys/net/pf/pf.c
#ifdef INET6
case AF_INET6: {
u_int16_t b;
u_int8_t i, curstart = 255, curend = 0,
maxstart = 0, maxend = 0;
u_int8_t i, curstart, curend, maxstart, maxend;
curstart = curend = maxstart = maxend = 255;
for (i = 0; i < 8; i++) {
if (!addr->addr16[i]) {
if (curstart == 255)
curstart = i;
else
curend = i;
curend = i;
} else {
if (curstart) {
if ((curend - curstart) >
(maxend - maxstart)) {
maxstart = curstart;
maxend = curend;
curstart = 255;
}
if ((curend - curstart) >
(maxend - maxstart)) {
maxstart = curstart;
maxend = curend;
}
curstart = curend = 255;
}
}
if ((curend - curstart) >
(maxend - maxstart)) {
maxstart = curstart;
maxend = curend;
}
for (i = 0; i < 8; i++) {
if (i >= maxstart && i <= maxend) {
if (maxend != 7) {
if (i == maxstart)
kprintf(":");
} else {
if (i == maxend)
kprintf(":");
}
if (i == 0)
kprintf(":");
if (i == maxend)
kprintf(":");
} else {
b = ntohs(addr->addr16[i]);
kprintf("%x", b);
    (1-1/1)