Commit 86b5b776 authored by Martina Ferrari's avatar Martina Ferrari

Merge tag 'upstream/1.60+git20151124.452f8e2e' into debian/sid

parents fe9bba96 452f8e2e
......@@ -101,7 +101,7 @@ static int arp_del(char **args)
char host[128];
struct arpreq req;
struct sockaddr_storage ss;
struct sockaddr *sa;
struct sockaddr *sa = (struct sockaddr *)&ss;
int flags = 0;
int deleted = 0;
......@@ -113,8 +113,7 @@ static int arp_del(char **args)
return (-1);
}
safe_strncpy(host, *args, (sizeof host));
sa = (struct sockaddr *)&ss;
if (ap->input(0, host, sa) < 0) {
if (ap->input(0, host, &ss) < 0) {
ap->herror(host);
return (-1);
}
......@@ -179,7 +178,7 @@ static int arp_del(char **args)
usage();
if (strcmp(*args, "255.255.255.255") != 0) {
safe_strncpy(host, *args, (sizeof host));
if (ap->input(0, host, sa) < 0) {
if (ap->input(0, host, &ss) < 0) {
ap->herror(host);
return (-1);
}
......@@ -269,7 +268,7 @@ static int arp_set(char **args)
char host[128];
struct arpreq req;
struct sockaddr_storage ss;
struct sockaddr *sa;
struct sockaddr *sa = (struct sockaddr *)&ss;
int flags;
memset((char *) &req, 0, sizeof(req));
......@@ -280,8 +279,7 @@ static int arp_set(char **args)
return (-1);
}
safe_strncpy(host, *args++, (sizeof host));
sa = (struct sockaddr *)&ss;
if (ap->input(0, host, sa) < 0) {
if (ap->input(0, host, &ss) < 0) {
ap->herror(host);
return (-1);
}
......@@ -297,10 +295,11 @@ static int arp_set(char **args)
if (arp_getdevhw(*args++, &req.arp_ha, hw_set ? hw : NULL) < 0)
return (-1);
} else {
if (hw->input(*args++, &req.arp_ha) < 0) {
if (hw->input(*args++, &ss) < 0) {
fprintf(stderr, _("arp: invalid hardware address\n"));
return (-1);
}
memcpy(&req.arp_ha, sa, sizeof(*sa));
}
/* Check out any modifiers. */
......@@ -356,7 +355,7 @@ static int arp_set(char **args)
usage();
if (strcmp(*args, "255.255.255.255") != 0) {
safe_strncpy(host, *args, (sizeof host));
if (ap->input(0, host, sa) < 0) {
if (ap->input(0, host, &ss) < 0) {
ap->herror(host);
return (-1);
}
......@@ -530,7 +529,6 @@ static int arp_show(char *name)
{
char host[100];
struct sockaddr_storage ss;
struct sockaddr *sa;
char ip[100];
char hwa[100];
char mask[100];
......@@ -543,15 +541,14 @@ static int arp_show(char *name)
host[0] = '\0';
sa = (struct sockaddr *)&ss;
if (name != NULL) {
/* Resolve the host name. */
safe_strncpy(host, name, (sizeof host));
if (ap->input(0, host, sa) < 0) {
if (ap->input(0, host, &ss) < 0) {
ap->herror(host);
return (-1);
}
safe_strncpy(host, ap->sprint(sa, 1), sizeof(host));
safe_strncpy(host, ap->sprint(&ss, 1), sizeof(host));
}
/* Open the PROCps kernel table. */
if ((fp = fopen(_PATH_PROCNET_ARP, "r")) == NULL) {
......@@ -587,10 +584,10 @@ static int arp_show(char *name)
if (opt_n)
hostname = "?";
else {
if (ap->input(0, ip, sa) < 0)
if (ap->input(0, ip, &ss) < 0)
hostname = ip;
else
hostname = ap->sprint(sa, opt_n | 0x8000);
hostname = ap->sprint(&ss, opt_n | 0x8000);
if (strcmp(hostname, ip) == 0)
hostname = "?";
}
......
......@@ -201,11 +201,6 @@ static void showhname(char *hname, int c)
case 'f':
printf("%s\n", hp->h_name);
break;
case 's':
if (p != NULL)
*p = '\0';
printf("%s\n", hp->h_name);
break;
}
}
......@@ -392,7 +387,12 @@ int main(int argc, char **argv)
fprintf(stderr, _("gethostname()=`%s'\n"), myname);
if (!type)
printf("%s\n", myname);
else
else if (type == 's') {
char *p = strchr(myname, '.');
if (p)
*p = '\0';
printf("%s\n", myname);
} else
showhname(myname, type);
break;
case 3:
......
......@@ -255,7 +255,7 @@ int main(int argc, char **argv)
struct sockaddr_storage _sa, _samask;
struct sockaddr *sa = (struct sockaddr *)&_sa;
struct sockaddr *samask = (struct sockaddr *)&_samask;
struct sockaddr_in *sin = (struct sockaddr_in *)sa;
struct sockaddr_in *sin = (struct sockaddr_in *)&_sa;
char host[128];
const struct aftype *ap;
const struct hwtype *hw;
......@@ -265,7 +265,7 @@ int main(int argc, char **argv)
int fd;
#if HAVE_AFINET6
extern struct aftype inet6_aftype;
struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)sa;
struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)&_sa;
struct in6_ifreq ifr6;
unsigned long prefix_len;
char *cp;
......@@ -518,7 +518,7 @@ int main(int argc, char **argv)
if (!strcmp(*spp, "broadcast")) {
if (*++spp != NULL) {
safe_strncpy(host, *spp, (sizeof host));
if (ap->input(0, host, sa) < 0) {
if (ap->input(0, host, &_sa) < 0) {
if (ap->herror)
ap->herror(host);
else
......@@ -542,7 +542,7 @@ int main(int argc, char **argv)
if (*++spp == NULL)
usage();
safe_strncpy(host, *spp, (sizeof host));
if (ap->input(0, host, sa) < 0) {
if (ap->input(0, host, &_sa) < 0) {
if (ap->herror)
ap->herror(host);
else
......@@ -564,7 +564,7 @@ int main(int argc, char **argv)
if (*++spp == NULL || didnetmask)
usage();
safe_strncpy(host, *spp, (sizeof host));
if (ap->input(0, host, sa) < 0) {
if (ap->input(0, host, &_sa) < 0) {
if (ap->herror)
ap->herror(host);
else
......@@ -654,7 +654,7 @@ int main(int argc, char **argv)
if (*(spp + 1) != NULL) {
spp++;
safe_strncpy(host, *spp, (sizeof host));
if (ap->input(0, host, sa)) {
if (ap->input(0, host, &_sa)) {
if (ap->herror)
ap->herror(host);
else
......@@ -689,7 +689,7 @@ int main(int argc, char **argv)
if (*++spp == NULL)
usage();
safe_strncpy(host, *spp, (sizeof host));
if (hw->input(host, sa) < 0) {
if (hw->input(host, &_sa) < 0) {
fprintf(stderr, _("%s: invalid %s address.\n"), host, hw->name);
goterr = 1;
spp++;
......@@ -724,7 +724,7 @@ int main(int argc, char **argv)
prefix_len = 128;
}
safe_strncpy(host, *spp, (sizeof host));
if (inet6_aftype.input(1, host, sa) < 0) {
if (inet6_aftype.input(1, host, &_sa) < 0) {
if (inet6_aftype.herror)
inet6_aftype.herror(host);
else
......@@ -763,7 +763,7 @@ int main(int argc, char **argv)
{ /* ipv4 address a.b.c.d */
in_addr_t ip, nm, bc;
safe_strncpy(host, *spp, (sizeof host));
if (inet_aftype.input(0, host, sa) < 0) {
if (inet_aftype.input(0, host, &_sa) < 0) {
ap->herror(host);
goterr = 1;
spp++;
......@@ -815,7 +815,7 @@ int main(int argc, char **argv)
prefix_len = 128;
}
safe_strncpy(host, *spp, (sizeof host));
if (inet6_aftype.input(1, host, sa) < 0) {
if (inet6_aftype.input(1, host, &_sa) < 0) {
inet6_aftype.herror(host);
goterr = 1;
spp++;
......@@ -856,7 +856,7 @@ int main(int argc, char **argv)
/* ipv4 address a.b.c.d */
in_addr_t ip, nm, bc;
safe_strncpy(host, *spp, (sizeof host));
if (inet_aftype.input(0, host, sa) < 0) {
if (inet_aftype.input(0, host, &_sa) < 0) {
ap->herror(host);
goterr = 1;
spp++;
......@@ -906,7 +906,7 @@ int main(int argc, char **argv)
prefix_len = 128;
}
safe_strncpy(host, *spp, (sizeof host));
if (inet6_aftype.input(1, host, sa) < 0) {
if (inet6_aftype.input(1, host, &_sa) < 0) {
inet6_aftype.herror(host);
goterr = 1;
spp++;
......@@ -946,7 +946,7 @@ int main(int argc, char **argv)
/* FIXME: sa is too small for INET6 addresses, inet6 should use that too,
broadcast is unexpected */
if (ap->getmask) {
switch (ap->getmask(host, samask, NULL)) {
switch (ap->getmask(host, &_samask, NULL)) {
case -1:
usage();
break;
......@@ -963,7 +963,7 @@ int main(int argc, char **argv)
fprintf(stderr, _("ifconfig: Cannot set address for this protocol family.\n"));
exit(1);
}
if (ap->input(0, host, sa) < 0) {
if (ap->input(0, host, &_sa) < 0) {
if (ap->herror)
ap->herror(host);
else
......@@ -1083,7 +1083,7 @@ static int do_ifcmd(struct interface *x, struct ifcmd *ptr)
searcher[i] = 1;
/* copy */
sin = (struct sockaddr_in *)&x->dstaddr;
sin = (struct sockaddr_in *)&x->dstaddr_sas;
if (sin->sin_addr.s_addr != ptr->addr) {
return 0;
}
......@@ -1113,9 +1113,9 @@ static int get_nmbc_parent(char *parent,
return -1;
if (do_if_fetch(i) < 0)
return 0;
sin = (struct sockaddr_in *)&i->netmask;
sin = (struct sockaddr_in *)&i->netmask_sas;
memcpy(nm, &sin->sin_addr.s_addr, sizeof(*nm));
sin = (struct sockaddr_in *)&i->broadaddr;
sin = (struct sockaddr_in *)&i->broadaddr_sas;
memcpy(bc, &sin->sin_addr.s_addr, sizeof(*bc));
return 0;
}
......
......@@ -35,16 +35,46 @@ struct interface {
int mtu; /* MTU value */
int tx_queue_len; /* transmit queue length */
struct ifmap map; /* hardware setup */
struct sockaddr addr; /* IP address */
struct sockaddr dstaddr; /* P-P IP address */
struct sockaddr broadaddr; /* IP broadcast address */
struct sockaddr netmask; /* IP network mask */
struct sockaddr ipxaddr_bb; /* IPX network address */
struct sockaddr ipxaddr_sn; /* IPX network address */
struct sockaddr ipxaddr_e3; /* IPX network address */
struct sockaddr ipxaddr_e2; /* IPX network address */
struct sockaddr ddpaddr; /* Appletalk DDP address */
struct sockaddr ecaddr; /* Econet address */
union {
struct sockaddr_storage addr_sas;
struct sockaddr addr; /* IP address */
};
union {
struct sockaddr_storage dstaddr_sas;
struct sockaddr dstaddr; /* P-P IP address */
};
union {
struct sockaddr_storage broadaddr_sas;
struct sockaddr broadaddr; /* IP broadcast address */
};
union {
struct sockaddr_storage netmask_sas;
struct sockaddr netmask; /* IP network mask */
};
union {
struct sockaddr_storage ipxaddr_bb_sas;
struct sockaddr ipxaddr_bb; /* IPX network address */
};
union {
struct sockaddr_storage ipxaddr_sn_sas;
struct sockaddr ipxaddr_sn; /* IPX network address */
};
union {
struct sockaddr_storage ipxaddr_e3_sas;
struct sockaddr ipxaddr_e3; /* IPX network address */
};
union {
struct sockaddr_storage ipxaddr_e2_sas;
struct sockaddr ipxaddr_e2; /* IPX network address */
};
union {
struct sockaddr_storage ddpaddr_sas;
struct sockaddr ddpaddr; /* Appletalk DDP address */
};
union {
struct sockaddr_storage ecaddr_sas;
struct sockaddr ecaddr; /* Econet address */
};
int has_ip;
int has_ipx_bb;
int has_ipx_sn;
......
......@@ -50,8 +50,9 @@ static const char *pr_arcnet(const char *ptr)
#endif
/* Input an ARCnet address and convert to binary. */
static int in_arcnet(char *bufp, struct sockaddr *sap)
static int in_arcnet(char *bufp, struct sockaddr_storage *sasp)
{
struct sockaddr *sap = (struct sockaddr *)sasp;
char *ptr;
char c, *orig;
int i, val;
......
......@@ -58,8 +58,9 @@ pr_ash(const char *ptr)
struct hwtype ash_hwtype;
static int
in_ash(char *bufp, struct sockaddr *sap)
in_ash(char *bufp, struct sockaddr_storage *sasp)
{
struct sockaddr *sap = (struct sockaddr *)sasp;
char *ptr;
unsigned int i = 0;
......@@ -103,8 +104,9 @@ struct hwtype ash_hwtype =
/* Display an Ash socket address. */
static const char *
pr_sash(const struct sockaddr *sap, int numeric)
pr_sash(const struct sockaddr_storage *sasp, int numeric)
{
const struct sockaddr *sap = (const struct sockaddr *)sasp;
static char buf[64];
if (sap->sa_family != AF_ASH)
......
......@@ -67,13 +67,14 @@ static const char *AX25_print(const char *ptr)
/* Display an AX.25 socket address. */
static const char *
AX25_sprint(const struct sockaddr *sap, int numeric)
AX25_sprint(const struct sockaddr_storage *sasp, int numeric)
{
const struct sockaddr *sap = (const struct sockaddr *)sasp;
static char buf[64];
if (sap->sa_family == 0xFFFF || sap->sa_family == 0)
return safe_strncpy(buf, _("[NONE SET]"), sizeof(buf));
return (AX25_print(((struct sockaddr_ax25 *) sap)->sax25_call.ax25_call));
return (AX25_print(((const struct sockaddr_ax25 *) sasp)->sax25_call.ax25_call));
}
#ifdef DEBUG
......@@ -82,14 +83,15 @@ static const char *
#define _DEBUG 0
#endif
static int AX25_input(int type, char *bufp, struct sockaddr *sap)
static int AX25_input(int type, char *bufp, struct sockaddr_storage *sasp)
{
struct sockaddr *sap = (struct sockaddr *)sasp;
char *ptr;
char *orig, c;
int i;
sap->sa_family = ax25_aftype.af;
ptr = ((struct sockaddr_ax25 *) sap)->sax25_call.ax25_call;
ptr = ((struct sockaddr_ax25 *) sasp)->sax25_call.ax25_call;
/* First, scan and convert the basic callsign. */
orig = bufp;
......@@ -152,9 +154,10 @@ static void AX25_herror(const char *text)
}
static int AX25_hinput(char *bufp, struct sockaddr *sap)
static int AX25_hinput(char *bufp, struct sockaddr_storage *sasp)
{
if (AX25_input(0, bufp, sap) < 0)
struct sockaddr *sap = (struct sockaddr *)sasp;
if (AX25_input(0, bufp, sasp) < 0)
return (-1);
sap->sa_family = ARPHRD_AX25;
return (0);
......
......@@ -42,8 +42,9 @@ static const char *ddp_print(const char *ptr)
/* Display a ddp domain address. */
static const char *ddp_sprint(const struct sockaddr *sap, int numeric)
static const char *ddp_sprint(const struct sockaddr_storage *sasp, int numeric)
{
const struct sockaddr *sap = (const struct sockaddr *)sasp;
static char buf[64];
if (sap->sa_family != AF_APPLETALK)
......
......@@ -44,20 +44,20 @@ ec_print(const char *ptr)
/* Display an Econet socket address */
static const char *
ec_sprint(const struct sockaddr *sap, int numeric)
ec_sprint(const struct sockaddr_storage *sasp, int numeric)
{
struct sockaddr_ec *sec = (struct sockaddr_ec *) sap;
const struct sockaddr_ec *sec = (const struct sockaddr_ec *)sasp;
if (sap->sa_family != AF_ECONET)
if (sasp->ss_family != AF_ECONET)
return _("[NONE SET]");
return ec_print((const char *) &sec->addr);
}
static int
ec_input(int type, char *bufp, struct sockaddr *sap)
ec_input(int type, char *bufp, struct sockaddr_storage *sasp)
{
struct sockaddr_ec *sec = (struct sockaddr_ec *) sap;
struct sockaddr_ec *sec = (struct sockaddr_ec *) sasp;
int net, stn;
switch (sscanf(bufp, "%d.%d", &net, &stn)) {
case 2:
......
......@@ -53,8 +53,9 @@ static const char *pr_ether(const char *ptr)
#endif
/* Input an Ethernet address and convert to binary. */
static int in_ether(char *bufp, struct sockaddr *sap)
static int in_ether(char *bufp, struct sockaddr_storage *sasp)
{
struct sockaddr *sap = (struct sockaddr *)sasp;
char *ptr;
char c, *orig;
int i;
......
......@@ -67,8 +67,9 @@ static const char *pr_eui64(const char *ptr)
#endif
/* Start the PPP encapsulation on the file descriptor. */
static int in_eui64( char *bufp, struct sockaddr *sap )
static int in_eui64(char *bufp, struct sockaddr_storage *sasp)
{
struct sockaddr *sap = (struct sockaddr *)sasp;
char *ptr;
char c, *orig;
int i;
......
......@@ -64,8 +64,9 @@ static const char *pr_fddi(const char *ptr)
#endif
/* Input an FDDI address and convert to binary. */
static int in_fddi(char *bufp, struct sockaddr *sap)
static int in_fddi(char *bufp, struct sockaddr_storage *sasp)
{
struct sockaddr *sap = (struct sockaddr *)sasp;
char *ptr;
char c, *orig;
int i, val;
......
......@@ -64,8 +64,9 @@ static const char *pr_hippi(const char *ptr)
#endif
/* Input an HIPPI address and convert to binary. */
static int in_hippi(char *bufp, struct sockaddr *sap)
static int in_hippi(char *bufp, struct sockaddr_storage *sasp)
{
struct sockaddr *sap = (struct sockaddr *)sasp;
char *ptr;
char c, *orig;
int i, val;
......
......@@ -63,8 +63,9 @@ static const char *pr_ib(const char *ptr)
#endif
/* Input an Infiniband address and convert to binary. */
static int in_ib(char *bufp, struct sockaddr *sap)
static int in_ib(char *bufp, struct sockaddr_storage *sasp)
{
struct sockaddr *sap = (struct sockaddr *)sasp;
char *ptr;
char c, *orig;
int i;
......
......@@ -74,8 +74,9 @@ static struct service *tcp_name = NULL, *udp_name = NULL, *raw_name = NULL;
static struct addr *INET_nn = NULL; /* addr-to-name cache */
static int INET_resolve(char *name, struct sockaddr_in *sin, int hostfirst)
static int INET_resolve(char *name, struct sockaddr_storage *sasp, int hostfirst)
{
struct sockaddr_in *sin = (struct sockaddr_in *)sasp;
struct hostent *hp;
struct netent *np;
......@@ -138,9 +139,10 @@ static int INET_resolve(char *name, struct sockaddr_in *sin, int hostfirst)
* & 0x4000: host instead of net,
* & 0x0fff: don't resolve
*/
static int INET_rresolve(char *name, size_t len, struct sockaddr_in *sin,
static int INET_rresolve(char *name, size_t len, const struct sockaddr_storage *sasp,
int numeric, unsigned int netmask)
{
const struct sockaddr_in *sin = (const struct sockaddr_in *)sasp;
struct hostent *ent;
struct netent *np;
struct addr *pn;
......@@ -249,42 +251,39 @@ static const char *INET_print(const char *ptr)
/* Display an Internet socket address. */
static const char *INET_sprint(const struct sockaddr *sap, int numeric)
static const char *INET_sprint(const struct sockaddr_storage *sasp, int numeric)
{
static char buff[128];
if (sap->sa_family == 0xFFFF || sap->sa_family == 0)
if (sasp->ss_family == 0xFFFF || sasp->ss_family == 0)
return safe_strncpy(buff, _("[NONE SET]"), sizeof(buff));
if (INET_rresolve(buff, sizeof(buff), (struct sockaddr_in *) sap,
numeric, 0xffffff00) != 0)
if (INET_rresolve(buff, sizeof(buff), sasp, numeric, 0xffffff00) != 0)
return (NULL);
return (buff);
}
char *INET_sprintmask(struct sockaddr *sap, int numeric,
char *INET_sprintmask(const struct sockaddr_storage *sasp, int numeric,
unsigned int netmask)
{
static char buff[128];
if (sap->sa_family == 0xFFFF || sap->sa_family == 0)
if (sasp->ss_family == 0xFFFF || sasp->ss_family == 0)
return safe_strncpy(buff, _("[NONE SET]"), sizeof(buff));
if (INET_rresolve(buff, sizeof(buff), (struct sockaddr_in *) sap,
numeric, netmask) != 0)
if (INET_rresolve(buff, sizeof(buff), sasp, numeric, netmask) != 0)
return (NULL);
return (buff);
}
static int INET_getsock(char *bufp, struct sockaddr *sap)
static int INET_getsock(char *bufp, struct sockaddr_storage *sasp)
{
char *sp = bufp, *bp;
unsigned int i;
unsigned val;
struct sockaddr_in *sin;
struct sockaddr_in *sin = (struct sockaddr_in *)sasp;
sin = (struct sockaddr_in *) sap;
sin->sin_family = AF_INET;
sin->sin_port = 0;
......@@ -318,19 +317,19 @@ static int INET_getsock(char *bufp, struct sockaddr *sap)
return (sp - bufp);
}
static int INET_input(int type, char *bufp, struct sockaddr *sap)
static int INET_input(int type, char *bufp, struct sockaddr_storage *sasp)
{
switch (type) {
case 1:
return (INET_getsock(bufp, sap));
return INET_getsock(bufp, sasp);
case 256:
return (INET_resolve(bufp, (struct sockaddr_in *) sap, 1));
return INET_resolve(bufp, sasp, 1);
default:
return (INET_resolve(bufp, (struct sockaddr_in *) sap, 0));
return INET_resolve(bufp, sasp, 0);
}
}
static int INET_getnetmask(char *adr, struct sockaddr *m, char *name)
static int INET_getnetmask(char *adr, struct sockaddr_storage *m, char *name)
{
struct sockaddr_in *mask = (struct sockaddr_in *) m;
char *slash, *end;
......
......@@ -59,7 +59,7 @@ static char *fix_v4_address(char *buf, const struct in6_addr *in6)
return buf;
}
static int INET6_resolve(char *name, struct sockaddr_in6 *sin6)
static int INET6_resolve(char *name, struct sockaddr_storage *sasp)
{
struct addrinfo req, *ai;
int s;
......@@ -70,7 +70,7 @@ static int INET6_resolve(char *name, struct sockaddr_in6 *sin6)
fprintf(stderr, "getaddrinfo: %s: %d\n", name, s);
return -1;
}
memcpy(sin6, ai->ai_addr, sizeof(struct sockaddr_in6));
memcpy(sasp, ai->ai_addr, sizeof(struct sockaddr_in6));
freeaddrinfo(ai);
......@@ -85,8 +85,9 @@ static int INET6_resolve(char *name, struct sockaddr_in6 *sin6)
static int INET6_rresolve(char *name, size_t namelen,
struct sockaddr_in6 *sin6, int numeric)
const struct sockaddr_storage *sasp, int numeric)
{
const struct sockaddr_in6 *sin6 = (const struct sockaddr_in6 *)sasp;
/* Grmpf. -FvK */
if (sin6->sin6_family != AF_INET6) {
#ifdef DEBUG
......@@ -108,7 +109,7 @@ static int INET6_rresolve(char *name, size_t namelen,
return (0);
}
if (getnameinfo((struct sockaddr *) sin6, sizeof(struct sockaddr_in6),
if (getnameinfo((const struct sockaddr *)sasp, sizeof(struct sockaddr_in6),
name, namelen , NULL, 0, 0)) {
inet_ntop( AF_INET6, &sin6->sin6_addr, name, namelen);
}
......@@ -136,25 +137,24 @@ static const char *INET6_print(const char *ptr)
/* Display an Internet socket address. */
/* dirty! struct sockaddr usually doesn't suffer for inet6 addresses, fst. */
static const char *INET6_sprint(const struct sockaddr *sap, int numeric)
static const char *INET6_sprint(const struct sockaddr_storage *sasp, int numeric)
{
static char buff[128];
if (sap->sa_family == 0xFFFF || sap->sa_family == 0)
if (sasp->ss_family == 0xFFFF || sasp->ss_family == 0)
return safe_strncpy(buff, _("[NONE SET]"), sizeof(buff));
if (INET6_rresolve(buff, sizeof(buff),
(struct sockaddr_in6 *) sap, numeric) != 0)
if (INET6_rresolve(buff, sizeof(buff), sasp, numeric) != 0)
return safe_strncpy(buff, _("[UNKNOWN]"), sizeof(buff));
return (fix_v4_address(buff, &((struct sockaddr_in6 *)sap)->sin6_addr));
return (fix_v4_address(buff, &((struct sockaddr_in6 *)sasp)->sin6_addr));
}
static int INET6_getsock(char *bufp, struct sockaddr *sap)
static int INET6_getsock(char *bufp, struct sockaddr_storage *sasp)
{
struct sockaddr_in6 *sin6;
char *p;
sin6 = (struct sockaddr_in6 *) sap;
sin6 = (struct sockaddr_in6 *) sasp;
sin6->sin6_family = AF_INET6;
sin6->sin6_port = 0;
sin6->sin6_scope_id = 0;
......@@ -168,13 +168,13 @@ static int INET6_getsock(char *bufp, struct sockaddr *sap)
return 16; /* ?;) */
}
static int INET6_input(int type, char *bufp, struct sockaddr *sap)
static int INET6_input(int type, char *bufp, struct sockaddr_storage *sasp)
{
switch (type) {
case 1:
return (INET6_getsock(bufp, sap));
return INET6_getsock(bufp, sasp);
default:
return (INET6_resolve(bufp, (struct sockaddr_in6 *) sap));
return INET6_resolve(bufp, sasp);
}
}
......
......@@ -58,7 +58,7 @@ int rprint_fib6(int ext, int numeric)
{
char buff[4096], iface[16], flags[16];
char addr6[128], naddr6[128];
struct sockaddr_in6 saddr6, snaddr6;
struct sockaddr_storage sas, sasn;
int num, iflags, metric, refcnt, use, prefix_len, slen;
FILE *fp = fopen(_PATH_PROCNET_ROUTE6, "r");
......@@ -104,18 +104,18 @@ int rprint_fib6(int ext, int numeric)
snprintf(addr6, sizeof(addr6), "%s:%s:%s:%s:%s:%s:%s:%s",
addr6p[0], addr6p[1], addr6p[2], addr6p[3],
addr6p[4], addr6p[5], addr6p[6], addr6p[7]);
inet6_aftype.input(1, addr6, (struct sockaddr *) &saddr6);
inet6_aftype.input(1, addr6, &sas);
snprintf(addr6, sizeof(addr6), "%s/%d",
inet6_aftype.sprint((struct sockaddr *) &saddr6, numeric),
inet6_aftype.sprint(&sas, numeric),
prefix_len);
/* Fetch and resolve the nexthop address. */
snprintf(naddr6, sizeof(naddr6), "%s:%s:%s:%s:%s:%s:%s:%s",
naddr6p[0], naddr6p[1], naddr6p[2], naddr6p[3],
naddr6p[4], naddr6p