struct ip6tables_target
{
struct ip6tables_target *next;
-
+
ip6t_chainlabel name;
const char *version;
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);
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);
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);
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,
#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);
#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);
#define AF_DECnet 12
#endif
-struct dn_naddr
+struct dn_naddr
{
unsigned short a_len;
unsigned char a_addr[DN_MAXADDL];
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));
( 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
basename = argv[0];
else
basename++;
-
+
while (argc > 1) {
char *opt = argv[1];
if (strcmp(opt,"--") == 0) {
_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);
/*
* 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
* Author:
* Masahide NAKAMURA @USAGI
*/
-
+
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
{
char remote[64];
char local[64];
-
+
inet_ntop(AF_INET6, &p->raddr, remote, sizeof(remote));
inet_ntop(AF_INET6, &p->laddr, local, sizeof(local));
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;
-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);
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);
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;
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;
#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_);
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;
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;
}
-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;
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)
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);
}
close(s);
- return 0;
+ return 0;
}
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);
}
close(s);
- return 0;
+ return 0;
}
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;
}
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;
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)
return -1;
}
close(s);
- return 0;
+ return 0;
}
}
if (newbrd) {
if (parse_address(dev, htype, halen, newbrd, &ifr1) < 0)
- return -1;
+ return -1;
}
}
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)
fprintf(fp, "family %d ", list->addr.family);
break;
}
- fprintf(fp, "%s",
+ fprintf(fp, "%s",
format_host(list->addr.family,
-1,
list->addr.data,
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);
if (sscanf(buf, "%d%s", &vifi, dev) < 2)
continue;
-
+
if (vifi<0 || vifi>31)
continue;
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)));
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));
}
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]),
/*
* 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
/*
* 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
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);
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 &&
}
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]),
/* 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]),
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]),
}
len = strlen (buffer);
-
+
if ((write (flush_fd, (void *)buffer, len)) < len) {
fprintf (stderr, "Cannot flush routing cache\n");
return -1;
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) {
{
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);
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]),
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;
}
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;
printf(" ttl %d ", p->iph.ttl);
else
printf(" ttl inherit ");
-
+
if (p->iph.tos) {
SPRINT_BUF(b1);
printf(" tos");
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:
/*
* 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
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);
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;
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_);
}
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;
/*
* 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
/*
* 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
/*
* 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
/*
* 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
/*
* 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
/*
* 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
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");
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);
*(str + pos) = '.';
pos++;
-
+
for(i = 0; i < 6; i++) {
if (do_digit(str + pos, addr->ipx_node[i], 1, &pos, len))
return str;
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;
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" },
{
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;
*cp = 0;
cp = strchr(line1, '#');
- if (cp)
+ if (cp)
*cp = '\0';
*linep = realloc(*linep, strlen(*linep) + strlen(line1) + 1);
DB *dbase;
char *dbname = "/var/lib/arpd/arpd.db";
-int ifnum;
+int ifnum;
int *ifvec;
char **ifnames;
};
#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])
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)
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;
sa.sa_handler = handler;
#ifdef SA_INTERRUPT
sa.sa_flags = SA_INTERRUPT;
-#endif
+#endif
sigaction(sig, &sa, NULL);
}
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];
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);
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;
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++;
}
}
return 0;
}
-
+
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 */
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;
req_files[num_req_files++] = strdup(optarg);
break;
case '?':
- case 'h':
+ case 'h':
usage(argv[0], 0);
break;
case 'i':
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++) {
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;
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)
}
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];
if (!path)
path = PROC_NET_STAT;
-
+
dir = opendir(path);
if (!dir) {
struct lnstat_file *lf;
file = NULL;
field = name;
}
-
+
for (lf = lnstat_files; lf; lf = lf->next) {
int i;
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);
"%-10s "
"%-10s "
"\n"
- , "Realm", "BytesTo", "PktsTo", "BytesFrom", "PktsFrom");
+ , "Realm", "BytesTo", "PktsTo", "BytesFrom", "PktsFrom");
fprintf(fp,
"%-10s "
"%-10s "
"%-10s "
"%-10s "
"\n"
- , "", "BPSTo", "PPSTo", "BPSFrom", "PPSFrom");
+ , "", "BPSTo", "PPSTo", "BPSFrom", "PPSFrom");
}
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");
}
}
"%-10s "
"%-10s "
"\n"
- , "Realm", "BytesTo", "PktsTo", "BytesFrom", "PktsFrom");
+ , "Realm", "BytesTo", "PktsTo", "BytesFrom", "PktsFrom");
fprintf(fp,
"%-10s "
"%-10s "
"%-10s "
"%-10s "
"\n"
- , "", "BPSTo", "PPSTo", "BPSFrom", "PPSFrom");
+ , "", "BPSTo", "PPSTo", "BPSFrom", "PPSFrom");
}
for (realm=0; realm<256; realm++) {
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");
}
}
{
}
-/* 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)
{
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));
struct slabstat slabstat;
-static const char *slabstat_ids[] =
+static const char *slabstat_ids[] =
{
"sock",
"tcp_bind_bucket",
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 {
if (!notfirst) {
setservent(1);
notfirst = 1;
- }
+ }
se = getservbyport(htons(port), dg_proto);
if (se)
return se->s_name;
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)
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;
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;
}
}
-/* Relocate external jumps by reloc. */
+/* Relocate external jumps by reloc. */
static void ssfilter_patch(char *a, int len, int reloc)
{
while (len > 0) {
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;
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);
&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)
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.);
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)
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;
}
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));
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);
}
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) {
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]);
return -1;
fgets(buf, sizeof(buf)-1, fp);
- if (memcmp(buf, "Peer", 4) == 0)
+ if (memcmp(buf, "Peer", 4) == 0)
newformat = 1;
cnt = 0;
}
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");
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) {
}
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);
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;
}
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,
{ "version", 0, 0, 'V' },
{ "help", 0, 0, 'h' },
{ 0 }
-
+
};
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) {
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");
$$ = alloc_node(SSF_DCOND, $2);
}
| SCOND HOSTCOND
- {
+ {
$$ = alloc_node(SSF_SCOND, $2);
}
| DPORT GEQ HOSTCOND
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)
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);
if (!bstrcmp(kind, meta_table[i].kind) &&
meta_table[i].id != 0)
return &meta_table[i];
-
+
return NULL;
}
for (i = 0; i < (sizeof(meta_table)/sizeof(meta_table[0])); i++)
if (meta_table[i].id == id)
return &meta_table[i];
-
+
return NULL;
}
{
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;
{
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,
if (left) {
struct tcf_meta_val *right = obj;
-
+
if (TCF_META_TYPE(right->kind) == TCF_META_TYPE(left->kind))
goto compatible;
right->kind = overwrite_type(right, left);
else
goto not_compatible;
- } else
+ } else
goto not_compatible;
}
return PARSE_FAILURE;
}
a = bstr_next(a);
-
+
shift = bstrtoul(a);
if (shift == LONG_MAX) {
PARSE_ERR(a, "meta: invalid shift, must " \
return PARSE_FAILURE;
}
a = bstr_next(a);
-
+
mask = bstrtoul(a);
if (mask == LONG_MAX) {
PARSE_ERR(a, "meta: invalid mask, must be " \
return -1;
else if (a != NULL)
return PARSE_ERR(a, "meta: unexpected trailer");
-
+
addraw_l(n, MAX_MSG, hdr, sizeof(*hdr));
if (offset_present == 0)
return PARSE_ERR(a, "nbyte: offset required");
-
+
nb.len = needle->len;
nb.layer = (__u8) layer;
nb.off = (__u16) offset;
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;
}
offset = bstrtoul(a);
} else
offset = bstrtoul(a);
-
+
if (offset == ULONG_MAX)
return PARSE_ERR(a, "u32: invalid offset");
return ERROR;
}
strbuf_index = 0;
-
+
BEGIN(str);
}
<str>\\[0-7]{1,3} { /* octal escape sequence */
int res;
-
+
sscanf(yytext + 1, "%o", &res);
if (res > 0xFF) {
fprintf(stderr, "error: octal escape sequence" \
<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");
return -1;
}
}
-
+
t->tcm_handle = h;
tail = (struct rtattr*)(((void*)n)+NLMSG_ALIGN(n->nlmsg_len));
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]);
} 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");
* 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
*
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;
}
}
int
-new_cmd(char **argv)
+new_cmd(char **argv)
{
if ((matches(*argv, "change") == 0) ||
(matches(*argv, "replace") == 0)||
goto done;
}
- if (NULL == a) {
+ if (NULL == a) {
goto bad_val;
}
*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;
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 ");
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;
}
#endif
a = get_action_kind(k);
- if (NULL == a) {
+ if (NULL == a) {
fprintf(stderr,"bad action %s\n",k);
goto bad_val;
}
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;
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;
"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);
}
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);
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);
if (t->inverted)
hdr.flags |= TCF_EM_INVERT;
-
+
addattr_l(n, MAX_MSG, index++, NULL, 0);
if (t->child) {
begin_argv++;
begin_argc--;
}
-
+
fprintf(stderr, "...\n");
if (args) {
i++;
}
-
+
return 0;
}
memcpy(buf, b->data, b->len);
buf[b->len] = '\0';
-
+
l = strtol(buf, &inv, 0);
if (l == ULONG_MAX || inv == buf)
return LONG_MAX;
int argc = *p_argc;
char **argv = *p_argv;
unsigned A, time_const;
-
+
NEXT_ARG();
if (est->ewma_log)
duparg("estimator", *argv);
/*
- * 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>
/* 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";
/*
- * 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
* 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
*
*/
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)
{
name[IPT_FUNCTION_MAXNAMELEN - 1] = revision;
}
-/*
+/*
* we may need to check for version mismatch
*/
int
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;
argv += optind;
*argc_p = rargc - iargc;
*argv_p = argv;
-
+
optind = 1;
free_opts(opts);
struct tcf_t *tm = RTA_DATA(tb[TCA_IPT_TM]);
print_tm(f,tm);
}
- }
+ }
fprintf(f, " \n");
}
/*
- * 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
*
*/
}
return -1;
-
+
}
int
/*
- * 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>
{
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 "
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;
}
-struct m_pedit_util
+struct m_pedit_util
*get_pedit_kind(char *str)
{
static void *pBODY;
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);
} else if (matches(*argv, "preserve") == 0) {
retain = mask = o;
} else {
- if (matches(*argv, "clear") != 0)
+ if (matches(*argv, "clear") != 0)
return -1;
}
tkey->at = atv;
NEXT_ARG();
-
+
if (get_u32(&offmask, *argv, 16))
return -1;
tkey->offmask = offmask;
return 0;
}
-int
+int
pedit_print_xstats(struct action_util *au, FILE *f, struct rtattr *xstats)
{
return 0;
/*
- * 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_
* 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
*
*/
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);
__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));
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);
return 0;
}
-int
+int
tc_print_police(FILE *f, struct rtattr *arg) {
return print_police(&police_action_util,f,arg);
}
* 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>
/*
- * 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>
* 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>
* 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>
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;
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;
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]);
* 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>
*
*/
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)) {
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++) {
usc = RTA_DATA(tb[TCA_HFSC_USC]);
}
-
+
if (rsc != NULL && fsc != NULL &&
memcmp(rsc, fsc, sizeof(*rsc)) == 0)
hfsc_print_sc(f, "sc", rsc);
return 0;
}
-
+
struct qdisc_util hfsc_qdisc_util = {
.id = "hfsc",
.parse_qopt = hfsc_parse_opt,
}
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;
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);
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;
static void explain(void)
{
- fprintf(stderr,
+ fprintf(stderr,
"Usage: ... netem [ limit PACKETS ] \n" \
" [ delay TIME [ JITTER [CORRELATION]]]\n" \
" [ distribution {uniform|normal|pareto|paretonormal} ]\n" \
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;
for (p = line; ; p = endp) {
x = strtol(p, &endp, 0);
- if (endp == p)
+ if (endp == p)
break;
if (n >= MAXDIST) {
return n;
}
-static int isnumber(const char *arg)
+static int isnumber(const char *arg)
{
char *p;
(void) strtod(arg, &p);
#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)
{
if(get_usecs(&t, str))
return -1;
-
+
if (tc_core_usec2big(t)) {
fprintf(stderr, "Illegal %d usecs (too large)\n", t);
return -1;
}
-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;
if (NEXT_IS_NUMBER()) {
NEXT_ARG();
- if (get_percent(&cor.delay_corr,
+ if (get_percent(&cor.delay_corr,
*argv)) {
explain1("latency");
return -1;
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;
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));
}
fprintf(f, " marked %u early %u pdrop %u other %u",
st->marked, st->early, st->pdrop, st->other);
return 0;
-
+
#endif
return 0;
}
__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));
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;
}
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);
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;
}
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;
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");
static __u32 filter_protocol;
int print_filter(const struct sockaddr_nl *who,
- struct nlmsghdr *n,
+ struct nlmsghdr *n,
void *arg)
{
FILE *fp = (FILE*)arg;
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;
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;
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]);
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();
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)));
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) {
{
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);
};
{
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);
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);