version 1.40, 2013/11/21 17:32:13 |
version 1.41, 2014/04/17 15:36:53 |
|
|
*/ |
*/ |
|
|
#include <sys/param.h> |
#include <sys/param.h> |
#include <sys/protosw.h> |
|
#include <sys/socket.h> |
#include <sys/socket.h> |
#include <sys/sysctl.h> |
#include <sys/sysctl.h> |
|
|
#include <net/if.h> |
#include <net/if.h> |
#include <net/if_var.h> |
|
#include <net/if_dl.h> |
#include <net/if_dl.h> |
#include <net/if_types.h> |
#include <net/if_types.h> |
#include <net/pfkeyv2.h> |
#include <net/pfkeyv2.h> |
|
|
{ 0 } |
{ 0 } |
}; |
}; |
|
|
|
int WID_DST(int); |
void p_rtentry(struct rt_msghdr *); |
void p_rtentry(struct rt_msghdr *); |
void p_pfkentry(struct sadb_msg *); |
void p_pfkentry(struct sadb_msg *); |
void pr_family(int); |
void pr_family(int); |
|
|
*/ |
*/ |
#define WID_GW(af) ((af) == AF_INET6 ? (nflag ? 30 : 18) : 18) |
#define WID_GW(af) ((af) == AF_INET6 ? (nflag ? 30 : 18) : 18) |
|
|
static int |
int |
WID_DST(int af) |
WID_DST(int af) |
{ |
{ |
|
|
|
|
return; |
return; |
|
|
get_rtaddrs(rtm->rtm_addrs, sa, rti_info); |
get_rtaddrs(rtm->rtm_addrs, sa, rti_info); |
|
|
if (Fflag && rti_info[RTAX_GATEWAY]->sa_family != sa->sa_family) { |
if (Fflag && rti_info[RTAX_GATEWAY]->sa_family != sa->sa_family) { |
return; |
return; |
} |
} |
|
|
case AF_MPLS: |
case AF_MPLS: |
afname = "MPLS"; |
afname = "MPLS"; |
break; |
break; |
case AF_APPLETALK: |
|
afname = "AppleTalk"; |
|
break; |
|
default: |
default: |
afname = NULL; |
afname = NULL; |
break; |
break; |
|
|
if (mask) { |
if (mask) { |
lim = mask->sin6_len - offsetof(struct sockaddr_in6, sin6_addr); |
lim = mask->sin6_len - offsetof(struct sockaddr_in6, sin6_addr); |
lim = lim < (int)sizeof(struct in6_addr) ? |
lim = lim < (int)sizeof(struct in6_addr) ? |
lim : sizeof(struct in6_addr); |
lim : (int)sizeof(struct in6_addr); |
for (p = (u_char *)&mask->sin6_addr, i = 0; i < lim; p++) { |
for (p = (u_char *)&mask->sin6_addr, i = 0; i < lim; p++) { |
if (final && *p) { |
if (final && *p) { |
illegal++; |
illegal++; |
|
|
else |
else |
sin6.sin6_addr.s6_addr[i++] = 0x00; |
sin6.sin6_addr.s6_addr[i++] = 0x00; |
} |
} |
while (i < sizeof(struct in6_addr)) |
while (i < (int)sizeof(struct in6_addr)) |
sin6.sin6_addr.s6_addr[i++] = 0x00; |
sin6.sin6_addr.s6_addr[i++] = 0x00; |
} else |
} else |
masklen = 128; |
masklen = 128; |