remove trailing whitespace
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23815 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -2,22 +2,22 @@
|
||||
* Copyright (c) 2000 - 2002, 2005 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
*
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
@@ -95,7 +95,7 @@ struct mbuf;
|
||||
* 3. Neither the name of the author nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
@@ -193,9 +193,9 @@ ifa_sa_len(sa_family_t family, int len)
|
||||
return size;
|
||||
}
|
||||
|
||||
static void
|
||||
ifa_make_sockaddr(sa_family_t family,
|
||||
struct sockaddr *sa,
|
||||
static void
|
||||
ifa_make_sockaddr(sa_family_t family,
|
||||
struct sockaddr *sa,
|
||||
void *p, size_t len,
|
||||
uint32_t scope, uint32_t scopeid)
|
||||
{
|
||||
@@ -227,8 +227,8 @@ ifa_make_sockaddr(sa_family_t family,
|
||||
|
||||
#ifndef IFA_NETMASK
|
||||
static struct sockaddr *
|
||||
ifa_make_sockaddr_mask(sa_family_t family,
|
||||
struct sockaddr *sa,
|
||||
ifa_make_sockaddr_mask(sa_family_t family,
|
||||
struct sockaddr *sa,
|
||||
uint32_t prefixlen)
|
||||
{
|
||||
int i;
|
||||
@@ -274,7 +274,7 @@ ifa_make_sockaddr_mask(sa_family_t family,
|
||||
#endif
|
||||
|
||||
/* ====================================================================== */
|
||||
static int
|
||||
static int
|
||||
nl_sendreq(int sd, int request, int flags, int *seq)
|
||||
{
|
||||
char reqbuf[NLMSG_ALIGN(sizeof(struct nlmsghdr)) +
|
||||
@@ -300,9 +300,9 @@ nl_sendreq(int sd, int request, int flags, int *seq)
|
||||
(struct sockaddr *)&nladdr, sizeof(nladdr)));
|
||||
}
|
||||
|
||||
static int
|
||||
nl_recvmsg(int sd, int request, int seq,
|
||||
void *buf, size_t buflen,
|
||||
static int
|
||||
nl_recvmsg(int sd, int request, int seq,
|
||||
void *buf, size_t buflen,
|
||||
int *flags)
|
||||
{
|
||||
struct msghdr msg;
|
||||
@@ -327,8 +327,8 @@ nl_recvmsg(int sd, int request, int seq,
|
||||
return read_len;
|
||||
}
|
||||
|
||||
static int
|
||||
nl_getmsg(int sd, int request, int seq,
|
||||
static int
|
||||
nl_getmsg(int sd, int request, int seq,
|
||||
struct nlmsghdr **nlhp,
|
||||
int *done)
|
||||
{
|
||||
@@ -447,7 +447,7 @@ nl_getlist(int sd, int seq,
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
static void
|
||||
static void
|
||||
free_nlmsglist(struct nlmsg_list *nlm0)
|
||||
{
|
||||
struct nlmsg_list *nlm, *nlm_next;
|
||||
@@ -464,7 +464,7 @@ free_nlmsglist(struct nlmsg_list *nlm0)
|
||||
__set_errno(saved_errno);
|
||||
}
|
||||
|
||||
static void
|
||||
static void
|
||||
free_data(void *data, void *ifdata)
|
||||
{
|
||||
int saved_errno = errno;
|
||||
@@ -474,7 +474,7 @@ free_data(void *data, void *ifdata)
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
static void
|
||||
static void
|
||||
nl_close(int sd)
|
||||
{
|
||||
int saved_errno = errno;
|
||||
@@ -483,7 +483,7 @@ nl_close(int sd)
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
static int
|
||||
static int
|
||||
nl_open(void)
|
||||
{
|
||||
struct sockaddr_nl nladdr;
|
||||
@@ -561,7 +561,7 @@ rk_getifaddrs(struct ifaddrs **ifap)
|
||||
NLMSG_ALIGN(sizeof(struct ifaddrs[icnt]))
|
||||
+ dlen + xlen + nlen);
|
||||
ifa = (struct ifaddrs *)data;
|
||||
ifdata = calloc(1,
|
||||
ifdata = calloc(1,
|
||||
NLMSG_ALIGN(sizeof(char *[max_ifindex+1]))
|
||||
+ NLMSG_ALIGN(sizeof(uint16_t [max_ifindex+1])));
|
||||
if (ifap != NULL)
|
||||
@@ -588,8 +588,8 @@ rk_getifaddrs(struct ifaddrs **ifap)
|
||||
int nlmlen = nlm->size;
|
||||
if (!(nlh0 = nlm->nlh))
|
||||
continue;
|
||||
for (nlh = nlh0;
|
||||
NLMSG_OK(nlh, nlmlen);
|
||||
for (nlh = nlh0;
|
||||
NLMSG_OK(nlh, nlmlen);
|
||||
nlh=NLMSG_NEXT(nlh,nlmlen)){
|
||||
struct ifinfomsg *ifim = NULL;
|
||||
struct ifaddrmsg *ifam = NULL;
|
||||
@@ -826,8 +826,8 @@ rk_getifaddrs(struct ifaddrs **ifap)
|
||||
if (ifa->ifa_name == NULL)
|
||||
ifa->ifa_name = iflist[nlm_index];
|
||||
#ifndef IFA_NETMASK
|
||||
if (ifa->ifa_addr &&
|
||||
ifa->ifa_addr->sa_family != AF_UNSPEC &&
|
||||
if (ifa->ifa_addr &&
|
||||
ifa->ifa_addr->sa_family != AF_UNSPEC &&
|
||||
ifa->ifa_addr->sa_family != AF_PACKET){
|
||||
ifa->ifa_netmask = (struct sockaddr *)data;
|
||||
ifa_make_sockaddr_mask(ifa->ifa_addr->sa_family, ifa->ifa_netmask, nlm_prefixlen);
|
||||
@@ -863,7 +863,7 @@ rk_getifaddrs(struct ifaddrs **ifap)
|
||||
*/
|
||||
|
||||
static int
|
||||
getifaddrs2(struct ifaddrs **ifap,
|
||||
getifaddrs2(struct ifaddrs **ifap,
|
||||
int af, int siocgifconf, int siocgifflags,
|
||||
size_t ifreq_sz)
|
||||
{
|
||||
@@ -970,7 +970,7 @@ getifaddrs2(struct ifaddrs **ifap,
|
||||
ret = ENOMEM;
|
||||
goto error_out;
|
||||
}
|
||||
memcpy((*end)->ifa_broadaddr, &ifr->ifr_broadaddr,
|
||||
memcpy((*end)->ifa_broadaddr, &ifr->ifr_broadaddr,
|
||||
sizeof(ifr->ifr_broadaddr));
|
||||
} else if(ifreq.ifr_flags & IFF_POINTOPOINT) {
|
||||
(*end)->ifa_dstaddr = malloc(sizeof(ifr->ifr_dstaddr));
|
||||
@@ -978,7 +978,7 @@ getifaddrs2(struct ifaddrs **ifap,
|
||||
ret = ENOMEM;
|
||||
goto error_out;
|
||||
}
|
||||
memcpy((*end)->ifa_dstaddr, &ifr->ifr_dstaddr,
|
||||
memcpy((*end)->ifa_dstaddr, &ifr->ifr_dstaddr,
|
||||
sizeof(ifr->ifr_dstaddr));
|
||||
} else
|
||||
(*end)->ifa_dstaddr = NULL;
|
||||
@@ -1005,7 +1005,7 @@ getifaddrs2(struct ifaddrs **ifap,
|
||||
|
||||
#if defined(HAVE_IPV6) && defined(SIOCGLIFCONF) && defined(SIOCGLIFFLAGS)
|
||||
static int
|
||||
getlifaddrs2(struct ifaddrs **ifap,
|
||||
getlifaddrs2(struct ifaddrs **ifap,
|
||||
int af, int siocgifconf, int siocgifflags,
|
||||
size_t ifreq_sz)
|
||||
{
|
||||
@@ -1116,7 +1116,7 @@ getlifaddrs2(struct ifaddrs **ifap,
|
||||
ret = ENOMEM;
|
||||
goto error_out;
|
||||
}
|
||||
memcpy((*end)->ifa_broadaddr, &ifr->ifr_broadaddr,
|
||||
memcpy((*end)->ifa_broadaddr, &ifr->ifr_broadaddr,
|
||||
sizeof(ifr->ifr_broadaddr));
|
||||
} else if(ifreq.ifr_flags & IFF_POINTOPOINT) {
|
||||
(*end)->ifa_dstaddr = malloc(sizeof(ifr->ifr_dstaddr));
|
||||
@@ -1124,7 +1124,7 @@ getlifaddrs2(struct ifaddrs **ifap,
|
||||
ret = ENOMEM;
|
||||
goto error_out;
|
||||
}
|
||||
memcpy((*end)->ifa_dstaddr, &ifr->ifr_dstaddr,
|
||||
memcpy((*end)->ifa_dstaddr, &ifr->ifr_dstaddr,
|
||||
sizeof(ifr->ifr_dstaddr));
|
||||
} else
|
||||
(*end)->ifa_dstaddr = NULL;
|
||||
@@ -1151,7 +1151,7 @@ getlifaddrs2(struct ifaddrs **ifap,
|
||||
#endif /* defined(HAVE_IPV6) && defined(SIOCGLIFCONF) && defined(SIOCGLIFFLAGS) */
|
||||
|
||||
int ROKEN_LIB_FUNCTION
|
||||
rk_getifaddrs(struct ifaddrs **ifap)
|
||||
rk_getifaddrs(struct ifaddrs **ifap)
|
||||
{
|
||||
int ret = -1;
|
||||
errno = ENXIO;
|
||||
@@ -1184,14 +1184,14 @@ void ROKEN_LIB_FUNCTION
|
||||
rk_freeifaddrs(struct ifaddrs *ifp)
|
||||
{
|
||||
struct ifaddrs *p, *q;
|
||||
|
||||
|
||||
for(p = ifp; p; ) {
|
||||
free(p->ifa_name);
|
||||
if(p->ifa_addr)
|
||||
free(p->ifa_addr);
|
||||
if(p->ifa_dstaddr)
|
||||
if(p->ifa_dstaddr)
|
||||
free(p->ifa_dstaddr);
|
||||
if(p->ifa_netmask)
|
||||
if(p->ifa_netmask)
|
||||
free(p->ifa_netmask);
|
||||
if(p->ifa_data)
|
||||
free(p->ifa_data);
|
||||
@@ -1212,25 +1212,25 @@ print_addr(const char *s, struct sockaddr *sa)
|
||||
for(i = 0; i < sa->sa_len - ((long)sa->sa_data - (long)&sa->sa_family); i++)
|
||||
printf("%02x", ((unsigned char*)sa->sa_data)[i]);
|
||||
#else
|
||||
for(i = 0; i < sizeof(sa->sa_data); i++)
|
||||
for(i = 0; i < sizeof(sa->sa_data); i++)
|
||||
printf("%02x", ((unsigned char*)sa->sa_data)[i]);
|
||||
#endif
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
print_ifaddrs(struct ifaddrs *x)
|
||||
{
|
||||
struct ifaddrs *p;
|
||||
|
||||
|
||||
for(p = x; p; p = p->ifa_next) {
|
||||
printf("%s\n", p->ifa_name);
|
||||
printf(" flags=%x\n", p->ifa_flags);
|
||||
if(p->ifa_addr)
|
||||
print_addr("addr", p->ifa_addr);
|
||||
if(p->ifa_dstaddr)
|
||||
if(p->ifa_dstaddr)
|
||||
print_addr("dstaddr", p->ifa_dstaddr);
|
||||
if(p->ifa_netmask)
|
||||
if(p->ifa_netmask)
|
||||
print_addr("netmask", p->ifa_netmask);
|
||||
printf(" %p\n", p->ifa_data);
|
||||
}
|
||||
|
Reference in New Issue
Block a user