stop using __u32 etc. uint32_t is there for a reason
This commit is contained in:
@ -93,7 +93,7 @@ int df_main(int argc, char **argv)
|
|||||||
mount_entry = find_mount_point(mount_point, bb_path_mtab_file);
|
mount_entry = find_mount_point(mount_point, bb_path_mtab_file);
|
||||||
if (!mount_entry) {
|
if (!mount_entry) {
|
||||||
bb_error_msg("%s: can't find mount point", mount_point);
|
bb_error_msg("%s: can't find mount point", mount_point);
|
||||||
SET_ERROR:
|
SET_ERROR:
|
||||||
status = EXIT_FAILURE;
|
status = EXIT_FAILURE;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -133,12 +133,12 @@ typedef int socklen_t;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* ---- Compiler dependent settings ------------------------- */
|
/* ---- Compiler dependent settings ------------------------- */
|
||||||
#ifndef __GNUC__
|
//#ifndef __GNUC__
|
||||||
#if defined __INTEL_COMPILER
|
//#if defined __INTEL_COMPILER
|
||||||
__extension__ typedef __signed__ long long __s64;
|
//__extension__ typedef __signed__ long long __s64;
|
||||||
__extension__ typedef unsigned long long __u64;
|
//__extension__ typedef unsigned long long __u64;
|
||||||
#endif /* __INTEL_COMPILER */
|
//#endif /* __INTEL_COMPILER */
|
||||||
#endif /* ifndef __GNUC__ */
|
//#endif /* ifndef __GNUC__ */
|
||||||
|
|
||||||
#if (defined __digital__ && defined __unix__)
|
#if (defined __digital__ && defined __unix__)
|
||||||
# undef HAVE_MNTENT_H
|
# undef HAVE_MNTENT_H
|
||||||
|
@ -3765,12 +3765,8 @@ add_ksymoops_symbols(struct obj_file *f, const char *filename,
|
|||||||
|
|
||||||
if (realpath(filename, real)) {
|
if (realpath(filename, real)) {
|
||||||
absolute_filename = xstrdup(real);
|
absolute_filename = xstrdup(real);
|
||||||
}
|
} else {
|
||||||
else {
|
bb_perror_msg("cannot get realpath for %s", filename);
|
||||||
int save_errno = errno;
|
|
||||||
bb_error_msg("cannot get realpath for %s", filename);
|
|
||||||
errno = save_errno;
|
|
||||||
perror("");
|
|
||||||
absolute_filename = xstrdup(filename);
|
absolute_filename = xstrdup(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3783,7 +3779,8 @@ add_ksymoops_symbols(struct obj_file *f, const char *filename,
|
|||||||
*/
|
*/
|
||||||
use_ksymtab = obj_find_section(f, "__ksymtab") || flag_noexport;
|
use_ksymtab = obj_find_section(f, "__ksymtab") || flag_noexport;
|
||||||
|
|
||||||
if ((sec = obj_find_section(f, ".this"))) {
|
sec = obj_find_section(f, ".this");
|
||||||
|
if (sec) {
|
||||||
/* tag the module header with the object name, last modified
|
/* tag the module header with the object name, last modified
|
||||||
* timestamp and module version. worst case for module version
|
* timestamp and module version. worst case for module version
|
||||||
* is 0xffffff, decimal 16777215. putting all three fields in
|
* is 0xffffff, decimal 16777215. putting all three fields in
|
||||||
@ -3834,8 +3831,8 @@ add_ksymoops_symbols(struct obj_file *f, const char *filename,
|
|||||||
/* tag the desired sections if size is non-zero */
|
/* tag the desired sections if size is non-zero */
|
||||||
|
|
||||||
for (i = 0; i < sizeof(section_names)/sizeof(section_names[0]); ++i) {
|
for (i = 0; i < sizeof(section_names)/sizeof(section_names[0]); ++i) {
|
||||||
if ((sec = obj_find_section(f, section_names[i])) &&
|
sec = obj_find_section(f, section_names[i]);
|
||||||
sec->header.sh_size) {
|
if (sec && sec->header.sh_size) {
|
||||||
l = sizeof(symprefix)+ /* "__insmod_" */
|
l = sizeof(symprefix)+ /* "__insmod_" */
|
||||||
lm_name+ /* module name */
|
lm_name+ /* module name */
|
||||||
2+ /* "_S" */
|
2+ /* "_S" */
|
||||||
|
@ -616,7 +616,7 @@ int ipaddr_list_or_flush(int argc, char **argv, int flush)
|
|||||||
static int default_scope(inet_prefix *lcl)
|
static int default_scope(inet_prefix *lcl)
|
||||||
{
|
{
|
||||||
if (lcl->family == AF_INET) {
|
if (lcl->family == AF_INET) {
|
||||||
if (lcl->bytelen >= 1 && *(__u8*)&lcl->data == 127)
|
if (lcl->bytelen >= 1 && *(uint8_t*)&lcl->data == 127)
|
||||||
return RT_SCOPE_HOST;
|
return RT_SCOPE_HOST;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -47,11 +47,11 @@ static int get_ctl_fd(void)
|
|||||||
if (fd >= 0)
|
if (fd >= 0)
|
||||||
return fd;
|
return fd;
|
||||||
errno = s_errno;
|
errno = s_errno;
|
||||||
perror("Cannot create control socket");
|
bb_perror_msg("cannot create control socket");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int do_chflags(char *dev, __u32 flags, __u32 mask)
|
static int do_chflags(char *dev, uint32_t flags, uint32_t mask)
|
||||||
{
|
{
|
||||||
struct ifreq ifr;
|
struct ifreq ifr;
|
||||||
int fd;
|
int fd;
|
||||||
@ -63,7 +63,7 @@ static int do_chflags(char *dev, __u32 flags, __u32 mask)
|
|||||||
return -1;
|
return -1;
|
||||||
err = ioctl(fd, SIOCGIFFLAGS, &ifr);
|
err = ioctl(fd, SIOCGIFFLAGS, &ifr);
|
||||||
if (err) {
|
if (err) {
|
||||||
perror("SIOCGIFFLAGS");
|
bb_perror_msg("SIOCGIFFLAGS");
|
||||||
close(fd);
|
close(fd);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -72,7 +72,7 @@ static int do_chflags(char *dev, __u32 flags, __u32 mask)
|
|||||||
ifr.ifr_flags |= mask&flags;
|
ifr.ifr_flags |= mask&flags;
|
||||||
err = ioctl(fd, SIOCSIFFLAGS, &ifr);
|
err = ioctl(fd, SIOCSIFFLAGS, &ifr);
|
||||||
if (err)
|
if (err)
|
||||||
perror("SIOCSIFFLAGS");
|
bb_perror_msg("SIOCSIFFLAGS");
|
||||||
}
|
}
|
||||||
close(fd);
|
close(fd);
|
||||||
return err;
|
return err;
|
||||||
@ -91,7 +91,7 @@ static int do_changename(char *dev, char *newdev)
|
|||||||
return -1;
|
return -1;
|
||||||
err = ioctl(fd, SIOCSIFNAME, &ifr);
|
err = ioctl(fd, SIOCSIFNAME, &ifr);
|
||||||
if (err) {
|
if (err) {
|
||||||
perror("SIOCSIFNAME");
|
bb_perror_msg("SIOCSIFNAME");
|
||||||
close(fd);
|
close(fd);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -112,7 +112,7 @@ static int set_qlen(char *dev, int qlen)
|
|||||||
strncpy(ifr.ifr_name, dev, sizeof(ifr.ifr_name));
|
strncpy(ifr.ifr_name, dev, sizeof(ifr.ifr_name));
|
||||||
ifr.ifr_qlen = qlen;
|
ifr.ifr_qlen = qlen;
|
||||||
if (ioctl(s, SIOCSIFTXQLEN, &ifr) < 0) {
|
if (ioctl(s, SIOCSIFTXQLEN, &ifr) < 0) {
|
||||||
perror("SIOCSIFXQLEN");
|
bb_perror_msg("SIOCSIFXQLEN");
|
||||||
close(s);
|
close(s);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -134,7 +134,7 @@ static int set_mtu(char *dev, int mtu)
|
|||||||
strncpy(ifr.ifr_name, dev, sizeof(ifr.ifr_name));
|
strncpy(ifr.ifr_name, dev, sizeof(ifr.ifr_name));
|
||||||
ifr.ifr_mtu = mtu;
|
ifr.ifr_mtu = mtu;
|
||||||
if (ioctl(s, SIOCSIFMTU, &ifr) < 0) {
|
if (ioctl(s, SIOCSIFMTU, &ifr) < 0) {
|
||||||
perror("SIOCSIFMTU");
|
bb_perror_msg("SIOCSIFMTU");
|
||||||
close(s);
|
close(s);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -152,14 +152,14 @@ static int get_address(char *dev, int *htype)
|
|||||||
|
|
||||||
s = socket(PF_PACKET, SOCK_DGRAM, 0);
|
s = socket(PF_PACKET, SOCK_DGRAM, 0);
|
||||||
if (s < 0) {
|
if (s < 0) {
|
||||||
perror("socket(PF_PACKET)");
|
bb_perror_msg("socket(PF_PACKET)");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(&ifr, 0, sizeof(ifr));
|
memset(&ifr, 0, sizeof(ifr));
|
||||||
strncpy(ifr.ifr_name, dev, sizeof(ifr.ifr_name));
|
strncpy(ifr.ifr_name, dev, sizeof(ifr.ifr_name));
|
||||||
if (ioctl(s, SIOCGIFINDEX, &ifr) < 0) {
|
if (ioctl(s, SIOCGIFINDEX, &ifr) < 0) {
|
||||||
perror("SIOCGIFINDEX");
|
bb_perror_msg("SIOCGIFINDEX");
|
||||||
close(s);
|
close(s);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -169,14 +169,14 @@ static int get_address(char *dev, int *htype)
|
|||||||
me.sll_ifindex = ifr.ifr_ifindex;
|
me.sll_ifindex = ifr.ifr_ifindex;
|
||||||
me.sll_protocol = htons(ETH_P_LOOP);
|
me.sll_protocol = htons(ETH_P_LOOP);
|
||||||
if (bind(s, (struct sockaddr*)&me, sizeof(me)) == -1) {
|
if (bind(s, (struct sockaddr*)&me, sizeof(me)) == -1) {
|
||||||
perror("bind");
|
bb_perror_msg("bind");
|
||||||
close(s);
|
close(s);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
alen = sizeof(me);
|
alen = sizeof(me);
|
||||||
if (getsockname(s, (struct sockaddr*)&me, &alen) == -1) {
|
if (getsockname(s, (struct sockaddr*)&me, &alen) == -1) {
|
||||||
perror("getsockname");
|
bb_perror_msg("getsockname");
|
||||||
close(s);
|
close(s);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -210,7 +210,7 @@ static int set_address(struct ifreq *ifr, int brd)
|
|||||||
if (s < 0)
|
if (s < 0)
|
||||||
return -1;
|
return -1;
|
||||||
if (ioctl(s, brd?SIOCSIFHWBROADCAST:SIOCSIFHWADDR, ifr) < 0) {
|
if (ioctl(s, brd?SIOCSIFHWBROADCAST:SIOCSIFHWADDR, ifr) < 0) {
|
||||||
perror(brd?"SIOCSIFHWBROADCAST":"SIOCSIFHWADDR");
|
bb_perror_msg(brd ? "SIOCSIFHWBROADCAST" : "SIOCSIFHWADDR");
|
||||||
close(s);
|
close(s);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -222,8 +222,8 @@ static int set_address(struct ifreq *ifr, int brd)
|
|||||||
static int do_set(int argc, char **argv)
|
static int do_set(int argc, char **argv)
|
||||||
{
|
{
|
||||||
char *dev = NULL;
|
char *dev = NULL;
|
||||||
__u32 mask = 0;
|
uint32_t mask = 0;
|
||||||
__u32 flags = 0;
|
uint32_t flags = 0;
|
||||||
int qlen = -1;
|
int qlen = -1;
|
||||||
int mtu = -1;
|
int mtu = -1;
|
||||||
char *newaddr = NULL;
|
char *newaddr = NULL;
|
||||||
|
@ -15,12 +15,6 @@
|
|||||||
|
|
||||||
#include "libbb.h"
|
#include "libbb.h"
|
||||||
|
|
||||||
#include <sys/socket.h>
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
#include "rt_names.h"
|
#include "rt_names.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "ip_common.h"
|
#include "ip_common.h"
|
||||||
@ -248,7 +242,7 @@ static int print_route(struct sockaddr_nl *who ATTRIBUTE_UNUSED,
|
|||||||
abuf, sizeof(abuf)));
|
abuf, sizeof(abuf)));
|
||||||
}
|
}
|
||||||
if (tb[RTA_PRIORITY]) {
|
if (tb[RTA_PRIORITY]) {
|
||||||
fprintf(fp, " metric %d ", *(__u32*)RTA_DATA(tb[RTA_PRIORITY]));
|
fprintf(fp, " metric %d ", *(uint32_t*)RTA_DATA(tb[RTA_PRIORITY]));
|
||||||
}
|
}
|
||||||
if (r->rtm_family == AF_INET6) {
|
if (r->rtm_family == AF_INET6) {
|
||||||
struct rta_cacheinfo *ci = NULL;
|
struct rta_cacheinfo *ci = NULL;
|
||||||
@ -405,7 +399,8 @@ static int iproute_modify(int cmd, unsigned flags, int argc, char **argv)
|
|||||||
ll_init_map(&rth);
|
ll_init_map(&rth);
|
||||||
|
|
||||||
if (d) {
|
if (d) {
|
||||||
if ((idx = ll_name_to_index(d)) == 0) {
|
idx = ll_name_to_index(d);
|
||||||
|
if (idx == 0) {
|
||||||
bb_error_msg("cannot find device \"%s\"", d);
|
bb_error_msg("cannot find device \"%s\"", d);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -119,7 +119,7 @@ static int print_rule(struct sockaddr_nl *who ATTRIBUTE_UNUSED,
|
|||||||
fprintf(fp, "tos %s ", rtnl_dsfield_n2a(r->rtm_tos, b1, sizeof(b1)));
|
fprintf(fp, "tos %s ", rtnl_dsfield_n2a(r->rtm_tos, b1, sizeof(b1)));
|
||||||
}
|
}
|
||||||
if (tb[RTA_PROTOINFO]) {
|
if (tb[RTA_PROTOINFO]) {
|
||||||
fprintf(fp, "fwmark %#x ", *(__u32*)RTA_DATA(tb[RTA_PROTOINFO]));
|
fprintf(fp, "fwmark %#x ", *(uint32_t*)RTA_DATA(tb[RTA_PROTOINFO]));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tb[RTA_IIF]) {
|
if (tb[RTA_IIF]) {
|
||||||
@ -130,8 +130,8 @@ static int print_rule(struct sockaddr_nl *who ATTRIBUTE_UNUSED,
|
|||||||
fprintf(fp, "lookup %s ", rtnl_rttable_n2a(r->rtm_table, b1, sizeof(b1)));
|
fprintf(fp, "lookup %s ", rtnl_rttable_n2a(r->rtm_table, b1, sizeof(b1)));
|
||||||
|
|
||||||
if (tb[RTA_FLOW]) {
|
if (tb[RTA_FLOW]) {
|
||||||
__u32 to = *(__u32*)RTA_DATA(tb[RTA_FLOW]);
|
uint32_t to = *(uint32_t*)RTA_DATA(tb[RTA_FLOW]);
|
||||||
__u32 from = to>>16;
|
uint32_t from = to>>16;
|
||||||
to &= 0xFFFF;
|
to &= 0xFFFF;
|
||||||
if (from) {
|
if (from) {
|
||||||
fprintf(fp, "realms %s/",
|
fprintf(fp, "realms %s/",
|
||||||
@ -230,25 +230,25 @@ int iprule_modify(int cmd, int argc, char **argv)
|
|||||||
} else if (matches(*argv, "preference") == 0 ||
|
} else if (matches(*argv, "preference") == 0 ||
|
||||||
matches(*argv, "order") == 0 ||
|
matches(*argv, "order") == 0 ||
|
||||||
matches(*argv, "priority") == 0) {
|
matches(*argv, "priority") == 0) {
|
||||||
__u32 pref;
|
uint32_t pref;
|
||||||
NEXT_ARG();
|
NEXT_ARG();
|
||||||
if (get_u32(&pref, *argv, 0))
|
if (get_u32(&pref, *argv, 0))
|
||||||
invarg("preference value", *argv);
|
invarg("preference value", *argv);
|
||||||
addattr32(&req.n, sizeof(req), RTA_PRIORITY, pref);
|
addattr32(&req.n, sizeof(req), RTA_PRIORITY, pref);
|
||||||
} else if (strcmp(*argv, "tos") == 0) {
|
} else if (strcmp(*argv, "tos") == 0) {
|
||||||
__u32 tos;
|
uint32_t tos;
|
||||||
NEXT_ARG();
|
NEXT_ARG();
|
||||||
if (rtnl_dsfield_a2n(&tos, *argv))
|
if (rtnl_dsfield_a2n(&tos, *argv))
|
||||||
invarg("TOS value", *argv);
|
invarg("TOS value", *argv);
|
||||||
req.r.rtm_tos = tos;
|
req.r.rtm_tos = tos;
|
||||||
} else if (strcmp(*argv, "fwmark") == 0) {
|
} else if (strcmp(*argv, "fwmark") == 0) {
|
||||||
__u32 fwmark;
|
uint32_t fwmark;
|
||||||
NEXT_ARG();
|
NEXT_ARG();
|
||||||
if (get_u32(&fwmark, *argv, 0))
|
if (get_u32(&fwmark, *argv, 0))
|
||||||
invarg("fwmark value", *argv);
|
invarg("fwmark value", *argv);
|
||||||
addattr32(&req.n, sizeof(req), RTA_PROTOINFO, fwmark);
|
addattr32(&req.n, sizeof(req), RTA_PROTOINFO, fwmark);
|
||||||
} else if (matches(*argv, "realms") == 0) {
|
} else if (matches(*argv, "realms") == 0) {
|
||||||
__u32 realm;
|
uint32_t realm;
|
||||||
NEXT_ARG();
|
NEXT_ARG();
|
||||||
if (get_rt_realms(&realm, *argv))
|
if (get_rt_realms(&realm, *argv))
|
||||||
invarg("realms", *argv);
|
invarg("realms", *argv);
|
||||||
|
@ -267,7 +267,7 @@ static int parse_args(int argc, char **argv, int cmd, struct ip_tunnel_parm *p)
|
|||||||
}
|
}
|
||||||
} else if (strcmp(*argv, "tos") == 0 ||
|
} else if (strcmp(*argv, "tos") == 0 ||
|
||||||
matches(*argv, "dsfield") == 0) {
|
matches(*argv, "dsfield") == 0) {
|
||||||
__u32 uval;
|
uint32_t uval;
|
||||||
NEXT_ARG();
|
NEXT_ARG();
|
||||||
if (strcmp(*argv, "inherit") != 0) {
|
if (strcmp(*argv, "inherit") != 0) {
|
||||||
if (rtnl_dsfield_a2n(&uval, *argv))
|
if (rtnl_dsfield_a2n(&uval, *argv))
|
||||||
|
@ -319,7 +319,7 @@ int rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n, pid_t peer,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int addattr32(struct nlmsghdr *n, int maxlen, int type, __u32 data)
|
int addattr32(struct nlmsghdr *n, int maxlen, int type, uint32_t data)
|
||||||
{
|
{
|
||||||
int len = RTA_LENGTH(4);
|
int len = RTA_LENGTH(4);
|
||||||
struct rtattr *rta;
|
struct rtattr *rta;
|
||||||
@ -348,7 +348,7 @@ int addattr_l(struct nlmsghdr *n, int maxlen, int type, void *data, int alen)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int rta_addattr32(struct rtattr *rta, int maxlen, int type, __u32 data)
|
int rta_addattr32(struct rtattr *rta, int maxlen, int type, uint32_t data)
|
||||||
{
|
{
|
||||||
int len = RTA_LENGTH(4);
|
int len = RTA_LENGTH(4);
|
||||||
struct rtattr *subrta;
|
struct rtattr *subrta;
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#ifndef __LIBNETLINK_H__
|
#ifndef __LIBNETLINK_H__
|
||||||
#define __LIBNETLINK_H__ 1
|
#define __LIBNETLINK_H__ 1
|
||||||
|
|
||||||
#include <asm/types.h>
|
//#include <asm/types.h>
|
||||||
#include <linux/netlink.h>
|
#include <linux/netlink.h>
|
||||||
#include <linux/rtnetlink.h>
|
#include <linux/rtnetlink.h>
|
||||||
|
|
||||||
@ -11,8 +11,8 @@ struct rtnl_handle
|
|||||||
int fd;
|
int fd;
|
||||||
struct sockaddr_nl local;
|
struct sockaddr_nl local;
|
||||||
struct sockaddr_nl peer;
|
struct sockaddr_nl peer;
|
||||||
__u32 seq;
|
uint32_t seq;
|
||||||
__u32 dump;
|
uint32_t dump;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern int rtnl_open(struct rtnl_handle *rth, unsigned subscriptions);
|
extern int rtnl_open(struct rtnl_handle *rth, unsigned subscriptions);
|
||||||
@ -31,9 +31,9 @@ extern int rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n, pid_t peer,
|
|||||||
extern int rtnl_send(struct rtnl_handle *rth, char *buf, int);
|
extern int rtnl_send(struct rtnl_handle *rth, char *buf, int);
|
||||||
|
|
||||||
|
|
||||||
extern int addattr32(struct nlmsghdr *n, int maxlen, int type, __u32 data);
|
extern int addattr32(struct nlmsghdr *n, int maxlen, int type, uint32_t data);
|
||||||
extern int addattr_l(struct nlmsghdr *n, int maxlen, int type, void *data, int alen);
|
extern int addattr_l(struct nlmsghdr *n, int maxlen, int type, void *data, int alen);
|
||||||
extern int rta_addattr32(struct rtattr *rta, int maxlen, int type, __u32 data);
|
extern int rta_addattr32(struct rtattr *rta, int maxlen, int type, uint32_t data);
|
||||||
extern int rta_addattr_l(struct rtattr *rta, int maxlen, int type, void *data, int alen);
|
extern int rta_addattr_l(struct rtattr *rta, int maxlen, int type, void *data, int alen);
|
||||||
|
|
||||||
extern int parse_rtattr(struct rtattr *tb[], int max, struct rtattr *rta, int len);
|
extern int parse_rtattr(struct rtattr *tb[], int max, struct rtattr *rta, int len);
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
filler or even bulk.
|
filler or even bulk.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <asm/types.h>
|
//#include <asm/types.h>
|
||||||
|
|
||||||
#define TC_PRIO_BESTEFFORT 0
|
#define TC_PRIO_BESTEFFORT 0
|
||||||
#define TC_PRIO_FILLER 1
|
#define TC_PRIO_FILLER 1
|
||||||
@ -32,15 +32,15 @@
|
|||||||
|
|
||||||
struct tc_stats
|
struct tc_stats
|
||||||
{
|
{
|
||||||
__u64 bytes; /* NUmber of enqueues bytes */
|
uint64_t bytes; /* Nnmber of enqueued bytes */
|
||||||
__u32 packets; /* Number of enqueued packets */
|
uint32_t packets; /* Number of enqueued packets */
|
||||||
__u32 drops; /* Packets dropped because of lack of resources */
|
uint32_t drops; /* Packets dropped because of lack of resources */
|
||||||
__u32 overlimits; /* Number of throttle events when this
|
uint32_t overlimits; /* Number of throttle events when this
|
||||||
* flow goes out of allocated bandwidth */
|
* flow goes out of allocated bandwidth */
|
||||||
__u32 bps; /* Current flow byte rate */
|
uint32_t bps; /* Current flow byte rate */
|
||||||
__u32 pps; /* Current flow packet rate */
|
uint32_t pps; /* Current flow packet rate */
|
||||||
__u32 qlen;
|
uint32_t qlen;
|
||||||
__u32 backlog;
|
uint32_t backlog;
|
||||||
#ifdef __KERNEL__
|
#ifdef __KERNEL__
|
||||||
spinlock_t *lock;
|
spinlock_t *lock;
|
||||||
#endif
|
#endif
|
||||||
@ -86,14 +86,14 @@ struct tc_ratespec
|
|||||||
unsigned short feature;
|
unsigned short feature;
|
||||||
short addend;
|
short addend;
|
||||||
unsigned short mpu;
|
unsigned short mpu;
|
||||||
__u32 rate;
|
uint32_t rate;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* FIFO section */
|
/* FIFO section */
|
||||||
|
|
||||||
struct tc_fifo_qopt
|
struct tc_fifo_qopt
|
||||||
{
|
{
|
||||||
__u32 limit; /* Queue length: bytes for bfifo, packets for pfifo */
|
uint32_t limit; /* Queue length: bytes for bfifo, packets for pfifo */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* PRIO section */
|
/* PRIO section */
|
||||||
@ -103,7 +103,7 @@ struct tc_fifo_qopt
|
|||||||
struct tc_prio_qopt
|
struct tc_prio_qopt
|
||||||
{
|
{
|
||||||
int bands; /* Number of bands */
|
int bands; /* Number of bands */
|
||||||
__u8 priomap[TC_PRIO_MAX+1]; /* Map: logical priority -> PRIO band */
|
uint8_t priomap[TC_PRIO_MAX+1]; /* Map: logical priority -> PRIO band */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* CSZ section */
|
/* CSZ section */
|
||||||
@ -113,7 +113,7 @@ struct tc_csz_qopt
|
|||||||
int flows; /* Maximal number of guaranteed flows */
|
int flows; /* Maximal number of guaranteed flows */
|
||||||
unsigned char R_log; /* Fixed point position for round number */
|
unsigned char R_log; /* Fixed point position for round number */
|
||||||
unsigned char delta_log; /* Log of maximal managed time interval */
|
unsigned char delta_log; /* Log of maximal managed time interval */
|
||||||
__u8 priomap[TC_PRIO_MAX+1]; /* Map: logical priority -> CSZ band */
|
uint8_t priomap[TC_PRIO_MAX+1]; /* Map: logical priority -> CSZ band */
|
||||||
};
|
};
|
||||||
|
|
||||||
struct tc_csz_copt
|
struct tc_csz_copt
|
||||||
@ -121,9 +121,9 @@ struct tc_csz_copt
|
|||||||
struct tc_ratespec slice;
|
struct tc_ratespec slice;
|
||||||
struct tc_ratespec rate;
|
struct tc_ratespec rate;
|
||||||
struct tc_ratespec peakrate;
|
struct tc_ratespec peakrate;
|
||||||
__u32 limit;
|
uint32_t limit;
|
||||||
__u32 buffer;
|
uint32_t buffer;
|
||||||
__u32 mtu;
|
uint32_t mtu;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum
|
enum
|
||||||
@ -140,9 +140,9 @@ struct tc_tbf_qopt
|
|||||||
{
|
{
|
||||||
struct tc_ratespec rate;
|
struct tc_ratespec rate;
|
||||||
struct tc_ratespec peakrate;
|
struct tc_ratespec peakrate;
|
||||||
__u32 limit;
|
uint32_t limit;
|
||||||
__u32 buffer;
|
uint32_t buffer;
|
||||||
__u32 mtu;
|
uint32_t mtu;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum
|
enum
|
||||||
@ -164,7 +164,7 @@ struct tc_sfq_qopt
|
|||||||
{
|
{
|
||||||
unsigned quantum; /* Bytes per round allocated to flow */
|
unsigned quantum; /* Bytes per round allocated to flow */
|
||||||
int perturb_period; /* Period of hash perturbation */
|
int perturb_period; /* Period of hash perturbation */
|
||||||
__u32 limit; /* Maximal packets in queue */
|
uint32_t limit; /* Maximal packets in queue */
|
||||||
unsigned divisor; /* Hash divisor */
|
unsigned divisor; /* Hash divisor */
|
||||||
unsigned flows; /* Maximal number of flows */
|
unsigned flows; /* Maximal number of flows */
|
||||||
};
|
};
|
||||||
@ -189,9 +189,9 @@ enum
|
|||||||
|
|
||||||
struct tc_red_qopt
|
struct tc_red_qopt
|
||||||
{
|
{
|
||||||
__u32 limit; /* HARD maximal queue length (bytes) */
|
uint32_t limit; /* HARD maximal queue length (bytes) */
|
||||||
__u32 qth_min; /* Min average length threshold (bytes) */
|
uint32_t qth_min; /* Min average length threshold (bytes) */
|
||||||
__u32 qth_max; /* Max average length threshold (bytes) */
|
uint32_t qth_max; /* Max average length threshold (bytes) */
|
||||||
unsigned char Wlog; /* log(W) */
|
unsigned char Wlog; /* log(W) */
|
||||||
unsigned char Plog; /* log(P_max/(qth_max-qth_min)) */
|
unsigned char Plog; /* log(P_max/(qth_max-qth_min)) */
|
||||||
unsigned char Scell_log; /* cell size for idle damping */
|
unsigned char Scell_log; /* cell size for idle damping */
|
||||||
@ -201,10 +201,10 @@ struct tc_red_qopt
|
|||||||
|
|
||||||
struct tc_red_xstats
|
struct tc_red_xstats
|
||||||
{
|
{
|
||||||
__u32 early; /* Early drops */
|
uint32_t early; /* Early drops */
|
||||||
__u32 pdrop; /* Drops due to queue limits */
|
uint32_t pdrop; /* Drops due to queue limits */
|
||||||
__u32 other; /* Drops due to drop() calls */
|
uint32_t other; /* Drops due to drop() calls */
|
||||||
__u32 marked; /* Marked packets */
|
uint32_t marked; /* Marked packets */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* GRED section */
|
/* GRED section */
|
||||||
@ -222,33 +222,30 @@ enum
|
|||||||
#define TCA_SET_OFF TCA_GRED_PARMS
|
#define TCA_SET_OFF TCA_GRED_PARMS
|
||||||
struct tc_gred_qopt
|
struct tc_gred_qopt
|
||||||
{
|
{
|
||||||
__u32 limit; /* HARD maximal queue length (bytes)
|
uint32_t limit; /* HARD maximal queue length (bytes) */
|
||||||
*/
|
uint32_t qth_min; /* Min average length threshold (bytes) */
|
||||||
__u32 qth_min; /* Min average length threshold (bytes)
|
uint32_t qth_max; /* Max average length threshold (bytes) */
|
||||||
*/
|
uint32_t DP; /* upto 2^32 DPs */
|
||||||
__u32 qth_max; /* Max average length threshold (bytes)
|
uint32_t backlog;
|
||||||
*/
|
uint32_t qave;
|
||||||
__u32 DP; /* upto 2^32 DPs */
|
uint32_t forced;
|
||||||
__u32 backlog;
|
uint32_t early;
|
||||||
__u32 qave;
|
uint32_t other;
|
||||||
__u32 forced;
|
uint32_t pdrop;
|
||||||
__u32 early;
|
|
||||||
__u32 other;
|
|
||||||
__u32 pdrop;
|
|
||||||
|
|
||||||
unsigned char Wlog; /* log(W) */
|
unsigned char Wlog; /* log(W) */
|
||||||
unsigned char Plog; /* log(P_max/(qth_max-qth_min)) */
|
unsigned char Plog; /* log(P_max/(qth_max-qth_min)) */
|
||||||
unsigned char Scell_log; /* cell size for idle damping */
|
unsigned char Scell_log; /* cell size for idle damping */
|
||||||
__u8 prio; /* prio of this VQ */
|
uint8_t prio; /* prio of this VQ */
|
||||||
__u32 packets;
|
uint32_t packets;
|
||||||
__u32 bytesin;
|
uint32_t bytesin;
|
||||||
};
|
};
|
||||||
/* gred setup */
|
/* gred setup */
|
||||||
struct tc_gred_sopt
|
struct tc_gred_sopt
|
||||||
{
|
{
|
||||||
__u32 DPs;
|
uint32_t DPs;
|
||||||
__u32 def_DP;
|
uint32_t def_DP;
|
||||||
__u8 grio;
|
uint8_t grio;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* HTB section */
|
/* HTB section */
|
||||||
@ -257,30 +254,30 @@ struct tc_gred_sopt
|
|||||||
|
|
||||||
struct tc_htb_opt
|
struct tc_htb_opt
|
||||||
{
|
{
|
||||||
struct tc_ratespec rate;
|
struct tc_ratespec rate;
|
||||||
struct tc_ratespec ceil;
|
struct tc_ratespec ceil;
|
||||||
__u32 buffer;
|
uint32_t buffer;
|
||||||
__u32 cbuffer;
|
uint32_t cbuffer;
|
||||||
__u32 quantum; /* out only */
|
uint32_t quantum; /* out only */
|
||||||
__u32 level; /* out only */
|
uint32_t level; /* out only */
|
||||||
__u8 prio;
|
uint8_t prio;
|
||||||
__u8 injectd; /* inject class distance */
|
uint8_t injectd; /* inject class distance */
|
||||||
__u8 pad[2];
|
uint8_t pad[2];
|
||||||
};
|
};
|
||||||
struct tc_htb_glob
|
struct tc_htb_glob
|
||||||
{
|
{
|
||||||
__u32 rate2quantum; /* bps->quantum divisor */
|
uint32_t rate2quantum; /* bps->quantum divisor */
|
||||||
__u32 defcls; /* default class number */
|
uint32_t defcls; /* default class number */
|
||||||
__u32 use_dcache; /* use dequeue cache ? */
|
uint32_t use_dcache; /* use dequeue cache ? */
|
||||||
__u32 debug; /* debug flags */
|
uint32_t debug; /* debug flags */
|
||||||
|
|
||||||
|
|
||||||
/* stats */
|
/* stats */
|
||||||
__u32 deq_rate; /* dequeue rate */
|
uint32_t deq_rate; /* dequeue rate */
|
||||||
__u32 utilz; /* dequeue utilization */
|
uint32_t utilz; /* dequeue utilization */
|
||||||
__u32 trials; /* deq_prio trials per dequeue */
|
uint32_t trials; /* deq_prio trials per dequeue */
|
||||||
__u32 dcache_hits;
|
uint32_t dcache_hits;
|
||||||
__u32 direct_pkts; /* count of non shapped packets */
|
uint32_t direct_pkts; /* count of non shapped packets */
|
||||||
};
|
};
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
@ -292,12 +289,12 @@ enum
|
|||||||
};
|
};
|
||||||
struct tc_htb_xstats
|
struct tc_htb_xstats
|
||||||
{
|
{
|
||||||
__u32 lends;
|
uint32_t lends;
|
||||||
__u32 borrows;
|
uint32_t borrows;
|
||||||
__u32 giants; /* too big packets (rate will not be accurate) */
|
uint32_t giants; /* too big packets (rate will not be accurate) */
|
||||||
__u32 injects; /* how many times leaf used injected bw */
|
uint32_t injects; /* how many times leaf used injected bw */
|
||||||
__u32 tokens;
|
uint32_t tokens;
|
||||||
__u32 ctokens;
|
uint32_t ctokens;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* CBQ section */
|
/* CBQ section */
|
||||||
@ -320,10 +317,10 @@ struct tc_cbq_lssopt
|
|||||||
#define TCF_CBQ_LSS_MINIDLE 8
|
#define TCF_CBQ_LSS_MINIDLE 8
|
||||||
#define TCF_CBQ_LSS_OFFTIME 0x10
|
#define TCF_CBQ_LSS_OFFTIME 0x10
|
||||||
#define TCF_CBQ_LSS_AVPKT 0x20
|
#define TCF_CBQ_LSS_AVPKT 0x20
|
||||||
__u32 maxidle;
|
uint32_t maxidle;
|
||||||
__u32 minidle;
|
uint32_t minidle;
|
||||||
__u32 offtime;
|
uint32_t offtime;
|
||||||
__u32 avpkt;
|
uint32_t avpkt;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct tc_cbq_wrropt
|
struct tc_cbq_wrropt
|
||||||
@ -332,8 +329,8 @@ struct tc_cbq_wrropt
|
|||||||
unsigned char priority;
|
unsigned char priority;
|
||||||
unsigned char cpriority;
|
unsigned char cpriority;
|
||||||
unsigned char __reserved;
|
unsigned char __reserved;
|
||||||
__u32 allot;
|
uint32_t allot;
|
||||||
__u32 weight;
|
uint32_t weight;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct tc_cbq_ovl
|
struct tc_cbq_ovl
|
||||||
@ -345,7 +342,7 @@ struct tc_cbq_ovl
|
|||||||
#define TC_CBQ_OVL_DROP 3
|
#define TC_CBQ_OVL_DROP 3
|
||||||
#define TC_CBQ_OVL_RCLASSIC 4
|
#define TC_CBQ_OVL_RCLASSIC 4
|
||||||
unsigned char priority2;
|
unsigned char priority2;
|
||||||
__u32 penalty;
|
uint32_t penalty;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct tc_cbq_police
|
struct tc_cbq_police
|
||||||
@ -357,17 +354,17 @@ struct tc_cbq_police
|
|||||||
|
|
||||||
struct tc_cbq_fopt
|
struct tc_cbq_fopt
|
||||||
{
|
{
|
||||||
__u32 split;
|
uint32_t split;
|
||||||
__u32 defmap;
|
uint32_t defmap;
|
||||||
__u32 defchange;
|
uint32_t defchange;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct tc_cbq_xstats
|
struct tc_cbq_xstats
|
||||||
{
|
{
|
||||||
__u32 borrows;
|
uint32_t borrows;
|
||||||
__u32 overactions;
|
uint32_t overactions;
|
||||||
__s32 avgidle;
|
int32_t avgidle;
|
||||||
__s32 undertime;
|
int32_t undertime;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum
|
enum
|
||||||
|
@ -88,9 +88,9 @@ int rtnl_rtntype_a2n(int *id, char *arg)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int get_rt_realms(__u32 *realms, char *arg)
|
int get_rt_realms(uint32_t *realms, char *arg)
|
||||||
{
|
{
|
||||||
__u32 realm = 0;
|
uint32_t realm = 0;
|
||||||
char *p = strchr(arg, '/');
|
char *p = strchr(arg, '/');
|
||||||
|
|
||||||
*realms = 0;
|
*realms = 0;
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
char *rtnl_rtntype_n2a(int id, char *buf, int len);
|
char *rtnl_rtntype_n2a(int id, char *buf, int len);
|
||||||
int rtnl_rtntype_a2n(int *id, char *arg);
|
int rtnl_rtntype_a2n(int *id, char *arg);
|
||||||
|
|
||||||
int get_rt_realms(__u32 *realms, char *arg);
|
int get_rt_realms(uint32_t *realms, char *arg);
|
||||||
|
|
||||||
|
|
||||||
#endif /* __RTM_MAP_H__ */
|
#endif /* __RTM_MAP_H__ */
|
||||||
|
@ -47,7 +47,7 @@ int get_unsigned(unsigned *val, char *arg, int base)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int get_u32(__u32 * val, char *arg, int base)
|
int get_u32(uint32_t * val, char *arg, int base)
|
||||||
{
|
{
|
||||||
unsigned long res;
|
unsigned long res;
|
||||||
char *ptr;
|
char *ptr;
|
||||||
@ -61,7 +61,7 @@ int get_u32(__u32 * val, char *arg, int base)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int get_u16(__u16 * val, char *arg, int base)
|
int get_u16(uint16_t * val, char *arg, int base)
|
||||||
{
|
{
|
||||||
unsigned long res;
|
unsigned long res;
|
||||||
char *ptr;
|
char *ptr;
|
||||||
@ -75,7 +75,7 @@ int get_u16(__u16 * val, char *arg, int base)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int get_u8(__u8 * val, char *arg, int base)
|
int get_u8(uint8_t * val, char *arg, int base)
|
||||||
{
|
{
|
||||||
unsigned long res;
|
unsigned long res;
|
||||||
char *ptr;
|
char *ptr;
|
||||||
@ -89,7 +89,7 @@ int get_u8(__u8 * val, char *arg, int base)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int get_s16(__s16 * val, char *arg, int base)
|
int get_s16(int16_t * val, char *arg, int base)
|
||||||
{
|
{
|
||||||
long res;
|
long res;
|
||||||
char *ptr;
|
char *ptr;
|
||||||
@ -103,7 +103,7 @@ int get_s16(__s16 * val, char *arg, int base)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int get_s8(__s8 * val, char *arg, int base)
|
int get_s8(int8_t * val, char *arg, int base)
|
||||||
{
|
{
|
||||||
long res;
|
long res;
|
||||||
char *ptr;
|
char *ptr;
|
||||||
@ -225,7 +225,7 @@ int get_prefix(inet_prefix * dst, char *arg, int family)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
__u32 get_addr32(char *name)
|
uint32_t get_addr32(char *name)
|
||||||
{
|
{
|
||||||
inet_prefix addr;
|
inet_prefix addr;
|
||||||
|
|
||||||
@ -268,8 +268,8 @@ int matches(char *cmd, char *pattern)
|
|||||||
|
|
||||||
int inet_addr_match(inet_prefix * a, inet_prefix * b, int bits)
|
int inet_addr_match(inet_prefix * a, inet_prefix * b, int bits)
|
||||||
{
|
{
|
||||||
__u32 *a1 = a->data;
|
uint32_t *a1 = a->data;
|
||||||
__u32 *a2 = b->data;
|
uint32_t *a2 = b->data;
|
||||||
int words = bits >> 0x05;
|
int words = bits >> 0x05;
|
||||||
|
|
||||||
bits &= 0x1f;
|
bits &= 0x1f;
|
||||||
@ -279,8 +279,8 @@ int inet_addr_match(inet_prefix * a, inet_prefix * b, int bits)
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (bits) {
|
if (bits) {
|
||||||
__u32 w1, w2;
|
uint32_t w1, w2;
|
||||||
__u32 mask;
|
uint32_t mask;
|
||||||
|
|
||||||
w1 = a1[words];
|
w1 = a1[words];
|
||||||
w2 = a2[words];
|
w2 = a2[words];
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
#define __UTILS_H__ 1
|
#define __UTILS_H__ 1
|
||||||
|
|
||||||
#include "libbb.h"
|
#include "libbb.h"
|
||||||
#include <asm/types.h>
|
//#include <asm/types.h>
|
||||||
#include <resolv.h>
|
//#include <resolv.h>
|
||||||
|
|
||||||
#include "libnetlink.h"
|
#include "libnetlink.h"
|
||||||
#include "ll_map.h"
|
#include "ll_map.h"
|
||||||
@ -34,10 +34,10 @@ extern void incomplete_command(void) ATTRIBUTE_NORETURN;
|
|||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
__u8 family;
|
uint8_t family;
|
||||||
__u8 bytelen;
|
uint8_t bytelen;
|
||||||
__s16 bitlen;
|
int16_t bitlen;
|
||||||
__u32 data[4];
|
uint32_t data[4];
|
||||||
} inet_prefix;
|
} inet_prefix;
|
||||||
|
|
||||||
#define DN_MAXADDL 20
|
#define DN_MAXADDL 20
|
||||||
@ -58,7 +58,7 @@ struct ipx_addr {
|
|||||||
uint8_t ipx_node[IPX_NODE_LEN];
|
uint8_t ipx_node[IPX_NODE_LEN];
|
||||||
};
|
};
|
||||||
|
|
||||||
extern __u32 get_addr32(char *name);
|
extern uint32_t get_addr32(char *name);
|
||||||
extern int get_addr_1(inet_prefix *dst, char *arg, int family);
|
extern int get_addr_1(inet_prefix *dst, char *arg, int family);
|
||||||
extern int get_prefix_1(inet_prefix *dst, char *arg, int family);
|
extern int get_prefix_1(inet_prefix *dst, char *arg, int family);
|
||||||
extern int get_addr(inet_prefix *dst, char *arg, int family);
|
extern int get_addr(inet_prefix *dst, char *arg, int family);
|
||||||
@ -69,11 +69,11 @@ extern int get_unsigned(unsigned *val, char *arg, int base);
|
|||||||
#define get_byte get_u8
|
#define get_byte get_u8
|
||||||
#define get_ushort get_u16
|
#define get_ushort get_u16
|
||||||
#define get_short get_s16
|
#define get_short get_s16
|
||||||
extern int get_u32(__u32 *val, char *arg, int base);
|
extern int get_u32(uint32_t *val, char *arg, int base);
|
||||||
extern int get_u16(__u16 *val, char *arg, int base);
|
extern int get_u16(uint16_t *val, char *arg, int base);
|
||||||
extern int get_s16(__s16 *val, char *arg, int base);
|
extern int get_s16(int16_t *val, char *arg, int base);
|
||||||
extern int get_u8(__u8 *val, char *arg, int base);
|
extern int get_u8(uint8_t *val, char *arg, int base);
|
||||||
extern int get_s8(__s8 *val, char *arg, int base);
|
extern int get_s8(int8_t *val, char *arg, int base);
|
||||||
|
|
||||||
extern const char *format_host(int af, int len, void *addr, char *buf, int buflen);
|
extern const char *format_host(int af, int len, void *addr, char *buf, int buflen);
|
||||||
extern const char *rt_addr_n2a(int af, int len, void *addr, char *buf, int buflen);
|
extern const char *rt_addr_n2a(int af, int len, void *addr, char *buf, int buflen);
|
||||||
@ -93,7 +93,7 @@ int ipx_pton(int af, const char *src, void *addr);
|
|||||||
extern int __iproute2_hz_internal;
|
extern int __iproute2_hz_internal;
|
||||||
extern int __get_hz(void);
|
extern int __get_hz(void);
|
||||||
|
|
||||||
static __inline__ int get_hz(void)
|
static inline int get_hz(void)
|
||||||
{
|
{
|
||||||
if (__iproute2_hz_internal == 0)
|
if (__iproute2_hz_internal == 0)
|
||||||
__iproute2_hz_internal = __get_hz();
|
__iproute2_hz_internal = __get_hz();
|
||||||
|
@ -462,17 +462,13 @@ static const char flagchars[] = /* Must agree with flagvals[]. */
|
|||||||
#endif
|
#endif
|
||||||
;
|
;
|
||||||
|
|
||||||
static
|
static void set_flags(char *flagstr, int flags)
|
||||||
#ifndef CONFIG_FEATURE_IPV6
|
|
||||||
__inline
|
|
||||||
#endif
|
|
||||||
void set_flags(char *flagstr, int flags)
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
*flagstr++ = 'U';
|
*flagstr++ = 'U';
|
||||||
|
|
||||||
for (i=0 ; (*flagstr = flagchars[i]) != 0 ; i++) {
|
for (i = 0; (*flagstr = flagchars[i]) != 0; i++) {
|
||||||
if (flags & flagvals[i]) {
|
if (flags & flagvals[i]) {
|
||||||
++flagstr;
|
++flagstr;
|
||||||
}
|
}
|
||||||
@ -480,7 +476,6 @@ void set_flags(char *flagstr, int flags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* also used in netstat */
|
/* also used in netstat */
|
||||||
void displayroutes(int noresolve, int netstatfmt);
|
|
||||||
void displayroutes(int noresolve, int netstatfmt)
|
void displayroutes(int noresolve, int netstatfmt)
|
||||||
{
|
{
|
||||||
char devname[64], flags[16], sdest[16], sgw[16];
|
char devname[64], flags[16], sdest[16], sgw[16];
|
||||||
@ -492,9 +487,8 @@ void displayroutes(int noresolve, int netstatfmt)
|
|||||||
FILE *fp = xfopen("/proc/net/route", "r");
|
FILE *fp = xfopen("/proc/net/route", "r");
|
||||||
|
|
||||||
printf("Kernel IP routing table\n"
|
printf("Kernel IP routing table\n"
|
||||||
"Destination Gateway Genmask"
|
"Destination Gateway Genmask Flags %s Iface\n",
|
||||||
" Flags %s Iface\n",
|
netstatfmt ? " MSS Window irtt" : "Metric Ref Use");
|
||||||
netstatfmt ? " MSS Window irtt" : "Metric Ref Use");
|
|
||||||
|
|
||||||
if (fscanf(fp, "%*[^\n]\n") < 0) { /* Skip the first line. */
|
if (fscanf(fp, "%*[^\n]\n") < 0) { /* Skip the first line. */
|
||||||
goto ERROR; /* Empty or missing line, or read error. */
|
goto ERROR; /* Empty or missing line, or read error. */
|
||||||
@ -508,7 +502,7 @@ void displayroutes(int noresolve, int netstatfmt)
|
|||||||
if ((r < 0) && feof(fp)) { /* EOF with no (nonspace) chars read. */
|
if ((r < 0) && feof(fp)) { /* EOF with no (nonspace) chars read. */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ERROR:
|
ERROR:
|
||||||
bb_error_msg_and_die("fscanf");
|
bb_error_msg_and_die("fscanf");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -574,7 +568,7 @@ static void INET6_displayroutes(int noresolve)
|
|||||||
if ((r < 0) && feof(fp)) { /* EOF with no (nonspace) chars read. */
|
if ((r < 0) && feof(fp)) { /* EOF with no (nonspace) chars read. */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ERROR:
|
ERROR:
|
||||||
bb_error_msg_and_die("fscanf");
|
bb_error_msg_and_die("fscanf");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user