Use size_t for buffer sizes. Improve error handling in some places.
Remove a __DECONST() that was needed before this interface cleanup.
This commit is contained in:
parent
21b40f3c1b
commit
c7185249d7
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=118163
@ -559,7 +559,8 @@ pvc_add(int argc, char **argv, const struct cmd *cmdp)
|
|||||||
const struct traffics *trafp;
|
const struct traffics *trafp;
|
||||||
char *cp;
|
char *cp;
|
||||||
u_long v;
|
u_long v;
|
||||||
int buf_len, s;
|
ssize_t buf_len;
|
||||||
|
int s;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialize opcode and flags
|
* Initialize opcode and flags
|
||||||
@ -577,29 +578,23 @@ pvc_add(int argc, char **argv, const struct cmd *cmdp)
|
|||||||
}
|
}
|
||||||
bzero(air.air_int_intf, sizeof(air.air_int_intf));
|
bzero(air.air_int_intf, sizeof(air.air_int_intf));
|
||||||
strcpy(air.air_int_intf, argv[0]);
|
strcpy(air.air_int_intf, argv[0]);
|
||||||
buf_len = sizeof(struct air_int_rsp);
|
|
||||||
air.air_opcode = AIOCS_INF_INT;
|
air.air_opcode = AIOCS_INF_INT;
|
||||||
buf_len = do_info_ioctl(&air, buf_len);
|
buf_len = do_info_ioctl(&air, sizeof(struct air_int_rsp));
|
||||||
if (buf_len < 0) {
|
if (buf_len == -1) {
|
||||||
fprintf(stderr, "%s: ", prog);
|
|
||||||
switch (errno) {
|
switch (errno) {
|
||||||
case ENOPROTOOPT:
|
case ENOPROTOOPT:
|
||||||
case EOPNOTSUPP:
|
case EOPNOTSUPP:
|
||||||
perror("Internal error");
|
err(1, "Internal error");
|
||||||
break;
|
|
||||||
case ENXIO:
|
case ENXIO:
|
||||||
fprintf(stderr, "%s is not an ATM device\n",
|
errx(1, "%s is not an ATM device", argv[0]);
|
||||||
argv[0]);
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
perror("ioctl (AIOCINFO)");
|
err(1, "ioctl (AIOCINFO)");
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
exit(1);
|
|
||||||
}
|
}
|
||||||
int_info = (struct air_int_rsp *)(void *)air.air_buf_addr;
|
int_info = (struct air_int_rsp *)(void *)air.air_buf_addr;
|
||||||
strcpy(apr.aar_pvc_intf, argv[0]);
|
strcpy(apr.aar_pvc_intf, argv[0]);
|
||||||
argc--; argv++;
|
argc--;
|
||||||
|
argv++;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Validate vpi/vci values
|
* Validate vpi/vci values
|
||||||
@ -769,35 +764,30 @@ pvc_add(int argc, char **argv, const struct cmd *cmdp)
|
|||||||
sock_error(errno);
|
sock_error(errno);
|
||||||
}
|
}
|
||||||
if (ioctl(s, AIOCADD, (caddr_t)&apr) < 0) {
|
if (ioctl(s, AIOCADD, (caddr_t)&apr) < 0) {
|
||||||
fprintf(stderr, "%s: ", prog);
|
|
||||||
switch (errno) {
|
switch (errno) {
|
||||||
case EPROTONOSUPPORT:
|
case EPROTONOSUPPORT:
|
||||||
case ENOPROTOOPT:
|
case ENOPROTOOPT:
|
||||||
perror("Internal error");
|
err(1, "Internal error");
|
||||||
break;
|
|
||||||
case EINVAL:
|
case EINVAL:
|
||||||
fprintf(stderr, "Invalid parameter\n");
|
errx(1, "Invalid parameter");
|
||||||
break;
|
|
||||||
case EEXIST:
|
case EEXIST:
|
||||||
fprintf(stderr, "PVC already exists\n");
|
errx(1, "PVC already exists");
|
||||||
break;
|
break;
|
||||||
case ENETDOWN:
|
case ENETDOWN:
|
||||||
fprintf(stderr, "ATM network is inoperable\n");
|
errx(1, "ATM network is inoperable");
|
||||||
break;
|
break;
|
||||||
case ENOMEM:
|
case ENOMEM:
|
||||||
fprintf(stderr, "Kernel memory exhausted\n");
|
errx(1, "Kernel memory exhausted");
|
||||||
break;
|
break;
|
||||||
case EPERM:
|
case EPERM:
|
||||||
fprintf(stderr, "Must be super user to use add subcommand\n");
|
errx(1, "Must be super user to use add subcommand");
|
||||||
break;
|
break;
|
||||||
case ERANGE:
|
case ERANGE:
|
||||||
fprintf(stderr, "Invalid VPI or VCI value\n");
|
errx(1, "Invalid VPI or VCI value");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
perror("ioctl (AIOCADD) add PVC");
|
err(1, "ioctl (AIOCADD) add PVC");
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
exit(1);
|
|
||||||
}
|
}
|
||||||
(void)close(s);
|
(void)close(s);
|
||||||
}
|
}
|
||||||
|
@ -187,7 +187,7 @@ const char * get_adapter_name(const char *);
|
|||||||
int get_hex_addr(char *, u_char *, int);
|
int get_hex_addr(char *, u_char *, int);
|
||||||
const char * format_mac_addr(const Mac_addr *);
|
const char * format_mac_addr(const Mac_addr *);
|
||||||
int parse_ip_prefix(const char *, struct in_addr *);
|
int parse_ip_prefix(const char *, struct in_addr *);
|
||||||
int compress_prefix_list(struct in_addr *, int);
|
size_t compress_prefix_list(struct in_addr *, size_t);
|
||||||
void check_netif_name(const char *);
|
void check_netif_name(const char *);
|
||||||
void sock_error(int);
|
void sock_error(int);
|
||||||
|
|
||||||
|
@ -52,6 +52,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <err.h>
|
||||||
|
|
||||||
#include "atm.h"
|
#include "atm.h"
|
||||||
|
|
||||||
@ -135,7 +136,8 @@ show_eni_stats(intf, argc, argv)
|
|||||||
int argc;
|
int argc;
|
||||||
char **argv;
|
char **argv;
|
||||||
{
|
{
|
||||||
int buf_len, stats_type;
|
int stats_type;
|
||||||
|
ssize_t buf_len;
|
||||||
struct atminfreq air;
|
struct atminfreq air;
|
||||||
struct air_vinfo_rsp *stats;
|
struct air_vinfo_rsp *stats;
|
||||||
|
|
||||||
@ -153,10 +155,10 @@ show_eni_stats(intf, argc, argv)
|
|||||||
} else if (!strcasecmp("driver", argv[0])) {
|
} else if (!strcasecmp("driver", argv[0])) {
|
||||||
stats_type = SHOW_DRIVER;
|
stats_type = SHOW_DRIVER;
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "%s: Illegal or unsupported statistics type\n", prog);
|
errx(1, "Illegal or unsupported statistics type");
|
||||||
exit(1);
|
|
||||||
}
|
}
|
||||||
argc--; argv++;
|
argc--;
|
||||||
|
argv++;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get vendor-specific statistics from the kernel
|
* Get vendor-specific statistics from the kernel
|
||||||
@ -165,22 +167,16 @@ show_eni_stats(intf, argc, argv)
|
|||||||
air.air_opcode = AIOCS_INF_VST;
|
air.air_opcode = AIOCS_INF_VST;
|
||||||
strcpy(air.air_vinfo_intf, intf);
|
strcpy(air.air_vinfo_intf, intf);
|
||||||
buf_len = do_info_ioctl(&air, sizeof(struct air_vinfo_rsp) + 1024);
|
buf_len = do_info_ioctl(&air, sizeof(struct air_vinfo_rsp) + 1024);
|
||||||
if (buf_len < 0) {
|
if (buf_len == -1) {
|
||||||
fprintf(stderr, "%s: ", prog);
|
|
||||||
switch (errno) {
|
switch (errno) {
|
||||||
case ENOPROTOOPT:
|
case ENOPROTOOPT:
|
||||||
case EOPNOTSUPP:
|
case EOPNOTSUPP:
|
||||||
perror("Internal error");
|
err(1, "Internal error");
|
||||||
break;
|
|
||||||
case ENXIO:
|
case ENXIO:
|
||||||
fprintf(stderr, "%s is not an ATM device\n",
|
errx(1, "%s is not an ATM device", intf);
|
||||||
intf);
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
perror("ioctl (AIOCINFO)");
|
err(1, "ioctl (AIOCINFO)");
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
exit(1);
|
|
||||||
}
|
}
|
||||||
stats = (struct air_vinfo_rsp *)(void *)air.air_buf_addr;
|
stats = (struct air_vinfo_rsp *)(void *)air.air_buf_addr;
|
||||||
|
|
||||||
|
@ -54,6 +54,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <err.h>
|
||||||
|
|
||||||
#include "atm.h"
|
#include "atm.h"
|
||||||
|
|
||||||
@ -151,7 +152,8 @@ show_fore200_stats(intf, argc, argv)
|
|||||||
int argc;
|
int argc;
|
||||||
char **argv;
|
char **argv;
|
||||||
{
|
{
|
||||||
int buf_len, stats_type;
|
int stats_type;
|
||||||
|
ssize_t buf_len;
|
||||||
struct air_cfg_rsp *cfg;
|
struct air_cfg_rsp *cfg;
|
||||||
struct air_vinfo_rsp *stats;
|
struct air_vinfo_rsp *stats;
|
||||||
struct atminfreq air;
|
struct atminfreq air;
|
||||||
@ -174,8 +176,7 @@ show_fore200_stats(intf, argc, argv)
|
|||||||
} else if (!strcasecmp("driver", argv[0])) {
|
} else if (!strcasecmp("driver", argv[0])) {
|
||||||
stats_type = SHOW_DRIVER;
|
stats_type = SHOW_DRIVER;
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "%s: Illegal statistics type\n", prog);
|
errx(1, "Illegal statistics type");
|
||||||
exit(1);
|
|
||||||
}
|
}
|
||||||
argc--; argv++;
|
argc--; argv++;
|
||||||
|
|
||||||
@ -186,22 +187,16 @@ show_fore200_stats(intf, argc, argv)
|
|||||||
air.air_opcode = AIOCS_INF_CFG;
|
air.air_opcode = AIOCS_INF_CFG;
|
||||||
strcpy(air.air_cfg_intf, intf);
|
strcpy(air.air_cfg_intf, intf);
|
||||||
buf_len = do_info_ioctl(&air, sizeof(struct air_cfg_rsp));
|
buf_len = do_info_ioctl(&air, sizeof(struct air_cfg_rsp));
|
||||||
if (buf_len < 0) {
|
if (buf_len == -1) {
|
||||||
fprintf(stderr, "%s: ", prog);
|
|
||||||
switch (errno) {
|
switch (errno) {
|
||||||
case ENOPROTOOPT:
|
case ENOPROTOOPT:
|
||||||
case EOPNOTSUPP:
|
case EOPNOTSUPP:
|
||||||
perror("Internal error");
|
err(1, "Internal error");
|
||||||
break;
|
|
||||||
case ENXIO:
|
case ENXIO:
|
||||||
fprintf(stderr, "%s is not an ATM device\n",
|
errx(1, "%s is not an ATM device", intf);
|
||||||
intf);
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
perror("ioctl (AIOCINFO)");
|
err(1, "ioctl (AIOCINFO)");
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
exit(1);
|
|
||||||
}
|
}
|
||||||
cfg = (struct air_cfg_rsp *)(void *)air.air_buf_addr;
|
cfg = (struct air_cfg_rsp *)(void *)air.air_buf_addr;
|
||||||
|
|
||||||
@ -212,22 +207,16 @@ show_fore200_stats(intf, argc, argv)
|
|||||||
air.air_opcode = AIOCS_INF_VST;
|
air.air_opcode = AIOCS_INF_VST;
|
||||||
strcpy(air.air_vinfo_intf, intf);
|
strcpy(air.air_vinfo_intf, intf);
|
||||||
buf_len = do_info_ioctl(&air, sizeof(struct air_vinfo_rsp) + 1024);
|
buf_len = do_info_ioctl(&air, sizeof(struct air_vinfo_rsp) + 1024);
|
||||||
if (buf_len < 0) {
|
if (buf_len == -1) {
|
||||||
fprintf(stderr, "%s: ", prog);
|
|
||||||
switch (errno) {
|
switch (errno) {
|
||||||
case ENOPROTOOPT:
|
case ENOPROTOOPT:
|
||||||
case EOPNOTSUPP:
|
case EOPNOTSUPP:
|
||||||
perror("Internal error");
|
err(1, "Internal error");
|
||||||
break;
|
|
||||||
case ENXIO:
|
case ENXIO:
|
||||||
fprintf(stderr, "%s is not an ATM device\n",
|
errx(1, "%s is not an ATM device", intf);
|
||||||
intf);
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
perror("ioctl (AIOCINFO)");
|
err(1, "ioctl (AIOCINFO)");
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
exit(1);
|
|
||||||
}
|
}
|
||||||
stats = (struct air_vinfo_rsp *)(void *)air.air_buf_addr;
|
stats = (struct air_vinfo_rsp *)(void *)air.air_buf_addr;
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ ip_pvcadd(int argc, char **argv, const struct cmd *cmdp,
|
|||||||
{
|
{
|
||||||
char *cp;
|
char *cp;
|
||||||
char nhelp[128];
|
char nhelp[128];
|
||||||
int netif_no;
|
u_int netif_no;
|
||||||
u_int i, netif_pref_len;
|
u_int i, netif_pref_len;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -109,30 +109,24 @@ ip_pvcadd(int argc, char **argv, const struct cmd *cmdp,
|
|||||||
bzero(app->aar_pvc_intf, sizeof(app->aar_pvc_intf));
|
bzero(app->aar_pvc_intf, sizeof(app->aar_pvc_intf));
|
||||||
netif_pref_len = strlen(intp->anp_nif_pref);
|
netif_pref_len = strlen(intp->anp_nif_pref);
|
||||||
cp = &argv[0][netif_pref_len];
|
cp = &argv[0][netif_pref_len];
|
||||||
netif_no = atoi(cp);
|
netif_no = (u_int)strtoul(cp, NULL, 10);
|
||||||
for (i = 0; i < strlen(cp); i++) {
|
for (i = 0; i < strlen(cp); i++) {
|
||||||
if (cp[i] < '0' || cp[i] > '9') {
|
if (cp[i] < '0' || cp[i] > '9') {
|
||||||
netif_no = -1;
|
netif_no = -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((strlen(argv[0]) > sizeof(app->aar_pvc_intf) - 1) ||
|
if (strlen(argv[0]) > sizeof(app->aar_pvc_intf) - 1)
|
||||||
(netif_no < 0)) {
|
errx(1, "Illegal network interface name '%s'", argv[0]);
|
||||||
fprintf(stderr, "%s: Illegal network interface name\n",
|
|
||||||
prog);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
if (strncasecmp(intp->anp_nif_pref, argv[0], netif_pref_len) ||
|
if (strncasecmp(intp->anp_nif_pref, argv[0], netif_pref_len) ||
|
||||||
strlen (argv[0]) <= netif_pref_len ||
|
strlen(argv[0]) <= netif_pref_len || netif_no >= intp->anp_nif_cnt)
|
||||||
netif_no > intp->anp_nif_cnt - 1) {
|
errx(1, "network interface %s is not associated with "
|
||||||
fprintf(stderr, "%s: network interface %s is not associated with interface %s\n",
|
"interface %s", argv[0], intp->anp_intf);
|
||||||
prog,
|
|
||||||
argv[0],
|
|
||||||
intp->anp_intf);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
strcpy(app->aar_pvc_intf, argv[0]);
|
strcpy(app->aar_pvc_intf, argv[0]);
|
||||||
argc--; argv++;
|
argc--;
|
||||||
|
argv++;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set PVC destination address
|
* Set PVC destination address
|
||||||
|
@ -79,7 +79,10 @@ __RCSID("@(#) $FreeBSD$");
|
|||||||
void
|
void
|
||||||
set_arpserver(int argc, char **argv, const struct cmd *cmdp __unused)
|
set_arpserver(int argc, char **argv, const struct cmd *cmdp __unused)
|
||||||
{
|
{
|
||||||
int i, len, prefix_len = 0, rc, s;
|
int rc, s;
|
||||||
|
u_int i;
|
||||||
|
ssize_t len;
|
||||||
|
size_t prefix_len = 0;
|
||||||
char *intf;
|
char *intf;
|
||||||
Atm_addr server;
|
Atm_addr server;
|
||||||
struct sockaddr_in *lis;
|
struct sockaddr_in *lis;
|
||||||
@ -138,12 +141,11 @@ set_arpserver(int argc, char **argv, const struct cmd *cmdp __unused)
|
|||||||
* with the network interface and insert them into the
|
* with the network interface and insert them into the
|
||||||
* list of permitted LIS prefixes.
|
* list of permitted LIS prefixes.
|
||||||
*/
|
*/
|
||||||
len = sizeof(struct air_netif_rsp);
|
|
||||||
bzero(&air, sizeof(air));
|
bzero(&air, sizeof(air));
|
||||||
air.air_opcode = AIOCS_INF_NIF;
|
air.air_opcode = AIOCS_INF_NIF;
|
||||||
strcpy(air.air_int_intf, intf);
|
strcpy(air.air_int_intf, intf);
|
||||||
len = do_info_ioctl(&air, len);
|
len = do_info_ioctl(&air, sizeof(struct air_netif_rsp));
|
||||||
if (len < 0) {
|
if (len == -1) {
|
||||||
fprintf(stderr, "%s: ", prog);
|
fprintf(stderr, "%s: ", prog);
|
||||||
switch (errno) {
|
switch (errno) {
|
||||||
case ENOPROTOOPT:
|
case ENOPROTOOPT:
|
||||||
@ -371,7 +373,8 @@ set_netif(int argc, char **argv, const struct cmd *cmdp __unused)
|
|||||||
struct atmsetreq anr;
|
struct atmsetreq anr;
|
||||||
char str[16];
|
char str[16];
|
||||||
char *cp;
|
char *cp;
|
||||||
int nifs, s;
|
int s;
|
||||||
|
u_long nifs;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set IOCTL opcode
|
* Set IOCTL opcode
|
||||||
@ -402,8 +405,9 @@ set_netif(int argc, char **argv, const struct cmd *cmdp __unused)
|
|||||||
/*
|
/*
|
||||||
* Validate interface count
|
* Validate interface count
|
||||||
*/
|
*/
|
||||||
nifs = (int) strtol(argv[0], &cp, 0);
|
errno = 0;
|
||||||
if ((*cp != '\0') || (nifs < 0) || (nifs > MAX_NIFS)) {
|
nifs = strtoul(argv[0], &cp, 0);
|
||||||
|
if (errno != 0 || *cp != '\0' || nifs > MAX_NIFS) {
|
||||||
fprintf(stderr, "%s: Invalid interface count\n", prog);
|
fprintf(stderr, "%s: Invalid interface count\n", prog);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
@ -412,7 +416,7 @@ set_netif(int argc, char **argv, const struct cmd *cmdp __unused)
|
|||||||
/*
|
/*
|
||||||
* Make sure the resulting name won't be too long
|
* Make sure the resulting name won't be too long
|
||||||
*/
|
*/
|
||||||
sprintf(str, "%d", nifs - 1);
|
sprintf(str, "%lu", nifs - 1);
|
||||||
if ((strlen(str) + strlen(anr.asr_nif_pref)) >
|
if ((strlen(str) + strlen(anr.asr_nif_pref)) >
|
||||||
sizeof(anr.asr_nif_intf) - 1) {
|
sizeof(anr.asr_nif_intf) - 1) {
|
||||||
fprintf(stderr, "%s: Network interface prefix too long\n", prog);
|
fprintf(stderr, "%s: Network interface prefix too long\n", prog);
|
||||||
|
@ -86,7 +86,7 @@ static int arp_compare(const void *, const void *);
|
|||||||
void
|
void
|
||||||
show_arp(int argc, char **argv, const struct cmd *cmdp __unused)
|
show_arp(int argc, char **argv, const struct cmd *cmdp __unused)
|
||||||
{
|
{
|
||||||
int buf_len, arp_info_len;
|
size_t arp_info_len;
|
||||||
struct atminfreq air;
|
struct atminfreq air;
|
||||||
struct air_arp_rsp *arp_info, *arp_info_base;
|
struct air_arp_rsp *arp_info, *arp_info_base;
|
||||||
struct sockaddr_in *sain;
|
struct sockaddr_in *sain;
|
||||||
@ -116,11 +116,10 @@ show_arp(int argc, char **argv, const struct cmd *cmdp __unused)
|
|||||||
* Get ARP information from the kernel
|
* Get ARP information from the kernel
|
||||||
*/
|
*/
|
||||||
bzero(&air, sizeof(air));
|
bzero(&air, sizeof(air));
|
||||||
buf_len = sizeof(struct air_arp_rsp) * 10;
|
|
||||||
air.air_opcode = AIOCS_INF_ARP;
|
air.air_opcode = AIOCS_INF_ARP;
|
||||||
air.air_arp_addr = host_addr.sa;
|
air.air_arp_addr = host_addr.sa;
|
||||||
arp_info_len = do_info_ioctl(&air, buf_len);
|
arp_info_len = do_info_ioctl(&air, sizeof(struct air_arp_rsp) * 10);
|
||||||
if (arp_info_len < 0) {
|
if ((ssize_t)arp_info_len == -1) {
|
||||||
fprintf(stderr, "%s: ", prog);
|
fprintf(stderr, "%s: ", prog);
|
||||||
switch (errno) {
|
switch (errno) {
|
||||||
case ENOPROTOOPT:
|
case ENOPROTOOPT:
|
||||||
@ -150,7 +149,7 @@ show_arp(int argc, char **argv, const struct cmd *cmdp __unused)
|
|||||||
/*
|
/*
|
||||||
* Print the relevant information
|
* Print the relevant information
|
||||||
*/
|
*/
|
||||||
while (arp_info_len > 0) {
|
while (arp_info_len >= sizeof(struct air_arp_rsp)) {
|
||||||
print_arp_info(arp_info);
|
print_arp_info(arp_info);
|
||||||
arp_info++;
|
arp_info++;
|
||||||
arp_info_len -= sizeof(struct air_arp_rsp);
|
arp_info_len -= sizeof(struct air_arp_rsp);
|
||||||
@ -181,7 +180,7 @@ show_arp(int argc, char **argv, const struct cmd *cmdp __unused)
|
|||||||
void
|
void
|
||||||
show_arpserv(int argc, char **argv, const struct cmd *cmdp __unused)
|
show_arpserv(int argc, char **argv, const struct cmd *cmdp __unused)
|
||||||
{
|
{
|
||||||
int asrv_info_len, buf_len = sizeof(struct air_asrv_rsp) * 3;
|
size_t buf_len, asrv_info_len;
|
||||||
struct atminfreq air;
|
struct atminfreq air;
|
||||||
struct air_asrv_rsp *asrv_info, *asrv_info_base;
|
struct air_asrv_rsp *asrv_info, *asrv_info_base;
|
||||||
|
|
||||||
@ -203,8 +202,8 @@ show_arpserv(int argc, char **argv, const struct cmd *cmdp __unused)
|
|||||||
* Get interface information from the kernel
|
* Get interface information from the kernel
|
||||||
*/
|
*/
|
||||||
air.air_opcode = AIOCS_INF_ASV;
|
air.air_opcode = AIOCS_INF_ASV;
|
||||||
buf_len = do_info_ioctl(&air, buf_len);
|
buf_len = do_info_ioctl(&air, sizeof(struct air_asrv_rsp) * 3);
|
||||||
if (buf_len < 0) {
|
if ((ssize_t)buf_len == -1) {
|
||||||
fprintf(stderr, "%s: ", prog);
|
fprintf(stderr, "%s: ", prog);
|
||||||
switch (errno) {
|
switch (errno) {
|
||||||
case ENOPROTOOPT:
|
case ENOPROTOOPT:
|
||||||
@ -227,14 +226,13 @@ show_arpserv(int argc, char **argv, const struct cmd *cmdp __unused)
|
|||||||
*/
|
*/
|
||||||
asrv_info_base = asrv_info =
|
asrv_info_base = asrv_info =
|
||||||
(struct air_asrv_rsp *)(void *)air.air_buf_addr;
|
(struct air_asrv_rsp *)(void *)air.air_buf_addr;
|
||||||
for (; (size_t)buf_len >= sizeof(struct air_asrv_rsp);
|
while (buf_len >= sizeof(struct air_asrv_rsp)) {
|
||||||
asrv_info = (struct air_asrv_rsp *)
|
|
||||||
((u_long)asrv_info + asrv_info_len),
|
|
||||||
buf_len -= asrv_info_len) {
|
|
||||||
print_asrv_info(asrv_info);
|
print_asrv_info(asrv_info);
|
||||||
asrv_info_len = sizeof(struct air_asrv_rsp) +
|
asrv_info_len = sizeof(struct air_asrv_rsp) +
|
||||||
asrv_info->asp_nprefix *
|
asrv_info->asp_nprefix * sizeof(struct in_addr) * 2;
|
||||||
sizeof(struct in_addr) * 2;
|
asrv_info = (struct air_asrv_rsp *)(void *)
|
||||||
|
((char *)asrv_info + asrv_info_len);
|
||||||
|
buf_len -= asrv_info_len;
|
||||||
}
|
}
|
||||||
free(asrv_info_base);
|
free(asrv_info_base);
|
||||||
}
|
}
|
||||||
@ -258,7 +256,7 @@ show_arpserv(int argc, char **argv, const struct cmd *cmdp __unused)
|
|||||||
void
|
void
|
||||||
show_config(int argc, char **argv, const struct cmd *cmdp __unused)
|
show_config(int argc, char **argv, const struct cmd *cmdp __unused)
|
||||||
{
|
{
|
||||||
int buf_len = sizeof(struct air_asrv_rsp) * 3;
|
size_t buf_len;
|
||||||
struct atminfreq air;
|
struct atminfreq air;
|
||||||
struct air_cfg_rsp *cfg_info, *cfg_info_base;
|
struct air_cfg_rsp *cfg_info, *cfg_info_base;
|
||||||
|
|
||||||
@ -280,8 +278,8 @@ show_config(int argc, char **argv, const struct cmd *cmdp __unused)
|
|||||||
* Get configuration information from the kernel
|
* Get configuration information from the kernel
|
||||||
*/
|
*/
|
||||||
air.air_opcode = AIOCS_INF_CFG;
|
air.air_opcode = AIOCS_INF_CFG;
|
||||||
buf_len = do_info_ioctl(&air, buf_len);
|
buf_len = do_info_ioctl(&air, sizeof(struct air_asrv_rsp) * 3);
|
||||||
if (buf_len < 0) {
|
if ((ssize_t)buf_len == -1) {
|
||||||
fprintf(stderr, "%s: ", prog);
|
fprintf(stderr, "%s: ", prog);
|
||||||
switch (errno) {
|
switch (errno) {
|
||||||
case ENOPROTOOPT:
|
case ENOPROTOOPT:
|
||||||
@ -304,7 +302,7 @@ show_config(int argc, char **argv, const struct cmd *cmdp __unused)
|
|||||||
*/
|
*/
|
||||||
cfg_info_base = cfg_info =
|
cfg_info_base = cfg_info =
|
||||||
(struct air_cfg_rsp *)(void *)air.air_buf_addr;
|
(struct air_cfg_rsp *)(void *)air.air_buf_addr;
|
||||||
for (; (size_t)buf_len >= sizeof(struct air_cfg_rsp); cfg_info++,
|
for (; buf_len >= sizeof(struct air_cfg_rsp); cfg_info++,
|
||||||
buf_len -= sizeof(struct air_cfg_rsp)) {
|
buf_len -= sizeof(struct air_cfg_rsp)) {
|
||||||
print_cfg_info(cfg_info);
|
print_cfg_info(cfg_info);
|
||||||
}
|
}
|
||||||
@ -330,7 +328,7 @@ show_config(int argc, char **argv, const struct cmd *cmdp __unused)
|
|||||||
void
|
void
|
||||||
show_intf(int argc, char **argv, const struct cmd *cmdp __unused)
|
show_intf(int argc, char **argv, const struct cmd *cmdp __unused)
|
||||||
{
|
{
|
||||||
int buf_len = sizeof(struct air_int_rsp) * 3;
|
size_t buf_len;
|
||||||
struct atminfreq air;
|
struct atminfreq air;
|
||||||
struct air_int_rsp *int_info, *int_info_base;
|
struct air_int_rsp *int_info, *int_info_base;
|
||||||
|
|
||||||
@ -352,8 +350,8 @@ show_intf(int argc, char **argv, const struct cmd *cmdp __unused)
|
|||||||
* Get interface information from the kernel
|
* Get interface information from the kernel
|
||||||
*/
|
*/
|
||||||
air.air_opcode = AIOCS_INF_INT;
|
air.air_opcode = AIOCS_INF_INT;
|
||||||
buf_len = do_info_ioctl(&air, buf_len);
|
buf_len = do_info_ioctl(&air, sizeof(struct air_int_rsp) * 3);
|
||||||
if (buf_len < 0) {
|
if ((ssize_t)buf_len == -1) {
|
||||||
fprintf(stderr, "%s: ", prog);
|
fprintf(stderr, "%s: ", prog);
|
||||||
switch (errno) {
|
switch (errno) {
|
||||||
case ENOPROTOOPT:
|
case ENOPROTOOPT:
|
||||||
@ -376,7 +374,7 @@ show_intf(int argc, char **argv, const struct cmd *cmdp __unused)
|
|||||||
*/
|
*/
|
||||||
int_info_base = int_info =
|
int_info_base = int_info =
|
||||||
(struct air_int_rsp *)(void *)air.air_buf_addr;
|
(struct air_int_rsp *)(void *)air.air_buf_addr;
|
||||||
for (; (size_t)buf_len >= sizeof(struct air_int_rsp); int_info++,
|
for (; buf_len >= sizeof(struct air_int_rsp); int_info++,
|
||||||
buf_len -= sizeof(struct air_int_rsp)) {
|
buf_len -= sizeof(struct air_int_rsp)) {
|
||||||
print_intf_info(int_info);
|
print_intf_info(int_info);
|
||||||
}
|
}
|
||||||
@ -402,7 +400,8 @@ show_intf(int argc, char **argv, const struct cmd *cmdp __unused)
|
|||||||
void
|
void
|
||||||
show_ip_vcc(int argc, char **argv, const struct cmd *cmdp __unused)
|
show_ip_vcc(int argc, char **argv, const struct cmd *cmdp __unused)
|
||||||
{
|
{
|
||||||
int buf_len, ip_info_len, rc;
|
int rc;
|
||||||
|
size_t ip_info_len;
|
||||||
char *if_name = (char *)0;
|
char *if_name = (char *)0;
|
||||||
struct atminfreq air;
|
struct atminfreq air;
|
||||||
struct air_ip_vcc_rsp *ip_info, *ip_info_base;
|
struct air_ip_vcc_rsp *ip_info, *ip_info_base;
|
||||||
@ -459,11 +458,10 @@ show_ip_vcc(int argc, char **argv, const struct cmd *cmdp __unused)
|
|||||||
/*
|
/*
|
||||||
* Get IP map information from the kernel
|
* Get IP map information from the kernel
|
||||||
*/
|
*/
|
||||||
buf_len = sizeof(struct air_ip_vcc_rsp) * 10;
|
|
||||||
air.air_opcode = AIOCS_INF_IPM;
|
air.air_opcode = AIOCS_INF_IPM;
|
||||||
air.air_ip_addr = host_addr.sa;
|
air.air_ip_addr = host_addr.sa;
|
||||||
ip_info_len = do_info_ioctl(&air, buf_len);
|
ip_info_len = do_info_ioctl(&air, sizeof(struct air_ip_vcc_rsp) * 10);
|
||||||
if (ip_info_len < 0) {
|
if ((ssize_t)ip_info_len == -1) {
|
||||||
fprintf(stderr, "%s: ", prog);
|
fprintf(stderr, "%s: ", prog);
|
||||||
switch (errno) {
|
switch (errno) {
|
||||||
case ENOPROTOOPT:
|
case ENOPROTOOPT:
|
||||||
@ -493,7 +491,7 @@ show_ip_vcc(int argc, char **argv, const struct cmd *cmdp __unused)
|
|||||||
/*
|
/*
|
||||||
* Print the relevant information
|
* Print the relevant information
|
||||||
*/
|
*/
|
||||||
while (ip_info_len>0) {
|
while (ip_info_len >= sizeof(struct air_ip_vcc_rsp)) {
|
||||||
if (!if_name || !strcmp(if_name, ip_info->aip_intf)) {
|
if (!if_name || !strcmp(if_name, ip_info->aip_intf)) {
|
||||||
print_ip_vcc_info(ip_info);
|
print_ip_vcc_info(ip_info);
|
||||||
}
|
}
|
||||||
@ -505,7 +503,6 @@ show_ip_vcc(int argc, char **argv, const struct cmd *cmdp __unused)
|
|||||||
* Release the information from the kernel
|
* Release the information from the kernel
|
||||||
*/
|
*/
|
||||||
free(ip_info_base);
|
free(ip_info_base);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -527,7 +524,7 @@ show_ip_vcc(int argc, char **argv, const struct cmd *cmdp __unused)
|
|||||||
void
|
void
|
||||||
show_netif(int argc, char **argv, const struct cmd *cmdp __unused)
|
show_netif(int argc, char **argv, const struct cmd *cmdp __unused)
|
||||||
{
|
{
|
||||||
int buf_len = sizeof(struct air_netif_rsp) * 3;
|
size_t buf_len;
|
||||||
struct atminfreq air;
|
struct atminfreq air;
|
||||||
struct air_netif_rsp *int_info, *int_info_base;
|
struct air_netif_rsp *int_info, *int_info_base;
|
||||||
|
|
||||||
@ -548,8 +545,8 @@ show_netif(int argc, char **argv, const struct cmd *cmdp __unused)
|
|||||||
* Get network interface information from the kernel
|
* Get network interface information from the kernel
|
||||||
*/
|
*/
|
||||||
air.air_opcode = AIOCS_INF_NIF;
|
air.air_opcode = AIOCS_INF_NIF;
|
||||||
buf_len = do_info_ioctl(&air, buf_len);
|
buf_len = do_info_ioctl(&air, sizeof(struct air_netif_rsp) * 3);
|
||||||
if (buf_len < 0) {
|
if ((ssize_t)buf_len == -1) {
|
||||||
fprintf(stderr, "%s: ", prog);
|
fprintf(stderr, "%s: ", prog);
|
||||||
switch (errno) {
|
switch (errno) {
|
||||||
case ENOPROTOOPT:
|
case ENOPROTOOPT:
|
||||||
@ -572,7 +569,7 @@ show_netif(int argc, char **argv, const struct cmd *cmdp __unused)
|
|||||||
*/
|
*/
|
||||||
int_info_base = int_info =
|
int_info_base = int_info =
|
||||||
(struct air_netif_rsp *) air.air_buf_addr;
|
(struct air_netif_rsp *) air.air_buf_addr;
|
||||||
for (; (size_t)buf_len >= sizeof(struct air_netif_rsp); int_info++,
|
for (; buf_len >= sizeof(struct air_netif_rsp); int_info++,
|
||||||
buf_len -= sizeof(struct air_netif_rsp)) {
|
buf_len -= sizeof(struct air_netif_rsp)) {
|
||||||
print_netif_info(int_info);
|
print_netif_info(int_info);
|
||||||
}
|
}
|
||||||
@ -598,7 +595,7 @@ show_netif(int argc, char **argv, const struct cmd *cmdp __unused)
|
|||||||
void
|
void
|
||||||
show_intf_stats(int argc, char **argv, const struct cmd *cmdp __unused)
|
show_intf_stats(int argc, char **argv, const struct cmd *cmdp __unused)
|
||||||
{
|
{
|
||||||
int buf_len;
|
size_t buf_len;
|
||||||
char intf[IFNAMSIZ];
|
char intf[IFNAMSIZ];
|
||||||
struct atminfreq air;
|
struct atminfreq air;
|
||||||
struct air_phy_stat_rsp *pstat_info, *pstat_info_base;
|
struct air_phy_stat_rsp *pstat_info, *pstat_info_base;
|
||||||
@ -626,11 +623,10 @@ show_intf_stats(int argc, char **argv, const struct cmd *cmdp __unused)
|
|||||||
/*
|
/*
|
||||||
* Get adapter configuration information
|
* Get adapter configuration information
|
||||||
*/
|
*/
|
||||||
buf_len = sizeof(struct air_cfg_rsp);
|
|
||||||
air.air_opcode = AIOCS_INF_CFG;
|
air.air_opcode = AIOCS_INF_CFG;
|
||||||
strcpy(air.air_cfg_intf, intf);
|
strcpy(air.air_cfg_intf, intf);
|
||||||
buf_len = do_info_ioctl(&air, buf_len);
|
buf_len = do_info_ioctl(&air, sizeof(struct air_cfg_rsp));
|
||||||
if (buf_len < 0) {
|
if ((ssize_t)buf_len == -1) {
|
||||||
fprintf(stderr, "%s: ", prog);
|
fprintf(stderr, "%s: ", prog);
|
||||||
switch (errno) {
|
switch (errno) {
|
||||||
case ENOPROTOOPT:
|
case ENOPROTOOPT:
|
||||||
@ -670,11 +666,11 @@ show_intf_stats(int argc, char **argv, const struct cmd *cmdp __unused)
|
|||||||
/*
|
/*
|
||||||
* Get generic interface statistics
|
* Get generic interface statistics
|
||||||
*/
|
*/
|
||||||
buf_len = sizeof(struct air_phy_stat_rsp) * 3;
|
|
||||||
air.air_opcode = AIOCS_INF_PIS;
|
air.air_opcode = AIOCS_INF_PIS;
|
||||||
strcpy(air.air_physt_intf, intf);
|
strcpy(air.air_physt_intf, intf);
|
||||||
buf_len = do_info_ioctl(&air, buf_len);
|
buf_len = do_info_ioctl(&air,
|
||||||
if (buf_len < 0) {
|
sizeof(struct air_phy_stat_rsp) * 3);
|
||||||
|
if ((ssize_t)buf_len == -1) {
|
||||||
fprintf(stderr, "%s: ", prog);
|
fprintf(stderr, "%s: ", prog);
|
||||||
switch (errno) {
|
switch (errno) {
|
||||||
case ENOPROTOOPT:
|
case ENOPROTOOPT:
|
||||||
@ -697,7 +693,7 @@ show_intf_stats(int argc, char **argv, const struct cmd *cmdp __unused)
|
|||||||
*/
|
*/
|
||||||
pstat_info_base = pstat_info = (struct air_phy_stat_rsp *)
|
pstat_info_base = pstat_info = (struct air_phy_stat_rsp *)
|
||||||
(void *)air.air_buf_addr;
|
(void *)air.air_buf_addr;
|
||||||
for (; (size_t)buf_len >= sizeof(struct air_phy_stat_rsp);
|
for (; buf_len >= sizeof(struct air_phy_stat_rsp);
|
||||||
pstat_info++,
|
pstat_info++,
|
||||||
buf_len-=sizeof(struct air_phy_stat_rsp)) {
|
buf_len-=sizeof(struct air_phy_stat_rsp)) {
|
||||||
print_intf_stats(pstat_info);
|
print_intf_stats(pstat_info);
|
||||||
@ -725,7 +721,7 @@ show_intf_stats(int argc, char **argv, const struct cmd *cmdp __unused)
|
|||||||
void
|
void
|
||||||
show_vcc_stats(int argc, char **argv, const struct cmd *cmdp __unused)
|
show_vcc_stats(int argc, char **argv, const struct cmd *cmdp __unused)
|
||||||
{
|
{
|
||||||
int vcc_info_len;
|
size_t vcc_info_len;
|
||||||
int vpi = -1, vci = -1;
|
int vpi = -1, vci = -1;
|
||||||
char *cp, *intf = NULL;
|
char *cp, *intf = NULL;
|
||||||
struct air_vcc_rsp *vcc_info, *vcc_info_base;
|
struct air_vcc_rsp *vcc_info, *vcc_info_base;
|
||||||
@ -774,7 +770,7 @@ show_vcc_stats(int argc, char **argv, const struct cmd *cmdp __unused)
|
|||||||
vcc_info_len = get_vcc_info(intf, &vcc_info);
|
vcc_info_len = get_vcc_info(intf, &vcc_info);
|
||||||
if (vcc_info_len == 0)
|
if (vcc_info_len == 0)
|
||||||
exit(1);
|
exit(1);
|
||||||
else if (vcc_info_len < 0) {
|
else if ((ssize_t)vcc_info_len == -1) {
|
||||||
fprintf(stderr, "%s: ", prog);
|
fprintf(stderr, "%s: ", prog);
|
||||||
switch (errno) {
|
switch (errno) {
|
||||||
case ENOPROTOOPT:
|
case ENOPROTOOPT:
|
||||||
@ -803,7 +799,7 @@ show_vcc_stats(int argc, char **argv, const struct cmd *cmdp __unused)
|
|||||||
* Display the VCC statistics
|
* Display the VCC statistics
|
||||||
*/
|
*/
|
||||||
vcc_info_base = vcc_info;
|
vcc_info_base = vcc_info;
|
||||||
for (; (size_t)vcc_info_len >= sizeof(struct air_vcc_rsp);
|
for (; vcc_info_len >= sizeof(struct air_vcc_rsp);
|
||||||
vcc_info_len-=sizeof(struct air_vcc_rsp),
|
vcc_info_len-=sizeof(struct air_vcc_rsp),
|
||||||
vcc_info++) {
|
vcc_info++) {
|
||||||
if (vpi != -1 && vcc_info->avp_vpi != vpi)
|
if (vpi != -1 && vcc_info->avp_vpi != vpi)
|
||||||
@ -834,7 +830,7 @@ show_vcc_stats(int argc, char **argv, const struct cmd *cmdp __unused)
|
|||||||
void
|
void
|
||||||
show_vcc(int argc, char **argv, const struct cmd *cmdp __unused)
|
show_vcc(int argc, char **argv, const struct cmd *cmdp __unused)
|
||||||
{
|
{
|
||||||
int vcc_info_len;
|
size_t vcc_info_len;
|
||||||
int vpi = -1, vci = -1, show_pvc = 0, show_svc = 0;
|
int vpi = -1, vci = -1, show_pvc = 0, show_svc = 0;
|
||||||
char *cp, *intf = NULL;
|
char *cp, *intf = NULL;
|
||||||
struct air_vcc_rsp *vcc_info, *vcc_info_base;
|
struct air_vcc_rsp *vcc_info, *vcc_info_base;
|
||||||
@ -890,7 +886,7 @@ show_vcc(int argc, char **argv, const struct cmd *cmdp __unused)
|
|||||||
vcc_info_len = get_vcc_info(intf, &vcc_info);
|
vcc_info_len = get_vcc_info(intf, &vcc_info);
|
||||||
if (vcc_info_len == 0)
|
if (vcc_info_len == 0)
|
||||||
exit(1);
|
exit(1);
|
||||||
else if (vcc_info_len < 0) {
|
else if ((ssize_t)vcc_info_len == -1) {
|
||||||
fprintf(stderr, "%s: ", prog);
|
fprintf(stderr, "%s: ", prog);
|
||||||
switch (errno) {
|
switch (errno) {
|
||||||
case ENOPROTOOPT:
|
case ENOPROTOOPT:
|
||||||
@ -919,7 +915,7 @@ show_vcc(int argc, char **argv, const struct cmd *cmdp __unused)
|
|||||||
* Display the VCC information
|
* Display the VCC information
|
||||||
*/
|
*/
|
||||||
vcc_info_base = vcc_info;
|
vcc_info_base = vcc_info;
|
||||||
for (; (size_t)vcc_info_len >= sizeof(struct air_vcc_rsp);
|
for (; vcc_info_len >= sizeof(struct air_vcc_rsp);
|
||||||
vcc_info_len-=sizeof(struct air_vcc_rsp),
|
vcc_info_len-=sizeof(struct air_vcc_rsp),
|
||||||
vcc_info++) {
|
vcc_info++) {
|
||||||
if (vpi != -1 && vcc_info->avp_vpi != vpi)
|
if (vpi != -1 && vcc_info->avp_vpi != vpi)
|
||||||
@ -955,7 +951,7 @@ void
|
|||||||
show_version(int argc __unused, char **argv __unused,
|
show_version(int argc __unused, char **argv __unused,
|
||||||
const struct cmd *cmdp __unused)
|
const struct cmd *cmdp __unused)
|
||||||
{
|
{
|
||||||
int buf_len = sizeof(struct air_version_rsp);
|
size_t buf_len;
|
||||||
struct atminfreq air;
|
struct atminfreq air;
|
||||||
struct air_version_rsp *ver_info, *ver_info_base;
|
struct air_version_rsp *ver_info, *ver_info_base;
|
||||||
|
|
||||||
@ -963,8 +959,8 @@ show_version(int argc __unused, char **argv __unused,
|
|||||||
* Get network interface information from the kernel
|
* Get network interface information from the kernel
|
||||||
*/
|
*/
|
||||||
air.air_opcode = AIOCS_INF_VER;
|
air.air_opcode = AIOCS_INF_VER;
|
||||||
buf_len = do_info_ioctl(&air, buf_len);
|
buf_len = do_info_ioctl(&air, sizeof(struct air_version_rsp));
|
||||||
if (buf_len < 0) {
|
if ((ssize_t)buf_len == -1) {
|
||||||
fprintf(stderr, "%s: ", prog);
|
fprintf(stderr, "%s: ", prog);
|
||||||
switch (errno) {
|
switch (errno) {
|
||||||
case ENOPROTOOPT:
|
case ENOPROTOOPT:
|
||||||
@ -986,7 +982,7 @@ show_version(int argc __unused, char **argv __unused,
|
|||||||
*/
|
*/
|
||||||
ver_info_base = ver_info =
|
ver_info_base = ver_info =
|
||||||
(struct air_version_rsp *)(void *)air.air_buf_addr;
|
(struct air_version_rsp *)(void *)air.air_buf_addr;
|
||||||
for (; (size_t)buf_len >= sizeof(struct air_version_rsp); ver_info++,
|
for (; buf_len >= sizeof(struct air_version_rsp); ver_info++,
|
||||||
buf_len -= sizeof(struct air_version_rsp)) {
|
buf_len -= sizeof(struct air_version_rsp)) {
|
||||||
print_version_info(ver_info);
|
print_version_info(ver_info);
|
||||||
}
|
}
|
||||||
|
@ -251,7 +251,7 @@ get_bus_type(int bus)
|
|||||||
const char *
|
const char *
|
||||||
get_adapter_name(const char *intf)
|
get_adapter_name(const char *intf)
|
||||||
{
|
{
|
||||||
int buf_len;
|
size_t buf_len;
|
||||||
struct atminfreq air;
|
struct atminfreq air;
|
||||||
struct air_cfg_rsp *cfg;
|
struct air_cfg_rsp *cfg;
|
||||||
static char name[256];
|
static char name[256];
|
||||||
@ -268,7 +268,7 @@ get_adapter_name(const char *intf)
|
|||||||
air.air_opcode = AIOCS_INF_CFG;
|
air.air_opcode = AIOCS_INF_CFG;
|
||||||
strcpy(air.air_cfg_intf, intf);
|
strcpy(air.air_cfg_intf, intf);
|
||||||
buf_len = do_info_ioctl(&air, sizeof(struct air_cfg_rsp));
|
buf_len = do_info_ioctl(&air, sizeof(struct air_cfg_rsp));
|
||||||
if ((size_t)buf_len < sizeof(struct air_cfg_rsp))
|
if (buf_len < sizeof(struct air_cfg_rsp))
|
||||||
return("-");
|
return("-");
|
||||||
cfg = (struct air_cfg_rsp *)(void *)air.air_buf_addr;
|
cfg = (struct air_cfg_rsp *)(void *)air.air_buf_addr;
|
||||||
|
|
||||||
@ -440,10 +440,10 @@ parse_ip_prefix(const char *cp, struct in_addr *op)
|
|||||||
* length of compressed list
|
* length of compressed list
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
int
|
size_t
|
||||||
compress_prefix_list(struct in_addr *ipp, int ilen)
|
compress_prefix_list(struct in_addr *ipp, size_t ilen)
|
||||||
{
|
{
|
||||||
int i, j, n;
|
u_int i, j, n;
|
||||||
struct in_addr *ip1, *ip2, *m1, *m2;
|
struct in_addr *ip1, *ip2, *m1, *m2;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -557,7 +557,7 @@ check_netif_name(const char *nif)
|
|||||||
/*
|
/*
|
||||||
* Look up the name in the kernel
|
* Look up the name in the kernel
|
||||||
*/
|
*/
|
||||||
rc = verify_nif_name(__DECONST(char *, nif)); /* XXX */
|
rc = verify_nif_name(nif);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check the result
|
* Check the result
|
||||||
|
Loading…
Reference in New Issue
Block a user