mirror of
https://git.proxmox.com/git/mirror_iproute2
synced 2026-01-02 04:55:47 +00:00
Remove trailing whitespace
Go through source files and remove all trailing whitespace Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
This commit is contained in:
parent
0bf0fbc47e
commit
ae665a522b
@ -65,7 +65,7 @@ struct ip6tables_match
|
||||
struct ip6tables_target
|
||||
{
|
||||
struct ip6tables_target *next;
|
||||
|
||||
|
||||
ip6t_chainlabel name;
|
||||
|
||||
const char *version;
|
||||
@ -87,7 +87,7 @@ struct ip6tables_target
|
||||
int (*parse)(int c, char **argv, int invert, unsigned int *flags,
|
||||
const struct ip6t_entry *entry,
|
||||
struct ip6t_entry_target **target);
|
||||
|
||||
|
||||
/* Final check; exit if not ok. */
|
||||
void (*final_check)(unsigned int flags);
|
||||
|
||||
|
||||
@ -170,7 +170,7 @@ extern struct iptables_match *find_match(const char *name, enum ipt_tryload, str
|
||||
|
||||
extern int delete_chain(const ipt_chainlabel chain, int verbose,
|
||||
iptc_handle_t *handle);
|
||||
extern int flush_entries(const ipt_chainlabel chain, int verbose,
|
||||
extern int flush_entries(const ipt_chainlabel chain, int verbose,
|
||||
iptc_handle_t *handle);
|
||||
extern int for_each_chain(int (*fn)(const ipt_chainlabel, int, iptc_handle_t *),
|
||||
int verbose, int builtinstoo, iptc_handle_t *handle);
|
||||
|
||||
@ -10,16 +10,16 @@ enum exittype {
|
||||
extern void exit_printhelp(void) __attribute__((noreturn));
|
||||
extern void exit_tryhelp(int) __attribute__((noreturn));
|
||||
int check_inverse(const char option[], int *invert, int *optind, int argc);
|
||||
extern int string_to_number(const char *,
|
||||
unsigned int,
|
||||
extern int string_to_number(const char *,
|
||||
unsigned int,
|
||||
unsigned int,
|
||||
unsigned int *);
|
||||
extern int string_to_number_l(const char *,
|
||||
unsigned long int,
|
||||
extern int string_to_number_l(const char *,
|
||||
unsigned long int,
|
||||
unsigned long int,
|
||||
unsigned long *);
|
||||
extern int string_to_number_ll(const char *,
|
||||
unsigned long long int,
|
||||
extern int string_to_number_ll(const char *,
|
||||
unsigned long long int,
|
||||
unsigned long long int,
|
||||
unsigned long long *);
|
||||
extern int iptables_insmod(const char *modname, const char *modprobe);
|
||||
|
||||
@ -23,7 +23,7 @@ extern void rtnl_close(struct rtnl_handle *rth);
|
||||
extern int rtnl_wilddump_request(struct rtnl_handle *rth, int fam, int type);
|
||||
extern int rtnl_dump_request(struct rtnl_handle *rth, int type, void *req, int len);
|
||||
|
||||
typedef int (*rtnl_filter_t)(const struct sockaddr_nl *,
|
||||
typedef int (*rtnl_filter_t)(const struct sockaddr_nl *,
|
||||
struct nlmsghdr *n, void *);
|
||||
extern int rtnl_dump_filter(struct rtnl_handle *rth, rtnl_filter_t filter,
|
||||
void *arg1,
|
||||
@ -48,7 +48,7 @@ extern int parse_rtattr_byindex(struct rtattr *tb[], int max, struct rtattr *rta
|
||||
#define parse_rtattr_nested(tb, max, rta) \
|
||||
(parse_rtattr((tb), (max), RTA_DATA(rta), RTA_PAYLOAD(rta)))
|
||||
|
||||
extern int rtnl_listen(struct rtnl_handle *, rtnl_filter_t handler,
|
||||
extern int rtnl_listen(struct rtnl_handle *, rtnl_filter_t handler,
|
||||
void *jarg);
|
||||
extern int rtnl_from_file(FILE *, rtnl_filter_t handler,
|
||||
void *jarg);
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#ifndef __LL_MAP_H__
|
||||
#define __LL_MAP_H__ 1
|
||||
|
||||
extern int ll_remember_index(const struct sockaddr_nl *who,
|
||||
extern int ll_remember_index(const struct sockaddr_nl *who,
|
||||
struct nlmsghdr *n, void *arg);
|
||||
extern int ll_init_map(struct rtnl_handle *rth);
|
||||
extern unsigned ll_name_to_index(const char *name);
|
||||
|
||||
@ -55,7 +55,7 @@ typedef struct
|
||||
#define AF_DECnet 12
|
||||
#endif
|
||||
|
||||
struct dn_naddr
|
||||
struct dn_naddr
|
||||
{
|
||||
unsigned short a_len;
|
||||
unsigned char a_addr[DN_MAXADDL];
|
||||
@ -89,9 +89,9 @@ extern int get_s8(__s8 *val, const char *arg, int base);
|
||||
extern char* hexstring_n2a(const __u8 *str, int len, char *buf, int blen);
|
||||
extern __u8* hexstring_a2n(const char *str, __u8 *buf, int blen);
|
||||
|
||||
extern const char *format_host(int af, int len, const void *addr,
|
||||
extern const char *format_host(int af, int len, const void *addr,
|
||||
char *buf, int buflen);
|
||||
extern const char *rt_addr_n2a(int af, int len, const void *addr,
|
||||
extern const char *rt_addr_n2a(int af, int len, const void *addr,
|
||||
char *buf, int buflen);
|
||||
|
||||
void missarg(const char *) __attribute__((noreturn));
|
||||
|
||||
2
ip/ifcfg
2
ip/ifcfg
@ -129,7 +129,7 @@ noarp=$?
|
||||
( sleep 2 ;
|
||||
arping -q -U -c 1 -I $dev $ipaddr ) >& /dev/null </dev/null &
|
||||
|
||||
ip route add unreachable 224.0.0.0/24 >& /dev/null
|
||||
ip route add unreachable 224.0.0.0/24 >& /dev/null
|
||||
ip route add unreachable 255.255.255.255 >& /dev/null
|
||||
if [ `ip link ls $dev | grep -c MULTICAST` -ge 1 ]; then
|
||||
ip route add 224.0.0.0/4 dev $dev scope global >& /dev/null
|
||||
|
||||
10
ip/ip.c
10
ip/ip.c
@ -145,7 +145,7 @@ int main(int argc, char **argv)
|
||||
basename = argv[0];
|
||||
else
|
||||
basename++;
|
||||
|
||||
|
||||
while (argc > 1) {
|
||||
char *opt = argv[1];
|
||||
if (strcmp(opt,"--") == 0) {
|
||||
@ -220,16 +220,16 @@ int main(int argc, char **argv)
|
||||
|
||||
_SL_ = oneline ? "\\" : "\n" ;
|
||||
|
||||
if (batch_file)
|
||||
if (batch_file)
|
||||
return batch(batch_file);
|
||||
|
||||
|
||||
if (rtnl_open(&rth, 0) < 0)
|
||||
exit(1);
|
||||
|
||||
if (strlen(basename) > 2)
|
||||
if (strlen(basename) > 2)
|
||||
return do_cmd(basename+2, argc, argv);
|
||||
|
||||
if (argc > 1)
|
||||
if (argc > 1)
|
||||
return do_cmd(argv[1], argc-1, argv+1);
|
||||
|
||||
rtnl_close(&rth);
|
||||
|
||||
@ -1,16 +1,16 @@
|
||||
/*
|
||||
* Copyright (C)2006 USAGI/WIDE Project
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
@ -24,7 +24,7 @@
|
||||
* Author:
|
||||
* Masahide NAKAMURA @USAGI
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
@ -72,7 +72,7 @@ static void print_tunnel(struct ip6_tnl_parm *p)
|
||||
{
|
||||
char remote[64];
|
||||
char local[64];
|
||||
|
||||
|
||||
inet_ntop(AF_INET6, &p->raddr, remote, sizeof(remote));
|
||||
inet_ntop(AF_INET6, &p->laddr, local, sizeof(local));
|
||||
|
||||
@ -353,8 +353,8 @@ static int do_del(int argc, char **argv)
|
||||
return tnl_del_ioctl(p.name[0] ? p.name : "ip6tnl0", p.name, &p);
|
||||
}
|
||||
|
||||
int do_ip6tunnel(int argc, char **argv)
|
||||
{
|
||||
int do_ip6tunnel(int argc, char **argv)
|
||||
{
|
||||
switch (preferred_family) {
|
||||
case AF_UNSPEC:
|
||||
preferred_family = AF_INET6;
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
extern int print_linkinfo(const struct sockaddr_nl *who,
|
||||
struct nlmsghdr *n,
|
||||
extern int print_linkinfo(const struct sockaddr_nl *who,
|
||||
struct nlmsghdr *n,
|
||||
void *arg);
|
||||
extern int print_addrinfo(const struct sockaddr_nl *who,
|
||||
struct nlmsghdr *n,
|
||||
struct nlmsghdr *n,
|
||||
void *arg);
|
||||
extern int print_neigh(const struct sockaddr_nl *who,
|
||||
struct nlmsghdr *n, void *arg);
|
||||
@ -16,7 +16,7 @@ extern void iproute_reset_filter(void);
|
||||
extern void ipaddr_reset_filter(int);
|
||||
extern void ipneigh_reset_filter(void);
|
||||
extern void ipntable_reset_filter(void);
|
||||
extern int print_route(const struct sockaddr_nl *who,
|
||||
extern int print_route(const struct sockaddr_nl *who,
|
||||
struct nlmsghdr *n, void *arg);
|
||||
extern int print_prefix(const struct sockaddr_nl *who,
|
||||
struct nlmsghdr *n, void *arg);
|
||||
|
||||
@ -120,7 +120,7 @@ void print_queuelen(char *name)
|
||||
|
||||
memset(&ifr, 0, sizeof(ifr));
|
||||
strcpy(ifr.ifr_name, name);
|
||||
if (ioctl(s, SIOCGIFTXQLEN, &ifr) < 0) {
|
||||
if (ioctl(s, SIOCGIFTXQLEN, &ifr) < 0) {
|
||||
perror("SIOCGIFXQLEN");
|
||||
close(s);
|
||||
return;
|
||||
@ -131,7 +131,7 @@ void print_queuelen(char *name)
|
||||
printf("qlen %d", ifr.ifr_qlen);
|
||||
}
|
||||
|
||||
int print_linkinfo(const struct sockaddr_nl *who,
|
||||
int print_linkinfo(const struct sockaddr_nl *who,
|
||||
struct nlmsghdr *n, void *arg)
|
||||
{
|
||||
FILE *fp = (FILE*)arg;
|
||||
@ -195,7 +195,7 @@ int print_linkinfo(const struct sockaddr_nl *who,
|
||||
#endif
|
||||
if (filter.showqueue)
|
||||
print_queuelen((char*)RTA_DATA(tb[IFLA_IFNAME]));
|
||||
|
||||
|
||||
if (!filter.family || filter.family == AF_PACKET) {
|
||||
SPRINT_BUF(b1);
|
||||
fprintf(fp, "%s", _SL_);
|
||||
@ -290,7 +290,7 @@ static int set_lifetime(unsigned int *lifetime, char *argv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int print_addrinfo(const struct sockaddr_nl *who, struct nlmsghdr *n,
|
||||
int print_addrinfo(const struct sockaddr_nl *who, struct nlmsghdr *n,
|
||||
void *arg)
|
||||
{
|
||||
FILE *fp = (FILE*)arg;
|
||||
@ -474,7 +474,7 @@ int print_selected_addrinfo(int ifindex, struct nlmsg_list *ainfo, FILE *fp)
|
||||
if (n->nlmsg_len < NLMSG_LENGTH(sizeof(ifa)))
|
||||
return -1;
|
||||
|
||||
if (ifa->ifa_index != ifindex ||
|
||||
if (ifa->ifa_index != ifindex ||
|
||||
(filter.family && filter.family != ifa->ifa_family))
|
||||
continue;
|
||||
|
||||
@ -484,7 +484,7 @@ int print_selected_addrinfo(int ifindex, struct nlmsg_list *ainfo, FILE *fp)
|
||||
}
|
||||
|
||||
|
||||
static int store_nlmsg(const struct sockaddr_nl *who, struct nlmsghdr *n,
|
||||
static int store_nlmsg(const struct sockaddr_nl *who, struct nlmsghdr *n,
|
||||
void *arg)
|
||||
{
|
||||
struct nlmsg_list **linfo = (struct nlmsg_list**)arg;
|
||||
@ -667,7 +667,7 @@ int ipaddr_list_or_flush(int argc, char **argv, int flush)
|
||||
struct nlmsghdr *n = &a->h;
|
||||
struct ifaddrmsg *ifa = NLMSG_DATA(n);
|
||||
|
||||
if (ifa->ifa_index != ifi->ifi_index ||
|
||||
if (ifa->ifa_index != ifi->ifi_index ||
|
||||
(filter.family && filter.family != ifa->ifa_family))
|
||||
continue;
|
||||
if ((filter.scope^ifa->ifa_scope)&filter.scopemask)
|
||||
|
||||
32
ip/iplink.c
32
ip/iplink.c
@ -140,8 +140,8 @@ static int set_qlen(const char *dev, int qlen)
|
||||
return -1;
|
||||
|
||||
memset(&ifr, 0, sizeof(ifr));
|
||||
strncpy(ifr.ifr_name, dev, IFNAMSIZ);
|
||||
ifr.ifr_qlen = qlen;
|
||||
strncpy(ifr.ifr_name, dev, IFNAMSIZ);
|
||||
ifr.ifr_qlen = qlen;
|
||||
if (ioctl(s, SIOCSIFTXQLEN, &ifr) < 0) {
|
||||
perror("SIOCSIFXQLEN");
|
||||
close(s);
|
||||
@ -149,7 +149,7 @@ static int set_qlen(const char *dev, int qlen)
|
||||
}
|
||||
close(s);
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int set_mtu(const char *dev, int mtu)
|
||||
@ -162,8 +162,8 @@ static int set_mtu(const char *dev, int mtu)
|
||||
return -1;
|
||||
|
||||
memset(&ifr, 0, sizeof(ifr));
|
||||
strncpy(ifr.ifr_name, dev, IFNAMSIZ);
|
||||
ifr.ifr_mtu = mtu;
|
||||
strncpy(ifr.ifr_name, dev, IFNAMSIZ);
|
||||
ifr.ifr_mtu = mtu;
|
||||
if (ioctl(s, SIOCSIFMTU, &ifr) < 0) {
|
||||
perror("SIOCSIFMTU");
|
||||
close(s);
|
||||
@ -171,7 +171,7 @@ static int set_mtu(const char *dev, int mtu)
|
||||
}
|
||||
close(s);
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int get_address(const char *dev, int *htype)
|
||||
@ -182,7 +182,7 @@ static int get_address(const char *dev, int *htype)
|
||||
int s;
|
||||
|
||||
s = socket(PF_PACKET, SOCK_DGRAM, 0);
|
||||
if (s < 0) {
|
||||
if (s < 0) {
|
||||
perror("socket(PF_PACKET)");
|
||||
return -1;
|
||||
}
|
||||
@ -216,7 +216,7 @@ static int get_address(const char *dev, int *htype)
|
||||
return me.sll_halen;
|
||||
}
|
||||
|
||||
static int parse_address(const char *dev, int hatype, int halen,
|
||||
static int parse_address(const char *dev, int hatype, int halen,
|
||||
char *lla, struct ifreq *ifr)
|
||||
{
|
||||
int alen;
|
||||
@ -231,7 +231,7 @@ static int parse_address(const char *dev, int hatype, int halen,
|
||||
fprintf(stderr, "Wrong address (%s) length: expected %d bytes\n", lla, halen);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int set_address(struct ifreq *ifr, int brd)
|
||||
@ -247,7 +247,7 @@ static int set_address(struct ifreq *ifr, int brd)
|
||||
return -1;
|
||||
}
|
||||
close(s);
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -379,7 +379,7 @@ static int do_set(int argc, char **argv)
|
||||
}
|
||||
if (newbrd) {
|
||||
if (parse_address(dev, htype, halen, newbrd, &ifr1) < 0)
|
||||
return -1;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -388,18 +388,18 @@ static int do_set(int argc, char **argv)
|
||||
return -1;
|
||||
dev = newname;
|
||||
}
|
||||
if (qlen != -1) {
|
||||
if (qlen != -1) {
|
||||
if (set_qlen(dev, qlen) < 0)
|
||||
return -1;
|
||||
return -1;
|
||||
}
|
||||
if (mtu != -1) {
|
||||
if (mtu != -1) {
|
||||
if (set_mtu(dev, mtu) < 0)
|
||||
return -1;
|
||||
return -1;
|
||||
}
|
||||
if (newaddr || newbrd) {
|
||||
if (newbrd) {
|
||||
if (set_address(&ifr1, 1) < 0)
|
||||
return -1;
|
||||
return -1;
|
||||
}
|
||||
if (newaddr) {
|
||||
if (set_address(&ifr0, 0) < 0)
|
||||
|
||||
@ -212,7 +212,7 @@ static void print_maddr(FILE *fp, struct ma_info *list)
|
||||
fprintf(fp, "family %d ", list->addr.family);
|
||||
break;
|
||||
}
|
||||
fprintf(fp, "%s",
|
||||
fprintf(fp, "%s",
|
||||
format_host(list->addr.family,
|
||||
-1,
|
||||
list->addr.data,
|
||||
@ -298,7 +298,7 @@ int multiaddr_modify(int cmd, int argc, char **argv)
|
||||
usage();
|
||||
if (ifr.ifr_hwaddr.sa_data[0])
|
||||
duparg("address", *argv);
|
||||
if (ll_addr_a2n(ifr.ifr_hwaddr.sa_data,
|
||||
if (ll_addr_a2n(ifr.ifr_hwaddr.sa_data,
|
||||
14, *argv) < 0) {
|
||||
fprintf(stderr, "Error: \"%s\" is not a legal ll address.\n", *argv);
|
||||
exit(1);
|
||||
|
||||
@ -66,7 +66,7 @@ static void read_viftable(void)
|
||||
|
||||
if (sscanf(buf, "%d%s", &vifi, dev) < 2)
|
||||
continue;
|
||||
|
||||
|
||||
if (vifi<0 || vifi>31)
|
||||
continue;
|
||||
|
||||
@ -109,7 +109,7 @@ static void read_mroute_list(FILE *ofp)
|
||||
if (filter.msrc.family && inet_addr_match(&msrc, &filter.msrc, filter.msrc.bitlen))
|
||||
continue;
|
||||
|
||||
snprintf(obuf, sizeof(obuf), "(%s, %s)",
|
||||
snprintf(obuf, sizeof(obuf), "(%s, %s)",
|
||||
format_host(AF_INET, 4, &msrc.data[0], sbuf, sizeof(sbuf)),
|
||||
format_host(AF_INET, 4, &maddr.data[0], mbuf, sizeof(mbuf)));
|
||||
|
||||
|
||||
@ -197,7 +197,7 @@ int print_neigh(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
|
||||
if (n->nlmsg_type != RTM_NEWNEIGH && n->nlmsg_type != RTM_DELNEIGH) {
|
||||
fprintf(stderr, "Not RTM_NEWNEIGH: %08x %08x %08x\n",
|
||||
n->nlmsg_len, n->nlmsg_type, n->nlmsg_flags);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
len -= NLMSG_LENGTH(sizeof(*r));
|
||||
@ -254,7 +254,7 @@ int print_neigh(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
|
||||
}
|
||||
|
||||
if (tb[NDA_DST]) {
|
||||
fprintf(fp, "%s ",
|
||||
fprintf(fp, "%s ",
|
||||
format_host(r->ndm_family,
|
||||
RTA_PAYLOAD(tb[NDA_DST]),
|
||||
RTA_DATA(tb[NDA_DST]),
|
||||
|
||||
@ -1,16 +1,16 @@
|
||||
/*
|
||||
* Copyright (C)2006 USAGI/WIDE Project
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
@ -1,16 +1,16 @@
|
||||
/*
|
||||
* Copyright (C)2005 USAGI/WIDE Project
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
@ -78,7 +78,7 @@ int print_prefix(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
|
||||
pfx = (struct in6_addr *)RTA_DATA(tb[PREFIX_ADDRESS]);
|
||||
|
||||
memset(abuf, '\0', sizeof(abuf));
|
||||
fprintf(fp, "%s", rt_addr_n2a(family, sizeof(*pfx), pfx,
|
||||
fprintf(fp, "%s", rt_addr_n2a(family, sizeof(*pfx), pfx,
|
||||
abuf, sizeof(abuf)));
|
||||
}
|
||||
fprintf(fp, "/%u ", prefix->prefix_len);
|
||||
|
||||
14
ip/iproute.c
14
ip/iproute.c
@ -281,7 +281,7 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
|
||||
if ((oif^filter.oif)&filter.oifmask)
|
||||
return 0;
|
||||
}
|
||||
if (filter.flushb &&
|
||||
if (filter.flushb &&
|
||||
r->rtm_family == AF_INET6 &&
|
||||
r->rtm_dst_len == 0 &&
|
||||
r->rtm_type == RTN_UNREACHABLE &&
|
||||
@ -363,7 +363,7 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
|
||||
}
|
||||
|
||||
if (tb[RTA_GATEWAY] && filter.rvia.bitlen != host_len) {
|
||||
fprintf(fp, "via %s ",
|
||||
fprintf(fp, "via %s ",
|
||||
format_host(r->rtm_family,
|
||||
RTA_PAYLOAD(tb[RTA_GATEWAY]),
|
||||
RTA_DATA(tb[RTA_GATEWAY]),
|
||||
@ -384,7 +384,7 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
|
||||
/* Do not use format_host(). It is our local addr
|
||||
and symbolic name will not be useful.
|
||||
*/
|
||||
fprintf(fp, " src %s ",
|
||||
fprintf(fp, " src %s ",
|
||||
rt_addr_n2a(r->rtm_family,
|
||||
RTA_PAYLOAD(tb[RTA_PREFSRC]),
|
||||
RTA_DATA(tb[RTA_PREFSRC]),
|
||||
@ -557,7 +557,7 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
|
||||
if (nh->rtnh_len > sizeof(*nh)) {
|
||||
parse_rtattr(tb, RTA_MAX, RTNH_DATA(nh), nh->rtnh_len - sizeof(*nh));
|
||||
if (tb[RTA_GATEWAY]) {
|
||||
fprintf(fp, " via %s ",
|
||||
fprintf(fp, " via %s ",
|
||||
format_host(r->rtm_family,
|
||||
RTA_PAYLOAD(tb[RTA_GATEWAY]),
|
||||
RTA_DATA(tb[RTA_GATEWAY]),
|
||||
@ -1020,7 +1020,7 @@ static int iproute_flush_cache(void)
|
||||
}
|
||||
|
||||
len = strlen (buffer);
|
||||
|
||||
|
||||
if ((write (flush_fd, (void *)buffer, len)) < len) {
|
||||
fprintf (stderr, "Cannot flush routing cache\n");
|
||||
return -1;
|
||||
@ -1292,7 +1292,7 @@ int iproute_get(int argc, char **argv)
|
||||
req.r.rtm_src_len = 0;
|
||||
req.r.rtm_dst_len = 0;
|
||||
req.r.rtm_tos = 0;
|
||||
|
||||
|
||||
while (argc > 0) {
|
||||
if (strcmp(*argv, "tos") == 0 ||
|
||||
matches(*argv, "dsfield") == 0) {
|
||||
@ -1434,7 +1434,7 @@ int do_iproute(int argc, char **argv)
|
||||
{
|
||||
if (argc < 1)
|
||||
return iproute_list_or_flush(0, NULL, 0);
|
||||
|
||||
|
||||
if (matches(*argv, "add") == 0)
|
||||
return iproute_modify(RTM_NEWROUTE, NLM_F_CREATE|NLM_F_EXCL,
|
||||
argc-1, argv+1);
|
||||
|
||||
@ -155,7 +155,7 @@ int print_rule(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
|
||||
|
||||
if (r->rtm_type == RTN_NAT) {
|
||||
if (tb[RTA_GATEWAY]) {
|
||||
fprintf(fp, "map-to %s ",
|
||||
fprintf(fp, "map-to %s ",
|
||||
format_host(r->rtm_family,
|
||||
RTA_PAYLOAD(tb[RTA_GATEWAY]),
|
||||
RTA_DATA(tb[RTA_GATEWAY]),
|
||||
|
||||
@ -262,7 +262,7 @@ static int do_add(int cmd, int argc, char **argv)
|
||||
return tnl_add_ioctl(cmd, "gre0", p.name, &p);
|
||||
case IPPROTO_IPV6:
|
||||
return tnl_add_ioctl(cmd, "sit0", p.name, &p);
|
||||
default:
|
||||
default:
|
||||
fprintf(stderr, "cannot determine tunnel mode (ipip, gre or sit)\n");
|
||||
return -1;
|
||||
}
|
||||
@ -283,7 +283,7 @@ static int do_del(int argc, char **argv)
|
||||
return tnl_del_ioctl("gre0", p.name, &p);
|
||||
case IPPROTO_IPV6:
|
||||
return tnl_del_ioctl("sit0", p.name, &p);
|
||||
default:
|
||||
default:
|
||||
return tnl_del_ioctl(p.name, p.name, &p);
|
||||
}
|
||||
return -1;
|
||||
@ -318,7 +318,7 @@ static void print_tunnel(struct ip_tunnel_parm *p)
|
||||
printf(" ttl %d ", p->iph.ttl);
|
||||
else
|
||||
printf(" ttl inherit ");
|
||||
|
||||
|
||||
if (p->iph.tos) {
|
||||
SPRINT_BUF(b1);
|
||||
printf(" tos");
|
||||
@ -427,7 +427,7 @@ static int do_show(int argc, char **argv)
|
||||
return -1;
|
||||
|
||||
switch (p.iph.protocol) {
|
||||
case IPPROTO_IPIP:
|
||||
case IPPROTO_IPIP:
|
||||
err = tnl_get_ioctl(p.name[0] ? p.name : "tunl0", &p);
|
||||
break;
|
||||
case IPPROTO_GRE:
|
||||
|
||||
12
ip/ipxfrm.c
12
ip/ipxfrm.c
@ -2,17 +2,17 @@
|
||||
|
||||
/*
|
||||
* Copyright (C)2004 USAGI/WIDE Project
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
@ -59,7 +59,7 @@ static void usage(void) __attribute__((noreturn));
|
||||
|
||||
static void usage(void)
|
||||
{
|
||||
fprintf(stderr,
|
||||
fprintf(stderr,
|
||||
"Usage: ip xfrm XFRM_OBJECT { COMMAND | help }\n"
|
||||
"where XFRM_OBJECT := { state | policy | monitor }\n");
|
||||
exit(-1);
|
||||
@ -349,7 +349,7 @@ static const char *strxf_time(__u64 time)
|
||||
time_t t;
|
||||
struct tm *tp;
|
||||
|
||||
/* XXX: treat time in the same manner of kernel's
|
||||
/* XXX: treat time in the same manner of kernel's
|
||||
* net/xfrm/xfrm_{user,state}.c
|
||||
*/
|
||||
t = (long)time;
|
||||
@ -690,7 +690,7 @@ void xfrm_xfrma_print(struct rtattr *tb[], __u16 family,
|
||||
|
||||
memset(abuf, '\0', sizeof(abuf));
|
||||
fprintf(fp, "%s",
|
||||
rt_addr_n2a(family, sizeof(*coa), coa,
|
||||
rt_addr_n2a(family, sizeof(*coa), coa,
|
||||
abuf, sizeof(abuf)));
|
||||
fprintf(fp, "%s", _SL_);
|
||||
}
|
||||
|
||||
@ -46,7 +46,7 @@ static void write_stamp(FILE *fp)
|
||||
fwrite((void*)n1, 1, NLMSG_ALIGN(n1->nlmsg_len), fp);
|
||||
}
|
||||
|
||||
static int dump_msg(const struct sockaddr_nl *who, struct nlmsghdr *n,
|
||||
static int dump_msg(const struct sockaddr_nl *who, struct nlmsghdr *n,
|
||||
void *arg)
|
||||
{
|
||||
FILE *fp = (FILE*)arg;
|
||||
|
||||
@ -1,16 +1,16 @@
|
||||
/*
|
||||
* Copyright (C)2006 USAGI/WIDE Project
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
@ -1,16 +1,16 @@
|
||||
/*
|
||||
* Copyright (C)2006 USAGI/WIDE Project
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
@ -2,17 +2,17 @@
|
||||
|
||||
/*
|
||||
* Copyright (C)2004 USAGI/WIDE Project
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
@ -2,17 +2,17 @@
|
||||
|
||||
/*
|
||||
* Copyright (C)2005 USAGI/WIDE Project
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
@ -2,17 +2,17 @@
|
||||
|
||||
/*
|
||||
* Copyright (C)2004 USAGI/WIDE Project
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
@ -2,17 +2,17 @@
|
||||
|
||||
/*
|
||||
* Copyright (C)2004 USAGI/WIDE Project
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
@ -82,7 +82,7 @@ static void usage(void)
|
||||
|
||||
fprintf(stderr, "FLAG-LIST := [ FLAG-LIST ] FLAG\n");
|
||||
fprintf(stderr, "FLAG := [ noecn | decap-dscp | wildrecv ]\n");
|
||||
|
||||
|
||||
fprintf(stderr, "ENCAP := ENCAP-TYPE SPORT DPORT OADDR\n");
|
||||
fprintf(stderr, "ENCAP-TYPE := espinudp | espinudp-nonike\n");
|
||||
|
||||
@ -669,7 +669,7 @@ int xfrm_state_print(const struct sockaddr_nl *who, struct nlmsghdr *n,
|
||||
rta = XFRMSID_RTA(xsid);
|
||||
else if (n->nlmsg_type == XFRM_MSG_EXPIRE)
|
||||
rta = XFRMEXP_RTA(xexp);
|
||||
else
|
||||
else
|
||||
rta = XFRMS_RTA(xsinfo);
|
||||
|
||||
parse_rtattr(tb, XFRMA_MAX, rta, len);
|
||||
|
||||
@ -38,7 +38,7 @@ static const char *ipx_ntop1(const struct ipx_addr *addr, char *str, size_t len)
|
||||
|
||||
*(str + pos) = '.';
|
||||
pos++;
|
||||
|
||||
|
||||
for(i = 0; i < 6; i++) {
|
||||
if (do_digit(str + pos, addr->ipx_node[i], 1, &pos, len))
|
||||
return str;
|
||||
|
||||
@ -36,7 +36,7 @@ struct idxmap
|
||||
|
||||
static struct idxmap *idxmap[16];
|
||||
|
||||
int ll_remember_index(const struct sockaddr_nl *who,
|
||||
int ll_remember_index(const struct sockaddr_nl *who,
|
||||
struct nlmsghdr *n, void *arg)
|
||||
{
|
||||
int h;
|
||||
|
||||
@ -35,63 +35,63 @@ static struct {
|
||||
const char *name;
|
||||
} llproto_names[] = {
|
||||
__PF(LOOP,loop)
|
||||
__PF(PUP,pup)
|
||||
__PF(PUP,pup)
|
||||
#ifdef ETH_P_PUPAT
|
||||
__PF(PUPAT,pupat)
|
||||
#endif
|
||||
#endif
|
||||
__PF(IP,ip)
|
||||
__PF(X25,x25)
|
||||
__PF(ARP,arp)
|
||||
__PF(BPQ,bpq)
|
||||
#ifdef ETH_P_IEEEPUP
|
||||
__PF(IEEEPUP,ieeepup)
|
||||
#endif
|
||||
#endif
|
||||
#ifdef ETH_P_IEEEPUPAT
|
||||
__PF(IEEEPUPAT,ieeepupat)
|
||||
#endif
|
||||
__PF(DEC,dec)
|
||||
__PF(DNA_DL,dna_dl)
|
||||
__PF(DNA_RC,dna_rc)
|
||||
__PF(DNA_RT,dna_rt)
|
||||
__PF(LAT,lat)
|
||||
__PF(DIAG,diag)
|
||||
__PF(CUST,cust)
|
||||
__PF(SCA,sca)
|
||||
__PF(RARP,rarp)
|
||||
__PF(ATALK,atalk)
|
||||
__PF(AARP,aarp)
|
||||
__PF(IPX,ipx)
|
||||
__PF(IPV6,ipv6)
|
||||
#endif
|
||||
__PF(DEC,dec)
|
||||
__PF(DNA_DL,dna_dl)
|
||||
__PF(DNA_RC,dna_rc)
|
||||
__PF(DNA_RT,dna_rt)
|
||||
__PF(LAT,lat)
|
||||
__PF(DIAG,diag)
|
||||
__PF(CUST,cust)
|
||||
__PF(SCA,sca)
|
||||
__PF(RARP,rarp)
|
||||
__PF(ATALK,atalk)
|
||||
__PF(AARP,aarp)
|
||||
__PF(IPX,ipx)
|
||||
__PF(IPV6,ipv6)
|
||||
#ifdef ETH_P_PPP_DISC
|
||||
__PF(PPP_DISC,ppp_disc)
|
||||
#endif
|
||||
#endif
|
||||
#ifdef ETH_P_PPP_SES
|
||||
__PF(PPP_SES,ppp_ses)
|
||||
#endif
|
||||
#endif
|
||||
#ifdef ETH_P_ATMMPOA
|
||||
__PF(ATMMPOA,atmmpoa)
|
||||
#endif
|
||||
#ifdef ETH_P_ATMFATE
|
||||
__PF(ATMFATE,atmfate)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
__PF(802_3,802_3)
|
||||
__PF(AX25,ax25)
|
||||
__PF(ALL,all)
|
||||
__PF(802_2,802_2)
|
||||
__PF(SNAP,snap)
|
||||
__PF(DDCMP,ddcmp)
|
||||
__PF(WAN_PPP,wan_ppp)
|
||||
__PF(PPP_MP,ppp_mp)
|
||||
__PF(LOCALTALK,localtalk)
|
||||
__PF(PPPTALK,ppptalk)
|
||||
__PF(TR_802_2,tr_802_2)
|
||||
__PF(MOBITEX,mobitex)
|
||||
__PF(CONTROL,control)
|
||||
__PF(IRDA,irda)
|
||||
__PF(802_3,802_3)
|
||||
__PF(AX25,ax25)
|
||||
__PF(ALL,all)
|
||||
__PF(802_2,802_2)
|
||||
__PF(SNAP,snap)
|
||||
__PF(DDCMP,ddcmp)
|
||||
__PF(WAN_PPP,wan_ppp)
|
||||
__PF(PPP_MP,ppp_mp)
|
||||
__PF(LOCALTALK,localtalk)
|
||||
__PF(PPPTALK,ppptalk)
|
||||
__PF(TR_802_2,tr_802_2)
|
||||
__PF(MOBITEX,mobitex)
|
||||
__PF(CONTROL,control)
|
||||
__PF(IRDA,irda)
|
||||
#ifdef ETH_P_ECONET
|
||||
__PF(ECONET,econet)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
{ 0x8100, "802.1Q" },
|
||||
{ ETH_P_IP, "ipv4" },
|
||||
|
||||
@ -582,15 +582,15 @@ size_t getcmdline(char **linep, size_t *lenp, FILE *in)
|
||||
{
|
||||
size_t cc;
|
||||
char *cp;
|
||||
|
||||
|
||||
if ((cc = getline(linep, lenp, in)) < 0)
|
||||
return cc; /* eof or error */
|
||||
++cmdlineno;
|
||||
|
||||
cp = strchr(*linep, '#');
|
||||
if (cp)
|
||||
if (cp)
|
||||
*cp = '\0';
|
||||
|
||||
|
||||
while ((cp = strstr(*linep, "\\\n")) != NULL) {
|
||||
char *line1 = NULL;
|
||||
size_t len1 = 0;
|
||||
@ -605,7 +605,7 @@ size_t getcmdline(char **linep, size_t *lenp, FILE *in)
|
||||
*cp = 0;
|
||||
|
||||
cp = strchr(line1, '#');
|
||||
if (cp)
|
||||
if (cp)
|
||||
*cp = '\0';
|
||||
|
||||
*linep = realloc(*linep, strlen(*linep) + strlen(line1) + 1);
|
||||
|
||||
12
misc/arpd.c
12
misc/arpd.c
@ -42,7 +42,7 @@ int resolve_hosts;
|
||||
DB *dbase;
|
||||
char *dbname = "/var/lib/arpd/arpd.db";
|
||||
|
||||
int ifnum;
|
||||
int ifnum;
|
||||
int *ifvec;
|
||||
char **ifnames;
|
||||
|
||||
@ -53,7 +53,7 @@ struct dbkey
|
||||
};
|
||||
|
||||
#define IS_NEG(x) (((__u8*)(x))[0] == 0xFF)
|
||||
#define NEG_TIME(x) (((x)[2]<<24)|((x)[3]<<16)|((x)[4]<<8)|(x)[5])
|
||||
#define NEG_TIME(x) (((x)[2]<<24)|((x)[3]<<16)|((x)[4]<<8)|(x)[5])
|
||||
#define NEG_AGE(x) ((__u32)time(NULL) - NEG_TIME((__u8*)x))
|
||||
#define NEG_VALID(x) (NEG_AGE(x) < negative_timeout)
|
||||
#define NEG_CNT(x) (((__u8*)(x))[1])
|
||||
@ -485,7 +485,7 @@ void get_arp_pkt(void)
|
||||
DBT dbkey, dbdat;
|
||||
int n;
|
||||
|
||||
n = recvfrom(pset[0].fd, buf, sizeof(buf), MSG_DONTWAIT,
|
||||
n = recvfrom(pset[0].fd, buf, sizeof(buf), MSG_DONTWAIT,
|
||||
(struct sockaddr*)&sll, &sll_len);
|
||||
if (n < 0) {
|
||||
if (errno != EINTR && errno != EAGAIN)
|
||||
@ -510,7 +510,7 @@ void get_arp_pkt(void)
|
||||
key.iface = sll.sll_ifindex;
|
||||
memcpy(&key.addr, (char*)(a+1) + a->ar_hln, 4);
|
||||
|
||||
/* DAD message, ignore. */
|
||||
/* DAD message, ignore. */
|
||||
if (key.addr == 0)
|
||||
return;
|
||||
|
||||
@ -538,7 +538,7 @@ void catch_signal(int sig, void (*handler)(int))
|
||||
sa.sa_handler = handler;
|
||||
#ifdef SA_INTERRUPT
|
||||
sa.sa_flags = SA_INTERRUPT;
|
||||
#endif
|
||||
#endif
|
||||
sigaction(sig, &sa, NULL);
|
||||
}
|
||||
|
||||
@ -728,7 +728,7 @@ int main(int argc, char **argv)
|
||||
DBT dbkey, dbdat;
|
||||
printf("%-8s %-15s %s\n", "#Ifindex", "IP", "MAC");
|
||||
while (dbase->seq(dbase, &dbkey, &dbdat, R_NEXT) == 0) {
|
||||
struct dbkey *key = dbkey.data;
|
||||
struct dbkey *key = dbkey.data;
|
||||
if (handle_if(key->iface)) {
|
||||
if (!IS_NEG(dbdat.data)) {
|
||||
char b1[18];
|
||||
|
||||
@ -77,7 +77,7 @@ static int match(const char *id)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int get_nlmsg(const struct sockaddr_nl *who,
|
||||
static int get_nlmsg(const struct sockaddr_nl *who,
|
||||
struct nlmsghdr *m, void *arg)
|
||||
{
|
||||
struct ifinfomsg *ifi = NLMSG_DATA(m);
|
||||
@ -442,11 +442,11 @@ void update_db(int interval)
|
||||
int i;
|
||||
for (i = 0; i < MAXS; i++) {
|
||||
if ((long)(h1->ival[i] - n->ival[i]) < 0) {
|
||||
memset(n->ival, 0, sizeof(n->ival));
|
||||
memset(n->ival, 0, sizeof(n->ival));
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < MAXS; i++) {
|
||||
for (i = 0; i < MAXS; i++) {
|
||||
double sample;
|
||||
unsigned long incr = h1->ival[i] - n->ival[i];
|
||||
n->val[i] += incr;
|
||||
|
||||
@ -119,7 +119,7 @@ static int map_field_params(struct lnstat_file *lnstat_files,
|
||||
fps->params[j].lf->file->interval.tv_sec =
|
||||
interval;
|
||||
if (!fps->params[j].print.width)
|
||||
fps->params[j].print.width =
|
||||
fps->params[j].print.width =
|
||||
FIELD_WIDTH_DEFAULT;
|
||||
j++;
|
||||
}
|
||||
@ -204,7 +204,7 @@ static int print_hdr(FILE *of, struct table_hdr *th)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
@ -222,10 +222,10 @@ int main(int argc, char **argv)
|
||||
static struct field_params fp;
|
||||
int num_req_files = 0;
|
||||
char *req_files[LNSTAT_MAX_FILES];
|
||||
|
||||
|
||||
/* backwards compatibility mode for old tools */
|
||||
basename = strrchr(argv[0], '/');
|
||||
if (basename)
|
||||
if (basename)
|
||||
basename += 1; /* name after slash */
|
||||
else
|
||||
basename = argv[0]; /* no slash */
|
||||
@ -240,7 +240,7 @@ int main(int argc, char **argv)
|
||||
num_req_files = 1;
|
||||
}
|
||||
|
||||
while ((c = getopt_long(argc, argv,"Vc:df:h?i:k:s:w:",
|
||||
while ((c = getopt_long(argc, argv,"Vc:df:h?i:k:s:w:",
|
||||
opts, NULL)) != -1) {
|
||||
int i, len = 0;
|
||||
char *tmp, *tok;
|
||||
@ -256,7 +256,7 @@ int main(int argc, char **argv)
|
||||
req_files[num_req_files++] = strdup(optarg);
|
||||
break;
|
||||
case '?':
|
||||
case 'h':
|
||||
case 'h':
|
||||
usage(argv[0], 0);
|
||||
break;
|
||||
case 'i':
|
||||
@ -315,12 +315,12 @@ int main(int argc, char **argv)
|
||||
|
||||
if (!map_field_params(lnstat_files, &fp, interval))
|
||||
exit(1);
|
||||
|
||||
|
||||
header = build_hdr_string(lnstat_files, &fp, 80);
|
||||
if (!header)
|
||||
exit(1);
|
||||
|
||||
if (interval < 1 )
|
||||
if (interval < 1 )
|
||||
interval=1;
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
|
||||
@ -49,12 +49,12 @@ static int scan_lines(struct lnstat_file *lf, int i)
|
||||
|
||||
num_lines++;
|
||||
|
||||
fgets(buf, sizeof(buf)-1, lf->fp);
|
||||
fgets(buf, sizeof(buf)-1, lf->fp);
|
||||
gettimeofday(&lf->last_read, NULL);
|
||||
|
||||
for (j = 0; j < lf->num_fields; j++) {
|
||||
unsigned long f = strtoul(ptr, &ptr, 16);
|
||||
if (j == 0)
|
||||
if (j == 0)
|
||||
lf->fields[j].values[i] = f;
|
||||
else
|
||||
lf->fields[j].values[i] += f;
|
||||
@ -63,8 +63,8 @@ static int scan_lines(struct lnstat_file *lf, int i)
|
||||
return num_lines;
|
||||
}
|
||||
|
||||
static int time_after(struct timeval *last,
|
||||
struct timeval *tout,
|
||||
static int time_after(struct timeval *last,
|
||||
struct timeval *tout,
|
||||
struct timeval *now)
|
||||
{
|
||||
if (now->tv_sec > last->tv_sec + tout->tv_sec)
|
||||
@ -98,7 +98,7 @@ int lnstat_update(struct lnstat_file *lnstat_files)
|
||||
}
|
||||
scan_lines(lf, 1);
|
||||
|
||||
for (i = 0, lfi = &lf->fields[i];
|
||||
for (i = 0, lfi = &lf->fields[i];
|
||||
i < lf->num_fields; i++, lfi = &lf->fields[i]) {
|
||||
if (i == 0)
|
||||
lfi->result = lfi->values[1];
|
||||
@ -211,7 +211,7 @@ struct lnstat_file *lnstat_scan_dir(const char *path, const int num_req_files,
|
||||
|
||||
if (!path)
|
||||
path = PROC_NET_STAT;
|
||||
|
||||
|
||||
dir = opendir(path);
|
||||
if (!dir) {
|
||||
struct lnstat_file *lf;
|
||||
@ -307,7 +307,7 @@ struct lnstat_field *lnstat_find_field(struct lnstat_file *lnstat_files,
|
||||
file = NULL;
|
||||
field = name;
|
||||
}
|
||||
|
||||
|
||||
for (lf = lnstat_files; lf; lf = lf->next) {
|
||||
int i;
|
||||
|
||||
|
||||
@ -373,7 +373,7 @@ void server_loop(int fd)
|
||||
struct pollfd p;
|
||||
p.fd = fd;
|
||||
p.events = p.revents = POLLIN;
|
||||
|
||||
|
||||
sprintf(info_source, "%d.%lu sampling_interval=%d time_const=%d",
|
||||
getpid(), (unsigned long)random(), scan_interval/1000, time_constant/1000);
|
||||
|
||||
|
||||
@ -168,7 +168,7 @@ void dump_abs_db(FILE *fp)
|
||||
"%-10s "
|
||||
"%-10s "
|
||||
"\n"
|
||||
, "Realm", "BytesTo", "PktsTo", "BytesFrom", "PktsFrom");
|
||||
, "Realm", "BytesTo", "PktsTo", "BytesFrom", "PktsFrom");
|
||||
fprintf(fp,
|
||||
"%-10s "
|
||||
"%-10s "
|
||||
@ -176,7 +176,7 @@ void dump_abs_db(FILE *fp)
|
||||
"%-10s "
|
||||
"%-10s "
|
||||
"\n"
|
||||
, "", "BPSTo", "PPSTo", "BPSFrom", "PPSFrom");
|
||||
, "", "BPSTo", "PPSTo", "BPSFrom", "PPSFrom");
|
||||
|
||||
}
|
||||
|
||||
@ -207,10 +207,10 @@ void dump_abs_db(FILE *fp)
|
||||
|
||||
fprintf(fp, "%-10s", rtnl_rtrealm_n2a(realm, b1, sizeof(b1)));
|
||||
for (i = 0; i < 4; i++)
|
||||
format_count(fp, val[i]);
|
||||
format_count(fp, val[i]);
|
||||
fprintf(fp, "\n%-10s", "");
|
||||
for (i = 0; i < 4; i++)
|
||||
format_rate(fp, rate[i]);
|
||||
format_rate(fp, rate[i]);
|
||||
fprintf(fp, "\n");
|
||||
}
|
||||
}
|
||||
@ -230,7 +230,7 @@ void dump_incr_db(FILE *fp)
|
||||
"%-10s "
|
||||
"%-10s "
|
||||
"\n"
|
||||
, "Realm", "BytesTo", "PktsTo", "BytesFrom", "PktsFrom");
|
||||
, "Realm", "BytesTo", "PktsTo", "BytesFrom", "PktsFrom");
|
||||
fprintf(fp,
|
||||
"%-10s "
|
||||
"%-10s "
|
||||
@ -238,7 +238,7 @@ void dump_incr_db(FILE *fp)
|
||||
"%-10s "
|
||||
"%-10s "
|
||||
"\n"
|
||||
, "", "BPSTo", "PPSTo", "BPSFrom", "PPSFrom");
|
||||
, "", "BPSTo", "PPSTo", "BPSFrom", "PPSFrom");
|
||||
}
|
||||
|
||||
for (realm=0; realm<256; realm++) {
|
||||
@ -282,10 +282,10 @@ void dump_incr_db(FILE *fp)
|
||||
|
||||
fprintf(fp, "%-10s", rtnl_rtrealm_n2a(realm, b1, sizeof(b1)));
|
||||
for (i = 0; i < 4; i++)
|
||||
format_count(fp, rval[i]);
|
||||
format_count(fp, rval[i]);
|
||||
fprintf(fp, "\n%-10s", "");
|
||||
for (i = 0; i < 4; i++)
|
||||
format_rate(fp, rate[i]);
|
||||
format_rate(fp, rate[i]);
|
||||
fprintf(fp, "\n");
|
||||
}
|
||||
}
|
||||
@ -297,7 +297,7 @@ void sigchild(int signo)
|
||||
{
|
||||
}
|
||||
|
||||
/* Server side only: read kernel data, update tables, calculate rates. */
|
||||
/* Server side only: read kernel data, update tables, calculate rates. */
|
||||
|
||||
void update_db(int interval)
|
||||
{
|
||||
@ -368,9 +368,9 @@ void server_loop(int fd)
|
||||
p.fd = fd;
|
||||
p.events = p.revents = POLLIN;
|
||||
|
||||
sprintf(kern_db->signature,
|
||||
sprintf(kern_db->signature,
|
||||
"%u.%lu sampling_interval=%d time_const=%d",
|
||||
(unsigned) getpid(), (unsigned long)random(),
|
||||
(unsigned) getpid(), (unsigned long)random(),
|
||||
scan_interval/1000, time_constant/1000);
|
||||
|
||||
pad_kern_table(kern_db, read_kern_table(kern_db->ival));
|
||||
|
||||
90
misc/ss.c
90
misc/ss.c
@ -296,7 +296,7 @@ struct slabstat
|
||||
|
||||
struct slabstat slabstat;
|
||||
|
||||
static const char *slabstat_ids[] =
|
||||
static const char *slabstat_ids[] =
|
||||
{
|
||||
"sock",
|
||||
"tcp_bind_bucket",
|
||||
@ -480,7 +480,7 @@ static int is_ephemeral(int port)
|
||||
if (!ip_local_port_min) {
|
||||
FILE *f = fdopen(ephemeral_ports_open(), "r");
|
||||
if (f) {
|
||||
fscanf(f, "%d %d",
|
||||
fscanf(f, "%d %d",
|
||||
&ip_local_port_min, &ip_local_port_max);
|
||||
fclose(f);
|
||||
} else {
|
||||
@ -508,7 +508,7 @@ const char *__resolve_service(int port)
|
||||
if (!notfirst) {
|
||||
setservent(1);
|
||||
notfirst = 1;
|
||||
}
|
||||
}
|
||||
se = getservbyport(htons(port), dg_proto);
|
||||
if (se)
|
||||
return se->s_name;
|
||||
@ -537,7 +537,7 @@ const char *resolve_service(int port)
|
||||
const char *res;
|
||||
int hash = (port^(((unsigned long)dg_proto)>>2))&255;
|
||||
|
||||
for (c = &cache[hash]; c; c = c->next) {
|
||||
for (c = &cache[hash]; c; c = c->next) {
|
||||
if (c->port == port &&
|
||||
c->proto == dg_proto) {
|
||||
if (c->name)
|
||||
@ -647,7 +647,7 @@ int run_ssfilter(struct ssfilter *f, struct tcpstat *s)
|
||||
char *p;
|
||||
memcpy(&p, s->local.data, sizeof(p));
|
||||
return p == NULL || (p[0] == '@' && strlen(p) == 6 &&
|
||||
strspn(p+1, "0123456789abcdef") == 5);
|
||||
strspn(p+1, "0123456789abcdef") == 5);
|
||||
}
|
||||
if (s->local.family == AF_PACKET)
|
||||
return s->lport == 0 && s->local.data == 0;
|
||||
@ -690,7 +690,7 @@ int run_ssfilter(struct ssfilter *f, struct tcpstat *s)
|
||||
do {
|
||||
if (!inet2_addr_match(&s->local, &a->addr, a->addr.bitlen))
|
||||
return 1;
|
||||
} while ((a = a->next) != NULL);
|
||||
} while ((a = a->next) != NULL);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
@ -728,7 +728,7 @@ int run_ssfilter(struct ssfilter *f, struct tcpstat *s)
|
||||
}
|
||||
}
|
||||
|
||||
/* Relocate external jumps by reloc. */
|
||||
/* Relocate external jumps by reloc. */
|
||||
static void ssfilter_patch(char *a, int len, int reloc)
|
||||
{
|
||||
while (len > 0) {
|
||||
@ -868,7 +868,7 @@ static int ssfilter_bytecompile(struct ssfilter *f, char **bytecode)
|
||||
|
||||
static int remember_he(struct aafilter *a, struct hostent *he)
|
||||
{
|
||||
char **ptr = he->h_addr_list;
|
||||
char **ptr = he->h_addr_list;
|
||||
int cnt = 0;
|
||||
int len;
|
||||
|
||||
@ -1110,28 +1110,28 @@ static int tcp_show_line(char *line, struct filter *f, int family)
|
||||
char opt[256];
|
||||
int n;
|
||||
char *p;
|
||||
|
||||
|
||||
if ((p = strchr(line, ':')) == NULL)
|
||||
return -1;
|
||||
loc = p+2;
|
||||
|
||||
|
||||
if ((p = strchr(loc, ':')) == NULL)
|
||||
return -1;
|
||||
p[5] = 0;
|
||||
rem = p+6;
|
||||
|
||||
|
||||
if ((p = strchr(rem, ':')) == NULL)
|
||||
return -1;
|
||||
p[5] = 0;
|
||||
data = p+6;
|
||||
|
||||
|
||||
do {
|
||||
int state = (data[1] >= 'A') ? (data[1] - 'A' + 10) : (data[1] - '0');
|
||||
|
||||
if (!(f->states & (1<<state)))
|
||||
return 0;
|
||||
} while (0);
|
||||
|
||||
|
||||
s.local.family = s.remote.family = family;
|
||||
if (family == AF_INET) {
|
||||
sscanf(loc, "%x:%x", s.local.data, (unsigned*)&s.lport);
|
||||
@ -1152,37 +1152,37 @@ static int tcp_show_line(char *line, struct filter *f, int family)
|
||||
&s.rport);
|
||||
s.local.bytelen = s.remote.bytelen = 16;
|
||||
}
|
||||
|
||||
|
||||
if (f->f && run_ssfilter(f->f, &s) == 0)
|
||||
return 0;
|
||||
|
||||
|
||||
opt[0] = 0;
|
||||
n = sscanf(data, "%x %x:%x %x:%x %x %d %d %d %d %llx %d %d %d %d %d %[^\n]\n",
|
||||
&s.state, &s.wq, &s.rq,
|
||||
&s.timer, &s.timeout, &s.retrs, &s.uid, &s.probes, &s.ino,
|
||||
&s.refcnt, &s.sk, &s.rto, &s.ato, &s.qack,
|
||||
&s.cwnd, &s.ssthresh, opt);
|
||||
|
||||
|
||||
if (n < 17)
|
||||
opt[0] = 0;
|
||||
|
||||
|
||||
if (n < 12) {
|
||||
s.rto = 0;
|
||||
s.cwnd = 2;
|
||||
s.ssthresh = -1;
|
||||
s.ato = s.qack = 0;
|
||||
}
|
||||
|
||||
|
||||
if (netid_width)
|
||||
printf("%-*s ", netid_width, "tcp");
|
||||
if (state_width)
|
||||
printf("%-*s ", state_width, sstate_name[s.state]);
|
||||
|
||||
|
||||
printf("%-6d %-6d ", s.rq, s.wq);
|
||||
|
||||
|
||||
formatted_print(&s.local, s.lport);
|
||||
formatted_print(&s.remote, s.rport);
|
||||
|
||||
|
||||
if (show_options) {
|
||||
if (s.timer) {
|
||||
if (s.timer > 4)
|
||||
@ -1288,10 +1288,10 @@ outwrongformat:
|
||||
outerr:
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
static char *sprint_bw(char *buf, double bw)
|
||||
{
|
||||
if (bw > 1000000.)
|
||||
if (bw > 1000000.)
|
||||
sprintf(buf,"%.1fM", bw / 1000000.);
|
||||
else if (bw > 1000.)
|
||||
sprintf(buf,"%.1fK", bw / 1000.);
|
||||
@ -1344,7 +1344,7 @@ static void tcp_show_info(const struct nlmsghdr *nlh, struct inet_diag_msg *r)
|
||||
if (tb[INET_DIAG_CONG])
|
||||
printf("%s", (char *) RTA_DATA(tb[INET_DIAG_CONG]));
|
||||
|
||||
if (info->tcpi_options & TCPI_OPT_WSCALE)
|
||||
if (info->tcpi_options & TCPI_OPT_WSCALE)
|
||||
printf(" wscale:%d,%d", info->tcpi_snd_wscale,
|
||||
info->tcpi_rcv_wscale);
|
||||
if (info->tcpi_rto && info->tcpi_rto != 3000000)
|
||||
@ -1364,7 +1364,7 @@ static void tcp_show_info(const struct nlmsghdr *nlh, struct inet_diag_msg *r)
|
||||
const struct tcpvegas_info *vinfo
|
||||
= RTA_DATA(tb[INET_DIAG_VEGASINFO]);
|
||||
|
||||
if (vinfo->tcpv_enabled &&
|
||||
if (vinfo->tcpv_enabled &&
|
||||
vinfo->tcpv_rtt && vinfo->tcpv_rtt != 0x7fffffff)
|
||||
rtt = vinfo->tcpv_rtt;
|
||||
}
|
||||
@ -1477,7 +1477,7 @@ int tcp_show_netlink(struct filter *f, FILE *dump_fp, int socktype)
|
||||
req.r.idiag_family = AF_INET;
|
||||
req.r.idiag_states = f->states;
|
||||
if (show_mem)
|
||||
req.r.idiag_ext |= (1<<(INET_DIAG_MEMINFO-1));
|
||||
req.r.idiag_ext |= (1<<(INET_DIAG_MEMINFO-1));
|
||||
|
||||
if (show_tcpinfo) {
|
||||
req.r.idiag_ext |= (1<<(INET_DIAG_INFO-1));
|
||||
@ -1485,9 +1485,9 @@ int tcp_show_netlink(struct filter *f, FILE *dump_fp, int socktype)
|
||||
req.r.idiag_ext |= (1<<(INET_DIAG_CONG-1));
|
||||
}
|
||||
|
||||
iov[0] = (struct iovec){
|
||||
.iov_base = &req,
|
||||
.iov_len = sizeof(req)
|
||||
iov[0] = (struct iovec){
|
||||
.iov_base = &req,
|
||||
.iov_len = sizeof(req)
|
||||
};
|
||||
if (f->f) {
|
||||
bclen = ssfilter_bytecompile(f->f, &bc);
|
||||
@ -1499,18 +1499,18 @@ int tcp_show_netlink(struct filter *f, FILE *dump_fp, int socktype)
|
||||
}
|
||||
|
||||
msg = (struct msghdr) {
|
||||
.msg_name = (void*)&nladdr,
|
||||
.msg_name = (void*)&nladdr,
|
||||
.msg_namelen = sizeof(nladdr),
|
||||
.msg_iov = iov,
|
||||
.msg_iov = iov,
|
||||
.msg_iovlen = f->f ? 3 : 1,
|
||||
};
|
||||
|
||||
if (sendmsg(fd, &msg, 0) < 0)
|
||||
return -1;
|
||||
|
||||
iov[0] = (struct iovec){
|
||||
.iov_base = buf,
|
||||
.iov_len = sizeof(buf)
|
||||
iov[0] = (struct iovec){
|
||||
.iov_base = buf,
|
||||
.iov_len = sizeof(buf)
|
||||
};
|
||||
|
||||
while (1) {
|
||||
@ -1938,13 +1938,13 @@ void unix_list_print(struct unixstat *list, struct filter *f)
|
||||
if (strcmp(peer, "*") == 0)
|
||||
memset(tst.remote.data, 0, sizeof(peer));
|
||||
else
|
||||
memcpy(tst.remote.data, &peer, sizeof(peer));
|
||||
memcpy(tst.remote.data, &peer, sizeof(peer));
|
||||
if (run_ssfilter(f->f, &tst) == 0)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (netid_width)
|
||||
printf("%-*s ", netid_width,
|
||||
printf("%-*s ", netid_width,
|
||||
s->type == SOCK_STREAM ? "u_str" : "u_dgr");
|
||||
if (state_width)
|
||||
printf("%-*s ", state_width, sstate_name[s->state]);
|
||||
@ -1974,7 +1974,7 @@ int unix_show(struct filter *f)
|
||||
return -1;
|
||||
fgets(buf, sizeof(buf)-1, fp);
|
||||
|
||||
if (memcmp(buf, "Peer", 4) == 0)
|
||||
if (memcmp(buf, "Peer", 4) == 0)
|
||||
newformat = 1;
|
||||
cnt = 0;
|
||||
|
||||
@ -2085,7 +2085,7 @@ int packet_show(struct filter *f)
|
||||
}
|
||||
|
||||
if (netid_width)
|
||||
printf("%-*s ", netid_width,
|
||||
printf("%-*s ", netid_width,
|
||||
type == SOCK_RAW ? "p_raw" : "p_dgr");
|
||||
if (state_width)
|
||||
printf("%-*s ", state_width, "UNCONN");
|
||||
@ -2094,7 +2094,7 @@ int packet_show(struct filter *f)
|
||||
printf("%*s:", addr_width, "*");
|
||||
} else {
|
||||
char tb[16];
|
||||
printf("%*s:", addr_width,
|
||||
printf("%*s:", addr_width,
|
||||
ll_proto_n2a(htons(prot), tb, sizeof(tb)));
|
||||
}
|
||||
if (iface == 0) {
|
||||
@ -2153,7 +2153,7 @@ int netlink_show(struct filter *f)
|
||||
}
|
||||
|
||||
if (netid_width)
|
||||
printf("%-*s ", netid_width, "nl");
|
||||
printf("%-*s ", netid_width, "nl");
|
||||
if (state_width)
|
||||
printf("%-*s ", state_width, "UNCONN");
|
||||
printf("%-6d %-6d ", rq, wq);
|
||||
@ -2179,7 +2179,7 @@ int netlink_show(struct filter *f)
|
||||
getenv("PROC_ROOT") ? : "/proc", pid);
|
||||
if ((fp = fopen(procname, "r")) != NULL) {
|
||||
if (fscanf(fp, "%*d (%[^)])", procname) == 1) {
|
||||
sprintf(procname+strlen(procname), "/%d", pid);
|
||||
sprintf(procname+strlen(procname), "/%d", pid);
|
||||
printf("%-*s ", serv_width, procname);
|
||||
done = 1;
|
||||
}
|
||||
@ -2353,7 +2353,7 @@ int print_summary(void)
|
||||
printf("RAW %-9d %-9d %-9d\n", s.raw4+s.raw6, s.raw4, s.raw6);
|
||||
printf("UDP %-9d %-9d %-9d\n", s.udp4+s.udp6, s.udp4, s.udp6);
|
||||
printf("TCP %-9d %-9d %-9d\n", s.tcp4_hashed+s.tcp6_hashed, s.tcp4_hashed, s.tcp6_hashed);
|
||||
printf("INET %-9d %-9d %-9d\n",
|
||||
printf("INET %-9d %-9d %-9d\n",
|
||||
s.raw4+s.udp4+s.tcp4_hashed+
|
||||
s.raw6+s.udp6+s.tcp6_hashed,
|
||||
s.raw4+s.udp4+s.tcp4_hashed,
|
||||
@ -2459,7 +2459,7 @@ static const struct option long_opts[] = {
|
||||
{ "version", 0, 0, 'V' },
|
||||
{ "help", 0, 0, 'h' },
|
||||
{ 0 }
|
||||
|
||||
|
||||
};
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
@ -2565,7 +2565,7 @@ int main(int argc, char *argv[])
|
||||
p = p1 = optarg;
|
||||
do {
|
||||
if ((p1 = strchr(p, ',')) != NULL)
|
||||
*p1 = 0;
|
||||
*p1 = 0;
|
||||
if (strcmp(p, "all") == 0) {
|
||||
current_filter.dbs = ALL_DB;
|
||||
} else if (strcmp(p, "inet") == 0) {
|
||||
@ -2788,7 +2788,7 @@ int main(int argc, char *argv[])
|
||||
if (addrp_width < 15+serv_width+1)
|
||||
addrp_width = 15+serv_width+1;
|
||||
|
||||
addr_width = addrp_width - serv_width - 1;
|
||||
addr_width = addrp_width - serv_width - 1;
|
||||
|
||||
if (netid_width)
|
||||
printf("%-*s ", netid_width, "Netid");
|
||||
|
||||
@ -55,7 +55,7 @@ expr: DCOND HOSTCOND
|
||||
$$ = alloc_node(SSF_DCOND, $2);
|
||||
}
|
||||
| SCOND HOSTCOND
|
||||
{
|
||||
{
|
||||
$$ = alloc_node(SSF_SCOND, $2);
|
||||
}
|
||||
| DPORT GEQ HOSTCOND
|
||||
|
||||
@ -63,7 +63,7 @@ static int cmp_parse_eopt(struct nlmsghdr *n, struct tcf_ematch_hdr *hdr,
|
||||
align = TCF_EM_ALIGN_U32;
|
||||
else
|
||||
return PARSE_ERR(args, "cmp: invalid alignment");
|
||||
|
||||
|
||||
for (a = bstr_next(args); a; a = bstr_next(a)) {
|
||||
if (!bstrcmp(a, "at")) {
|
||||
if (a->next == NULL)
|
||||
@ -111,7 +111,7 @@ static int cmp_parse_eopt(struct nlmsghdr *n, struct tcf_ematch_hdr *hdr,
|
||||
opnd = TCF_EM_OPND_GT;
|
||||
else if (!bstrcmp(a, "lt"))
|
||||
opnd = TCF_EM_OPND_LT;
|
||||
|
||||
|
||||
if (a->next == NULL)
|
||||
return PARSE_ERR(a, "cmp: missing argument");
|
||||
a = bstr_next(a);
|
||||
|
||||
20
tc/em_meta.c
20
tc/em_meta.c
@ -131,7 +131,7 @@ static struct meta_entry * lookup_meta_entry(struct bstr *kind)
|
||||
if (!bstrcmp(kind, meta_table[i].kind) &&
|
||||
meta_table[i].id != 0)
|
||||
return &meta_table[i];
|
||||
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -142,7 +142,7 @@ static struct meta_entry * lookup_meta_entry_byid(int id)
|
||||
for (i = 0; i < (sizeof(meta_table)/sizeof(meta_table[0])); i++)
|
||||
if (meta_table[i].id == id)
|
||||
return &meta_table[i];
|
||||
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -171,12 +171,12 @@ static inline int is_compatible(struct tcf_meta_val *what,
|
||||
{
|
||||
char *p;
|
||||
struct meta_entry *entry;
|
||||
|
||||
|
||||
entry = lookup_meta_entry_byid(TCF_META_ID(what->kind));
|
||||
|
||||
if (entry == NULL)
|
||||
return 0;
|
||||
|
||||
|
||||
for (p = entry->mask; p; p++)
|
||||
if (map_type(*p) == TCF_META_TYPE(needed->kind))
|
||||
return 1;
|
||||
@ -244,7 +244,7 @@ static inline int overwrite_type(struct tcf_meta_val *src,
|
||||
{
|
||||
return (TCF_META_TYPE(dst->kind) << 12) | TCF_META_ID(src->kind);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static inline struct bstr *
|
||||
parse_object(struct bstr *args, struct bstr *arg, struct tcf_meta_val *obj,
|
||||
@ -280,7 +280,7 @@ parse_object(struct bstr *args, struct bstr *arg, struct tcf_meta_val *obj,
|
||||
|
||||
if (left) {
|
||||
struct tcf_meta_val *right = obj;
|
||||
|
||||
|
||||
if (TCF_META_TYPE(right->kind) == TCF_META_TYPE(left->kind))
|
||||
goto compatible;
|
||||
|
||||
@ -301,7 +301,7 @@ parse_object(struct bstr *args, struct bstr *arg, struct tcf_meta_val *obj,
|
||||
right->kind = overwrite_type(right, left);
|
||||
else
|
||||
goto not_compatible;
|
||||
} else
|
||||
} else
|
||||
goto not_compatible;
|
||||
}
|
||||
|
||||
@ -318,7 +318,7 @@ compatible:
|
||||
return PARSE_FAILURE;
|
||||
}
|
||||
a = bstr_next(a);
|
||||
|
||||
|
||||
shift = bstrtoul(a);
|
||||
if (shift == LONG_MAX) {
|
||||
PARSE_ERR(a, "meta: invalid shift, must " \
|
||||
@ -336,7 +336,7 @@ compatible:
|
||||
return PARSE_FAILURE;
|
||||
}
|
||||
a = bstr_next(a);
|
||||
|
||||
|
||||
mask = bstrtoul(a);
|
||||
if (mask == LONG_MAX) {
|
||||
PARSE_ERR(a, "meta: invalid mask, must be " \
|
||||
@ -400,7 +400,7 @@ static int meta_parse_eopt(struct nlmsghdr *n, struct tcf_ematch_hdr *hdr,
|
||||
return -1;
|
||||
else if (a != NULL)
|
||||
return PARSE_ERR(a, "meta: unexpected trailer");
|
||||
|
||||
|
||||
|
||||
addraw_l(n, MAX_MSG, hdr, sizeof(*hdr));
|
||||
|
||||
|
||||
@ -92,7 +92,7 @@ static int nbyte_parse_eopt(struct nlmsghdr *n, struct tcf_ematch_hdr *hdr,
|
||||
|
||||
if (offset_present == 0)
|
||||
return PARSE_ERR(a, "nbyte: offset required");
|
||||
|
||||
|
||||
nb.len = needle->len;
|
||||
nb.layer = (__u8) layer;
|
||||
nb.off = (__u16) offset;
|
||||
@ -131,7 +131,7 @@ static int nbyte_print_eopt(FILE *fd, struct tcf_ematch_hdr *hdr, void *data,
|
||||
for (i = 0; i < nb->len; i++)
|
||||
fprintf(fd, "%c", isprint(needle[i]) ? needle[i] : '.');
|
||||
fprintf(fd, "\" at %d layer %d", nb->off, nb->layer);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -96,7 +96,7 @@ static int u32_parse_eopt(struct nlmsghdr *n, struct tcf_ematch_hdr *hdr,
|
||||
offset = bstrtoul(a);
|
||||
} else
|
||||
offset = bstrtoul(a);
|
||||
|
||||
|
||||
if (offset == ULONG_MAX)
|
||||
return PARSE_ERR(a, "u32: invalid offset");
|
||||
|
||||
|
||||
@ -77,7 +77,7 @@
|
||||
return ERROR;
|
||||
}
|
||||
strbuf_index = 0;
|
||||
|
||||
|
||||
BEGIN(str);
|
||||
}
|
||||
|
||||
@ -90,7 +90,7 @@
|
||||
|
||||
<str>\\[0-7]{1,3} { /* octal escape sequence */
|
||||
int res;
|
||||
|
||||
|
||||
sscanf(yytext + 1, "%o", &res);
|
||||
if (res > 0xFF) {
|
||||
fprintf(stderr, "error: octal escape sequence" \
|
||||
@ -107,9 +107,9 @@
|
||||
|
||||
<str>\\x[0-9a-fA-F]{1,2} {
|
||||
int res;
|
||||
|
||||
|
||||
sscanf(yytext + 2, "%x", &res);
|
||||
|
||||
|
||||
if (res > 0xFF) {
|
||||
fprintf(stderr, "error: hexadecimal escape " \
|
||||
"sequence out of range\n");
|
||||
|
||||
@ -52,7 +52,7 @@ static int basic_parse_opt(struct filter_util *qu, char *handle,
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
t->tcm_handle = h;
|
||||
|
||||
tail = (struct rtattr*)(((void*)n)+NLMSG_ALIGN(n->nlmsg_len));
|
||||
|
||||
@ -125,7 +125,7 @@ static int fw_print_opt(struct filter_util *qu, FILE *f, struct rtattr *opt, __u
|
||||
struct rtattr *idev = tb[TCA_FW_INDEV];
|
||||
fprintf(f, "input dev %s ",(char *)RTA_DATA(idev));
|
||||
}
|
||||
|
||||
|
||||
if (tb[TCA_FW_ACT]) {
|
||||
fprintf(f, "\n");
|
||||
tc_print_action(f, tb[TCA_FW_ACT]);
|
||||
|
||||
@ -833,7 +833,7 @@ static int u32_parse_opt(struct filter_util *qu, char *handle, int argc, char **
|
||||
} else if (matches(*argv, "divisor") == 0) {
|
||||
unsigned divisor;
|
||||
NEXT_ARG();
|
||||
if (get_unsigned(&divisor, *argv, 0) ||
|
||||
if (get_unsigned(&divisor, *argv, 0) ||
|
||||
divisor == 0 ||
|
||||
divisor > 0x100 || ((divisor - 1) & divisor)) {
|
||||
fprintf(stderr, "Illegal \"divisor\"\n");
|
||||
|
||||
@ -6,8 +6,8 @@
|
||||
* as published by the Free Software Foundation; either version
|
||||
* 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* Authors: J Hadi Salim (hadi@cyberus.ca)
|
||||
*
|
||||
* Authors: J Hadi Salim (hadi@cyberus.ca)
|
||||
*
|
||||
* TODO:
|
||||
* - parse to be passed a filedescriptor for logging purposes
|
||||
*
|
||||
@ -65,7 +65,7 @@ void act_usage(void)
|
||||
static int print_noaopt(struct action_util *au, FILE *f, struct rtattr *opt)
|
||||
{
|
||||
if (opt && RTA_PAYLOAD(opt))
|
||||
fprintf(f, "[Unknown action, optlen=%u] ",
|
||||
fprintf(f, "[Unknown action, optlen=%u] ",
|
||||
(unsigned) RTA_PAYLOAD(opt));
|
||||
return 0;
|
||||
}
|
||||
@ -139,7 +139,7 @@ noexist:
|
||||
}
|
||||
|
||||
int
|
||||
new_cmd(char **argv)
|
||||
new_cmd(char **argv)
|
||||
{
|
||||
if ((matches(*argv, "change") == 0) ||
|
||||
(matches(*argv, "replace") == 0)||
|
||||
@ -203,7 +203,7 @@ done0:
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (NULL == a) {
|
||||
if (NULL == a) {
|
||||
goto bad_val;
|
||||
}
|
||||
|
||||
@ -235,7 +235,7 @@ done:
|
||||
*argv_p = argv;
|
||||
return 0;
|
||||
bad_val:
|
||||
/* no need to undo things, returning from here should
|
||||
/* no need to undo things, returning from here should
|
||||
* cause enough pain */
|
||||
fprintf(stderr, "parse_action: bad value (%d:%s)!\n",argc,*argv);
|
||||
return -1;
|
||||
@ -337,11 +337,11 @@ int print_action(const struct sockaddr_nl *who,
|
||||
if (n->nlmsg_type != RTM_GETACTION)
|
||||
fprintf(stderr, "print_action: NULL kind\n");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (n->nlmsg_type == RTM_DELACTION) {
|
||||
if (n->nlmsg_flags & NLM_F_ROOT) {
|
||||
fprintf(fp, "Flushed table ");
|
||||
fprintf(fp, "Flushed table ");
|
||||
tab_flush = 1;
|
||||
} else {
|
||||
fprintf(fp, "deleted action ");
|
||||
@ -403,7 +403,7 @@ int tc_action_gd(int cmd, unsigned flags, int *argc_p, char ***argv_p)
|
||||
|
||||
strncpy(k, *argv, sizeof (k) - 1);
|
||||
a = get_action_kind(k);
|
||||
if (NULL == a) {
|
||||
if (NULL == a) {
|
||||
fprintf(stderr, "Error: non existent action: %s\n",k);
|
||||
ret = -1;
|
||||
goto bad_val;
|
||||
@ -536,7 +536,7 @@ int tc_act_list_or_flush(int argc, char **argv, int event)
|
||||
}
|
||||
#endif
|
||||
a = get_action_kind(k);
|
||||
if (NULL == a) {
|
||||
if (NULL == a) {
|
||||
fprintf(stderr,"bad action %s\n",k);
|
||||
goto bad_val;
|
||||
}
|
||||
@ -553,7 +553,7 @@ int tc_act_list_or_flush(int argc, char **argv, int event)
|
||||
|
||||
msg_size = NLMSG_ALIGN(req.n.nlmsg_len) - NLMSG_ALIGN(sizeof(struct nlmsghdr));
|
||||
|
||||
if (event == RTM_GETACTION) {
|
||||
if (event == RTM_GETACTION) {
|
||||
if (rtnl_dump_request(&rth, event, (void *)&req.t, msg_size) < 0) {
|
||||
perror("Cannot send dump request");
|
||||
return 1;
|
||||
@ -561,7 +561,7 @@ int tc_act_list_or_flush(int argc, char **argv, int event)
|
||||
ret = rtnl_dump_filter(&rth, print_action, stdout, NULL, NULL);
|
||||
}
|
||||
|
||||
if (event == RTM_DELACTION) {
|
||||
if (event == RTM_DELACTION) {
|
||||
req.n.nlmsg_len = NLMSG_ALIGN(req.n.nlmsg_len);
|
||||
req.n.nlmsg_type = RTM_DELACTION;
|
||||
req.n.nlmsg_flags |= NLM_F_ROOT;
|
||||
|
||||
@ -45,7 +45,7 @@ static inline void map_warning(int num, char *kind)
|
||||
"Error: Unable to find ematch \"%s\" in %s\n" \
|
||||
"Please assign a unique ID to the ematch kind the suggested " \
|
||||
"entry is:\n" \
|
||||
"\t%d\t%s\n",
|
||||
"\t%d\t%s\n",
|
||||
kind, EMATCH_MAP, num, kind);
|
||||
}
|
||||
|
||||
@ -66,7 +66,7 @@ static int lookup_map(__u16 num, char *dst, int len, const char *file)
|
||||
p++;
|
||||
if (*p == '#' || *p == '\n' || *p == 0)
|
||||
continue;
|
||||
|
||||
|
||||
if (sscanf(p, "%d %s", &id, namebuf) != 2) {
|
||||
fprintf(stderr, "ematch map %s corrupted at %s\n",
|
||||
file, p);
|
||||
@ -104,7 +104,7 @@ static int lookup_map_id(char *kind, int *dst, const char *file)
|
||||
p++;
|
||||
if (*p == '#' || *p == '\n' || *p == 0)
|
||||
continue;
|
||||
|
||||
|
||||
if (sscanf(p, "%d %s", &id, namebuf) != 2) {
|
||||
fprintf(stderr, "ematch map %s corrupted at %s\n",
|
||||
file, p);
|
||||
@ -185,7 +185,7 @@ static int parse_tree(struct nlmsghdr *n, struct ematch *tree)
|
||||
|
||||
if (t->inverted)
|
||||
hdr.flags |= TCF_EM_INVERT;
|
||||
|
||||
|
||||
addattr_l(n, MAX_MSG, index++, NULL, 0);
|
||||
|
||||
if (t->child) {
|
||||
@ -278,7 +278,7 @@ int em_parse_error(int err, struct bstr *args, struct bstr *carg,
|
||||
begin_argv++;
|
||||
begin_argc--;
|
||||
}
|
||||
|
||||
|
||||
fprintf(stderr, "...\n");
|
||||
|
||||
if (args) {
|
||||
@ -437,7 +437,7 @@ static int print_ematch_seq(FILE *fd, struct rtattr **tb, int start,
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -68,7 +68,7 @@ static inline unsigned long bstrtoul(struct bstr *b)
|
||||
|
||||
memcpy(buf, b->data, b->len);
|
||||
buf[b->len] = '\0';
|
||||
|
||||
|
||||
l = strtol(buf, &inv, 0);
|
||||
if (l == ULONG_MAX || inv == buf)
|
||||
return LONG_MAX;
|
||||
|
||||
@ -39,7 +39,7 @@ int parse_estimator(int *p_argc, char ***p_argv, struct tc_estimator *est)
|
||||
int argc = *p_argc;
|
||||
char **argv = *p_argv;
|
||||
unsigned A, time_const;
|
||||
|
||||
|
||||
NEXT_ARG();
|
||||
if (est->ewma_log)
|
||||
duparg("estimator", *argv);
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
/*
|
||||
* m_gact.c generic actions module
|
||||
* m_gact.c generic actions module
|
||||
*
|
||||
* This program is free software; you can distribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version
|
||||
* 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* Authors: J Hadi Salim (hadi@cyberus.ca)
|
||||
*
|
||||
* Authors: J Hadi Salim (hadi@cyberus.ca)
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
@ -27,7 +27,7 @@
|
||||
/* define to turn on probablity stuff */
|
||||
|
||||
#ifdef CONFIG_GACT_PROB
|
||||
static const char *prob_n2a(int p)
|
||||
static const char *prob_n2a(int p)
|
||||
{
|
||||
if (p == PGACT_NONE)
|
||||
return "none";
|
||||
|
||||
16
tc/m_ipt.c
16
tc/m_ipt.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* m_ipt.c iptables based targets
|
||||
* m_ipt.c iptables based targets
|
||||
* utilities mostly ripped from iptables <duh, its the linux way>
|
||||
*
|
||||
* This program is free software; you can distribute it and/or
|
||||
@ -7,8 +7,8 @@
|
||||
* as published by the Free Software Foundation; either version
|
||||
* 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* Authors: J Hadi Salim (hadi@cyberus.ca)
|
||||
*
|
||||
* Authors: J Hadi Salim (hadi@cyberus.ca)
|
||||
*
|
||||
* TODO: bad bad hardcoding IPT_LIB_DIR and PROC_SYS_MODPROBE
|
||||
*
|
||||
*/
|
||||
@ -126,7 +126,7 @@ addr_to_dotted(const struct in_addr *addrp)
|
||||
return buf;
|
||||
}
|
||||
|
||||
int string_to_number_ll(const char *s, unsigned long long min,
|
||||
int string_to_number_ll(const char *s, unsigned long long min,
|
||||
unsigned long long max,
|
||||
unsigned long long *ret)
|
||||
{
|
||||
@ -341,7 +341,7 @@ static void set_revision(char *name, u_int8_t revision)
|
||||
name[IPT_FUNCTION_MAXNAMELEN - 1] = revision;
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* we may need to check for version mismatch
|
||||
*/
|
||||
int
|
||||
@ -372,7 +372,7 @@ build_st(struct iptables_target *target, struct ipt_entry_target *t)
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int parse_ipt(struct action_util *a,int *argc_p,
|
||||
static int parse_ipt(struct action_util *a,int *argc_p,
|
||||
char ***argv_p, int tca_id, struct nlmsghdr *n)
|
||||
{
|
||||
struct iptables_target *m = NULL;
|
||||
@ -503,7 +503,7 @@ static int parse_ipt(struct action_util *a,int *argc_p,
|
||||
argv += optind;
|
||||
*argc_p = rargc - iargc;
|
||||
*argv_p = argv;
|
||||
|
||||
|
||||
optind = 1;
|
||||
free_opts(opts);
|
||||
|
||||
@ -578,7 +578,7 @@ print_ipt(struct action_util *au,FILE * f, struct rtattr *arg)
|
||||
struct tcf_t *tm = RTA_DATA(tb[TCA_IPT_TM]);
|
||||
print_tm(f,tm);
|
||||
}
|
||||
}
|
||||
}
|
||||
fprintf(f, " \n");
|
||||
|
||||
}
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
/*
|
||||
* m_egress.c ingress/egress packet mirror/redir actions module
|
||||
* m_egress.c ingress/egress packet mirror/redir actions module
|
||||
*
|
||||
* This program is free software; you can distribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version
|
||||
* 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* Authors: J Hadi Salim (hadi@cyberus.ca)
|
||||
*
|
||||
* Authors: J Hadi Salim (hadi@cyberus.ca)
|
||||
*
|
||||
* TODO: Add Ingress support
|
||||
*
|
||||
*/
|
||||
@ -247,7 +247,7 @@ parse_mirred(struct action_util *a, int *argc_p, char ***argv_p, int tca_id, str
|
||||
}
|
||||
|
||||
return -1;
|
||||
|
||||
|
||||
}
|
||||
|
||||
int
|
||||
|
||||
26
tc/m_pedit.c
26
tc/m_pedit.c
@ -1,18 +1,18 @@
|
||||
/*
|
||||
* m_pedit.c generic packet editor actions module
|
||||
* m_pedit.c generic packet editor actions module
|
||||
*
|
||||
* This program is free software; you can distribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version
|
||||
* 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* Authors: J Hadi Salim (hadi@cyberus.ca)
|
||||
*
|
||||
* TODO:
|
||||
* Authors: J Hadi Salim (hadi@cyberus.ca)
|
||||
*
|
||||
* TODO:
|
||||
* 1) Big endian broken in some spots
|
||||
* 2) A lot of this stuff was added on the fly; get a big double-double
|
||||
* and clean it up at some point.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
@ -37,7 +37,7 @@ explain(void)
|
||||
{
|
||||
fprintf(stderr, "Usage: ... pedit munge <MUNGE>\n");
|
||||
fprintf(stderr,
|
||||
"Where: MUNGE := <RAW>|<LAYERED>\n"
|
||||
"Where: MUNGE := <RAW>|<LAYERED>\n"
|
||||
"\t<RAW>:= <OFFSETC>[ATC]<CMD>\n "
|
||||
"\t\tOFFSETC:= offset <offval> <u8|u16|u32>\n "
|
||||
"\t\tATC:= at <atval> offmask <maskval> shift <shiftval>\n "
|
||||
@ -58,8 +58,8 @@ usage(void)
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
static int
|
||||
pedit_parse_nopopt (int *argc_p, char ***argv_p,struct tc_pedit_sel *sel,struct tc_pedit_key *tkey)
|
||||
static int
|
||||
pedit_parse_nopopt (int *argc_p, char ***argv_p,struct tc_pedit_sel *sel,struct tc_pedit_key *tkey)
|
||||
{
|
||||
int argc = *argc_p;
|
||||
char **argv = *argv_p;
|
||||
@ -73,7 +73,7 @@ pedit_parse_nopopt (int *argc_p, char ***argv_p,struct tc_pedit_sel *sel,struct
|
||||
|
||||
}
|
||||
|
||||
struct m_pedit_util
|
||||
struct m_pedit_util
|
||||
*get_pedit_kind(char *str)
|
||||
{
|
||||
static void *pBODY;
|
||||
@ -227,7 +227,7 @@ pack_key8(__u32 retain,struct tc_pedit_sel *sel,struct tc_pedit_key *tkey)
|
||||
retain <<= stride;
|
||||
tkey->mask = retain|m[ind];
|
||||
tkey->off &= ~3;
|
||||
|
||||
|
||||
if (pedit_debug)
|
||||
printf("pack_key8: Final word off %d val %08x mask %08x \n",tkey->off , tkey->val,tkey->mask);
|
||||
return pack_key(sel,tkey);
|
||||
@ -293,7 +293,7 @@ parse_cmd(int *argc_p, char ***argv_p, __u32 len, int type,__u32 retain,struct t
|
||||
} else if (matches(*argv, "preserve") == 0) {
|
||||
retain = mask = o;
|
||||
} else {
|
||||
if (matches(*argv, "clear") != 0)
|
||||
if (matches(*argv, "clear") != 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -390,7 +390,7 @@ done:
|
||||
tkey->at = atv;
|
||||
|
||||
NEXT_ARG();
|
||||
|
||||
|
||||
if (get_u32(&offmask, *argv, 16))
|
||||
return -1;
|
||||
tkey->offmask = offmask;
|
||||
@ -595,7 +595,7 @@ print_pedit(struct action_util *au,FILE * f, struct rtattr *arg)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
int
|
||||
pedit_print_xstats(struct action_util *au, FILE *f, struct rtattr *xstats)
|
||||
{
|
||||
return 0;
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
/*
|
||||
* m_pedit.h generic packet editor actions module
|
||||
* m_pedit.h generic packet editor actions module
|
||||
*
|
||||
* This program is free software; you can distribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version
|
||||
* 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* Authors: J Hadi Salim (hadi@cyberus.ca)
|
||||
*
|
||||
* Authors: J Hadi Salim (hadi@cyberus.ca)
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _ACT_PEDIT_H_
|
||||
|
||||
@ -7,8 +7,8 @@
|
||||
* 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
|
||||
* FIXES: 19990619 - J Hadi Salim (hadi@cyberus.ca)
|
||||
* simple addattr packaging fix.
|
||||
* FIXES: 19990619 - J Hadi Salim (hadi@cyberus.ca)
|
||||
* simple addattr packaging fix.
|
||||
* 2002: J Hadi Salim - Add tc action extensions syntax
|
||||
*
|
||||
*/
|
||||
@ -37,8 +37,8 @@ static void usage(void)
|
||||
fprintf(stderr, "Usage: ... police rate BPS burst BYTES[/BYTES] [ mtu BYTES[/BYTES] ]\n");
|
||||
fprintf(stderr, " [ peakrate BPS ] [ avrate BPS ]\n");
|
||||
fprintf(stderr, " [ ACTIONTERM ]\n");
|
||||
fprintf(stderr, "Old Syntax ACTIONTERM := action <EXCEEDACT>[/NOTEXCEEDACT] \n");
|
||||
fprintf(stderr, "New Syntax ACTIONTERM := conform-exceed <EXCEEDACT>[/NOTEXCEEDACT] \n");
|
||||
fprintf(stderr, "Old Syntax ACTIONTERM := action <EXCEEDACT>[/NOTEXCEEDACT] \n");
|
||||
fprintf(stderr, "New Syntax ACTIONTERM := conform-exceed <EXCEEDACT>[/NOTEXCEEDACT] \n");
|
||||
fprintf(stderr, "Where: *EXCEEDACT := pipe | ok | reclassify | drop | continue \n");
|
||||
fprintf(stderr, "Where: pipe is only valid for new syntax \n");
|
||||
exit(-1);
|
||||
@ -133,7 +133,7 @@ int act_parse_police(struct action_util *a,int *argc_p, char ***argv_p, int tca_
|
||||
__u32 avrate = 0;
|
||||
int presult = 0;
|
||||
unsigned buffer=0, mtu=0, mpu=0;
|
||||
int Rcell_log=-1, Pcell_log = -1;
|
||||
int Rcell_log=-1, Pcell_log = -1;
|
||||
struct rtattr *tail;
|
||||
|
||||
memset(&p, 0, sizeof(p));
|
||||
@ -304,7 +304,7 @@ int parse_police(int *argc_p, char ***argv_p, int tca_id, struct nlmsghdr *n)
|
||||
return act_parse_police(NULL,argc_p,argv_p,tca_id,n);
|
||||
}
|
||||
|
||||
int
|
||||
int
|
||||
print_police(struct action_util *a, FILE *f, struct rtattr *arg)
|
||||
{
|
||||
SPRINT_BUF(b1);
|
||||
@ -350,7 +350,7 @@ print_police(struct action_util *a, FILE *f, struct rtattr *arg)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
int
|
||||
tc_print_police(FILE *f, struct rtattr *arg) {
|
||||
return print_police(&police_action_util,f,arg);
|
||||
}
|
||||
|
||||
@ -6,8 +6,8 @@
|
||||
* as published by the Free Software Foundation; either version
|
||||
* 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* Authors: J Hadi Salim (hadi@cyberus.ca)
|
||||
*
|
||||
* Authors: J Hadi Salim (hadi@cyberus.ca)
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
/*
|
||||
* m_pedit.c packet editor: IPV4/6 header
|
||||
* m_pedit.c packet editor: IPV4/6 header
|
||||
*
|
||||
* This program is free software; you can distribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version
|
||||
* 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* Authors: J Hadi Salim (hadi@cyberus.ca)
|
||||
*
|
||||
* Authors: J Hadi Salim (hadi@cyberus.ca)
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
@ -6,8 +6,8 @@
|
||||
* as published by the Free Software Foundation; either version
|
||||
* 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* Authors: J Hadi Salim (hadi@cyberus.ca)
|
||||
*
|
||||
* Authors: J Hadi Salim (hadi@cyberus.ca)
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
@ -6,8 +6,8 @@
|
||||
* as published by the Free Software Foundation; either version
|
||||
* 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* Authors: J Hadi Salim (hadi@cyberus.ca)
|
||||
*
|
||||
* Authors: J Hadi Salim (hadi@cyberus.ca)
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
@ -53,7 +53,7 @@ static int cbq_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nl
|
||||
struct tc_cbq_lssopt lss;
|
||||
__u32 rtab[256];
|
||||
unsigned mpu=0, avpkt=0, allot=0;
|
||||
int cell_log=-1;
|
||||
int cell_log=-1;
|
||||
int ewma_log=-1;
|
||||
struct rtattr *tail;
|
||||
|
||||
@ -176,7 +176,7 @@ static int cbq_parse_class_opt(struct qdisc_util *qu, int argc, char **argv, str
|
||||
struct tc_cbq_ovl ovl;
|
||||
__u32 rtab[256];
|
||||
unsigned mpu=0;
|
||||
int cell_log=-1;
|
||||
int cell_log=-1;
|
||||
int ewma_log=-1;
|
||||
unsigned bndw = 0;
|
||||
unsigned minburst=0, maxburst=0;
|
||||
@ -451,7 +451,7 @@ static int cbq_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
|
||||
if (tb[TCA_CBQ_OVL_STRATEGY]) {
|
||||
if (RTA_PAYLOAD(tb[TCA_CBQ_OVL_STRATEGY]) < sizeof(*ovl))
|
||||
fprintf(stderr, "CBQ: too short overlimit strategy %u/%u\n",
|
||||
(unsigned) RTA_PAYLOAD(tb[TCA_CBQ_OVL_STRATEGY]),
|
||||
(unsigned) RTA_PAYLOAD(tb[TCA_CBQ_OVL_STRATEGY]),
|
||||
(unsigned) sizeof(*ovl));
|
||||
else
|
||||
ovl = RTA_DATA(tb[TCA_CBQ_OVL_STRATEGY]);
|
||||
|
||||
10
tc/q_gred.c
10
tc/q_gred.c
@ -6,9 +6,9 @@
|
||||
* as published by the Free Software Foundation; either version
|
||||
* 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* Authors: J Hadi Salim(hadi@nortelnetworks.com)
|
||||
* code ruthlessly ripped from
|
||||
* Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
|
||||
* Authors: J Hadi Salim(hadi@nortelnetworks.com)
|
||||
* code ruthlessly ripped from
|
||||
* Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
|
||||
*
|
||||
*/
|
||||
|
||||
@ -140,7 +140,7 @@ static int gred_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct n
|
||||
return -1;
|
||||
}
|
||||
return init_gred(qu,argc-1, argv+1,n);
|
||||
|
||||
|
||||
} else if (strcmp(*argv, "min") == 0) {
|
||||
NEXT_ARG();
|
||||
if (get_size(&opt.qth_min, *argv)) {
|
||||
@ -276,7 +276,7 @@ static int gred_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
|
||||
fprintf(f,"\n GRED received message smaller than expected\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/* Bad hack! should really return a proper message as shown above*/
|
||||
|
||||
for (i=0;i<MAX_DPs;i++, qopt++) {
|
||||
|
||||
@ -260,7 +260,7 @@ hfsc_print_class_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
|
||||
usc = RTA_DATA(tb[TCA_HFSC_USC]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (rsc != NULL && fsc != NULL &&
|
||||
memcmp(rsc, fsc, sizeof(*rsc)) == 0)
|
||||
hfsc_print_sc(f, "sc", rsc);
|
||||
@ -275,7 +275,7 @@ hfsc_print_class_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
struct qdisc_util hfsc_qdisc_util = {
|
||||
.id = "hfsc",
|
||||
.parse_qopt = hfsc_parse_opt,
|
||||
|
||||
@ -216,7 +216,7 @@ static int htb_parse_class_opt(struct qdisc_util *qu, int argc, char **argv, str
|
||||
}
|
||||
opt.buffer = tc_calc_xmittime(opt.rate.rate, buffer);
|
||||
opt.rate.cell_log = cell_log;
|
||||
|
||||
|
||||
if ((ccell_log = tc_calc_rtable(opt.ceil.rate, ctab, cell_log, mtu, mpu)) < 0) {
|
||||
fprintf(stderr, "htb: failed to calculate ceil rate table.\n");
|
||||
return -1;
|
||||
@ -279,14 +279,14 @@ static int htb_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
|
||||
fprintf(f, "cburst %s ", sprint_size(cbuffer, b1));
|
||||
}
|
||||
if (show_raw)
|
||||
fprintf(f, "buffer [%08x] cbuffer [%08x] ",
|
||||
fprintf(f, "buffer [%08x] cbuffer [%08x] ",
|
||||
hopt->buffer,hopt->cbuffer);
|
||||
}
|
||||
if (tb[TCA_HTB_INIT]) {
|
||||
gopt = RTA_DATA(tb[TCA_HTB_INIT]);
|
||||
if (RTA_PAYLOAD(tb[TCA_HTB_INIT]) < sizeof(*gopt)) return -1;
|
||||
|
||||
fprintf(f, "r2q %d default %x direct_packets_stat %u",
|
||||
fprintf(f, "r2q %d default %x direct_packets_stat %u",
|
||||
gopt->rate2quantum,gopt->defcls,gopt->direct_pkts);
|
||||
if (show_details)
|
||||
fprintf(f," ver %d.%d",gopt->version >> 16,gopt->version & 0xffff);
|
||||
@ -304,7 +304,7 @@ static int htb_print_xstats(struct qdisc_util *qu, FILE *f, struct rtattr *xstat
|
||||
return -1;
|
||||
|
||||
st = RTA_DATA(xstats);
|
||||
fprintf(f, " lended: %u borrowed: %u giants: %u\n",
|
||||
fprintf(f, " lended: %u borrowed: %u giants: %u\n",
|
||||
st->lends,st->borrows,st->giants);
|
||||
fprintf(f, " tokens: %d ctokens: %d\n", st->tokens,st->ctokens);
|
||||
return 0;
|
||||
|
||||
30
tc/q_netem.c
30
tc/q_netem.c
@ -27,7 +27,7 @@
|
||||
|
||||
static void explain(void)
|
||||
{
|
||||
fprintf(stderr,
|
||||
fprintf(stderr,
|
||||
"Usage: ... netem [ limit PACKETS ] \n" \
|
||||
" [ delay TIME [ JITTER [CORRELATION]]]\n" \
|
||||
" [ distribution {uniform|normal|pareto|paretonormal} ]\n" \
|
||||
@ -62,11 +62,11 @@ static int get_distribution(const char *type, __s16 *data)
|
||||
|
||||
snprintf(name, sizeof(name), "/usr/lib/tc/%s.dist", type);
|
||||
if ((f = fopen(name, "r")) == NULL) {
|
||||
fprintf(stderr, "No distribution data for %s (%s: %s)\n",
|
||||
fprintf(stderr, "No distribution data for %s (%s: %s)\n",
|
||||
type, name, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
n = 0;
|
||||
while (getline(&line, &len, f) != -1) {
|
||||
char *p, *endp;
|
||||
@ -75,7 +75,7 @@ static int get_distribution(const char *type, __s16 *data)
|
||||
|
||||
for (p = line; ; p = endp) {
|
||||
x = strtol(p, &endp, 0);
|
||||
if (endp == p)
|
||||
if (endp == p)
|
||||
break;
|
||||
|
||||
if (n >= MAXDIST) {
|
||||
@ -93,7 +93,7 @@ static int get_distribution(const char *type, __s16 *data)
|
||||
return n;
|
||||
}
|
||||
|
||||
static int isnumber(const char *arg)
|
||||
static int isnumber(const char *arg)
|
||||
{
|
||||
char *p;
|
||||
(void) strtod(arg, &p);
|
||||
@ -102,7 +102,7 @@ static int isnumber(const char *arg)
|
||||
|
||||
#define NEXT_IS_NUMBER() (NEXT_ARG_OK() && isnumber(argv[1]))
|
||||
|
||||
/* Adjust for the fact that psched_ticks aren't always usecs
|
||||
/* Adjust for the fact that psched_ticks aren't always usecs
|
||||
(based on kernel PSCHED_CLOCK configuration */
|
||||
static int get_ticks(__u32 *ticks, const char *str)
|
||||
{
|
||||
@ -110,7 +110,7 @@ static int get_ticks(__u32 *ticks, const char *str)
|
||||
|
||||
if(get_usecs(&t, str))
|
||||
return -1;
|
||||
|
||||
|
||||
if (tc_core_usec2big(t)) {
|
||||
fprintf(stderr, "Illegal %d usecs (too large)\n", t);
|
||||
return -1;
|
||||
@ -126,7 +126,7 @@ static char *sprint_ticks(__u32 ticks, char *buf)
|
||||
}
|
||||
|
||||
|
||||
static int netem_parse_opt(struct qdisc_util *qu, int argc, char **argv,
|
||||
static int netem_parse_opt(struct qdisc_util *qu, int argc, char **argv,
|
||||
struct nlmsghdr *n)
|
||||
{
|
||||
size_t dist_size = 0;
|
||||
@ -167,7 +167,7 @@ static int netem_parse_opt(struct qdisc_util *qu, int argc, char **argv,
|
||||
|
||||
if (NEXT_IS_NUMBER()) {
|
||||
NEXT_ARG();
|
||||
if (get_percent(&cor.delay_corr,
|
||||
if (get_percent(&cor.delay_corr,
|
||||
*argv)) {
|
||||
explain1("latency");
|
||||
return -1;
|
||||
@ -317,7 +317,7 @@ static int netem_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
|
||||
struct rtattr *tb[TCA_NETEM_MAX+1];
|
||||
parse_rtattr(tb, TCA_NETEM_MAX, RTA_DATA(opt) + sizeof(qopt),
|
||||
len);
|
||||
|
||||
|
||||
if (tb[TCA_NETEM_CORR]) {
|
||||
if (RTA_PAYLOAD(tb[TCA_NETEM_CORR]) < sizeof(*cor))
|
||||
return -1;
|
||||
@ -359,20 +359,20 @@ static int netem_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
|
||||
if (cor && cor->dup_corr)
|
||||
fprintf(f, " %s", sprint_percent(cor->dup_corr, b1));
|
||||
}
|
||||
|
||||
|
||||
if (reorder && reorder->probability) {
|
||||
fprintf(f, " reorder %s",
|
||||
fprintf(f, " reorder %s",
|
||||
sprint_percent(reorder->probability, b1));
|
||||
if (reorder->correlation)
|
||||
fprintf(f, " %s",
|
||||
fprintf(f, " %s",
|
||||
sprint_percent(reorder->correlation, b1));
|
||||
}
|
||||
|
||||
if (corrupt && corrupt->probability) {
|
||||
fprintf(f, " corrupt %s",
|
||||
fprintf(f, " corrupt %s",
|
||||
sprint_percent(corrupt->probability, b1));
|
||||
if (corrupt->correlation)
|
||||
fprintf(f, " %s",
|
||||
fprintf(f, " %s",
|
||||
sprint_percent(corrupt->correlation, b1));
|
||||
}
|
||||
|
||||
|
||||
@ -205,7 +205,7 @@ static int red_print_xstats(struct qdisc_util *qu, FILE *f, struct rtattr *xstat
|
||||
fprintf(f, " marked %u early %u pdrop %u other %u",
|
||||
st->marked, st->early, st->pdrop, st->other);
|
||||
return 0;
|
||||
|
||||
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -44,7 +44,7 @@ static int tbf_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nl
|
||||
__u32 rtab[256];
|
||||
__u32 ptab[256];
|
||||
unsigned buffer=0, mtu=0, mpu=0, latency=0;
|
||||
int Rcell_log=-1, Pcell_log = -1;
|
||||
int Rcell_log=-1, Pcell_log = -1;
|
||||
struct rtattr *tail;
|
||||
|
||||
memset(&opt, 0, sizeof(opt));
|
||||
|
||||
10
tc/tc.c
10
tc/tc.c
@ -42,11 +42,11 @@ static void *BODY = NULL; /* cached handle dlopen(NULL) */
|
||||
static struct qdisc_util * qdisc_list;
|
||||
static struct filter_util * filter_list;
|
||||
|
||||
static int print_noqopt(struct qdisc_util *qu, FILE *f,
|
||||
static int print_noqopt(struct qdisc_util *qu, FILE *f,
|
||||
struct rtattr *opt)
|
||||
{
|
||||
if (opt && RTA_PAYLOAD(opt))
|
||||
fprintf(f, "[Unknown qdisc, optlen=%u] ",
|
||||
fprintf(f, "[Unknown qdisc, optlen=%u] ",
|
||||
(unsigned) RTA_PAYLOAD(opt));
|
||||
return 0;
|
||||
}
|
||||
@ -63,7 +63,7 @@ static int parse_noqopt(struct qdisc_util *qu, int argc, char **argv, struct nlm
|
||||
static int print_nofopt(struct filter_util *qu, FILE *f, struct rtattr *opt, __u32 fhandle)
|
||||
{
|
||||
if (opt && RTA_PAYLOAD(opt))
|
||||
fprintf(f, "fh %08x [Unknown filter, optlen=%u] ",
|
||||
fprintf(f, "fh %08x [Unknown filter, optlen=%u] ",
|
||||
fhandle, (unsigned) RTA_PAYLOAD(opt));
|
||||
else if (fhandle)
|
||||
fprintf(f, "fh %08x ", fhandle);
|
||||
@ -206,8 +206,8 @@ static int do_cmd(int argc, char **argv)
|
||||
usage();
|
||||
return 0;
|
||||
}
|
||||
|
||||
fprintf(stderr, "Object \"%s\" is unknown, try \"tc help\".\n",
|
||||
|
||||
fprintf(stderr, "Object \"%s\" is unknown, try \"tc help\".\n",
|
||||
*argv);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -147,7 +147,7 @@ int tc_class_modify(int cmd, unsigned flags, int argc, char **argv)
|
||||
int filter_ifindex;
|
||||
__u32 filter_qdisc;
|
||||
|
||||
int print_class(const struct sockaddr_nl *who,
|
||||
int print_class(const struct sockaddr_nl *who,
|
||||
struct nlmsghdr *n, void *arg)
|
||||
{
|
||||
FILE *fp = (FILE*)arg;
|
||||
@ -213,7 +213,7 @@ int print_class(const struct sockaddr_nl *who,
|
||||
fprintf(fp, "\n");
|
||||
if (show_stats) {
|
||||
struct rtattr *xstats = NULL;
|
||||
|
||||
|
||||
if (tb[TCA_STATS] || tb[TCA_STATS2]) {
|
||||
print_tcstats_attr(fp, tb, " ", &xstats);
|
||||
fprintf(fp, "\n");
|
||||
|
||||
@ -177,7 +177,7 @@ static __u32 filter_prio;
|
||||
static __u32 filter_protocol;
|
||||
|
||||
int print_filter(const struct sockaddr_nl *who,
|
||||
struct nlmsghdr *n,
|
||||
struct nlmsghdr *n,
|
||||
void *arg)
|
||||
{
|
||||
FILE *fp = (FILE*)arg;
|
||||
|
||||
@ -154,7 +154,7 @@ int tc_qdisc_modify(int cmd, unsigned flags, int argc, char **argv)
|
||||
req.t.tcm_ifindex = idx;
|
||||
}
|
||||
|
||||
if (rtnl_talk(&rth, &req.n, 0, 0, NULL, NULL, NULL) < 0)
|
||||
if (rtnl_talk(&rth, &req.n, 0, 0, NULL, NULL, NULL) < 0)
|
||||
return 2;
|
||||
|
||||
return 0;
|
||||
@ -162,8 +162,8 @@ int tc_qdisc_modify(int cmd, unsigned flags, int argc, char **argv)
|
||||
|
||||
static int filter_ifindex;
|
||||
|
||||
int print_qdisc(const struct sockaddr_nl *who,
|
||||
struct nlmsghdr *n,
|
||||
int print_qdisc(const struct sockaddr_nl *who,
|
||||
struct nlmsghdr *n,
|
||||
void *arg)
|
||||
{
|
||||
FILE *fp = (FILE*)arg;
|
||||
@ -209,13 +209,13 @@ int print_qdisc(const struct sockaddr_nl *who,
|
||||
if (t->tcm_info != 1) {
|
||||
fprintf(fp, "refcnt %d ", t->tcm_info);
|
||||
}
|
||||
/* pfifo_fast is generic enough to warrant the hardcoding --JHS */
|
||||
|
||||
/* pfifo_fast is generic enough to warrant the hardcoding --JHS */
|
||||
|
||||
if (0 == strcmp("pfifo_fast", RTA_DATA(tb[TCA_KIND])))
|
||||
q = get_qdisc_kind("prio");
|
||||
else
|
||||
q = get_qdisc_kind(RTA_DATA(tb[TCA_KIND]));
|
||||
|
||||
|
||||
if (tb[TCA_OPTIONS]) {
|
||||
if (q)
|
||||
q->print_qopt(q, fp, tb[TCA_OPTIONS]);
|
||||
@ -249,7 +249,7 @@ int tc_qdisc_list(int argc, char **argv)
|
||||
memset(&t, 0, sizeof(t));
|
||||
t.tcm_family = AF_UNSPEC;
|
||||
memset(&d, 0, sizeof(d));
|
||||
|
||||
|
||||
while (argc > 0) {
|
||||
if (strcmp(*argv, "dev") == 0) {
|
||||
NEXT_ARG();
|
||||
|
||||
@ -450,7 +450,7 @@ void print_tcstats2_attr(FILE *fp, struct rtattr *rta, char *prefix, struct rtat
|
||||
fprintf(fp, " (dropped %u, overlimits %u requeues %u) ",
|
||||
q.drops, q.overlimits, q.requeues);
|
||||
}
|
||||
|
||||
|
||||
if (tbs[TCA_STATS_RATE_EST]) {
|
||||
struct gnet_stats_rate_est re = {0};
|
||||
memcpy(&re, RTA_DATA(tbs[TCA_STATS_RATE_EST]), MIN(RTA_PAYLOAD(tbs[TCA_STATS_RATE_EST]), sizeof(re)));
|
||||
@ -490,7 +490,7 @@ void print_tcstats_attr(FILE *fp, struct rtattr *tb[], char *prefix, struct rtat
|
||||
memcpy(&st, RTA_DATA(tb[TCA_STATS]), MIN(RTA_PAYLOAD(tb[TCA_STATS]), sizeof(st)));
|
||||
|
||||
fprintf(fp, "%sSent %llu bytes %u pkts (dropped %u, overlimits %u) ",
|
||||
prefix, (unsigned long long)st.bytes, st.packets, st.drops,
|
||||
prefix, (unsigned long long)st.bytes, st.packets, st.drops,
|
||||
st.overlimits);
|
||||
|
||||
if (st.bps || st.pps || st.qlen || st.backlog) {
|
||||
|
||||
@ -23,7 +23,7 @@ struct filter_util
|
||||
{
|
||||
struct filter_util *next;
|
||||
char id[16];
|
||||
int (*parse_fopt)(struct filter_util *qu, char *fhandle, int argc,
|
||||
int (*parse_fopt)(struct filter_util *qu, char *fhandle, int argc,
|
||||
char **argv, struct nlmsghdr *n);
|
||||
int (*print_fopt)(struct filter_util *qu, FILE *f, struct rtattr *opt, __u32 fhandle);
|
||||
};
|
||||
@ -32,7 +32,7 @@ struct action_util
|
||||
{
|
||||
struct action_util *next;
|
||||
char id[16];
|
||||
int (*parse_aopt)(struct action_util *a, int *argc, char ***argv,
|
||||
int (*parse_aopt)(struct action_util *a, int *argc, char ***argv,
|
||||
int code, struct nlmsghdr *n);
|
||||
int (*print_aopt)(struct action_util *au, FILE *f, struct rtattr *opt);
|
||||
int (*print_xstats)(struct action_util *au, FILE *f, struct rtattr *xstats);
|
||||
@ -72,9 +72,9 @@ extern int parse_police(int *, char ***, int, struct nlmsghdr *);
|
||||
extern char *action_n2a(int action, char *buf, int len);
|
||||
extern int action_a2n(char *arg, int *result);
|
||||
extern int act_parse_police(struct action_util *a,int *, char ***, int, struct nlmsghdr *);
|
||||
extern int print_police(struct action_util *a, FILE *f,
|
||||
extern int print_police(struct action_util *a, FILE *f,
|
||||
struct rtattr *tb);
|
||||
extern int police_print_xstats(struct action_util *a,FILE *f,
|
||||
extern int police_print_xstats(struct action_util *a,FILE *f,
|
||||
struct rtattr *tb);
|
||||
extern int tc_print_action(FILE *f, const struct rtattr *tb);
|
||||
extern int tc_print_ipt(FILE *f, const struct rtattr *tb);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user