├── .gitignore ├── Makefile ├── README.md ├── figs ├── in-host-chain.png ├── overview.png └── vxlan-chain.png ├── iproute2-3.19.0 ├── .gitignore ├── COPYING ├── Makefile ├── README ├── README.decnet ├── README.devel ├── README.distribution ├── README.iproute2+tc ├── README.lnstat ├── bridge │ ├── .gitignore │ ├── Makefile │ ├── br_common.h │ ├── bridge.c │ ├── fdb.c │ ├── link.c │ ├── mdb.c │ ├── monitor.c │ └── vlan.c ├── configure ├── doc │ ├── Makefile │ ├── Plan │ ├── SNAPSHOT.tex │ ├── actions │ │ ├── actions-general │ │ ├── gact-usage │ │ ├── ifb-README │ │ └── mirred-usage │ ├── api-ip6-flowlabels.tex │ ├── arpd.sgml │ ├── do-psnup │ ├── ip-cref.tex │ ├── ip-tunnels.tex │ ├── nstat.sgml │ ├── preamble.tex │ ├── rtstat.sgml │ └── ss.sgml ├── etc │ └── iproute2 │ │ ├── ematch_map │ │ ├── group │ │ ├── nl_protos │ │ ├── rt_dsfield │ │ ├── rt_protos │ │ ├── rt_realms │ │ ├── rt_scopes │ │ └── rt_tables ├── examples │ ├── README.cbq │ ├── SYN-DoS.rate.limit │ ├── cbq.init-v0.7.3 │ ├── cbqinit.eth1 │ ├── dhcp-client-script │ ├── diffserv │ │ ├── Edge1 │ │ ├── Edge2 │ │ ├── Edge31-ca-u32 │ │ ├── Edge31-cb-chains │ │ ├── Edge32-ca-u32 │ │ ├── Edge32-cb-chains │ │ ├── Edge32-cb-u32 │ │ ├── README │ │ ├── afcbq │ │ ├── ef-prio │ │ ├── efcbq │ │ └── regression-testing │ └── gaiconf ├── genl │ ├── .gitignore │ ├── Makefile │ ├── ctrl.c │ ├── genl.c │ ├── genl_utils.h │ └── static-syms.c ├── include │ ├── SNAPSHOT.h │ ├── dlfcn.h │ ├── hlist.h │ ├── ip6tables.h │ ├── iptables.h │ ├── iptables_common.h │ ├── libgenl.h │ ├── libiptc │ │ ├── ipt_kernel_headers.h │ │ ├── libip6tc.h │ │ └── libiptc.h │ ├── libnetlink.h │ ├── linux │ │ ├── atm.h │ │ ├── atmapi.h │ │ ├── atmioc.h │ │ ├── atmsap.h │ │ ├── bpf_common.h │ │ ├── can.h │ │ ├── can │ │ │ └── netlink.h │ │ ├── fib_rules.h │ │ ├── filter.h │ │ ├── fou.h │ │ ├── gen_stats.h │ │ ├── genetlink.h │ │ ├── hdlc │ │ │ └── ioctl.h │ │ ├── if.h │ │ ├── if_addr.h │ │ ├── if_addrlabel.h │ │ ├── if_arp.h │ │ ├── if_bridge.h │ │ ├── if_ether.h │ │ ├── if_link.h │ │ ├── if_tun.h │ │ ├── if_tunnel.h │ │ ├── if_vlan.h │ │ ├── in6.h │ │ ├── inet_diag.h │ │ ├── ip6_tunnel.h │ │ ├── l2tp.h │ │ ├── libc-compat.h │ │ ├── neighbour.h │ │ ├── netconf.h │ │ ├── netdevice.h │ │ ├── netfilter.h │ │ ├── netfilter │ │ │ ├── x_tables.h │ │ │ └── xt_tcpudp.h │ │ ├── netfilter_ipv4.h │ │ ├── netfilter_ipv4 │ │ │ └── ip_tables.h │ │ ├── netlink.h │ │ ├── netlink_diag.h │ │ ├── packet_diag.h │ │ ├── pkt_cls.h │ │ ├── pkt_sched.h │ │ ├── rtnetlink.h │ │ ├── sock_diag.h │ │ ├── socket.h │ │ ├── tc_act │ │ │ ├── tc_csum.h │ │ │ ├── tc_defact.h │ │ │ ├── tc_gact.h │ │ │ ├── tc_ipt.h │ │ │ ├── tc_mirred.h │ │ │ ├── tc_nat.h │ │ │ ├── tc_pedit.h │ │ │ ├── tc_skbedit.h │ │ │ └── tc_vlan.h │ │ ├── tc_ematch │ │ │ ├── tc_em_cmp.h │ │ │ ├── tc_em_meta.h │ │ │ ├── tc_em_nbyte.h │ │ │ └── tc_em_text.h │ │ ├── tcp.h │ │ ├── tcp_metrics.h │ │ ├── types.h │ │ ├── unix_diag.h │ │ ├── veth.h │ │ └── xfrm.h │ ├── ll_map.h │ ├── namespace.h │ ├── netinet │ │ └── tcp.h │ ├── rt_names.h │ ├── rtm_map.h │ ├── utils.h │ └── xt-internal.h ├── ip │ ├── .gitignore │ ├── Makefile │ ├── ifcfg │ ├── ip.c │ ├── ip6tunnel.c │ ├── ip_common.h │ ├── ipaddress.c │ ├── ipaddrlabel.c │ ├── ipfou.c │ ├── ipl2tp.c │ ├── iplink.c │ ├── iplink_bond.c │ ├── iplink_bond_slave.c │ ├── iplink_bridge.c │ ├── iplink_bridge_slave.c │ ├── iplink_can.c │ ├── iplink_hsr.c │ ├── iplink_ipoib.c │ ├── iplink_ipvlan.c │ ├── iplink_macvlan.c │ ├── iplink_macvtap.c │ ├── iplink_nsh.c │ ├── iplink_vlan.c │ ├── iplink_vxlan.c │ ├── ipmaddr.c │ ├── ipmonitor.c │ ├── ipmroute.c │ ├── ipneigh.c │ ├── ipnetconf.c │ ├── ipnetns.c │ ├── ipnsh.c │ ├── ipntable.c │ ├── ipprefix.c │ ├── iproute.c │ ├── iprule.c │ ├── iptoken.c │ ├── iptunnel.c │ ├── iptuntap.c │ ├── ipxfrm.c │ ├── link_gre.c │ ├── link_gre6.c │ ├── link_ip6tnl.c │ ├── link_iptnl.c │ ├── link_veth.c │ ├── link_vti.c │ ├── link_vti6.c │ ├── routef │ ├── routel │ ├── rtm_map.c │ ├── rtmon.c │ ├── rtpr │ ├── static-syms.c │ ├── tcp_metrics.c │ ├── tunnel.c │ ├── tunnel.h │ ├── xfrm.h │ ├── xfrm_monitor.c │ ├── xfrm_policy.c │ └── xfrm_state.c ├── lib │ ├── Makefile │ ├── dnet_ntop.c │ ├── dnet_pton.c │ ├── inet_proto.c │ ├── ipx_ntop.c │ ├── ipx_pton.c │ ├── libgenl.c │ ├── libnetlink.c │ ├── ll_addr.c │ ├── ll_map.c │ ├── ll_proto.c │ ├── ll_types.c │ ├── namespace.c │ ├── rt_names.c │ └── utils.c ├── man │ ├── Makefile │ ├── man3 │ │ ├── Makefile │ │ └── libnetlink.3 │ ├── man7 │ │ ├── Makefile │ │ └── tc-hfsc.7 │ └── man8 │ │ ├── .gitignore │ │ ├── Makefile │ │ ├── arpd.8 │ │ ├── bridge.8 │ │ ├── ctstat.8 │ │ ├── ip-address.8.in │ │ ├── ip-addrlabel.8 │ │ ├── ip-fou.8 │ │ ├── ip-gue.8 │ │ ├── ip-l2tp.8 │ │ ├── ip-link.8.in │ │ ├── ip-maddress.8 │ │ ├── ip-monitor.8 │ │ ├── ip-mroute.8 │ │ ├── ip-neighbour.8 │ │ ├── ip-netconf.8 │ │ ├── ip-netns.8 │ │ ├── ip-ntable.8 │ │ ├── ip-route.8.in │ │ ├── ip-rule.8 │ │ ├── ip-tcp_metrics.8 │ │ ├── ip-token.8 │ │ ├── ip-tunnel.8 │ │ ├── ip-xfrm.8 │ │ ├── ip.8 │ │ ├── lnstat.8 │ │ ├── nstat.8 │ │ ├── routef.8 │ │ ├── routel.8 │ │ ├── rtacct.8 │ │ ├── rtmon.8 │ │ ├── rtstat.8 │ │ ├── ss.8 │ │ ├── tc-bfifo.8 │ │ ├── tc-cbq-details.8 │ │ ├── tc-cbq.8 │ │ ├── tc-choke.8 │ │ ├── tc-codel.8 │ │ ├── tc-drr.8 │ │ ├── tc-ematch.8 │ │ ├── tc-fq_codel.8 │ │ ├── tc-hfsc.8 │ │ ├── tc-htb.8 │ │ ├── tc-mqprio.8 │ │ ├── tc-netem.8 │ │ ├── tc-pfifo.8 │ │ ├── tc-pfifo_fast.8 │ │ ├── tc-pie.8 │ │ ├── tc-prio.8 │ │ ├── tc-red.8 │ │ ├── tc-sfb.8 │ │ ├── tc-sfq.8 │ │ ├── tc-stab.8 │ │ ├── tc-tbf.8 │ │ └── tc.8 ├── misc │ ├── .gitignore │ ├── Makefile │ ├── arpd.c │ ├── ifstat.c │ ├── lnstat.c │ ├── lnstat.h │ ├── lnstat_util.c │ ├── nstat.c │ ├── rtacct.c │ ├── ss.c │ ├── ssfilter.h │ └── ssfilter.y ├── netem │ ├── .gitignore │ ├── Makefile │ ├── README.distribution │ ├── experimental.dat │ ├── maketable.c │ ├── normal.c │ ├── pareto.c │ ├── paretonormal.c │ └── stats.c ├── tc │ ├── .gitignore │ ├── Makefile │ ├── README.last │ ├── em_canid.c │ ├── em_cmp.c │ ├── em_ipset.c │ ├── em_meta.c │ ├── em_nbyte.c │ ├── em_u32.c │ ├── emp_ematch.l │ ├── emp_ematch.y │ ├── f_basic.c │ ├── f_bpf.c │ ├── f_cgroup.c │ ├── f_flow.c │ ├── f_fw.c │ ├── f_route.c │ ├── f_rsvp.c │ ├── f_tcindex.c │ ├── f_u32.c │ ├── m_action.c │ ├── m_csum.c │ ├── m_ematch.c │ ├── m_ematch.h │ ├── m_estimator.c │ ├── m_gact.c │ ├── m_ipt.c │ ├── m_mirred.c │ ├── m_nat.c │ ├── m_pedit.c │ ├── m_pedit.h │ ├── m_police.c │ ├── m_simple.c │ ├── m_skbedit.c │ ├── m_vlan.c │ ├── m_xt.c │ ├── m_xt_old.c │ ├── p_icmp.c │ ├── p_ip.c │ ├── p_tcp.c │ ├── p_udp.c │ ├── q_atm.c │ ├── q_cbq.c │ ├── q_choke.c │ ├── q_codel.c │ ├── q_drr.c │ ├── q_dsmark.c │ ├── q_fifo.c │ ├── q_fq.c │ ├── q_fq_codel.c │ ├── q_gred.c │ ├── q_hfsc.c │ ├── q_hhf.c │ ├── q_htb.c │ ├── q_ingress.c │ ├── q_mqprio.c │ ├── q_multiq.c │ ├── q_netem.c │ ├── q_pie.c │ ├── q_prio.c │ ├── q_qfq.c │ ├── q_red.c │ ├── q_rr.c │ ├── q_sfb.c │ ├── q_sfq.c │ ├── q_tbf.c │ ├── static-syms.c │ ├── tc.c │ ├── tc_cbq.c │ ├── tc_cbq.h │ ├── tc_class.c │ ├── tc_common.h │ ├── tc_core.c │ ├── tc_core.h │ ├── tc_estimator.c │ ├── tc_filter.c │ ├── tc_monitor.c │ ├── tc_qdisc.c │ ├── tc_red.c │ ├── tc_red.h │ ├── tc_stab.c │ ├── tc_util.c │ └── tc_util.h └── testsuite │ ├── Makefile │ ├── configs │ ├── all-2.4 │ ├── all-no-act │ └── all-police-act │ ├── iproute2 │ └── Makefile │ ├── lib │ └── generic.sh │ └── tests │ ├── ip │ └── link │ │ ├── dev_wo_vf_rate.nl │ │ ├── new_link.t │ │ └── show_dev_wo_vf_rate.t │ └── tc │ ├── cbq.t │ ├── cls-testbed.t │ ├── dsmark.t │ └── policer.t ├── nshkmod.c └── nshkmod.h /.gitignore: -------------------------------------------------------------------------------- 1 | *.ko 2 | *.o 3 | *.mod.c 4 | .*.cmd 5 | .tmp* 6 | .*.swp 7 | modules.order 8 | Module.symvers 9 | *.out 10 | *.sh 11 | *.pptx 12 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | KERNELSRCDIR := /lib/modules/$(shell uname -r)/build 2 | BUILD_DIR := $(shell pwd) 3 | VERBOSE = 0 4 | 5 | DEBUG?=no 6 | flag_debug_yes = -DDEBUG 7 | flag_debug_no = 8 | 9 | obj-m := nshkmod.o 10 | ccflags-y := $(flag_debug_$(DEBUG)) 11 | 12 | all: 13 | make -C $(KERNELSRCDIR) M=$(BUILD_DIR) V=$(VERBOSE) modules 14 | 15 | clean: 16 | make -C $(KERNELSRCDIR) M=$(BUILD_DIR) clean 17 | -------------------------------------------------------------------------------- /figs/in-host-chain.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upa/nshkmod/d336f2c749919199af0ea78d82b746fc5b183322/figs/in-host-chain.png -------------------------------------------------------------------------------- /figs/overview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upa/nshkmod/d336f2c749919199af0ea78d82b746fc5b183322/figs/overview.png -------------------------------------------------------------------------------- /figs/vxlan-chain.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upa/nshkmod/d336f2c749919199af0ea78d82b746fc5b183322/figs/vxlan-chain.png -------------------------------------------------------------------------------- /iproute2-3.19.0/.gitignore: -------------------------------------------------------------------------------- 1 | static-syms.h 2 | config.* 3 | Config 4 | *.o 5 | *.a 6 | *.so 7 | *~ 8 | \#*# 9 | 10 | # cscope 11 | cscope.* 12 | ncscope.* 13 | TAGS 14 | 15 | # git files that we don't want to ignore even it they are dot-files 16 | !.gitignore 17 | !.mailmap 18 | 19 | # for patch generation 20 | *.diff 21 | *.patch 22 | *.orig 23 | *.rej 24 | 25 | # for quilt 26 | .pc 27 | patches 28 | series 29 | 30 | # for gdb 31 | .gdbinit 32 | .gdb_history 33 | *.gdb 34 | 35 | # tests 36 | testsuite/results 37 | testsuite/iproute2/iproute2-this 38 | 39 | # doc files generated at runtime 40 | doc/*.aux 41 | doc/*.log 42 | doc/*.toc 43 | doc/*.ps 44 | doc/*.dvi 45 | doc/*.html 46 | doc/*.pdf 47 | -------------------------------------------------------------------------------- /iproute2-3.19.0/Makefile: -------------------------------------------------------------------------------- 1 | ROOTDIR=$(DESTDIR) 2 | PREFIX=/usr 3 | LIBDIR=$(PREFIX)/lib 4 | SBINDIR=/sbin 5 | CONFDIR=/etc/iproute2 6 | DATADIR=$(PREFIX)/share 7 | DOCDIR=$(DATADIR)/doc/iproute2 8 | MANDIR=$(DATADIR)/man 9 | ARPDDIR=/var/lib/arpd 10 | 11 | # Path to db_185.h include 12 | DBM_INCLUDE:=$(ROOTDIR)/usr/include 13 | 14 | SHARED_LIBS = y 15 | 16 | DEFINES= -DRESOLVE_HOSTNAMES -DLIBDIR=\"$(LIBDIR)\" 17 | ifneq ($(SHARED_LIBS),y) 18 | DEFINES+= -DNO_SHARED_LIBS 19 | endif 20 | 21 | DEFINES+=-DCONFDIR=\"$(CONFDIR)\" 22 | 23 | #options for decnet 24 | ADDLIB+=dnet_ntop.o dnet_pton.o 25 | 26 | #options for ipx 27 | ADDLIB+=ipx_ntop.o ipx_pton.o 28 | 29 | CC = gcc 30 | HOSTCC = gcc 31 | DEFINES += -D_GNU_SOURCE 32 | CCOPTS = -O2 33 | WFLAGS := -Wall -Wstrict-prototypes -Wmissing-prototypes 34 | WFLAGS += -Wmissing-declarations -Wold-style-definition -Wformat=2 35 | 36 | CFLAGS = $(WFLAGS) $(CCOPTS) -I../include $(DEFINES) 37 | YACCFLAGS = -d -t -v 38 | 39 | SUBDIRS=lib ip tc bridge misc netem genl man 40 | 41 | LIBNETLINK=../lib/libnetlink.a ../lib/libutil.a 42 | LDLIBS += $(LIBNETLINK) 43 | 44 | all: Config 45 | @set -e; \ 46 | for i in $(SUBDIRS); \ 47 | do $(MAKE) $(MFLAGS) -C $$i; done 48 | 49 | Config: 50 | sh configure $(KERNEL_INCLUDE) 51 | 52 | install: all 53 | install -m 0755 -d $(DESTDIR)$(SBINDIR) 54 | install -m 0755 -d $(DESTDIR)$(CONFDIR) 55 | install -m 0755 -d $(DESTDIR)$(ARPDDIR) 56 | install -m 0755 -d $(DESTDIR)$(DOCDIR)/examples 57 | install -m 0755 -d $(DESTDIR)$(DOCDIR)/examples/diffserv 58 | install -m 0644 README.iproute2+tc $(shell find examples -maxdepth 1 -type f) \ 59 | $(DESTDIR)$(DOCDIR)/examples 60 | install -m 0644 $(shell find examples/diffserv -maxdepth 1 -type f) \ 61 | $(DESTDIR)$(DOCDIR)/examples/diffserv 62 | @for i in $(SUBDIRS) doc; do $(MAKE) -C $$i install; done 63 | install -m 0644 $(shell find etc/iproute2 -maxdepth 1 -type f) $(DESTDIR)$(CONFDIR) 64 | 65 | snapshot: 66 | echo "static const char SNAPSHOT[] = \""`date +%y%m%d`"\";" \ 67 | > include/SNAPSHOT.h 68 | 69 | clean: 70 | @for i in $(SUBDIRS) doc; \ 71 | do $(MAKE) $(MFLAGS) -C $$i clean; done 72 | 73 | clobber: 74 | touch Config 75 | $(MAKE) $(MFLAGS) clean 76 | rm -f Config cscope.* 77 | 78 | distclean: clobber 79 | 80 | cscope: 81 | cscope -b -q -R -Iinclude -sip -slib -smisc -snetem -stc 82 | 83 | .EXPORT_ALL_VARIABLES: 84 | -------------------------------------------------------------------------------- /iproute2-3.19.0/README: -------------------------------------------------------------------------------- 1 | This is a set of utilities for Linux networking. 2 | 3 | Information: 4 | http://www.linuxfoundation.org/collaborate/workgroups/networking/iproute2 5 | 6 | Download: 7 | http://www.kernel.org/pub/linux/utils/net/iproute2/ 8 | 9 | Repository: 10 | git://git.kernel.org/pub/scm/linux/kernel/git/shemminger/iproute2.git 11 | 12 | How to compile this. 13 | -------------------- 14 | 1. libdbm 15 | 16 | arpd needs to have the db4 development libraries. For Debian 17 | users this is the package with a name like libdb4.x-dev. 18 | DBM_INCLUDE points to the directory with db_185.h which 19 | is the include file used by arpd to get to the old format Berkeley 20 | database routines. Often this is in the db-devel package. 21 | 22 | 2. make 23 | 24 | The makefile will automatically build a Config file which 25 | contains whether or not ATM is available, etc. 26 | 27 | 3. To make documentation, cd to doc/ directory , then 28 | look at start of Makefile and set correct values for 29 | PAGESIZE=a4 , ie: a4 , letter ... (string) 30 | PAGESPERPAGE=2 , ie: 1 , 2 ... (numeric) 31 | and make there. It assumes, that latex, dvips and psnup 32 | are in your path. 33 | 34 | 4. This package includes matching sanitized kernel headers because 35 | the build environment may not have up to date versions. See Makefile 36 | if you have special requirements and need to point at different 37 | kernel include files. 38 | 39 | Stephen Hemminger 40 | stephen@networkplumber.org 41 | 42 | Alexey Kuznetsov 43 | kuznet@ms2.inr.ac.ru 44 | -------------------------------------------------------------------------------- /iproute2-3.19.0/README.decnet: -------------------------------------------------------------------------------- 1 | 2 | Here are a few quick points about DECnet support... 3 | 4 | o iproute2 is the tool of choice for configuring the DECnet support for 5 | Linux. For many features, it is the only tool which can be used to 6 | configure them. 7 | 8 | o No name resolution is available as yet, all addresses must be 9 | entered numerically. 10 | 11 | o Remember to set the hardware address of the interface using: 12 | 13 | ip link set ethX address xx:xx:xx:xx:xx:xx 14 | (where xx:xx:xx:xx:xx:xx is the MAC address for your DECnet node 15 | address) 16 | 17 | if your Ethernet card won't listen to more than one unicast 18 | mac address at once. If the Linux DECnet stack doesn't talk to 19 | any other DECnet nodes, then check this with tcpdump and if its 20 | a problem, change the mac address (but do this _before_ starting 21 | any other network protocol on the interface) 22 | 23 | o Whilst you can use ip addr add to add more than one DECnet address to an 24 | interface, don't expect addresses which are not the same as the 25 | kernels node address to work properly with 2.4 kernels. This should 26 | be fine with 2.6 kernels as the routing code has been extensively 27 | modified and improved. 28 | 29 | o The DECnet support is currently self contained. It does not depend on 30 | the libdnet library. 31 | 32 | Steve Whitehouse 33 | 34 | -------------------------------------------------------------------------------- /iproute2-3.19.0/README.devel: -------------------------------------------------------------------------------- 1 | Iproute2 development is closely tied to Linux kernel networking 2 | development. Most new features require a kernel and a utility component. 3 | 4 | Please submit both to the Linux networking mailing list 5 | 6 | 7 | The current source is in the git repository: 8 | git://git.kernel.org/pub/scm/linux/kernel/git/shemminger/iproute2.git 9 | 10 | The master branch contains the source corresponding to the current 11 | code in the mainline Linux kernel (ie follows Linus). The net-next 12 | branch is a temporary branch that tracks the code intended for the 13 | next release; it corresponds with networking development branch in 14 | the kernel. 15 | 16 | -------------------------------------------------------------------------------- /iproute2-3.19.0/README.lnstat: -------------------------------------------------------------------------------- 1 | lnstat - linux networking statistics 2 | (C) 2004 Harald Welte &1 | \ 43 | grep -c '^\(LaTeX Warning: Label(s) may\|No file \|! Emergency stop\)'` -ge 1 ]; do \ 44 | if [ $$pass -gt 3 ]; then \ 45 | echo "Seems, something is wrong. Try by hands." ; exit 1 ; \ 46 | fi; \ 47 | echo "Re-running LaTeX $<, $${pass}d pass"; pass=$$[$$pass + 1]; \ 48 | done 49 | 50 | %.pdf: %.tex 51 | @set -e; pass=2; echo "Running pdfLaTeX $<"; \ 52 | while [ `pdflatex $< &1 | \ 53 | grep -c '^\(LaTeX Warning: Label(s) may\|No file \|! Emergency stop\)'` -ge 1 ]; do \ 54 | if [ $$pass -gt 3 ]; then \ 55 | echo "Seems, something is wrong. Try by hands." ; exit 1 ; \ 56 | fi; \ 57 | echo "Re-running pdfLaTeX $<, $${pass}d pass"; pass=$$[$$pass + 1]; \ 58 | done 59 | #%.pdf: %.ps 60 | # ps2pdf $< 61 | 62 | %.ps: %.dvi 63 | $(DVIPS) $< -o $@ 64 | 65 | %.html: %.sgml 66 | $(SGML2HTML) $< 67 | 68 | install: 69 | install -m 0644 $(shell echo *.tex) $(DESTDIR)$(DOCDIR) 70 | install -m 0644 $(shell echo *.sgml) $(DESTDIR)$(DOCDIR) 71 | 72 | clean: 73 | rm -f *.aux *.log *.toc $(PSFILES) $(DVIFILES) *.html *.pdf 74 | -------------------------------------------------------------------------------- /iproute2-3.19.0/doc/Plan: -------------------------------------------------------------------------------- 1 | Partially finished work. 2 | 3 | 1. User Reference manuals. 4 | 1.1 IP Command reference (ip-cref.tex, published) 5 | 1.2 TC Command reference (tc-cref.tex) 6 | 1.3 IP tunnels (ip-tunnels.tex, published) 7 | 8 | 2. Linux-2.2 Networking API 9 | 2.1 RTNETLINK (api-rtnl.tex) 10 | 2.2 Path MTU Discovery (api-pmtudisc.tex) 11 | 2.3 IPv6 Flow Labels (api-ip6-flowlabels.tex, published) 12 | 2.4 Miscellaneous extensions (api-misc.tex) 13 | 14 | 3. Linux-2.2 Networking Intra-Kernel Interfaces 15 | 3.1 NetDev --- Networking Devices and netdev... (iki-netdev.tex) 16 | 3.2 Neighbour cache and destination cache. (iki-neighdst.tex) 17 | -------------------------------------------------------------------------------- /iproute2-3.19.0/doc/SNAPSHOT.tex: -------------------------------------------------------------------------------- 1 | \def\Draft{020116} 2 | -------------------------------------------------------------------------------- /iproute2-3.19.0/doc/do-psnup: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | # $1 = Temporary file . "string" 3 | # $2 = File to process . "string" 4 | # $3 = Page size . ie: a4 , letter ... "string" 5 | # $4 = Number of pages to fit on a single sheet . "numeric" 6 | 7 | if type psnup >&/dev/null; then 8 | echo "psnup -$4 -p$3 $1 $2" 9 | psnup -$4 -p$3 $1 $2 10 | elif type psmulti >&/dev/null; then 11 | echo "psmulti $1 > $2" 12 | psmulti $1 > $2 13 | else 14 | echo "cp $1 $2" 15 | cp $1 $2 16 | fi 17 | -------------------------------------------------------------------------------- /iproute2-3.19.0/doc/preamble.tex: -------------------------------------------------------------------------------- 1 | \textwidth 6.0in 2 | \textheight 8.5in 3 | 4 | \input SNAPSHOT 5 | 6 | \pagestyle{myheadings} 7 | \markboth{\protect\TITLE}{} 8 | \markright{{\protect\sc iproute2-ss\Draft}} 9 | 10 | % To print it in compact form: both sides on one sheet (psnup -2) 11 | \evensidemargin=\oddsidemargin 12 | 13 | \newenvironment{NB}{\bgroup \vskip 1mm\leftskip 1cm \footnotesize \noindent NB. 14 | }{\par\egroup \vskip 1mm} 15 | 16 | \def\threeonly{[2.3.15+ only] } 17 | 18 | \begin{document} 19 | 20 | \makeatletter 21 | \renewcommand{\@oddhead}{{\protect\sc iproute2-ss\Draft} \hfill \protect\arabic{page}} 22 | \makeatother 23 | \let\oldthefootnote\thefootnote 24 | \def\thefootnote{} 25 | \footnotetext{Copyright \copyright~1999 A.N.Kuznetsov} 26 | 27 | -------------------------------------------------------------------------------- /iproute2-3.19.0/doc/rtstat.sgml: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | RTACCT Utility 6 | <author>Robert Olsson 7 | <date>some_negative_number, 20 Dec 2001 8 | 9 | <p> 10 | Here is some code for monitoring the route cache. For systems handling high 11 | network load, servers, routers, firewalls etc the route cache and its garbage 12 | collection is crucial. Linux has a solid implementation. 13 | 14 | <p> 15 | The kernel patch (not required since linux-2.4.7) adds statistics counters 16 | from route cache process into 17 | /proc/net/rt_cache_stat. A companion user mode program presents the statistics 18 | in a vmstat or iostat manner. The ratio between cache hits and misses gives 19 | the flow length. 20 | 21 | <p> 22 | Hopefully it can help understanding performance and DoS and other related 23 | issues. 24 | 25 | <p> An URL where newer versions of this utility can be (probably) found 26 | is ftp://robur.slu.se/pub/Linux/net-development/rt_cache_stat/ 27 | 28 | 29 | <p><bf/Description/ 30 | 31 | <p>The format of the command is: 32 | 33 | <tscreen><verb> 34 | rtstat [ OPTIONS ] 35 | </verb></tscreen> 36 | 37 | <p> <tt/OPTIONS/ are: 38 | 39 | <itemize> 40 | 41 | <item><tt/-h/, <tt/-help/ - show help page and version of the utility. 42 | 43 | <item><tt/-i INTERVAL/ - interval between snapshots, default value is 44 | 2 seconds. 45 | 46 | <item><tt/-s NUMBER/ - whether to print header line. 0 inhibits header line, 47 | 1 prescribes to print it once and 2 (this is default setting) forces header 48 | line each 20 lines. 49 | 50 | </itemize> 51 | 52 | </article> 53 | -------------------------------------------------------------------------------- /iproute2-3.19.0/etc/iproute2/ematch_map: -------------------------------------------------------------------------------- 1 | # lookup table for ematch kinds 2 | 1 cmp 3 | 2 nbyte 4 | 3 u32 5 | 4 meta 6 | 7 canid 7 | 8 ipset 8 | -------------------------------------------------------------------------------- /iproute2-3.19.0/etc/iproute2/group: -------------------------------------------------------------------------------- 1 | # device group names 2 | 0 default 3 | -------------------------------------------------------------------------------- /iproute2-3.19.0/etc/iproute2/nl_protos: -------------------------------------------------------------------------------- 1 | # Netlink protocol names mapping 2 | 3 | 0 rtnl 4 | 1 unused 5 | 2 usersock 6 | 3 fw 7 | 4 tcpdiag 8 | 5 nflog 9 | 6 xfrm 10 | 7 selinux 11 | 8 iscsi 12 | 9 audit 13 | 10 fiblookup 14 | 11 connector 15 | 12 nft 16 | 13 ip6fw 17 | 14 dec-rt 18 | 15 uevent 19 | 16 genl 20 | 18 scsi-trans 21 | 19 ecryptfs 22 | 20 rdma 23 | 21 crypto 24 | -------------------------------------------------------------------------------- /iproute2-3.19.0/etc/iproute2/rt_dsfield: -------------------------------------------------------------------------------- 1 | # Differentiated field values 2 | # These include the DSCP and unused bits 3 | 0x0 default 4 | # Newer RFC2597 values 5 | 0x28 AF11 6 | 0x30 AF12 7 | 0x38 AF13 8 | 0x48 AF21 9 | 0x50 AF22 10 | 0x58 AF23 11 | 0x68 AF31 12 | 0x70 AF32 13 | 0x78 AF33 14 | 0x88 AF41 15 | 0x90 AF42 16 | 0x98 AF43 17 | # Older values RFC2474 18 | 0x20 CS1 19 | 0x40 CS2 20 | 0x60 CS3 21 | 0x80 CS4 22 | 0xA0 CS5 23 | 0xC0 CS6 24 | 0xE0 CS7 25 | # RFC 2598 26 | 0xB8 EF 27 | -------------------------------------------------------------------------------- /iproute2-3.19.0/etc/iproute2/rt_protos: -------------------------------------------------------------------------------- 1 | # 2 | # Reserved protocols. 3 | # 4 | 0 unspec 5 | 1 redirect 6 | 2 kernel 7 | 3 boot 8 | 4 static 9 | 8 gated 10 | 9 ra 11 | 10 mrt 12 | 11 zebra 13 | 12 bird 14 | 13 dnrouted 15 | 14 xorp 16 | 15 ntk 17 | 16 dhcp 18 | 42 babel 19 | 20 | # 21 | # Used by me for gated 22 | # 23 | 254 gated/aggr 24 | 253 gated/bgp 25 | 252 gated/ospf 26 | 251 gated/ospfase 27 | 250 gated/rip 28 | 249 gated/static 29 | 248 gated/conn 30 | 247 gated/inet 31 | 246 gated/default 32 | -------------------------------------------------------------------------------- /iproute2-3.19.0/etc/iproute2/rt_realms: -------------------------------------------------------------------------------- 1 | # 2 | # reserved values 3 | # 4 | 0 cosmos 5 | # 6 | # local 7 | # 8 | #1 inr.ac 9 | #2 inr.ruhep 10 | #3 freenet 11 | #4 radio-msu 12 | #5 russia 13 | #6 internet 14 | -------------------------------------------------------------------------------- /iproute2-3.19.0/etc/iproute2/rt_scopes: -------------------------------------------------------------------------------- 1 | # 2 | # reserved values 3 | # 4 | 0 global 5 | 255 nowhere 6 | 254 host 7 | 253 link 8 | # 9 | # pseudo-reserved 10 | # 11 | 200 site 12 | -------------------------------------------------------------------------------- /iproute2-3.19.0/etc/iproute2/rt_tables: -------------------------------------------------------------------------------- 1 | # 2 | # reserved values 3 | # 4 | 255 local 5 | 254 main 6 | 253 default 7 | 0 unspec 8 | # 9 | # local 10 | # 11 | #1 inr.ruhep 12 | -------------------------------------------------------------------------------- /iproute2-3.19.0/examples/SYN-DoS.rate.limit: -------------------------------------------------------------------------------- 1 | #! /bin/sh -x 2 | # 3 | # sample script on using the ingress capabilities 4 | # this script shows how one can rate limit incoming SYNs 5 | # Useful for TCP-SYN attack protection. You can use 6 | # IPchains to have more powerful additions to the SYN (eg 7 | # in addition the subnet) 8 | # 9 | #path to various utilities; 10 | #change to reflect yours. 11 | # 12 | IPROUTE=/root/DS-6-beta/iproute2-990530-dsing 13 | TC=$IPROUTE/tc/tc 14 | IP=$IPROUTE/ip/ip 15 | IPCHAINS=/root/DS-6-beta/ipchains-1.3.9/ipchains 16 | INDEV=eth2 17 | # 18 | # tag all incoming SYN packets through $INDEV as mark value 1 19 | ############################################################ 20 | $IPCHAINS -A input -i $INDEV -y -m 1 21 | ############################################################ 22 | # 23 | # install the ingress qdisc on the ingress interface 24 | ############################################################ 25 | $TC qdisc add dev $INDEV handle ffff: ingress 26 | ############################################################ 27 | 28 | # 29 | # 30 | # SYN packets are 40 bytes (320 bits) so three SYNs equals 31 | # 960 bits (approximately 1kbit); so we rate limit below 32 | # the incoming SYNs to 3/sec (not very sueful really; but 33 | #serves to show the point - JHS 34 | ############################################################ 35 | $TC filter add dev $INDEV parent ffff: protocol ip prio 50 handle 1 fw \ 36 | police rate 1kbit burst 40 mtu 9k drop flowid :1 37 | ############################################################ 38 | 39 | 40 | # 41 | echo "---- qdisc parameters Ingress ----------" 42 | $TC qdisc ls dev $INDEV 43 | echo "---- Class parameters Ingress ----------" 44 | $TC class ls dev $INDEV 45 | echo "---- filter parameters Ingress ----------" 46 | $TC filter ls dev $INDEV parent ffff: 47 | 48 | #deleting the ingress qdisc 49 | #$TC qdisc del $INDEV ingress 50 | -------------------------------------------------------------------------------- /iproute2-3.19.0/examples/cbqinit.eth1: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | TC=/home/root/tc 4 | IP=/home/root/ip 5 | DEVICE=eth1 6 | BANDWIDTH="bandwidth 10Mbit" 7 | 8 | # Attach CBQ on $DEVICE. It will have handle 1:. 9 | # $BANDWIDTH is real $DEVICE bandwidth (10Mbit). 10 | # avpkt is average packet size. 11 | # mpu is minimal packet size. 12 | 13 | $TC qdisc add dev $DEVICE root handle 1: cbq \ 14 | $BANDWIDTH avpkt 1000 mpu 64 15 | 16 | # Create root class with classid 1:1. This step is not necessary. 17 | # bandwidth is the same as on CBQ itself. 18 | # rate == all the bandwidth 19 | # allot is MTU + MAC header 20 | # maxburst measure allowed class burstiness (please,read S.Floyd and VJ papers) 21 | # est 1sec 8sec means, that kernel will evaluate average rate 22 | # on this class with period 1sec and time constant 8sec. 23 | # This rate is viewed with "tc -s class ls dev $DEVICE" 24 | 25 | $TC class add dev $DEVICE parent 1:0 classid :1 est 1sec 8sec cbq \ 26 | $BANDWIDTH rate 10Mbit allot 1514 maxburst 50 avpkt 1000 27 | 28 | # Bulk. 29 | # New parameters are: 30 | # weight, which is set to be proportional to 31 | # "rate". It is not necessary, weight=1 will work as well. 32 | # defmap and split say that best effort ttraffic, not classfied 33 | # by another means will fall to this class. 34 | 35 | $TC class add dev $DEVICE parent 1:1 classid :2 est 1sec 8sec cbq \ 36 | $BANDWIDTH rate 4Mbit allot 1514 weight 500Kbit \ 37 | prio 6 maxburst 50 avpkt 1000 split 1:0 defmap ff3d 38 | 39 | # OPTIONAL. 40 | # Attach "sfq" qdisc to this class, quantum is MTU, perturb 41 | # gives period of hash function perturbation in seconds. 42 | # 43 | $TC qdisc add dev $DEVICE parent 1:2 sfq quantum 1514b perturb 15 44 | 45 | # Interactive-burst class 46 | 47 | $TC class add dev $DEVICE parent 1:1 classid :3 est 2sec 16sec cbq \ 48 | $BANDWIDTH rate 1Mbit allot 1514 weight 100Kbit \ 49 | prio 2 maxburst 100 avpkt 1000 split 1:0 defmap c0 50 | 51 | $TC qdisc add dev $DEVICE parent 1:3 sfq quantum 1514b perturb 15 52 | 53 | # Background. 54 | 55 | $TC class add dev $DEVICE parent 1:1 classid :4 est 1sec 8sec cbq \ 56 | $BANDWIDTH rate 100Kbit allot 1514 weight 10Mbit \ 57 | prio 7 maxburst 10 avpkt 1000 split 1:0 defmap 2 58 | 59 | $TC qdisc add dev $DEVICE parent 1:4 sfq quantum 1514b perturb 15 60 | 61 | # Realtime class for RSVP 62 | 63 | $TC class add dev $DEVICE parent 1:1 classid 1:7FFE cbq \ 64 | rate 5Mbit $BANDWIDTH allot 1514b avpkt 1000 \ 65 | maxburst 20 66 | 67 | # Reclassified realtime traffic 68 | # 69 | # New element: split is not 1:0, but 1:7FFE. It means, 70 | # that only real-time packets, which violated policing filters 71 | # or exceeded reshaping buffers will fall to it. 72 | 73 | $TC class add dev $DEVICE parent 1:7FFE classid 1:7FFF est 4sec 32sec cbq \ 74 | rate 1Mbit $BANDWIDTH allot 1514b avpkt 1000 weight 10Kbit \ 75 | prio 6 maxburst 10 split 1:7FFE defmap ffff 76 | 77 | -------------------------------------------------------------------------------- /iproute2-3.19.0/examples/diffserv/Edge1: -------------------------------------------------------------------------------- 1 | #! /bin/sh -x 2 | # 3 | # sample script on using the ingress capabilities 4 | # This script just tags on the ingress interfac using Ipchains 5 | # the result is used for fast classification and re-marking 6 | # on the egress interface 7 | # 8 | #path to various utilities; 9 | #change to reflect yours. 10 | # 11 | IPROUTE=/root/DS-6-beta/iproute2-990530-dsing 12 | TC=$IPROUTE/tc/tc 13 | IP=$IPROUTE/ip/ip 14 | IPCHAINS=/root/DS-6-beta/ipchains-1.3.9/ipchains 15 | INDEV=eth2 16 | EGDEV="dev eth1" 17 | # 18 | # tag all incoming packets from host 10.2.0.24 to value 1 19 | # tag all incoming packets from host 10.2.0.3 to value 2 20 | # tag the rest of incoming packets from subnet 10.2.0.0/24 to value 3 21 | #These values are used in the egress 22 | # 23 | ############################################################ 24 | $IPCHAINS -A input -s 10.2.0.4/24 -m 3 25 | $IPCHAINS -A input -i $INDEV -s 10.2.0.24 -m 1 26 | $IPCHAINS -A input -i $INDEV -s 10.2.0.3 -m 2 27 | 28 | ######################## Egress side ######################## 29 | 30 | 31 | # attach a dsmarker 32 | # 33 | $TC qdisc add $EGDEV handle 1:0 root dsmark indices 64 set_tc_index 34 | # 35 | # values of the DSCP to change depending on the class 36 | # 37 | #becomes EF 38 | $TC class change $EGDEV classid 1:1 dsmark mask 0x3 \ 39 | value 0xb8 40 | #becomes AF11 41 | $TC class change $EGDEV classid 1:2 dsmark mask 0x3 \ 42 | value 0x28 43 | #becomes AF21 44 | $TC class change $EGDEV classid 1:3 dsmark mask 0x3 \ 45 | value 0x48 46 | # 47 | # 48 | # The class mapping 49 | # 50 | $TC filter add $EGDEV parent 1:0 protocol ip prio 4 handle 1 fw classid 1:1 51 | $TC filter add $EGDEV parent 1:0 protocol ip prio 4 handle 2 fw classid 1:2 52 | $TC filter add $EGDEV parent 1:0 protocol ip prio 4 handle 3 fw classid 1:3 53 | # 54 | 55 | # 56 | echo "---- qdisc parameters Ingress ----------" 57 | $TC qdisc ls dev $INDEV 58 | echo "---- Class parameters Ingress ----------" 59 | $TC class ls dev $INDEV 60 | echo "---- filter parameters Ingress ----------" 61 | $TC filter ls dev $INDEV parent 1:0 62 | 63 | echo "---- qdisc parameters Egress ----------" 64 | $TC qdisc ls $EGDEV 65 | echo "---- Class parameters Egress ----------" 66 | $TC class ls $EGDEV 67 | echo "---- filter parameters Egress ----------" 68 | $TC filter ls $EGDEV parent 1:0 69 | -------------------------------------------------------------------------------- /iproute2-3.19.0/examples/diffserv/README: -------------------------------------------------------------------------------- 1 | 2 | Note all these are mere examples which can be customized to your needs 3 | 4 | AFCBQ 5 | ----- 6 | AF PHB built using CBQ, DSMARK,GRED (default in GRIO mode) ,RED for BE 7 | and the tcindex classifier with some algorithmic mapping 8 | 9 | EFCBQ 10 | ----- 11 | EF PHB built using CBQ (for rate control and prioritization), 12 | DSMARK( to remark DSCPs), tcindex classifier and RED for the BE 13 | traffic. 14 | 15 | EFPRIO 16 | ------ 17 | EF PHB using the PRIO scheduler, Token Bucket to rate control EF, 18 | tcindex classifier, DSMARK to remark, and RED for the BE traffic 19 | 20 | EDGE scripts 21 | ============== 22 | 23 | CB-3(1|2)-(u32/chains) 24 | ====================== 25 | 26 | 27 | The major differences are that the classifier is u32 on -u32 extension 28 | and IPchains on the chains extension. CB stands for color Blind 29 | and 31 is for the mode where only a CIR and CBS are defined whereas 30 | 32 stands for a mode where a CIR/CBS + PIR/EBS are defined. 31 | 32 | Color Blind (CB) 33 | ==========-----= 34 | We look at one special subnet that we are interested in for simplicty 35 | reasons to demonstrate the capability. We send the packets from that 36 | subnet to AF4*, BE or end up dropping depending on the metering results. 37 | 38 | 39 | The algorithm overview is as follows: 40 | 41 | *classify: 42 | 43 | **case: subnet X 44 | ---------------- 45 | if !exceed meter1 tag as AF41 46 | else 47 | if !exceed meter2 tag as AF42 48 | else 49 | if !exceed meter 3 tag as AF43 50 | else 51 | drop 52 | 53 | default case: Any other subnet 54 | ------------------------------- 55 | if !exceed meter 5 tag as AF43 56 | else 57 | drop 58 | 59 | 60 | One Egress side change the DSCPs of the packets to reflect AF4* and BE 61 | based on the tags from the ingress. 62 | 63 | ------------------------------------------------------------- 64 | 65 | Color Aware 66 | =========== 67 | 68 | Define some meters with + policing and give them IDs eg 69 | 70 | meter1=police index 1 rate $CIR1 burst $CBS1 71 | meter2=police index 2 rate $CIR2 burst $CBS2 etc 72 | 73 | General overview: 74 | classify based on the DSCPs and use the policer ids to decide tagging 75 | 76 | 77 | *classify on ingress: 78 | 79 | switch (dscp) { 80 | case AF41: /* tos&0xfc == 0x88 */ 81 | if (!exceed meter1) break; 82 | case AF42: /* tos&0xfc == 0x90 */ 83 | if (!exceed meter2) { 84 | tag as AF42; 85 | break; 86 | } 87 | case AF43: /* tos&0xfc == 0x98 */ 88 | if (!exceed meter3) { 89 | tag as AF43; 90 | break; 91 | } else 92 | drop; 93 | default: 94 | if (!exceed meter4) tag as BE; 95 | else drop; 96 | } 97 | 98 | On the Egress side mark the proper AF tags 99 | -------------------------------------------------------------------------------- /iproute2-3.19.0/examples/diffserv/ef-prio: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | $TC = "/root/DS-6-beta/iproute2-990530-dsing/tc/tc"; 3 | $DEV = "dev eth1"; 4 | $efrate="1.5Mbit"; 5 | $MTU="1.5kB"; 6 | print "$TC qdisc add $DEV handle 1:0 root dsmark indices 64 set_tc_index\n"; 7 | print "$TC filter add $DEV parent 1:0 protocol ip prio 1 tcindex ". 8 | "mask 0xfc shift 2\n"; 9 | print "$TC qdisc add $DEV parent 1:0 handle 2:0 prio\n"; 10 | # 11 | # EF class: Maximum about one MTU sized packet allowed on the queue 12 | # 13 | print "$TC qdisc add $DEV parent 2:1 tbf rate $efrate burst $MTU limit 1.6kB\n"; 14 | print "$TC filter add $DEV parent 2:0 protocol ip prio 1 ". 15 | "handle 0x2e tcindex classid 2:1 pass_on\n"; 16 | # 17 | # BE class 18 | # 19 | print "#BE class(2:2) \n"; 20 | print "$TC qdisc add $DEV parent 2:2 red limit 60KB ". 21 | "min 15KB max 45KB burst 20 avpkt 1000 bandwidth 10Mbit ". 22 | "probability 0.4\n"; 23 | # 24 | print "$TC filter add $DEV parent 2:0 protocol ip prio 2 ". 25 | "handle 0 tcindex mask 0 classid 2:2 pass_on\n"; 26 | -------------------------------------------------------------------------------- /iproute2-3.19.0/examples/diffserv/efcbq: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | # 3 | $TC = "/root/DS-6-beta/iproute2-990530-dsing/tc/tc"; 4 | $DEV = "dev eth1"; 5 | print "$TC qdisc add $DEV handle 1:0 root dsmark indices 64 set_tc_index\n"; 6 | print "$TC filter add $DEV parent 1:0 protocol ip prio 1 tcindex ". 7 | "mask 0xfc shift 2\n"; 8 | print "$TC qdisc add $DEV parent 1:0 handle 2:0 cbq bandwidth ". 9 | "10Mbit cell 8 avpkt 1000 mpu 64\n"; 10 | # 11 | # EF class 12 | # 13 | print "$TC class add $DEV parent 2:0 classid 2:1 cbq bandwidth ". 14 | "10Mbit rate 1500Kbit avpkt 1000 prio 1 bounded isolated ". 15 | "allot 1514 weight 1 maxburst 10 \n"; 16 | # packet fifo for EF? 17 | print "$TC qdisc add $DEV parent 2:1 pfifo limit 5\n"; 18 | print "$TC filter add $DEV parent 2:0 protocol ip prio 1 ". 19 | "handle 0x2e tcindex classid 2:1 pass_on\n"; 20 | # 21 | # BE class 22 | # 23 | print "#BE class(2:2) \n"; 24 | print "$TC class add $DEV parent 2:0 classid 2:2 cbq bandwidth ". 25 | "10Mbit rate 5Mbit avpkt 1000 prio 7 allot 1514 weight 1 ". 26 | "maxburst 21 borrow split 2:0 defmap 0xffff \n"; 27 | print "$TC qdisc add $DEV parent 2:2 red limit 60KB ". 28 | "min 15KB max 45KB burst 20 avpkt 1000 bandwidth 10Mbit ". 29 | "probability 0.4\n"; 30 | print "$TC filter add $DEV parent 2:0 protocol ip prio 2 ". 31 | "handle 0 tcindex mask 0 classid 2:2 pass_on\n"; 32 | -------------------------------------------------------------------------------- /iproute2-3.19.0/examples/gaiconf: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # Setup address label from /etc/gai.conf 5 | # 6 | # Written by YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>, 2010. 7 | # 8 | 9 | IP=ip 10 | DEFAULT_GAICONF=/etc/gai.conf 11 | verbose= 12 | debug= 13 | 14 | function run () 15 | { 16 | if [ x"$verbose" != x"" ]; then 17 | echo "$@" 18 | fi 19 | if [ x"$debug" = x"" ]; then 20 | "$@" 21 | fi 22 | } 23 | 24 | function do_load_config () 25 | { 26 | file=$1; shift 27 | flush=1 28 | cat $file | while read command prefix label; do 29 | if [ x"$command" = x"#label" ]; then 30 | if [ ${flush} = 1 ]; then 31 | run ${IP} -6 addrlabel flush 32 | flush=0 33 | fi 34 | run ${IP} -6 addrlabel add prefix $prefix label $label 35 | fi 36 | done 37 | } 38 | 39 | function do_list_config () 40 | { 41 | ${IP} -6 addrlabel list | while read p pfx l lbl; do 42 | echo label ${pfx} ${lbl} 43 | done 44 | } 45 | 46 | function help () 47 | { 48 | echo "Usage: $0 [-v] {--list | --config [ ${DEFAULT_GAICONF} ] | --default}" 49 | exit 1 50 | } 51 | 52 | TEMP=`getopt -o c::dlv -l config::,default,list,verbose -n gaiconf -- "$@"` 53 | 54 | if [ $? != 0 ]; then 55 | echo "Terminating..." >&2 56 | exit 1 57 | fi 58 | 59 | TEMPFILE=`mktemp` 60 | 61 | eval set -- "$TEMP" 62 | 63 | while true ; do 64 | case "$1" in 65 | -c|--config) 66 | if [ x"$cmd" != x"" ]; then 67 | help 68 | fi 69 | case "$2" in 70 | "") gai_conf="${DEFAULT_GAICONF}" 71 | shift 2 72 | ;; 73 | *) gai_conf="$2" 74 | shift 2 75 | esac 76 | cmd=config 77 | ;; 78 | -d|--default) 79 | if [ x"$cmd" != x"" ]; then 80 | help 81 | fi 82 | gai_conf=${TEMPFILE} 83 | cmd=config 84 | ;; 85 | -l|--list) 86 | if [ x"$cmd" != x"" ]; then 87 | help 88 | fi 89 | cmd=list 90 | shift 91 | ;; 92 | -v) 93 | verbose=1 94 | shift 95 | ;; 96 | --) 97 | shift; 98 | break 99 | ;; 100 | *) 101 | echo "Internal error!" >&2 102 | exit 1 103 | ;; 104 | esac 105 | done 106 | 107 | case "$cmd" in 108 | config) 109 | if [ x"$gai_conf" = x"${TEMPFILE}" ]; then 110 | sed -e 's/^[[:space:]]*//' <<END_OF_DEFAULT >${TEMPFILE} 111 | label ::1/128 0 112 | label ::/0 1 113 | label 2002::/16 2 114 | label ::/96 3 115 | label ::ffff:0:0/96 4 116 | label fec0::/10 5 117 | label fc00::/7 6 118 | label 2001:0::/32 7 119 | END_OF_DEFAULT 120 | fi 121 | do_load_config "$gai_conf" 122 | ;; 123 | list) 124 | do_list_config 125 | ;; 126 | *) 127 | help 128 | ;; 129 | esac 130 | 131 | rm -f "${TEMPFILE}" 132 | 133 | exit 0 134 | 135 | -------------------------------------------------------------------------------- /iproute2-3.19.0/genl/.gitignore: -------------------------------------------------------------------------------- 1 | genl 2 | -------------------------------------------------------------------------------- /iproute2-3.19.0/genl/Makefile: -------------------------------------------------------------------------------- 1 | GENLOBJ=genl.o 2 | 3 | include ../Config 4 | SHARED_LIBS ?= y 5 | 6 | CFLAGS += -fno-strict-aliasing 7 | 8 | GENLMODULES := 9 | GENLMODULES += ctrl.o 10 | 11 | GENLOBJ += $(GENLMODULES) 12 | 13 | GENLLIB := 14 | 15 | ifeq ($(SHARED_LIBS),y) 16 | LDFLAGS += -Wl,-export-dynamic 17 | LDLIBS += -lm -ldl 18 | endif 19 | 20 | all: genl 21 | 22 | genl: $(GENLOBJ) $(LIBNETLINK) $(LIBUTIL) $(GENLLIB) 23 | 24 | install: all 25 | install -m 0755 genl $(DESTDIR)$(SBINDIR) 26 | 27 | clean: 28 | rm -f $(GENLOBJ) $(GENLLIB) genl 29 | 30 | ifneq ($(SHARED_LIBS),y) 31 | 32 | genl: static-syms.o 33 | static-syms.o: static-syms.h 34 | static-syms.h: $(wildcard *.c) 35 | files="$^" ; \ 36 | for s in `grep -B 3 '\<dlsym' $$files | sed -n '/snprintf/{s:.*"\([^"]*\)".*:\1:;s:%s::;p}'` ; do \ 37 | sed -n '/'$$s'[^ ]* =/{s:.* \([^ ]*'$$s'[^ ]*\) .*:extern char \1[] __attribute__((weak)); if (!strcmp(sym, "\1")) return \1;:;p}' $$files ; \ 38 | done > $@ 39 | 40 | endif 41 | -------------------------------------------------------------------------------- /iproute2-3.19.0/genl/genl_utils.h: -------------------------------------------------------------------------------- 1 | #ifndef _TC_UTIL_H_ 2 | #define _TC_UTIL_H_ 1 3 | 4 | #include "utils.h" 5 | #include "linux/genetlink.h" 6 | 7 | struct genl_util 8 | { 9 | struct genl_util *next; 10 | char name[16]; 11 | int (*parse_genlopt)(struct genl_util *fu, int argc, char **argv); 12 | int (*print_genlopt)(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg); 13 | }; 14 | 15 | extern int genl_ctrl_resolve_family(const char *family); 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /iproute2-3.19.0/genl/static-syms.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This file creates a dummy version of dynamic loading 3 | * for environments where dynamic linking 4 | * is not used or available. 5 | */ 6 | 7 | #include <string.h> 8 | #include "dlfcn.h" 9 | 10 | void *_dlsym(const char *sym) 11 | { 12 | #include "static-syms.h" 13 | return NULL; 14 | } 15 | -------------------------------------------------------------------------------- /iproute2-3.19.0/include/SNAPSHOT.h: -------------------------------------------------------------------------------- 1 | static const char SNAPSHOT[] = "150210"; 2 | -------------------------------------------------------------------------------- /iproute2-3.19.0/include/dlfcn.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Stub dlfcn implementation for systems that lack shared library support 3 | * but obviously can still reference compiled-in symbols. 4 | */ 5 | 6 | #ifndef NO_SHARED_LIBS 7 | #include_next <dlfcn.h> 8 | #else 9 | 10 | #define RTLD_LAZY 0 11 | #define RTLD_GLOBAL 1 12 | #define _FAKE_DLFCN_HDL (void *)0xbeefcafe 13 | 14 | static inline void *dlopen(const char *file, int flag) 15 | { 16 | if (file == NULL) 17 | return _FAKE_DLFCN_HDL; 18 | else 19 | return NULL; 20 | } 21 | 22 | extern void *_dlsym(const char *sym); 23 | static inline void *dlsym(void *handle, const char *sym) 24 | { 25 | if (handle != _FAKE_DLFCN_HDL) 26 | return NULL; 27 | return _dlsym(sym); 28 | } 29 | 30 | static inline char *dlerror(void) 31 | { 32 | return NULL; 33 | } 34 | 35 | static inline int dlclose(void *handle) 36 | { 37 | return (handle == _FAKE_DLFCN_HDL) ? 0 : 1; 38 | } 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /iproute2-3.19.0/include/hlist.h: -------------------------------------------------------------------------------- 1 | #ifndef __HLIST_H__ 2 | #define __HLIST_H__ 1 3 | /* Hash list stuff from kernel */ 4 | 5 | #include <stddef.h> 6 | 7 | #define container_of(ptr, type, member) ({ \ 8 | const typeof( ((type *)0)->member ) *__mptr = (ptr); \ 9 | (type *)( (char *)__mptr - offsetof(type,member) );}) 10 | 11 | struct hlist_head { 12 | struct hlist_node *first; 13 | }; 14 | 15 | struct hlist_node { 16 | struct hlist_node *next, **pprev; 17 | }; 18 | 19 | static inline void hlist_del(struct hlist_node *n) 20 | { 21 | struct hlist_node *next = n->next; 22 | struct hlist_node **pprev = n->pprev; 23 | *pprev = next; 24 | if (next) 25 | next->pprev = pprev; 26 | } 27 | 28 | static inline void hlist_add_head(struct hlist_node *n, struct hlist_head *h) 29 | { 30 | struct hlist_node *first = h->first; 31 | n->next = first; 32 | if (first) 33 | first->pprev = &n->next; 34 | h->first = n; 35 | n->pprev = &h->first; 36 | } 37 | 38 | #define hlist_for_each(pos, head) \ 39 | for (pos = (head)->first; pos ; pos = pos->next) 40 | 41 | 42 | #define hlist_for_each_safe(pos, n, head) \ 43 | for (pos = (head)->first; pos && ({ n = pos->next; 1; }); \ 44 | pos = n) 45 | 46 | #define hlist_entry_safe(ptr, type, member) \ 47 | ({ typeof(ptr) ____ptr = (ptr); \ 48 | ____ptr ? hlist_entry(____ptr, type, member) : NULL; \ 49 | }) 50 | 51 | #define hlist_for_each_entry(pos, head, member) \ 52 | for (pos = hlist_entry_safe((head)->first, typeof(*(pos)), member);\ 53 | pos; \ 54 | pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member)) 55 | 56 | #endif /* __HLIST_H__ */ 57 | -------------------------------------------------------------------------------- /iproute2-3.19.0/include/iptables_common.h: -------------------------------------------------------------------------------- 1 | #ifndef _IPTABLES_COMMON_H 2 | #define _IPTABLES_COMMON_H 3 | /* Shared definitions between ipv4 and ipv6. */ 4 | 5 | enum exittype { 6 | OTHER_PROBLEM = 1, 7 | PARAMETER_PROBLEM, 8 | VERSION_PROBLEM, 9 | RESOURCE_PROBLEM 10 | }; 11 | 12 | /* this is a special 64bit data type that is 8-byte aligned */ 13 | #define aligned_u64 unsigned long long __attribute__((aligned(8))) 14 | 15 | extern void exit_printhelp(void) __attribute__((noreturn)); 16 | extern void exit_tryhelp(int) __attribute__((noreturn)); 17 | int check_inverse(const char option[], int *invert, int *optind, int argc); 18 | extern int string_to_number(const char *, 19 | unsigned int, 20 | unsigned int, 21 | unsigned int *); 22 | extern int string_to_number_l(const char *, 23 | unsigned long int, 24 | unsigned long int, 25 | unsigned long *); 26 | extern int string_to_number_ll(const char *, 27 | unsigned long long int, 28 | unsigned long long int, 29 | unsigned long long *); 30 | extern int iptables_insmod(const char *modname, const char *modprobe); 31 | extern int load_iptables_ko(const char *modprobe); 32 | void exit_error(enum exittype, char *, ...)__attribute__((noreturn, 33 | format(printf,2,3))); 34 | extern const char *program_name, *program_version; 35 | extern char *lib_dir; 36 | 37 | #define _init __attribute__((constructor)) my_init 38 | #ifdef NO_SHARED_LIBS 39 | # ifdef _INIT 40 | # undef _init 41 | # define _init _INIT 42 | # endif 43 | extern void init_extensions(void); 44 | #endif 45 | 46 | #define __be32 u_int32_t 47 | #define __le32 u_int32_t 48 | #define __be16 u_int16_t 49 | #define __le16 u_int16_t 50 | 51 | #endif /*_IPTABLES_COMMON_H*/ 52 | -------------------------------------------------------------------------------- /iproute2-3.19.0/include/libgenl.h: -------------------------------------------------------------------------------- 1 | #ifndef __LIBGENL_H__ 2 | #define __LIBGENL_H__ 3 | 4 | #include "libnetlink.h" 5 | 6 | #define GENL_REQUEST(_req, _bufsiz, _family, _hdrsiz, _ver, _cmd, _flags) \ 7 | struct { \ 8 | struct nlmsghdr n; \ 9 | struct genlmsghdr g; \ 10 | char buf[NLMSG_ALIGN(_hdrsiz) + (_bufsiz)]; \ 11 | } _req = { \ 12 | .n = { \ 13 | .nlmsg_type = (_family), \ 14 | .nlmsg_flags = (_flags), \ 15 | .nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN + (_hdrsiz)), \ 16 | }, \ 17 | .g = { \ 18 | .cmd = (_cmd), \ 19 | .version = (_ver), \ 20 | }, \ 21 | } 22 | 23 | extern int genl_resolve_family(struct rtnl_handle *grth, const char *family); 24 | 25 | #endif /* __LIBGENL_H__ */ 26 | -------------------------------------------------------------------------------- /iproute2-3.19.0/include/libiptc/ipt_kernel_headers.h: -------------------------------------------------------------------------------- 1 | /* This is the userspace/kernel interface for Generic IP Chains, 2 | required for libc6. */ 3 | #ifndef _FWCHAINS_KERNEL_HEADERS_H 4 | #define _FWCHAINS_KERNEL_HEADERS_H 5 | 6 | #include <limits.h> 7 | 8 | #if defined(__GLIBC__) && __GLIBC__ == 2 9 | #include <netinet/ip.h> 10 | #include <netinet/in.h> 11 | #include <netinet/ip_icmp.h> 12 | #include <netinet/tcp.h> 13 | #include <netinet/udp.h> 14 | #include <sys/types.h> 15 | #else /* libc5 */ 16 | #include <sys/socket.h> 17 | #include <linux/ip.h> 18 | #include <linux/in.h> 19 | #include <linux/if.h> 20 | #include <linux/icmp.h> 21 | #include <linux/tcp.h> 22 | #include <linux/udp.h> 23 | #include <linux/types.h> 24 | #include <linux/in6.h> 25 | #endif 26 | #endif 27 | -------------------------------------------------------------------------------- /iproute2-3.19.0/include/linux/atmapi.h: -------------------------------------------------------------------------------- 1 | /* atmapi.h - ATM API user space/kernel compatibility */ 2 | 3 | /* Written 1999,2000 by Werner Almesberger, EPFL ICA */ 4 | 5 | 6 | #ifndef _LINUX_ATMAPI_H 7 | #define _LINUX_ATMAPI_H 8 | 9 | #if defined(__sparc__) || defined(__ia64__) 10 | /* such alignment is not required on 32 bit sparcs, but we can't 11 | figure that we are on a sparc64 while compiling user-space programs. */ 12 | #define __ATM_API_ALIGN __attribute__((aligned(8))) 13 | #else 14 | #define __ATM_API_ALIGN 15 | #endif 16 | 17 | 18 | /* 19 | * Opaque type for kernel pointers. Note that _ is never accessed. We need 20 | * the struct in order hide the array, so that we can make simple assignments 21 | * instead of being forced to use memcpy. It also improves error reporting for 22 | * code that still assumes that we're passing unsigned longs. 23 | * 24 | * Convention: NULL pointers are passed as a field of all zeroes. 25 | */ 26 | 27 | typedef struct { unsigned char _[8]; } __ATM_API_ALIGN atm_kptr_t; 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /iproute2-3.19.0/include/linux/atmioc.h: -------------------------------------------------------------------------------- 1 | /* atmioc.h - ranges for ATM-related ioctl numbers */ 2 | 3 | /* Written 1995-1999 by Werner Almesberger, EPFL LRC/ICA */ 4 | 5 | 6 | /* 7 | * See http://icawww1.epfl.ch/linux-atm/magic.html for the complete list of 8 | * "magic" ioctl numbers. 9 | */ 10 | 11 | 12 | #ifndef _LINUX_ATMIOC_H 13 | #define _LINUX_ATMIOC_H 14 | 15 | #include <asm/ioctl.h> 16 | /* everybody including atmioc.h will also need _IO{,R,W,WR} */ 17 | 18 | #define ATMIOC_PHYCOM 0x00 /* PHY device common ioctls, globally unique */ 19 | #define ATMIOC_PHYCOM_END 0x0f 20 | #define ATMIOC_PHYTYP 0x10 /* PHY dev type ioctls, unique per PHY type */ 21 | #define ATMIOC_PHYTYP_END 0x2f 22 | #define ATMIOC_PHYPRV 0x30 /* PHY dev private ioctls, unique per driver */ 23 | #define ATMIOC_PHYPRV_END 0x4f 24 | #define ATMIOC_SARCOM 0x50 /* SAR device common ioctls, globally unique */ 25 | #define ATMIOC_SARCOM_END 0x50 26 | #define ATMIOC_SARPRV 0x60 /* SAR dev private ioctls, unique per driver */ 27 | #define ATMIOC_SARPRV_END 0x7f 28 | #define ATMIOC_ITF 0x80 /* Interface ioctls, globally unique */ 29 | #define ATMIOC_ITF_END 0x8f 30 | #define ATMIOC_BACKEND 0x90 /* ATM generic backend ioctls, u. per backend */ 31 | #define ATMIOC_BACKEND_END 0xaf 32 | /* 0xb0-0xbf: Reserved for future use */ 33 | #define ATMIOC_AREQUIPA 0xc0 /* Application requested IP over ATM, glob. u. */ 34 | #define ATMIOC_LANE 0xd0 /* LAN Emulation, globally unique */ 35 | #define ATMIOC_MPOA 0xd8 /* MPOA, globally unique */ 36 | #define ATMIOC_CLIP 0xe0 /* Classical IP over ATM control, globally u. */ 37 | #define ATMIOC_CLIP_END 0xef 38 | #define ATMIOC_SPECIAL 0xf0 /* Special-purpose controls, globally unique */ 39 | #define ATMIOC_SPECIAL_END 0xff 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /iproute2-3.19.0/include/linux/bpf_common.h: -------------------------------------------------------------------------------- 1 | #ifndef __LINUX_BPF_COMMON_H__ 2 | #define __LINUX_BPF_COMMON_H__ 3 | 4 | /* Instruction classes */ 5 | #define BPF_CLASS(code) ((code) & 0x07) 6 | #define BPF_LD 0x00 7 | #define BPF_LDX 0x01 8 | #define BPF_ST 0x02 9 | #define BPF_STX 0x03 10 | #define BPF_ALU 0x04 11 | #define BPF_JMP 0x05 12 | #define BPF_RET 0x06 13 | #define BPF_MISC 0x07 14 | 15 | /* ld/ldx fields */ 16 | #define BPF_SIZE(code) ((code) & 0x18) 17 | #define BPF_W 0x00 18 | #define BPF_H 0x08 19 | #define BPF_B 0x10 20 | #define BPF_MODE(code) ((code) & 0xe0) 21 | #define BPF_IMM 0x00 22 | #define BPF_ABS 0x20 23 | #define BPF_IND 0x40 24 | #define BPF_MEM 0x60 25 | #define BPF_LEN 0x80 26 | #define BPF_MSH 0xa0 27 | 28 | /* alu/jmp fields */ 29 | #define BPF_OP(code) ((code) & 0xf0) 30 | #define BPF_ADD 0x00 31 | #define BPF_SUB 0x10 32 | #define BPF_MUL 0x20 33 | #define BPF_DIV 0x30 34 | #define BPF_OR 0x40 35 | #define BPF_AND 0x50 36 | #define BPF_LSH 0x60 37 | #define BPF_RSH 0x70 38 | #define BPF_NEG 0x80 39 | #define BPF_MOD 0x90 40 | #define BPF_XOR 0xa0 41 | 42 | #define BPF_JA 0x00 43 | #define BPF_JEQ 0x10 44 | #define BPF_JGT 0x20 45 | #define BPF_JGE 0x30 46 | #define BPF_JSET 0x40 47 | #define BPF_SRC(code) ((code) & 0x08) 48 | #define BPF_K 0x00 49 | #define BPF_X 0x08 50 | 51 | #ifndef BPF_MAXINSNS 52 | #define BPF_MAXINSNS 4096 53 | #endif 54 | 55 | #endif /* __LINUX_BPF_COMMON_H__ */ 56 | -------------------------------------------------------------------------------- /iproute2-3.19.0/include/linux/fib_rules.h: -------------------------------------------------------------------------------- 1 | #ifndef __LINUX_FIB_RULES_H 2 | #define __LINUX_FIB_RULES_H 3 | 4 | #include <linux/types.h> 5 | #include <linux/rtnetlink.h> 6 | 7 | /* rule is permanent, and cannot be deleted */ 8 | #define FIB_RULE_PERMANENT 0x00000001 9 | #define FIB_RULE_INVERT 0x00000002 10 | #define FIB_RULE_UNRESOLVED 0x00000004 11 | #define FIB_RULE_IIF_DETACHED 0x00000008 12 | #define FIB_RULE_DEV_DETACHED FIB_RULE_IIF_DETACHED 13 | #define FIB_RULE_OIF_DETACHED 0x00000010 14 | 15 | /* try to find source address in routing lookups */ 16 | #define FIB_RULE_FIND_SADDR 0x00010000 17 | 18 | struct fib_rule_hdr { 19 | __u8 family; 20 | __u8 dst_len; 21 | __u8 src_len; 22 | __u8 tos; 23 | 24 | __u8 table; 25 | __u8 res1; /* reserved */ 26 | __u8 res2; /* reserved */ 27 | __u8 action; 28 | 29 | __u32 flags; 30 | }; 31 | 32 | enum { 33 | FRA_UNSPEC, 34 | FRA_DST, /* destination address */ 35 | FRA_SRC, /* source address */ 36 | FRA_IIFNAME, /* interface name */ 37 | #define FRA_IFNAME FRA_IIFNAME 38 | FRA_GOTO, /* target to jump to (FR_ACT_GOTO) */ 39 | FRA_UNUSED2, 40 | FRA_PRIORITY, /* priority/preference */ 41 | FRA_UNUSED3, 42 | FRA_UNUSED4, 43 | FRA_UNUSED5, 44 | FRA_FWMARK, /* mark */ 45 | FRA_FLOW, /* flow/class id */ 46 | FRA_UNUSED6, 47 | FRA_SUPPRESS_IFGROUP, 48 | FRA_SUPPRESS_PREFIXLEN, 49 | FRA_TABLE, /* Extended table id */ 50 | FRA_FWMASK, /* mask for netfilter mark */ 51 | FRA_OIFNAME, 52 | __FRA_MAX 53 | }; 54 | 55 | #define FRA_MAX (__FRA_MAX - 1) 56 | 57 | enum { 58 | FR_ACT_UNSPEC, 59 | FR_ACT_TO_TBL, /* Pass to fixed table */ 60 | FR_ACT_GOTO, /* Jump to another rule */ 61 | FR_ACT_NOP, /* No operation */ 62 | FR_ACT_RES3, 63 | FR_ACT_RES4, 64 | FR_ACT_BLACKHOLE, /* Drop without notification */ 65 | FR_ACT_UNREACHABLE, /* Drop with ENETUNREACH */ 66 | FR_ACT_PROHIBIT, /* Drop with EACCES */ 67 | __FR_ACT_MAX, 68 | }; 69 | 70 | #define FR_ACT_MAX (__FR_ACT_MAX - 1) 71 | 72 | #endif 73 | -------------------------------------------------------------------------------- /iproute2-3.19.0/include/linux/filter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Linux Socket Filter Data Structures 3 | */ 4 | 5 | #ifndef __LINUX_FILTER_H__ 6 | #define __LINUX_FILTER_H__ 7 | 8 | 9 | #include <linux/types.h> 10 | #include <linux/bpf_common.h> 11 | 12 | /* 13 | * Current version of the filter code architecture. 14 | */ 15 | #define BPF_MAJOR_VERSION 1 16 | #define BPF_MINOR_VERSION 1 17 | 18 | /* 19 | * Try and keep these values and structures similar to BSD, especially 20 | * the BPF code definitions which need to match so you can share filters 21 | */ 22 | 23 | struct sock_filter { /* Filter block */ 24 | __u16 code; /* Actual filter code */ 25 | __u8 jt; /* Jump true */ 26 | __u8 jf; /* Jump false */ 27 | __u32 k; /* Generic multiuse field */ 28 | }; 29 | 30 | struct sock_fprog { /* Required for SO_ATTACH_FILTER. */ 31 | unsigned short len; /* Number of filter blocks */ 32 | struct sock_filter *filter; 33 | }; 34 | 35 | /* ret - BPF_K and BPF_X also apply */ 36 | #define BPF_RVAL(code) ((code) & 0x18) 37 | #define BPF_A 0x10 38 | 39 | /* misc */ 40 | #define BPF_MISCOP(code) ((code) & 0xf8) 41 | #define BPF_TAX 0x00 42 | #define BPF_TXA 0x80 43 | 44 | /* 45 | * Macros for filter block array initializers. 46 | */ 47 | #ifndef BPF_STMT 48 | #define BPF_STMT(code, k) { (unsigned short)(code), 0, 0, k } 49 | #endif 50 | #ifndef BPF_JUMP 51 | #define BPF_JUMP(code, k, jt, jf) { (unsigned short)(code), jt, jf, k } 52 | #endif 53 | 54 | /* 55 | * Number of scratch memory words for: BPF_ST and BPF_STX 56 | */ 57 | #define BPF_MEMWORDS 16 58 | 59 | /* RATIONALE. Negative offsets are invalid in BPF. 60 | We use them to reference ancillary data. 61 | Unlike introduction new instructions, it does not break 62 | existing compilers/optimizers. 63 | */ 64 | #define SKF_AD_OFF (-0x1000) 65 | #define SKF_AD_PROTOCOL 0 66 | #define SKF_AD_PKTTYPE 4 67 | #define SKF_AD_IFINDEX 8 68 | #define SKF_AD_NLATTR 12 69 | #define SKF_AD_NLATTR_NEST 16 70 | #define SKF_AD_MARK 20 71 | #define SKF_AD_QUEUE 24 72 | #define SKF_AD_HATYPE 28 73 | #define SKF_AD_RXHASH 32 74 | #define SKF_AD_CPU 36 75 | #define SKF_AD_ALU_XOR_X 40 76 | #define SKF_AD_VLAN_TAG 44 77 | #define SKF_AD_VLAN_TAG_PRESENT 48 78 | #define SKF_AD_PAY_OFFSET 52 79 | #define SKF_AD_RANDOM 56 80 | #define SKF_AD_MAX 60 81 | #define SKF_NET_OFF (-0x100000) 82 | #define SKF_LL_OFF (-0x200000) 83 | 84 | 85 | #endif /* __LINUX_FILTER_H__ */ 86 | -------------------------------------------------------------------------------- /iproute2-3.19.0/include/linux/fou.h: -------------------------------------------------------------------------------- 1 | /* fou.h - FOU Interface */ 2 | 3 | #ifndef _LINUX_FOU_H 4 | #define _LINUX_FOU_H 5 | 6 | /* NETLINK_GENERIC related info 7 | */ 8 | #define FOU_GENL_NAME "fou" 9 | #define FOU_GENL_VERSION 0x1 10 | 11 | enum { 12 | FOU_ATTR_UNSPEC, 13 | FOU_ATTR_PORT, /* u16 */ 14 | FOU_ATTR_AF, /* u8 */ 15 | FOU_ATTR_IPPROTO, /* u8 */ 16 | FOU_ATTR_TYPE, /* u8 */ 17 | 18 | __FOU_ATTR_MAX, 19 | }; 20 | 21 | #define FOU_ATTR_MAX (__FOU_ATTR_MAX - 1) 22 | 23 | enum { 24 | FOU_CMD_UNSPEC, 25 | FOU_CMD_ADD, 26 | FOU_CMD_DEL, 27 | 28 | __FOU_CMD_MAX, 29 | }; 30 | 31 | enum { 32 | FOU_ENCAP_UNSPEC, 33 | FOU_ENCAP_DIRECT, 34 | FOU_ENCAP_GUE, 35 | }; 36 | 37 | #define FOU_CMD_MAX (__FOU_CMD_MAX - 1) 38 | 39 | #endif /* _LINUX_FOU_H */ 40 | -------------------------------------------------------------------------------- /iproute2-3.19.0/include/linux/gen_stats.h: -------------------------------------------------------------------------------- 1 | #ifndef __LINUX_GEN_STATS_H 2 | #define __LINUX_GEN_STATS_H 3 | 4 | #include <linux/types.h> 5 | 6 | enum { 7 | TCA_STATS_UNSPEC, 8 | TCA_STATS_BASIC, 9 | TCA_STATS_RATE_EST, 10 | TCA_STATS_QUEUE, 11 | TCA_STATS_APP, 12 | TCA_STATS_RATE_EST64, 13 | __TCA_STATS_MAX, 14 | }; 15 | #define TCA_STATS_MAX (__TCA_STATS_MAX - 1) 16 | 17 | /** 18 | * struct gnet_stats_basic - byte/packet throughput statistics 19 | * @bytes: number of seen bytes 20 | * @packets: number of seen packets 21 | */ 22 | struct gnet_stats_basic { 23 | __u64 bytes; 24 | __u32 packets; 25 | }; 26 | struct gnet_stats_basic_packed { 27 | __u64 bytes; 28 | __u32 packets; 29 | } __attribute__ ((packed)); 30 | 31 | /** 32 | * struct gnet_stats_rate_est - rate estimator 33 | * @bps: current byte rate 34 | * @pps: current packet rate 35 | */ 36 | struct gnet_stats_rate_est { 37 | __u32 bps; 38 | __u32 pps; 39 | }; 40 | 41 | /** 42 | * struct gnet_stats_rate_est64 - rate estimator 43 | * @bps: current byte rate 44 | * @pps: current packet rate 45 | */ 46 | struct gnet_stats_rate_est64 { 47 | __u64 bps; 48 | __u64 pps; 49 | }; 50 | 51 | /** 52 | * struct gnet_stats_queue - queuing statistics 53 | * @qlen: queue length 54 | * @backlog: backlog size of queue 55 | * @drops: number of dropped packets 56 | * @requeues: number of requeues 57 | * @overlimits: number of enqueues over the limit 58 | */ 59 | struct gnet_stats_queue { 60 | __u32 qlen; 61 | __u32 backlog; 62 | __u32 drops; 63 | __u32 requeues; 64 | __u32 overlimits; 65 | }; 66 | 67 | /** 68 | * struct gnet_estimator - rate estimator configuration 69 | * @interval: sampling period 70 | * @ewma_log: the log of measurement window weight 71 | */ 72 | struct gnet_estimator { 73 | signed char interval; 74 | unsigned char ewma_log; 75 | }; 76 | 77 | 78 | #endif /* __LINUX_GEN_STATS_H */ 79 | -------------------------------------------------------------------------------- /iproute2-3.19.0/include/linux/genetlink.h: -------------------------------------------------------------------------------- 1 | #ifndef __LINUX_GENERIC_NETLINK_H 2 | #define __LINUX_GENERIC_NETLINK_H 3 | 4 | #include <linux/types.h> 5 | #include <linux/netlink.h> 6 | 7 | #define GENL_NAMSIZ 16 /* length of family name */ 8 | 9 | #define GENL_MIN_ID NLMSG_MIN_TYPE 10 | #define GENL_MAX_ID 1023 11 | 12 | struct genlmsghdr { 13 | __u8 cmd; 14 | __u8 version; 15 | __u16 reserved; 16 | }; 17 | 18 | #define GENL_HDRLEN NLMSG_ALIGN(sizeof(struct genlmsghdr)) 19 | 20 | #define GENL_ADMIN_PERM 0x01 21 | #define GENL_CMD_CAP_DO 0x02 22 | #define GENL_CMD_CAP_DUMP 0x04 23 | #define GENL_CMD_CAP_HASPOL 0x08 24 | 25 | /* 26 | * List of reserved static generic netlink identifiers: 27 | */ 28 | #define GENL_ID_GENERATE 0 29 | #define GENL_ID_CTRL NLMSG_MIN_TYPE 30 | #define GENL_ID_VFS_DQUOT (NLMSG_MIN_TYPE + 1) 31 | #define GENL_ID_PMCRAID (NLMSG_MIN_TYPE + 2) 32 | 33 | /************************************************************************** 34 | * Controller 35 | **************************************************************************/ 36 | 37 | enum { 38 | CTRL_CMD_UNSPEC, 39 | CTRL_CMD_NEWFAMILY, 40 | CTRL_CMD_DELFAMILY, 41 | CTRL_CMD_GETFAMILY, 42 | CTRL_CMD_NEWOPS, 43 | CTRL_CMD_DELOPS, 44 | CTRL_CMD_GETOPS, 45 | CTRL_CMD_NEWMCAST_GRP, 46 | CTRL_CMD_DELMCAST_GRP, 47 | CTRL_CMD_GETMCAST_GRP, /* unused */ 48 | __CTRL_CMD_MAX, 49 | }; 50 | 51 | #define CTRL_CMD_MAX (__CTRL_CMD_MAX - 1) 52 | 53 | enum { 54 | CTRL_ATTR_UNSPEC, 55 | CTRL_ATTR_FAMILY_ID, 56 | CTRL_ATTR_FAMILY_NAME, 57 | CTRL_ATTR_VERSION, 58 | CTRL_ATTR_HDRSIZE, 59 | CTRL_ATTR_MAXATTR, 60 | CTRL_ATTR_OPS, 61 | CTRL_ATTR_MCAST_GROUPS, 62 | __CTRL_ATTR_MAX, 63 | }; 64 | 65 | #define CTRL_ATTR_MAX (__CTRL_ATTR_MAX - 1) 66 | 67 | enum { 68 | CTRL_ATTR_OP_UNSPEC, 69 | CTRL_ATTR_OP_ID, 70 | CTRL_ATTR_OP_FLAGS, 71 | __CTRL_ATTR_OP_MAX, 72 | }; 73 | 74 | #define CTRL_ATTR_OP_MAX (__CTRL_ATTR_OP_MAX - 1) 75 | 76 | enum { 77 | CTRL_ATTR_MCAST_GRP_UNSPEC, 78 | CTRL_ATTR_MCAST_GRP_NAME, 79 | CTRL_ATTR_MCAST_GRP_ID, 80 | __CTRL_ATTR_MCAST_GRP_MAX, 81 | }; 82 | 83 | #define CTRL_ATTR_MCAST_GRP_MAX (__CTRL_ATTR_MCAST_GRP_MAX - 1) 84 | 85 | 86 | #endif /* __LINUX_GENERIC_NETLINK_H */ 87 | -------------------------------------------------------------------------------- /iproute2-3.19.0/include/linux/if_addr.h: -------------------------------------------------------------------------------- 1 | #ifndef __LINUX_IF_ADDR_H 2 | #define __LINUX_IF_ADDR_H 3 | 4 | #include <linux/types.h> 5 | #include <linux/netlink.h> 6 | 7 | struct ifaddrmsg { 8 | __u8 ifa_family; 9 | __u8 ifa_prefixlen; /* The prefix length */ 10 | __u8 ifa_flags; /* Flags */ 11 | __u8 ifa_scope; /* Address scope */ 12 | __u32 ifa_index; /* Link index */ 13 | }; 14 | 15 | /* 16 | * Important comment: 17 | * IFA_ADDRESS is prefix address, rather than local interface address. 18 | * It makes no difference for normally configured broadcast interfaces, 19 | * but for point-to-point IFA_ADDRESS is DESTINATION address, 20 | * local address is supplied in IFA_LOCAL attribute. 21 | * 22 | * IFA_FLAGS is a u32 attribute that extends the u8 field ifa_flags. 23 | * If present, the value from struct ifaddrmsg will be ignored. 24 | */ 25 | enum { 26 | IFA_UNSPEC, 27 | IFA_ADDRESS, 28 | IFA_LOCAL, 29 | IFA_LABEL, 30 | IFA_BROADCAST, 31 | IFA_ANYCAST, 32 | IFA_CACHEINFO, 33 | IFA_MULTICAST, 34 | IFA_FLAGS, 35 | __IFA_MAX, 36 | }; 37 | 38 | #define IFA_MAX (__IFA_MAX - 1) 39 | 40 | /* ifa_flags */ 41 | #define IFA_F_SECONDARY 0x01 42 | #define IFA_F_TEMPORARY IFA_F_SECONDARY 43 | 44 | #define IFA_F_NODAD 0x02 45 | #define IFA_F_OPTIMISTIC 0x04 46 | #define IFA_F_DADFAILED 0x08 47 | #define IFA_F_HOMEADDRESS 0x10 48 | #define IFA_F_DEPRECATED 0x20 49 | #define IFA_F_TENTATIVE 0x40 50 | #define IFA_F_PERMANENT 0x80 51 | #define IFA_F_MANAGETEMPADDR 0x100 52 | #define IFA_F_NOPREFIXROUTE 0x200 53 | 54 | struct ifa_cacheinfo { 55 | __u32 ifa_prefered; 56 | __u32 ifa_valid; 57 | __u32 cstamp; /* created timestamp, hundredths of seconds */ 58 | __u32 tstamp; /* updated timestamp, hundredths of seconds */ 59 | }; 60 | 61 | /* backwards compatibility for userspace */ 62 | #define IFA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct ifaddrmsg)))) 63 | #define IFA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct ifaddrmsg)) 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /iproute2-3.19.0/include/linux/if_addrlabel.h: -------------------------------------------------------------------------------- 1 | /* 2 | * if_addrlabel.h - netlink interface for address labels 3 | * 4 | * Copyright (C)2007 USAGI/WIDE Project, All Rights Reserved. 5 | * 6 | * Authors: 7 | * YOSHIFUJI Hideaki @ USAGI/WIDE <yoshfuji@linux-ipv6.org> 8 | */ 9 | 10 | #ifndef __LINUX_IF_ADDRLABEL_H 11 | #define __LINUX_IF_ADDRLABEL_H 12 | 13 | #include <linux/types.h> 14 | 15 | struct ifaddrlblmsg { 16 | __u8 ifal_family; /* Address family */ 17 | __u8 __ifal_reserved; /* Reserved */ 18 | __u8 ifal_prefixlen; /* Prefix length */ 19 | __u8 ifal_flags; /* Flags */ 20 | __u32 ifal_index; /* Link index */ 21 | __u32 ifal_seq; /* sequence number */ 22 | }; 23 | 24 | enum { 25 | IFAL_ADDRESS = 1, 26 | IFAL_LABEL = 2, 27 | __IFAL_MAX 28 | }; 29 | 30 | #define IFAL_MAX (__IFAL_MAX - 1) 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /iproute2-3.19.0/include/linux/if_vlan.h: -------------------------------------------------------------------------------- 1 | /* 2 | * VLAN An implementation of 802.1Q VLAN tagging. 3 | * 4 | * Authors: Ben Greear <greearb@candelatech.com> 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU General Public License 8 | * as published by the Free Software Foundation; either version 9 | * 2 of the License, or (at your option) any later version. 10 | * 11 | */ 12 | 13 | #ifndef _LINUX_IF_VLAN_H_ 14 | #define _LINUX_IF_VLAN_H_ 15 | 16 | 17 | /* VLAN IOCTLs are found in sockios.h */ 18 | 19 | /* Passed in vlan_ioctl_args structure to determine behaviour. */ 20 | enum vlan_ioctl_cmds { 21 | ADD_VLAN_CMD, 22 | DEL_VLAN_CMD, 23 | SET_VLAN_INGRESS_PRIORITY_CMD, 24 | SET_VLAN_EGRESS_PRIORITY_CMD, 25 | GET_VLAN_INGRESS_PRIORITY_CMD, 26 | GET_VLAN_EGRESS_PRIORITY_CMD, 27 | SET_VLAN_NAME_TYPE_CMD, 28 | SET_VLAN_FLAG_CMD, 29 | GET_VLAN_REALDEV_NAME_CMD, /* If this works, you know it's a VLAN device, btw */ 30 | GET_VLAN_VID_CMD /* Get the VID of this VLAN (specified by name) */ 31 | }; 32 | 33 | enum vlan_flags { 34 | VLAN_FLAG_REORDER_HDR = 0x1, 35 | VLAN_FLAG_GVRP = 0x2, 36 | VLAN_FLAG_LOOSE_BINDING = 0x4, 37 | VLAN_FLAG_MVRP = 0x8, 38 | }; 39 | 40 | enum vlan_name_types { 41 | VLAN_NAME_TYPE_PLUS_VID, /* Name will look like: vlan0005 */ 42 | VLAN_NAME_TYPE_RAW_PLUS_VID, /* name will look like: eth1.0005 */ 43 | VLAN_NAME_TYPE_PLUS_VID_NO_PAD, /* Name will look like: vlan5 */ 44 | VLAN_NAME_TYPE_RAW_PLUS_VID_NO_PAD, /* Name will look like: eth0.5 */ 45 | VLAN_NAME_TYPE_HIGHEST 46 | }; 47 | 48 | struct vlan_ioctl_args { 49 | int cmd; /* Should be one of the vlan_ioctl_cmds enum above. */ 50 | char device1[24]; 51 | 52 | union { 53 | char device2[24]; 54 | int VID; 55 | unsigned int skb_priority; 56 | unsigned int name_type; 57 | unsigned int bind_type; 58 | unsigned int flag; /* Matches vlan_dev_priv flags */ 59 | } u; 60 | 61 | short vlan_qos; 62 | }; 63 | 64 | #endif /* _LINUX_IF_VLAN_H_ */ 65 | -------------------------------------------------------------------------------- /iproute2-3.19.0/include/linux/ip6_tunnel.h: -------------------------------------------------------------------------------- 1 | #ifndef _IP6_TUNNEL_H 2 | #define _IP6_TUNNEL_H 3 | 4 | #include <linux/types.h> 5 | 6 | #define IPV6_TLV_TNL_ENCAP_LIMIT 4 7 | #define IPV6_DEFAULT_TNL_ENCAP_LIMIT 4 8 | 9 | /* don't add encapsulation limit if one isn't present in inner packet */ 10 | #define IP6_TNL_F_IGN_ENCAP_LIMIT 0x1 11 | /* copy the traffic class field from the inner packet */ 12 | #define IP6_TNL_F_USE_ORIG_TCLASS 0x2 13 | /* copy the flowlabel from the inner packet */ 14 | #define IP6_TNL_F_USE_ORIG_FLOWLABEL 0x4 15 | /* being used for Mobile IPv6 */ 16 | #define IP6_TNL_F_MIP6_DEV 0x8 17 | /* copy DSCP from the outer packet */ 18 | #define IP6_TNL_F_RCV_DSCP_COPY 0x10 19 | /* copy fwmark from inner packet */ 20 | #define IP6_TNL_F_USE_ORIG_FWMARK 0x20 21 | 22 | struct ip6_tnl_parm { 23 | char name[IFNAMSIZ]; /* name of tunnel device */ 24 | int link; /* ifindex of underlying L2 interface */ 25 | __u8 proto; /* tunnel protocol */ 26 | __u8 encap_limit; /* encapsulation limit for tunnel */ 27 | __u8 hop_limit; /* hop limit for tunnel */ 28 | __be32 flowinfo; /* traffic class and flowlabel for tunnel */ 29 | __u32 flags; /* tunnel flags */ 30 | struct in6_addr laddr; /* local tunnel end-point address */ 31 | struct in6_addr raddr; /* remote tunnel end-point address */ 32 | }; 33 | 34 | struct ip6_tnl_parm2 { 35 | char name[IFNAMSIZ]; /* name of tunnel device */ 36 | int link; /* ifindex of underlying L2 interface */ 37 | __u8 proto; /* tunnel protocol */ 38 | __u8 encap_limit; /* encapsulation limit for tunnel */ 39 | __u8 hop_limit; /* hop limit for tunnel */ 40 | __be32 flowinfo; /* traffic class and flowlabel for tunnel */ 41 | __u32 flags; /* tunnel flags */ 42 | struct in6_addr laddr; /* local tunnel end-point address */ 43 | struct in6_addr raddr; /* remote tunnel end-point address */ 44 | 45 | __be16 i_flags; 46 | __be16 o_flags; 47 | __be32 i_key; 48 | __be32 o_key; 49 | }; 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /iproute2-3.19.0/include/linux/netconf.h: -------------------------------------------------------------------------------- 1 | #ifndef _LINUX_NETCONF_H_ 2 | #define _LINUX_NETCONF_H_ 3 | 4 | #include <linux/types.h> 5 | #include <linux/netlink.h> 6 | 7 | struct netconfmsg { 8 | __u8 ncm_family; 9 | }; 10 | 11 | enum { 12 | NETCONFA_UNSPEC, 13 | NETCONFA_IFINDEX, 14 | NETCONFA_FORWARDING, 15 | NETCONFA_RP_FILTER, 16 | NETCONFA_MC_FORWARDING, 17 | NETCONFA_PROXY_NEIGH, 18 | __NETCONFA_MAX 19 | }; 20 | #define NETCONFA_MAX (__NETCONFA_MAX - 1) 21 | 22 | #define NETCONFA_IFINDEX_ALL -1 23 | #define NETCONFA_IFINDEX_DEFAULT -2 24 | 25 | #endif /* _LINUX_NETCONF_H_ */ 26 | -------------------------------------------------------------------------------- /iproute2-3.19.0/include/linux/netdevice.h: -------------------------------------------------------------------------------- 1 | /* 2 | * INET An implementation of the TCP/IP protocol suite for the LINUX 3 | * operating system. INET is implemented using the BSD Socket 4 | * interface as the means of communication with the user level. 5 | * 6 | * Definitions for the Interfaces handler. 7 | * 8 | * Version: @(#)dev.h 1.0.10 08/12/93 9 | * 10 | * Authors: Ross Biro 11 | * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> 12 | * Corey Minyard <wf-rch!minyard@relay.EU.net> 13 | * Donald J. Becker, <becker@cesdis.gsfc.nasa.gov> 14 | * Alan Cox, <alan@lxorguk.ukuu.org.uk> 15 | * Bjorn Ekwall. <bj0rn@blox.se> 16 | * Pekka Riikonen <priikone@poseidon.pspt.fi> 17 | * 18 | * This program is free software; you can redistribute it and/or 19 | * modify it under the terms of the GNU General Public License 20 | * as published by the Free Software Foundation; either version 21 | * 2 of the License, or (at your option) any later version. 22 | * 23 | * Moved to /usr/include/linux for NET3 24 | */ 25 | #ifndef _LINUX_NETDEVICE_H 26 | #define _LINUX_NETDEVICE_H 27 | 28 | #include <linux/if.h> 29 | #include <linux/if_ether.h> 30 | #include <linux/if_packet.h> 31 | #include <linux/if_link.h> 32 | 33 | 34 | #define MAX_ADDR_LEN 32 /* Largest hardware address length */ 35 | 36 | /* Initial net device group. All devices belong to group 0 by default. */ 37 | #define INIT_NETDEV_GROUP 0 38 | 39 | 40 | /* interface name assignment types (sysfs name_assign_type attribute) */ 41 | #define NET_NAME_UNKNOWN 0 /* unknown origin (not exposed to userspace) */ 42 | #define NET_NAME_ENUM 1 /* enumerated by kernel */ 43 | #define NET_NAME_PREDICTABLE 2 /* predictably named by the kernel */ 44 | #define NET_NAME_USER 3 /* provided by user-space */ 45 | #define NET_NAME_RENAMED 4 /* renamed by user-space */ 46 | 47 | /* Media selection options. */ 48 | enum { 49 | IF_PORT_UNKNOWN = 0, 50 | IF_PORT_10BASE2, 51 | IF_PORT_10BASET, 52 | IF_PORT_AUI, 53 | IF_PORT_100BASET, 54 | IF_PORT_100BASETX, 55 | IF_PORT_100BASEFX 56 | }; 57 | 58 | /* hardware address assignment types */ 59 | #define NET_ADDR_PERM 0 /* address is permanent (default) */ 60 | #define NET_ADDR_RANDOM 1 /* address is generated randomly */ 61 | #define NET_ADDR_STOLEN 2 /* address is stolen from other device */ 62 | #define NET_ADDR_SET 3 /* address is set using 63 | * dev_set_mac_address() */ 64 | 65 | #endif /* _LINUX_NETDEVICE_H */ 66 | -------------------------------------------------------------------------------- /iproute2-3.19.0/include/linux/netfilter.h: -------------------------------------------------------------------------------- 1 | #ifndef __LINUX_NETFILTER_H 2 | #define __LINUX_NETFILTER_H 3 | 4 | #include <linux/types.h> 5 | 6 | #include <linux/sysctl.h> 7 | 8 | 9 | /* Responses from hook functions. */ 10 | #define NF_DROP 0 11 | #define NF_ACCEPT 1 12 | #define NF_STOLEN 2 13 | #define NF_QUEUE 3 14 | #define NF_REPEAT 4 15 | #define NF_STOP 5 16 | #define NF_MAX_VERDICT NF_STOP 17 | 18 | /* we overload the higher bits for encoding auxiliary data such as the queue 19 | * number or errno values. Not nice, but better than additional function 20 | * arguments. */ 21 | #define NF_VERDICT_MASK 0x000000ff 22 | 23 | /* extra verdict flags have mask 0x0000ff00 */ 24 | #define NF_VERDICT_FLAG_QUEUE_BYPASS 0x00008000 25 | 26 | /* queue number (NF_QUEUE) or errno (NF_DROP) */ 27 | #define NF_VERDICT_QMASK 0xffff0000 28 | #define NF_VERDICT_QBITS 16 29 | 30 | #define NF_QUEUE_NR(x) ((((x) << 16) & NF_VERDICT_QMASK) | NF_QUEUE) 31 | 32 | #define NF_DROP_ERR(x) (((-x) << 16) | NF_DROP) 33 | 34 | /* only for userspace compatibility */ 35 | /* Generic cache responses from hook functions. 36 | <= 0x2000 is used for protocol-flags. */ 37 | #define NFC_UNKNOWN 0x4000 38 | #define NFC_ALTERED 0x8000 39 | 40 | /* NF_VERDICT_BITS should be 8 now, but userspace might break if this changes */ 41 | #define NF_VERDICT_BITS 16 42 | 43 | enum nf_inet_hooks { 44 | NF_INET_PRE_ROUTING, 45 | NF_INET_LOCAL_IN, 46 | NF_INET_FORWARD, 47 | NF_INET_LOCAL_OUT, 48 | NF_INET_POST_ROUTING, 49 | NF_INET_NUMHOOKS 50 | }; 51 | 52 | enum { 53 | NFPROTO_UNSPEC = 0, 54 | NFPROTO_INET = 1, 55 | NFPROTO_IPV4 = 2, 56 | NFPROTO_ARP = 3, 57 | NFPROTO_BRIDGE = 7, 58 | NFPROTO_IPV6 = 10, 59 | NFPROTO_DECNET = 12, 60 | NFPROTO_NUMPROTO, 61 | }; 62 | 63 | union nf_inet_addr { 64 | __u32 all[4]; 65 | __be32 ip; 66 | __be32 ip6[4]; 67 | struct in_addr in; 68 | struct in6_addr in6; 69 | }; 70 | 71 | #endif /* __LINUX_NETFILTER_H */ 72 | -------------------------------------------------------------------------------- /iproute2-3.19.0/include/linux/netfilter/xt_tcpudp.h: -------------------------------------------------------------------------------- 1 | #ifndef _XT_TCPUDP_H 2 | #define _XT_TCPUDP_H 3 | 4 | #include <linux/types.h> 5 | 6 | /* TCP matching stuff */ 7 | struct xt_tcp { 8 | __u16 spts[2]; /* Source port range. */ 9 | __u16 dpts[2]; /* Destination port range. */ 10 | __u8 option; /* TCP Option iff non-zero*/ 11 | __u8 flg_mask; /* TCP flags mask byte */ 12 | __u8 flg_cmp; /* TCP flags compare byte */ 13 | __u8 invflags; /* Inverse flags */ 14 | }; 15 | 16 | /* Values for "inv" field in struct ipt_tcp. */ 17 | #define XT_TCP_INV_SRCPT 0x01 /* Invert the sense of source ports. */ 18 | #define XT_TCP_INV_DSTPT 0x02 /* Invert the sense of dest ports. */ 19 | #define XT_TCP_INV_FLAGS 0x04 /* Invert the sense of TCP flags. */ 20 | #define XT_TCP_INV_OPTION 0x08 /* Invert the sense of option test. */ 21 | #define XT_TCP_INV_MASK 0x0F /* All possible flags. */ 22 | 23 | /* UDP matching stuff */ 24 | struct xt_udp { 25 | __u16 spts[2]; /* Source port range. */ 26 | __u16 dpts[2]; /* Destination port range. */ 27 | __u8 invflags; /* Inverse flags */ 28 | }; 29 | 30 | /* Values for "invflags" field in struct ipt_udp. */ 31 | #define XT_UDP_INV_SRCPT 0x01 /* Invert the sense of source ports. */ 32 | #define XT_UDP_INV_DSTPT 0x02 /* Invert the sense of dest ports. */ 33 | #define XT_UDP_INV_MASK 0x03 /* All possible flags. */ 34 | 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /iproute2-3.19.0/include/linux/netfilter_ipv4.h: -------------------------------------------------------------------------------- 1 | /* IPv4-specific defines for netfilter. 2 | * (C)1998 Rusty Russell -- This code is GPL. 3 | */ 4 | #ifndef __LINUX_IP_NETFILTER_H 5 | #define __LINUX_IP_NETFILTER_H 6 | 7 | 8 | #include <linux/netfilter.h> 9 | 10 | /* only for userspace compatibility */ 11 | 12 | #include <limits.h> /* for INT_MIN, INT_MAX */ 13 | 14 | /* IP Cache bits. */ 15 | /* Src IP address. */ 16 | #define NFC_IP_SRC 0x0001 17 | /* Dest IP address. */ 18 | #define NFC_IP_DST 0x0002 19 | /* Input device. */ 20 | #define NFC_IP_IF_IN 0x0004 21 | /* Output device. */ 22 | #define NFC_IP_IF_OUT 0x0008 23 | /* TOS. */ 24 | #define NFC_IP_TOS 0x0010 25 | /* Protocol. */ 26 | #define NFC_IP_PROTO 0x0020 27 | /* IP options. */ 28 | #define NFC_IP_OPTIONS 0x0040 29 | /* Frag & flags. */ 30 | #define NFC_IP_FRAG 0x0080 31 | 32 | /* Per-protocol information: only matters if proto match. */ 33 | /* TCP flags. */ 34 | #define NFC_IP_TCPFLAGS 0x0100 35 | /* Source port. */ 36 | #define NFC_IP_SRC_PT 0x0200 37 | /* Dest port. */ 38 | #define NFC_IP_DST_PT 0x0400 39 | /* Something else about the proto */ 40 | #define NFC_IP_PROTO_UNKNOWN 0x2000 41 | 42 | /* IP Hooks */ 43 | /* After promisc drops, checksum checks. */ 44 | #define NF_IP_PRE_ROUTING 0 45 | /* If the packet is destined for this box. */ 46 | #define NF_IP_LOCAL_IN 1 47 | /* If the packet is destined for another interface. */ 48 | #define NF_IP_FORWARD 2 49 | /* Packets coming from a local process. */ 50 | #define NF_IP_LOCAL_OUT 3 51 | /* Packets about to hit the wire. */ 52 | #define NF_IP_POST_ROUTING 4 53 | #define NF_IP_NUMHOOKS 5 54 | 55 | enum nf_ip_hook_priorities { 56 | NF_IP_PRI_FIRST = INT_MIN, 57 | NF_IP_PRI_CONNTRACK_DEFRAG = -400, 58 | NF_IP_PRI_RAW = -300, 59 | NF_IP_PRI_SELINUX_FIRST = -225, 60 | NF_IP_PRI_CONNTRACK = -200, 61 | NF_IP_PRI_MANGLE = -150, 62 | NF_IP_PRI_NAT_DST = -100, 63 | NF_IP_PRI_FILTER = 0, 64 | NF_IP_PRI_SECURITY = 50, 65 | NF_IP_PRI_NAT_SRC = 100, 66 | NF_IP_PRI_SELINUX_LAST = 225, 67 | NF_IP_PRI_CONNTRACK_HELPER = 300, 68 | NF_IP_PRI_CONNTRACK_CONFIRM = INT_MAX, 69 | NF_IP_PRI_LAST = INT_MAX, 70 | }; 71 | 72 | /* Arguments for setsockopt SOL_IP: */ 73 | /* 2.0 firewalling went from 64 through 71 (and +256, +512, etc). */ 74 | /* 2.2 firewalling (+ masq) went from 64 through 76 */ 75 | /* 2.4 firewalling went 64 through 67. */ 76 | #define SO_ORIGINAL_DST 80 77 | 78 | 79 | #endif /* __LINUX_IP_NETFILTER_H */ 80 | -------------------------------------------------------------------------------- /iproute2-3.19.0/include/linux/netlink_diag.h: -------------------------------------------------------------------------------- 1 | #ifndef __NETLINK_DIAG_H__ 2 | #define __NETLINK_DIAG_H__ 3 | 4 | #include <linux/types.h> 5 | 6 | struct netlink_diag_req { 7 | __u8 sdiag_family; 8 | __u8 sdiag_protocol; 9 | __u16 pad; 10 | __u32 ndiag_ino; 11 | __u32 ndiag_show; 12 | __u32 ndiag_cookie[2]; 13 | }; 14 | 15 | struct netlink_diag_msg { 16 | __u8 ndiag_family; 17 | __u8 ndiag_type; 18 | __u8 ndiag_protocol; 19 | __u8 ndiag_state; 20 | 21 | __u32 ndiag_portid; 22 | __u32 ndiag_dst_portid; 23 | __u32 ndiag_dst_group; 24 | __u32 ndiag_ino; 25 | __u32 ndiag_cookie[2]; 26 | }; 27 | 28 | struct netlink_diag_ring { 29 | __u32 ndr_block_size; 30 | __u32 ndr_block_nr; 31 | __u32 ndr_frame_size; 32 | __u32 ndr_frame_nr; 33 | }; 34 | 35 | enum { 36 | /* NETLINK_DIAG_NONE, standard nl API requires this attribute! */ 37 | NETLINK_DIAG_MEMINFO, 38 | NETLINK_DIAG_GROUPS, 39 | NETLINK_DIAG_RX_RING, 40 | NETLINK_DIAG_TX_RING, 41 | 42 | __NETLINK_DIAG_MAX, 43 | }; 44 | 45 | #define NETLINK_DIAG_MAX (__NETLINK_DIAG_MAX - 1) 46 | 47 | #define NDIAG_PROTO_ALL ((__u8) ~0) 48 | 49 | #define NDIAG_SHOW_MEMINFO 0x00000001 /* show memory info of a socket */ 50 | #define NDIAG_SHOW_GROUPS 0x00000002 /* show groups of a netlink socket */ 51 | #define NDIAG_SHOW_RING_CFG 0x00000004 /* show ring configuration */ 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /iproute2-3.19.0/include/linux/packet_diag.h: -------------------------------------------------------------------------------- 1 | #ifndef __PACKET_DIAG_H__ 2 | #define __PACKET_DIAG_H__ 3 | 4 | #include <linux/types.h> 5 | 6 | struct packet_diag_req { 7 | __u8 sdiag_family; 8 | __u8 sdiag_protocol; 9 | __u16 pad; 10 | __u32 pdiag_ino; 11 | __u32 pdiag_show; 12 | __u32 pdiag_cookie[2]; 13 | }; 14 | 15 | #define PACKET_SHOW_INFO 0x00000001 /* Basic packet_sk information */ 16 | #define PACKET_SHOW_MCLIST 0x00000002 /* A set of packet_diag_mclist-s */ 17 | #define PACKET_SHOW_RING_CFG 0x00000004 /* Rings configuration parameters */ 18 | #define PACKET_SHOW_FANOUT 0x00000008 19 | #define PACKET_SHOW_MEMINFO 0x00000010 20 | #define PACKET_SHOW_FILTER 0x00000020 21 | 22 | struct packet_diag_msg { 23 | __u8 pdiag_family; 24 | __u8 pdiag_type; 25 | __u16 pdiag_num; 26 | 27 | __u32 pdiag_ino; 28 | __u32 pdiag_cookie[2]; 29 | }; 30 | 31 | enum { 32 | /* PACKET_DIAG_NONE, standard nl API requires this attribute! */ 33 | PACKET_DIAG_INFO, 34 | PACKET_DIAG_MCLIST, 35 | PACKET_DIAG_RX_RING, 36 | PACKET_DIAG_TX_RING, 37 | PACKET_DIAG_FANOUT, 38 | PACKET_DIAG_UID, 39 | PACKET_DIAG_MEMINFO, 40 | PACKET_DIAG_FILTER, 41 | 42 | __PACKET_DIAG_MAX, 43 | }; 44 | 45 | #define PACKET_DIAG_MAX (__PACKET_DIAG_MAX - 1) 46 | 47 | struct packet_diag_info { 48 | __u32 pdi_index; 49 | __u32 pdi_version; 50 | __u32 pdi_reserve; 51 | __u32 pdi_copy_thresh; 52 | __u32 pdi_tstamp; 53 | __u32 pdi_flags; 54 | 55 | #define PDI_RUNNING 0x1 56 | #define PDI_AUXDATA 0x2 57 | #define PDI_ORIGDEV 0x4 58 | #define PDI_VNETHDR 0x8 59 | #define PDI_LOSS 0x10 60 | }; 61 | 62 | struct packet_diag_mclist { 63 | __u32 pdmc_index; 64 | __u32 pdmc_count; 65 | __u16 pdmc_type; 66 | __u16 pdmc_alen; 67 | __u8 pdmc_addr[MAX_ADDR_LEN]; 68 | }; 69 | 70 | struct packet_diag_ring { 71 | __u32 pdr_block_size; 72 | __u32 pdr_block_nr; 73 | __u32 pdr_frame_size; 74 | __u32 pdr_frame_nr; 75 | __u32 pdr_retire_tmo; 76 | __u32 pdr_sizeof_priv; 77 | __u32 pdr_features; 78 | }; 79 | 80 | #endif 81 | -------------------------------------------------------------------------------- /iproute2-3.19.0/include/linux/sock_diag.h: -------------------------------------------------------------------------------- 1 | #ifndef __SOCK_DIAG_H__ 2 | #define __SOCK_DIAG_H__ 3 | 4 | #include <linux/types.h> 5 | 6 | #define SOCK_DIAG_BY_FAMILY 20 7 | 8 | struct sock_diag_req { 9 | __u8 sdiag_family; 10 | __u8 sdiag_protocol; 11 | }; 12 | 13 | enum { 14 | SK_MEMINFO_RMEM_ALLOC, 15 | SK_MEMINFO_RCVBUF, 16 | SK_MEMINFO_WMEM_ALLOC, 17 | SK_MEMINFO_SNDBUF, 18 | SK_MEMINFO_FWD_ALLOC, 19 | SK_MEMINFO_WMEM_QUEUED, 20 | SK_MEMINFO_OPTMEM, 21 | SK_MEMINFO_BACKLOG, 22 | 23 | SK_MEMINFO_VARS, 24 | }; 25 | 26 | #endif /* __SOCK_DIAG_H__ */ 27 | -------------------------------------------------------------------------------- /iproute2-3.19.0/include/linux/socket.h: -------------------------------------------------------------------------------- 1 | #ifndef _LINUX_SOCKET_H 2 | #define _LINUX_SOCKET_H 3 | 4 | /* 5 | * Desired design of maximum size and alignment (see RFC2553) 6 | */ 7 | #define _K_SS_MAXSIZE 128 /* Implementation specific max size */ 8 | #define _K_SS_ALIGNSIZE (__alignof__ (struct sockaddr *)) 9 | /* Implementation specific desired alignment */ 10 | 11 | typedef unsigned short __kernel_sa_family_t; 12 | 13 | struct __kernel_sockaddr_storage { 14 | __kernel_sa_family_t ss_family; /* address family */ 15 | /* Following field(s) are implementation specific */ 16 | char __data[_K_SS_MAXSIZE - sizeof(unsigned short)]; 17 | /* space to achieve desired size, */ 18 | /* _SS_MAXSIZE value minus size of ss_family */ 19 | } __attribute__ ((aligned(_K_SS_ALIGNSIZE))); /* force desired alignment */ 20 | 21 | #endif /* _LINUX_SOCKET_H */ 22 | -------------------------------------------------------------------------------- /iproute2-3.19.0/include/linux/tc_act/tc_csum.h: -------------------------------------------------------------------------------- 1 | #ifndef __LINUX_TC_CSUM_H 2 | #define __LINUX_TC_CSUM_H 3 | 4 | #include <linux/types.h> 5 | #include <linux/pkt_cls.h> 6 | 7 | #define TCA_ACT_CSUM 16 8 | 9 | enum { 10 | TCA_CSUM_UNSPEC, 11 | TCA_CSUM_PARMS, 12 | TCA_CSUM_TM, 13 | __TCA_CSUM_MAX 14 | }; 15 | #define TCA_CSUM_MAX (__TCA_CSUM_MAX - 1) 16 | 17 | enum { 18 | TCA_CSUM_UPDATE_FLAG_IPV4HDR = 1, 19 | TCA_CSUM_UPDATE_FLAG_ICMP = 2, 20 | TCA_CSUM_UPDATE_FLAG_IGMP = 4, 21 | TCA_CSUM_UPDATE_FLAG_TCP = 8, 22 | TCA_CSUM_UPDATE_FLAG_UDP = 16, 23 | TCA_CSUM_UPDATE_FLAG_UDPLITE = 32 24 | }; 25 | 26 | struct tc_csum { 27 | tc_gen; 28 | 29 | __u32 update_flags; 30 | }; 31 | 32 | #endif /* __LINUX_TC_CSUM_H */ 33 | -------------------------------------------------------------------------------- /iproute2-3.19.0/include/linux/tc_act/tc_defact.h: -------------------------------------------------------------------------------- 1 | #ifndef __LINUX_TC_DEF_H 2 | #define __LINUX_TC_DEF_H 3 | 4 | #include <linux/pkt_cls.h> 5 | 6 | struct tc_defact { 7 | tc_gen; 8 | }; 9 | 10 | enum { 11 | TCA_DEF_UNSPEC, 12 | TCA_DEF_TM, 13 | TCA_DEF_PARMS, 14 | TCA_DEF_DATA, 15 | __TCA_DEF_MAX 16 | }; 17 | #define TCA_DEF_MAX (__TCA_DEF_MAX - 1) 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /iproute2-3.19.0/include/linux/tc_act/tc_gact.h: -------------------------------------------------------------------------------- 1 | #ifndef __LINUX_TC_GACT_H 2 | #define __LINUX_TC_GACT_H 3 | 4 | #include <linux/types.h> 5 | #include <linux/pkt_cls.h> 6 | 7 | #define TCA_ACT_GACT 5 8 | struct tc_gact { 9 | tc_gen; 10 | 11 | }; 12 | 13 | struct tc_gact_p { 14 | #define PGACT_NONE 0 15 | #define PGACT_NETRAND 1 16 | #define PGACT_DETERM 2 17 | #define MAX_RAND (PGACT_DETERM + 1 ) 18 | __u16 ptype; 19 | __u16 pval; 20 | int paction; 21 | }; 22 | 23 | enum { 24 | TCA_GACT_UNSPEC, 25 | TCA_GACT_TM, 26 | TCA_GACT_PARMS, 27 | TCA_GACT_PROB, 28 | __TCA_GACT_MAX 29 | }; 30 | #define TCA_GACT_MAX (__TCA_GACT_MAX - 1) 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /iproute2-3.19.0/include/linux/tc_act/tc_ipt.h: -------------------------------------------------------------------------------- 1 | #ifndef __LINUX_TC_IPT_H 2 | #define __LINUX_TC_IPT_H 3 | 4 | #include <linux/pkt_cls.h> 5 | 6 | #define TCA_ACT_IPT 6 7 | #define TCA_ACT_XT 10 8 | 9 | enum { 10 | TCA_IPT_UNSPEC, 11 | TCA_IPT_TABLE, 12 | TCA_IPT_HOOK, 13 | TCA_IPT_INDEX, 14 | TCA_IPT_CNT, 15 | TCA_IPT_TM, 16 | TCA_IPT_TARG, 17 | __TCA_IPT_MAX 18 | }; 19 | #define TCA_IPT_MAX (__TCA_IPT_MAX - 1) 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /iproute2-3.19.0/include/linux/tc_act/tc_mirred.h: -------------------------------------------------------------------------------- 1 | #ifndef __LINUX_TC_MIR_H 2 | #define __LINUX_TC_MIR_H 3 | 4 | #include <linux/types.h> 5 | #include <linux/pkt_cls.h> 6 | 7 | #define TCA_ACT_MIRRED 8 8 | #define TCA_EGRESS_REDIR 1 /* packet redirect to EGRESS*/ 9 | #define TCA_EGRESS_MIRROR 2 /* mirror packet to EGRESS */ 10 | #define TCA_INGRESS_REDIR 3 /* packet redirect to INGRESS*/ 11 | #define TCA_INGRESS_MIRROR 4 /* mirror packet to INGRESS */ 12 | 13 | struct tc_mirred { 14 | tc_gen; 15 | int eaction; /* one of IN/EGRESS_MIRROR/REDIR */ 16 | __u32 ifindex; /* ifindex of egress port */ 17 | }; 18 | 19 | enum { 20 | TCA_MIRRED_UNSPEC, 21 | TCA_MIRRED_TM, 22 | TCA_MIRRED_PARMS, 23 | __TCA_MIRRED_MAX 24 | }; 25 | #define TCA_MIRRED_MAX (__TCA_MIRRED_MAX - 1) 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /iproute2-3.19.0/include/linux/tc_act/tc_nat.h: -------------------------------------------------------------------------------- 1 | #ifndef __LINUX_TC_NAT_H 2 | #define __LINUX_TC_NAT_H 3 | 4 | #include <linux/pkt_cls.h> 5 | #include <linux/types.h> 6 | 7 | #define TCA_ACT_NAT 9 8 | 9 | enum { 10 | TCA_NAT_UNSPEC, 11 | TCA_NAT_PARMS, 12 | TCA_NAT_TM, 13 | __TCA_NAT_MAX 14 | }; 15 | #define TCA_NAT_MAX (__TCA_NAT_MAX - 1) 16 | 17 | #define TCA_NAT_FLAG_EGRESS 1 18 | 19 | struct tc_nat { 20 | tc_gen; 21 | __be32 old_addr; 22 | __be32 new_addr; 23 | __be32 mask; 24 | __u32 flags; 25 | }; 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /iproute2-3.19.0/include/linux/tc_act/tc_pedit.h: -------------------------------------------------------------------------------- 1 | #ifndef __LINUX_TC_PED_H 2 | #define __LINUX_TC_PED_H 3 | 4 | #include <linux/types.h> 5 | #include <linux/pkt_cls.h> 6 | 7 | #define TCA_ACT_PEDIT 7 8 | 9 | enum { 10 | TCA_PEDIT_UNSPEC, 11 | TCA_PEDIT_TM, 12 | TCA_PEDIT_PARMS, 13 | __TCA_PEDIT_MAX 14 | }; 15 | #define TCA_PEDIT_MAX (__TCA_PEDIT_MAX - 1) 16 | 17 | struct tc_pedit_key { 18 | __u32 mask; /* AND */ 19 | __u32 val; /*XOR */ 20 | __u32 off; /*offset */ 21 | __u32 at; 22 | __u32 offmask; 23 | __u32 shift; 24 | }; 25 | 26 | struct tc_pedit_sel { 27 | tc_gen; 28 | unsigned char nkeys; 29 | unsigned char flags; 30 | struct tc_pedit_key keys[0]; 31 | }; 32 | #define tc_pedit tc_pedit_sel 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /iproute2-3.19.0/include/linux/tc_act/tc_skbedit.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2008, Intel Corporation. 3 | * 4 | * This program is free software; you can redistribute it and/or modify it 5 | * under the terms and conditions of the GNU General Public License, 6 | * version 2, as published by the Free Software Foundation. 7 | * 8 | * This program is distributed in the hope it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | * Place - Suite 330, Boston, MA 02111-1307 USA. 16 | * 17 | * Author: Alexander Duyck <alexander.h.duyck@intel.com> 18 | */ 19 | 20 | #ifndef __LINUX_TC_SKBEDIT_H 21 | #define __LINUX_TC_SKBEDIT_H 22 | 23 | #include <linux/pkt_cls.h> 24 | 25 | #define TCA_ACT_SKBEDIT 11 26 | 27 | #define SKBEDIT_F_PRIORITY 0x1 28 | #define SKBEDIT_F_QUEUE_MAPPING 0x2 29 | #define SKBEDIT_F_MARK 0x4 30 | 31 | struct tc_skbedit { 32 | tc_gen; 33 | }; 34 | 35 | enum { 36 | TCA_SKBEDIT_UNSPEC, 37 | TCA_SKBEDIT_TM, 38 | TCA_SKBEDIT_PARMS, 39 | TCA_SKBEDIT_PRIORITY, 40 | TCA_SKBEDIT_QUEUE_MAPPING, 41 | TCA_SKBEDIT_MARK, 42 | __TCA_SKBEDIT_MAX 43 | }; 44 | #define TCA_SKBEDIT_MAX (__TCA_SKBEDIT_MAX - 1) 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /iproute2-3.19.0/include/linux/tc_act/tc_vlan.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Jiri Pirko <jiri@resnulli.us> 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | */ 9 | 10 | #ifndef __LINUX_TC_VLAN_H 11 | #define __LINUX_TC_VLAN_H 12 | 13 | #include <linux/pkt_cls.h> 14 | 15 | #define TCA_ACT_VLAN 12 16 | 17 | #define TCA_VLAN_ACT_POP 1 18 | #define TCA_VLAN_ACT_PUSH 2 19 | 20 | struct tc_vlan { 21 | tc_gen; 22 | int v_action; 23 | }; 24 | 25 | enum { 26 | TCA_VLAN_UNSPEC, 27 | TCA_VLAN_TM, 28 | TCA_VLAN_PARMS, 29 | TCA_VLAN_PUSH_VLAN_ID, 30 | TCA_VLAN_PUSH_VLAN_PROTOCOL, 31 | __TCA_VLAN_MAX, 32 | }; 33 | #define TCA_VLAN_MAX (__TCA_VLAN_MAX - 1) 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /iproute2-3.19.0/include/linux/tc_ematch/tc_em_cmp.h: -------------------------------------------------------------------------------- 1 | #ifndef __LINUX_TC_EM_CMP_H 2 | #define __LINUX_TC_EM_CMP_H 3 | 4 | #include <linux/types.h> 5 | #include <linux/pkt_cls.h> 6 | 7 | struct tcf_em_cmp { 8 | __u32 val; 9 | __u32 mask; 10 | __u16 off; 11 | __u8 align:4; 12 | __u8 flags:4; 13 | __u8 layer:4; 14 | __u8 opnd:4; 15 | }; 16 | 17 | enum { 18 | TCF_EM_ALIGN_U8 = 1, 19 | TCF_EM_ALIGN_U16 = 2, 20 | TCF_EM_ALIGN_U32 = 4 21 | }; 22 | 23 | #define TCF_EM_CMP_TRANS 1 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /iproute2-3.19.0/include/linux/tc_ematch/tc_em_meta.h: -------------------------------------------------------------------------------- 1 | #ifndef __LINUX_TC_EM_META_H 2 | #define __LINUX_TC_EM_META_H 3 | 4 | #include <linux/types.h> 5 | #include <linux/pkt_cls.h> 6 | 7 | enum { 8 | TCA_EM_META_UNSPEC, 9 | TCA_EM_META_HDR, 10 | TCA_EM_META_LVALUE, 11 | TCA_EM_META_RVALUE, 12 | __TCA_EM_META_MAX 13 | }; 14 | #define TCA_EM_META_MAX (__TCA_EM_META_MAX - 1) 15 | 16 | struct tcf_meta_val { 17 | __u16 kind; 18 | __u8 shift; 19 | __u8 op; 20 | }; 21 | 22 | #define TCF_META_TYPE_MASK (0xf << 12) 23 | #define TCF_META_TYPE(kind) (((kind) & TCF_META_TYPE_MASK) >> 12) 24 | #define TCF_META_ID_MASK 0x7ff 25 | #define TCF_META_ID(kind) ((kind) & TCF_META_ID_MASK) 26 | 27 | enum { 28 | TCF_META_TYPE_VAR, 29 | TCF_META_TYPE_INT, 30 | __TCF_META_TYPE_MAX 31 | }; 32 | #define TCF_META_TYPE_MAX (__TCF_META_TYPE_MAX - 1) 33 | 34 | enum { 35 | TCF_META_ID_VALUE, 36 | TCF_META_ID_RANDOM, 37 | TCF_META_ID_LOADAVG_0, 38 | TCF_META_ID_LOADAVG_1, 39 | TCF_META_ID_LOADAVG_2, 40 | TCF_META_ID_DEV, 41 | TCF_META_ID_PRIORITY, 42 | TCF_META_ID_PROTOCOL, 43 | TCF_META_ID_PKTTYPE, 44 | TCF_META_ID_PKTLEN, 45 | TCF_META_ID_DATALEN, 46 | TCF_META_ID_MACLEN, 47 | TCF_META_ID_NFMARK, 48 | TCF_META_ID_TCINDEX, 49 | TCF_META_ID_RTCLASSID, 50 | TCF_META_ID_RTIIF, 51 | TCF_META_ID_SK_FAMILY, 52 | TCF_META_ID_SK_STATE, 53 | TCF_META_ID_SK_REUSE, 54 | TCF_META_ID_SK_BOUND_IF, 55 | TCF_META_ID_SK_REFCNT, 56 | TCF_META_ID_SK_SHUTDOWN, 57 | TCF_META_ID_SK_PROTO, 58 | TCF_META_ID_SK_TYPE, 59 | TCF_META_ID_SK_RCVBUF, 60 | TCF_META_ID_SK_RMEM_ALLOC, 61 | TCF_META_ID_SK_WMEM_ALLOC, 62 | TCF_META_ID_SK_OMEM_ALLOC, 63 | TCF_META_ID_SK_WMEM_QUEUED, 64 | TCF_META_ID_SK_RCV_QLEN, 65 | TCF_META_ID_SK_SND_QLEN, 66 | TCF_META_ID_SK_ERR_QLEN, 67 | TCF_META_ID_SK_FORWARD_ALLOCS, 68 | TCF_META_ID_SK_SNDBUF, 69 | TCF_META_ID_SK_ALLOCS, 70 | __TCF_META_ID_SK_ROUTE_CAPS, /* unimplemented but in ABI already */ 71 | TCF_META_ID_SK_HASH, 72 | TCF_META_ID_SK_LINGERTIME, 73 | TCF_META_ID_SK_ACK_BACKLOG, 74 | TCF_META_ID_SK_MAX_ACK_BACKLOG, 75 | TCF_META_ID_SK_PRIO, 76 | TCF_META_ID_SK_RCVLOWAT, 77 | TCF_META_ID_SK_RCVTIMEO, 78 | TCF_META_ID_SK_SNDTIMEO, 79 | TCF_META_ID_SK_SENDMSG_OFF, 80 | TCF_META_ID_SK_WRITE_PENDING, 81 | TCF_META_ID_VLAN_TAG, 82 | TCF_META_ID_RXHASH, 83 | __TCF_META_ID_MAX 84 | }; 85 | #define TCF_META_ID_MAX (__TCF_META_ID_MAX - 1) 86 | 87 | struct tcf_meta_hdr { 88 | struct tcf_meta_val left; 89 | struct tcf_meta_val right; 90 | }; 91 | 92 | #endif 93 | -------------------------------------------------------------------------------- /iproute2-3.19.0/include/linux/tc_ematch/tc_em_nbyte.h: -------------------------------------------------------------------------------- 1 | #ifndef __LINUX_TC_EM_NBYTE_H 2 | #define __LINUX_TC_EM_NBYTE_H 3 | 4 | #include <linux/types.h> 5 | #include <linux/pkt_cls.h> 6 | 7 | struct tcf_em_nbyte { 8 | __u16 off; 9 | __u16 len:12; 10 | __u8 layer:4; 11 | }; 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /iproute2-3.19.0/include/linux/tc_ematch/tc_em_text.h: -------------------------------------------------------------------------------- 1 | #ifndef __LINUX_TC_EM_TEXT_H 2 | #define __LINUX_TC_EM_TEXT_H 3 | 4 | #include <linux/types.h> 5 | #include <linux/pkt_cls.h> 6 | 7 | #define TC_EM_TEXT_ALGOSIZ 16 8 | 9 | struct tcf_em_text { 10 | char algo[TC_EM_TEXT_ALGOSIZ]; 11 | __u16 from_offset; 12 | __u16 to_offset; 13 | __u16 pattern_len; 14 | __u8 from_layer:4; 15 | __u8 to_layer:4; 16 | __u8 pad; 17 | }; 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /iproute2-3.19.0/include/linux/tcp_metrics.h: -------------------------------------------------------------------------------- 1 | /* tcp_metrics.h - TCP Metrics Interface */ 2 | 3 | #ifndef _LINUX_TCP_METRICS_H 4 | #define _LINUX_TCP_METRICS_H 5 | 6 | #include <linux/types.h> 7 | 8 | /* NETLINK_GENERIC related info 9 | */ 10 | #define TCP_METRICS_GENL_NAME "tcp_metrics" 11 | #define TCP_METRICS_GENL_VERSION 0x1 12 | 13 | enum tcp_metric_index { 14 | TCP_METRIC_RTT, /* in ms units */ 15 | TCP_METRIC_RTTVAR, /* in ms units */ 16 | TCP_METRIC_SSTHRESH, 17 | TCP_METRIC_CWND, 18 | TCP_METRIC_REORDERING, 19 | 20 | TCP_METRIC_RTT_US, /* in usec units */ 21 | TCP_METRIC_RTTVAR_US, /* in usec units */ 22 | 23 | /* Always last. */ 24 | __TCP_METRIC_MAX, 25 | }; 26 | 27 | #define TCP_METRIC_MAX (__TCP_METRIC_MAX - 1) 28 | 29 | enum { 30 | TCP_METRICS_ATTR_UNSPEC, 31 | TCP_METRICS_ATTR_ADDR_IPV4, /* u32 */ 32 | TCP_METRICS_ATTR_ADDR_IPV6, /* binary */ 33 | TCP_METRICS_ATTR_AGE, /* msecs */ 34 | TCP_METRICS_ATTR_TW_TSVAL, /* u32, raw, rcv tsval */ 35 | TCP_METRICS_ATTR_TW_TS_STAMP, /* s32, sec age */ 36 | TCP_METRICS_ATTR_VALS, /* nested +1, u32 */ 37 | TCP_METRICS_ATTR_FOPEN_MSS, /* u16 */ 38 | TCP_METRICS_ATTR_FOPEN_SYN_DROPS, /* u16, count of drops */ 39 | TCP_METRICS_ATTR_FOPEN_SYN_DROP_TS, /* msecs age */ 40 | TCP_METRICS_ATTR_FOPEN_COOKIE, /* binary */ 41 | TCP_METRICS_ATTR_SADDR_IPV4, /* u32 */ 42 | TCP_METRICS_ATTR_SADDR_IPV6, /* binary */ 43 | 44 | __TCP_METRICS_ATTR_MAX, 45 | }; 46 | 47 | #define TCP_METRICS_ATTR_MAX (__TCP_METRICS_ATTR_MAX - 1) 48 | 49 | enum { 50 | TCP_METRICS_CMD_UNSPEC, 51 | TCP_METRICS_CMD_GET, 52 | TCP_METRICS_CMD_DEL, 53 | 54 | __TCP_METRICS_CMD_MAX, 55 | }; 56 | 57 | #define TCP_METRICS_CMD_MAX (__TCP_METRICS_CMD_MAX - 1) 58 | 59 | #endif /* _LINUX_TCP_METRICS_H */ 60 | -------------------------------------------------------------------------------- /iproute2-3.19.0/include/linux/types.h: -------------------------------------------------------------------------------- 1 | #ifndef _LINUX_TYPES_H 2 | #define _LINUX_TYPES_H 3 | 4 | #include <asm/types.h> 5 | 6 | #ifndef __ASSEMBLY__ 7 | 8 | #include <linux/posix_types.h> 9 | 10 | 11 | /* 12 | * Below are truly Linux-specific types that should never collide with 13 | * any application/library that wants linux/types.h. 14 | */ 15 | 16 | #ifdef __CHECKER__ 17 | #define __bitwise__ __attribute__((bitwise)) 18 | #else 19 | #define __bitwise__ 20 | #endif 21 | #ifdef __CHECK_ENDIAN__ 22 | #define __bitwise __bitwise__ 23 | #else 24 | #define __bitwise 25 | #endif 26 | 27 | typedef __u16 __bitwise __le16; 28 | typedef __u16 __bitwise __be16; 29 | typedef __u32 __bitwise __le32; 30 | typedef __u32 __bitwise __be32; 31 | typedef __u64 __bitwise __le64; 32 | typedef __u64 __bitwise __be64; 33 | 34 | typedef __u16 __bitwise __sum16; 35 | typedef __u32 __bitwise __wsum; 36 | 37 | /* 38 | * aligned_u64 should be used in defining kernel<->userspace ABIs to avoid 39 | * common 32/64-bit compat problems. 40 | * 64-bit values align to 4-byte boundaries on x86_32 (and possibly other 41 | * architectures) and to 8-byte boundaries on 64-bit architectures. The new 42 | * aligned_64 type enforces 8-byte alignment so that structs containing 43 | * aligned_64 values have the same alignment on 32-bit and 64-bit architectures. 44 | * No conversions are necessary between 32-bit user-space and a 64-bit kernel. 45 | */ 46 | #define __aligned_u64 __u64 __attribute__((aligned(8))) 47 | #define __aligned_be64 __be64 __attribute__((aligned(8))) 48 | #define __aligned_le64 __le64 __attribute__((aligned(8))) 49 | 50 | #endif /* __ASSEMBLY__ */ 51 | #endif /* _LINUX_TYPES_H */ 52 | -------------------------------------------------------------------------------- /iproute2-3.19.0/include/linux/unix_diag.h: -------------------------------------------------------------------------------- 1 | #ifndef __UNIX_DIAG_H__ 2 | #define __UNIX_DIAG_H__ 3 | 4 | #include <linux/types.h> 5 | 6 | struct unix_diag_req { 7 | __u8 sdiag_family; 8 | __u8 sdiag_protocol; 9 | __u16 pad; 10 | __u32 udiag_states; 11 | __u32 udiag_ino; 12 | __u32 udiag_show; 13 | __u32 udiag_cookie[2]; 14 | }; 15 | 16 | #define UDIAG_SHOW_NAME 0x00000001 /* show name (not path) */ 17 | #define UDIAG_SHOW_VFS 0x00000002 /* show VFS inode info */ 18 | #define UDIAG_SHOW_PEER 0x00000004 /* show peer socket info */ 19 | #define UDIAG_SHOW_ICONS 0x00000008 /* show pending connections */ 20 | #define UDIAG_SHOW_RQLEN 0x00000010 /* show skb receive queue len */ 21 | #define UDIAG_SHOW_MEMINFO 0x00000020 /* show memory info of a socket */ 22 | 23 | struct unix_diag_msg { 24 | __u8 udiag_family; 25 | __u8 udiag_type; 26 | __u8 udiag_state; 27 | __u8 pad; 28 | 29 | __u32 udiag_ino; 30 | __u32 udiag_cookie[2]; 31 | }; 32 | 33 | enum { 34 | /* UNIX_DIAG_NONE, standard nl API requires this attribute! */ 35 | UNIX_DIAG_NAME, 36 | UNIX_DIAG_VFS, 37 | UNIX_DIAG_PEER, 38 | UNIX_DIAG_ICONS, 39 | UNIX_DIAG_RQLEN, 40 | UNIX_DIAG_MEMINFO, 41 | UNIX_DIAG_SHUTDOWN, 42 | 43 | __UNIX_DIAG_MAX, 44 | }; 45 | 46 | #define UNIX_DIAG_MAX (__UNIX_DIAG_MAX - 1) 47 | 48 | struct unix_diag_vfs { 49 | __u32 udiag_vfs_ino; 50 | __u32 udiag_vfs_dev; 51 | }; 52 | 53 | struct unix_diag_rqlen { 54 | __u32 udiag_rqueue; 55 | __u32 udiag_wqueue; 56 | }; 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /iproute2-3.19.0/include/linux/veth.h: -------------------------------------------------------------------------------- 1 | #ifndef __NET_VETH_H_ 2 | #define __NET_VETH_H_ 3 | 4 | enum { 5 | VETH_INFO_UNSPEC, 6 | VETH_INFO_PEER, 7 | 8 | __VETH_INFO_MAX 9 | #define VETH_INFO_MAX (__VETH_INFO_MAX - 1) 10 | }; 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /iproute2-3.19.0/include/ll_map.h: -------------------------------------------------------------------------------- 1 | #ifndef __LL_MAP_H__ 2 | #define __LL_MAP_H__ 1 3 | 4 | extern int ll_remember_index(const struct sockaddr_nl *who, 5 | struct nlmsghdr *n, void *arg); 6 | 7 | extern void ll_init_map(struct rtnl_handle *rth); 8 | extern unsigned ll_name_to_index(const char *name); 9 | extern const char *ll_index_to_name(unsigned idx); 10 | extern const char *ll_idx_n2a(unsigned idx, char *buf); 11 | extern int ll_index_to_type(unsigned idx); 12 | extern int ll_index_to_flags(unsigned idx); 13 | 14 | #endif /* __LL_MAP_H__ */ 15 | -------------------------------------------------------------------------------- /iproute2-3.19.0/include/namespace.h: -------------------------------------------------------------------------------- 1 | #ifndef __NAMESPACE_H__ 2 | #define __NAMESPACE_H__ 1 3 | 4 | #include <sched.h> 5 | #include <sys/mount.h> 6 | #include <sys/syscall.h> 7 | #include <errno.h> 8 | 9 | #define NETNS_RUN_DIR "/var/run/netns" 10 | #define NETNS_ETC_DIR "/etc/netns" 11 | 12 | #ifndef CLONE_NEWNET 13 | #define CLONE_NEWNET 0x40000000 /* New network namespace (lo, device, names sockets, etc) */ 14 | #endif 15 | 16 | #ifndef MNT_DETACH 17 | #define MNT_DETACH 0x00000002 /* Just detach from the tree */ 18 | #endif /* MNT_DETACH */ 19 | 20 | /* sys/mount.h may be out too old to have these */ 21 | #ifndef MS_REC 22 | #define MS_REC 16384 23 | #endif 24 | 25 | #ifndef MS_SLAVE 26 | #define MS_SLAVE (1 << 19) 27 | #endif 28 | 29 | #ifndef MS_SHARED 30 | #define MS_SHARED (1 << 20) 31 | #endif 32 | 33 | #ifndef HAVE_SETNS 34 | static inline int setns(int fd, int nstype) 35 | { 36 | #ifdef __NR_setns 37 | return syscall(__NR_setns, fd, nstype); 38 | #else 39 | errno = ENOSYS; 40 | return -1; 41 | #endif 42 | } 43 | #endif /* HAVE_SETNS */ 44 | 45 | extern int netns_switch(char *netns); 46 | extern int netns_get_fd(const char *netns); 47 | extern int netns_foreach(int (*func)(char *nsname, void *arg), void *arg); 48 | 49 | struct netns_func { 50 | int (*func)(char *nsname, void *arg); 51 | void *arg; 52 | }; 53 | 54 | #endif /* __NAMESPACE_H__ */ 55 | -------------------------------------------------------------------------------- /iproute2-3.19.0/include/rt_names.h: -------------------------------------------------------------------------------- 1 | #ifndef RT_NAMES_H_ 2 | #define RT_NAMES_H_ 1 3 | 4 | #include <asm/types.h> 5 | 6 | const char *rtnl_rtprot_n2a(int id, char *buf, int len); 7 | const char *rtnl_rtscope_n2a(int id, char *buf, int len); 8 | const char *rtnl_rttable_n2a(__u32 id, char *buf, int len); 9 | const char *rtnl_rtrealm_n2a(int id, char *buf, int len); 10 | const char *rtnl_dsfield_n2a(int id, char *buf, int len); 11 | const char *rtnl_group_n2a(int id, char *buf, int len); 12 | 13 | int rtnl_rtprot_a2n(__u32 *id, const char *arg); 14 | int rtnl_rtscope_a2n(__u32 *id, const char *arg); 15 | int rtnl_rttable_a2n(__u32 *id, const char *arg); 16 | int rtnl_rtrealm_a2n(__u32 *id, const char *arg); 17 | int rtnl_dsfield_a2n(__u32 *id, const char *arg); 18 | int rtnl_group_a2n(int *id, const char *arg); 19 | 20 | const char *inet_proto_n2a(int proto, char *buf, int len); 21 | int inet_proto_a2n(const char *buf); 22 | 23 | 24 | const char * ll_type_n2a(int type, char *buf, int len); 25 | const char *ll_addr_n2a(unsigned char *addr, int alen, 26 | int type, char *buf, int blen); 27 | int ll_addr_a2n(char *lladdr, int len, const char *arg); 28 | 29 | const char * ll_proto_n2a(unsigned short id, char *buf, int len); 30 | int ll_proto_a2n(unsigned short *id, const char *buf); 31 | 32 | const char *nl_proto_n2a(int id, char *buf, int len); 33 | int nl_proto_a2n(__u32 *id, const char *arg); 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /iproute2-3.19.0/include/rtm_map.h: -------------------------------------------------------------------------------- 1 | #ifndef __RTM_MAP_H__ 2 | #define __RTM_MAP_H__ 1 3 | 4 | char *rtnl_rtntype_n2a(int id, char *buf, int len); 5 | int rtnl_rtntype_a2n(int *id, char *arg); 6 | 7 | int get_rt_realms(__u32 *realms, char *arg); 8 | 9 | 10 | #endif /* __RTM_MAP_H__ */ 11 | -------------------------------------------------------------------------------- /iproute2-3.19.0/include/xt-internal.h: -------------------------------------------------------------------------------- 1 | #ifndef _XTABLES_INTERNAL_H 2 | #define _XTABLES_INTERNAL_H 1 3 | 4 | #ifndef XT_LIB_DIR 5 | # define XT_LIB_DIR "/lib/xtables" 6 | #endif 7 | 8 | /* protocol family dependent informations */ 9 | struct afinfo { 10 | /* protocol family */ 11 | int family; 12 | 13 | /* prefix of library name (ex "libipt_" */ 14 | char *libprefix; 15 | 16 | /* used by setsockopt (ex IPPROTO_IP */ 17 | int ipproto; 18 | 19 | /* kernel module (ex "ip_tables" */ 20 | char *kmod; 21 | 22 | /* optname to check revision support of match */ 23 | int so_rev_match; 24 | 25 | /* optname to check revision support of match */ 26 | int so_rev_target; 27 | }; 28 | 29 | enum xt_tryload { 30 | DONT_LOAD, 31 | DURING_LOAD, 32 | TRY_LOAD, 33 | LOAD_MUST_SUCCEED 34 | }; 35 | 36 | struct xtables_rule_match { 37 | struct xtables_rule_match *next; 38 | struct xtables_match *match; 39 | /* Multiple matches of the same type: the ones before 40 | the current one are completed from parsing point of view */ 41 | unsigned int completed; 42 | }; 43 | 44 | extern char *lib_dir; 45 | 46 | extern void *fw_calloc(size_t count, size_t size); 47 | extern void *fw_malloc(size_t size); 48 | 49 | extern const char *modprobe_program; 50 | extern int xtables_insmod(const char *modname, const char *modprobe, int quiet); 51 | extern int load_xtables_ko(const char *modprobe, int quiet); 52 | 53 | /* This is decleared in ip[6]tables.c */ 54 | extern struct afinfo afinfo; 55 | 56 | /* Keeping track of external matches and targets: linked lists. */ 57 | extern struct xtables_match *xtables_matches; 58 | extern struct xtables_target *xtables_targets; 59 | 60 | extern struct xtables_match *find_match(const char *name, enum xt_tryload, 61 | struct xtables_rule_match **match); 62 | extern struct xtables_target *find_target(const char *name, enum xt_tryload); 63 | 64 | extern void _init(void); 65 | 66 | #endif /* _XTABLES_INTERNAL_H */ 67 | -------------------------------------------------------------------------------- /iproute2-3.19.0/ip/.gitignore: -------------------------------------------------------------------------------- 1 | ip 2 | rtmon 3 | -------------------------------------------------------------------------------- /iproute2-3.19.0/ip/Makefile: -------------------------------------------------------------------------------- 1 | IPOBJ=ip.o ipaddress.o ipaddrlabel.o iproute.o iprule.o ipnetns.o \ 2 | rtm_map.o iptunnel.o ip6tunnel.o tunnel.o ipneigh.o ipntable.o iplink.o \ 3 | ipmaddr.o ipmonitor.o ipmroute.o ipprefix.o iptuntap.o ipnsh.o iptoken.o \ 4 | ipxfrm.o xfrm_state.o xfrm_policy.o xfrm_monitor.o \ 5 | iplink_vlan.o link_veth.o link_gre.o iplink_can.o \ 6 | iplink_macvlan.o iplink_macvtap.o ipl2tp.o link_vti.o link_vti6.o \ 7 | iplink_vxlan.o tcp_metrics.o iplink_ipoib.o ipnetconf.o link_ip6tnl.o \ 8 | link_iptnl.o link_gre6.o iplink_bond.o iplink_bond_slave.o iplink_hsr.o \ 9 | iplink_bridge.o iplink_bridge_slave.o ipfou.o iplink_ipvlan.o iplink_nsh.o 10 | 11 | RTMONOBJ=rtmon.o 12 | 13 | include ../Config 14 | 15 | ifeq ($(IP_CONFIG_SETNS),y) 16 | CFLAGS += -DHAVE_SETNS 17 | endif 18 | 19 | ALLOBJ=$(IPOBJ) $(RTMONOBJ) 20 | SCRIPTS=ifcfg rtpr routel routef 21 | TARGETS=ip rtmon 22 | 23 | all: $(TARGETS) $(SCRIPTS) 24 | 25 | ip: $(IPOBJ) $(LIBNETLINK) 26 | 27 | rtmon: $(RTMONOBJ) 28 | 29 | install: all 30 | install -m 0755 $(TARGETS) $(DESTDIR)$(SBINDIR) 31 | install -m 0755 $(SCRIPTS) $(DESTDIR)$(SBINDIR) 32 | 33 | clean: 34 | rm -f $(ALLOBJ) $(TARGETS) 35 | 36 | SHARED_LIBS ?= y 37 | ifeq ($(SHARED_LIBS),y) 38 | 39 | LDLIBS += -ldl 40 | LDFLAGS += -Wl,-export-dynamic 41 | 42 | else 43 | 44 | ip: static-syms.o 45 | static-syms.o: static-syms.h 46 | static-syms.h: $(wildcard *.c) 47 | files="$^" ; \ 48 | for s in `grep -B 3 '\<dlsym' $$files | sed -n '/snprintf/{s:.*"\([^"]*\)".*:\1:;s:%s::;p}'` ; do \ 49 | sed -n '/'$$s'[^ ]* =/{s:.* \([^ ]*'$$s'[^ ]*\) .*:extern char \1[] __attribute__((weak)); if (!strcmp(sym, "\1")) return \1;:;p}' $$files ; \ 50 | done > $@ 51 | 52 | endif 53 | -------------------------------------------------------------------------------- /iproute2-3.19.0/ip/iplink_bridge.c: -------------------------------------------------------------------------------- 1 | /* 2 | * iplink_bridge.c Bridge device support 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 7 | * 2 of the License, or (at your option) any later version. 8 | * 9 | * Authors: Jiri Pirko <jiri@resnulli.us> 10 | */ 11 | 12 | #include <stdio.h> 13 | #include <stdlib.h> 14 | #include <string.h> 15 | #include <linux/if_link.h> 16 | 17 | #include "utils.h" 18 | #include "ip_common.h" 19 | 20 | static void explain(void) 21 | { 22 | fprintf(stderr, 23 | "Usage: ... bridge [ forward_delay FORWARD_DELAY ]\n" 24 | " [ hello_time HELLO_TIME ]\n" 25 | " [ max_age MAX_AGE ]\n" 26 | ); 27 | } 28 | 29 | static int bridge_parse_opt(struct link_util *lu, int argc, char **argv, 30 | struct nlmsghdr *n) 31 | { 32 | __u32 val; 33 | 34 | while (argc > 0) { 35 | if (matches(*argv, "forward_delay") == 0) { 36 | NEXT_ARG(); 37 | if (get_u32(&val, *argv, 0)) { 38 | invarg("invalid forward_delay", *argv); 39 | return -1; 40 | } 41 | addattr32(n, 1024, IFLA_BR_FORWARD_DELAY, val); 42 | } else if (matches(*argv, "hello_time") == 0) { 43 | NEXT_ARG(); 44 | if (get_u32(&val, *argv, 0)) { 45 | invarg("invalid hello_time", *argv); 46 | return -1; 47 | } 48 | addattr32(n, 1024, IFLA_BR_HELLO_TIME, val); 49 | } else if (matches(*argv, "max_age") == 0) { 50 | NEXT_ARG(); 51 | if (get_u32(&val, *argv, 0)) { 52 | invarg("invalid max_age", *argv); 53 | return -1; 54 | } 55 | addattr32(n, 1024, IFLA_BR_MAX_AGE, val); 56 | } else if (matches(*argv, "help") == 0) { 57 | explain(); 58 | return -1; 59 | } else { 60 | fprintf(stderr, "bridge: unknown command \"%s\"?\n", *argv); 61 | explain(); 62 | return -1; 63 | } 64 | argc--, argv++; 65 | } 66 | 67 | return 0; 68 | } 69 | 70 | static void bridge_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) 71 | { 72 | if (!tb) 73 | return; 74 | 75 | if (tb[IFLA_BR_FORWARD_DELAY]) 76 | fprintf(f, "forward_delay %u ", 77 | rta_getattr_u32(tb[IFLA_BR_FORWARD_DELAY])); 78 | 79 | if (tb[IFLA_BR_HELLO_TIME]) 80 | fprintf(f, "hello_time %u ", 81 | rta_getattr_u32(tb[IFLA_BR_HELLO_TIME])); 82 | 83 | if (tb[IFLA_BR_MAX_AGE]) 84 | fprintf(f, "max_age %u ", 85 | rta_getattr_u32(tb[IFLA_BR_MAX_AGE])); 86 | } 87 | 88 | struct link_util bridge_link_util = { 89 | .id = "bridge", 90 | .maxattr = IFLA_BR_MAX, 91 | .parse_opt = bridge_parse_opt, 92 | .print_opt = bridge_print_opt, 93 | }; 94 | -------------------------------------------------------------------------------- /iproute2-3.19.0/ip/iplink_ipvlan.c: -------------------------------------------------------------------------------- 1 | /* iplink_ipvlan.c IPVLAN device support 2 | * 3 | * This program is free software; you can redistribute it and/or 4 | * modify it under the terms of the GNU General Public License 5 | * as published by the Free Software Foundation; either version 6 | * 2 of the License, or (at your option) any later version. 7 | * 8 | * Authors: Mahesh Bandewar <maheshb@google.com> 9 | */ 10 | 11 | #include <stdio.h> 12 | #include <stdlib.h> 13 | #include <string.h> 14 | #include <sys/socket.h> 15 | #include <linux/if_link.h> 16 | 17 | #include "rt_names.h" 18 | #include "utils.h" 19 | #include "ip_common.h" 20 | 21 | static void ipvlan_explain(FILE *f) 22 | { 23 | fprintf(f, "Usage: ... ipvlan [ mode { l2 | l3 } ]\n"); 24 | } 25 | 26 | static void explain(void) 27 | { 28 | ipvlan_explain(stderr); 29 | } 30 | 31 | static int mode_arg(void) 32 | { 33 | fprintf(stderr, "Error: argument of \"mode\" must be either \"l2\", " 34 | "or \"l3\"\n"); 35 | return -1; 36 | } 37 | 38 | static int ipvlan_parse_opt(struct link_util *lu, int argc, char **argv, 39 | struct nlmsghdr *n) 40 | { 41 | while (argc > 0) { 42 | if (matches(*argv, "mode") == 0) { 43 | __u16 mode = 0; 44 | NEXT_ARG(); 45 | 46 | if (strcmp(*argv, "l2") == 0) 47 | mode = IPVLAN_MODE_L2; 48 | else if (strcmp(*argv, "l3") == 0) 49 | mode = IPVLAN_MODE_L3; 50 | else 51 | return mode_arg(); 52 | 53 | addattr16(n, 1024, IFLA_IPVLAN_MODE, mode); 54 | } else if (matches(*argv, "help") == 0) { 55 | explain(); 56 | return -1; 57 | } else { 58 | fprintf(stderr, "ipvlan: unknown option \"%s\"?\n", 59 | *argv); 60 | explain(); 61 | return -1; 62 | } 63 | argc--, argv++; 64 | } 65 | 66 | return 0; 67 | } 68 | 69 | static void ipvlan_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) 70 | { 71 | 72 | if (!tb) 73 | return; 74 | 75 | if (tb[IFLA_IPVLAN_MODE]) { 76 | if (RTA_PAYLOAD(tb[IFLA_IPVLAN_MODE]) == sizeof(__u16)) { 77 | __u16 mode = rta_getattr_u16(tb[IFLA_IPVLAN_MODE]); 78 | 79 | fprintf(f, " mode %s ", 80 | mode == IPVLAN_MODE_L2 ? "l2" : 81 | mode == IPVLAN_MODE_L3 ? "l3" : "unknown"); 82 | } 83 | } 84 | } 85 | 86 | static void ipvlan_print_help(struct link_util *lu, int argc, char **argv, 87 | FILE *f) 88 | { 89 | ipvlan_explain(f); 90 | } 91 | 92 | struct link_util ipvlan_link_util = { 93 | .id = "ipvlan", 94 | .maxattr = IFLA_IPVLAN_MAX, 95 | .parse_opt = ipvlan_parse_opt, 96 | .print_opt = ipvlan_print_opt, 97 | .print_help = ipvlan_print_help, 98 | }; 99 | -------------------------------------------------------------------------------- /iproute2-3.19.0/ip/iplink_nsh.c: -------------------------------------------------------------------------------- 1 | /* 2 | * iplink_nsh.c 3 | */ 4 | 5 | #include <stdio.h> 6 | #include <string.h> 7 | 8 | #include "rt_names.h" 9 | #include "utils.h" 10 | #include "ip_common.h" 11 | #include "../../nshkmod.h" 12 | 13 | 14 | static 15 | void explain (void) 16 | { 17 | fprintf (stderr, 18 | "Usage: ... nsh [ spi SPI ] [ si SI ]\n"); 19 | } 20 | 21 | static int 22 | nsh_parse_opt (struct link_util * lu, int argc, char ** argv, 23 | struct nlmsghdr * n) 24 | { 25 | __u32 spi; 26 | __u8 si; 27 | int spi_set = 0, si_set = 0; 28 | 29 | while (argc > 0) { 30 | if (!matches (*argv, "help")) { 31 | explain (); 32 | exit (-1); 33 | } else if (!matches (*argv, "spi")) { 34 | NEXT_ARG (); 35 | if (get_u32 (&spi, *argv, 0) || spi >= 1u << 24) { 36 | invarg ("invalid spi", *argv); 37 | exit (-1); 38 | } 39 | spi_set = 1; 40 | } else if (!matches (*argv, "si")) { 41 | NEXT_ARG (); 42 | if (get_u8 (&si, *argv, 0)) { 43 | invarg ("invalid si", *argv); 44 | exit (-1); 45 | } 46 | si_set = 1; 47 | } 48 | argc--; 49 | argv++; 50 | } 51 | 52 | if (spi_set & si_set) { 53 | addattr32 (n, 1024, IFLA_NSHKMOD_SPI, spi); 54 | addattr8 (n, 1024, IFLA_NSHKMOD_SI, si); 55 | } else if (spi_set || si_set) { 56 | fprintf (stderr, "both spi and si are required\n"); 57 | exit (-1); 58 | } 59 | 60 | return 0; 61 | } 62 | 63 | static void 64 | nsh_print_opt (struct link_util * lu, FILE * f, struct rtattr * tb[]) 65 | { 66 | __u32 spi; 67 | __u8 si; 68 | 69 | if (!tb) 70 | return; 71 | 72 | if (!tb[IFLA_NSHKMOD_SPI] || !tb[IFLA_NSHKMOD_SI]) 73 | return; 74 | 75 | spi = rta_getattr_u32 (tb[IFLA_NSHKMOD_SPI]); 76 | si = rta_getattr_u8 (tb[IFLA_NSHKMOD_SI]); 77 | 78 | fprintf (f, "spi %u si %u ", spi, si); 79 | 80 | return; 81 | } 82 | 83 | struct link_util nsh_link_util = { 84 | .id = "nsh", 85 | .maxattr = IFLA_NSHKMOD_MAX, 86 | .parse_opt = nsh_parse_opt, 87 | .print_opt = nsh_print_opt, 88 | }; 89 | -------------------------------------------------------------------------------- /iproute2-3.19.0/ip/link_veth.c: -------------------------------------------------------------------------------- 1 | /* 2 | * link_veth.c veth driver module 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 7 | * 2 of the License, or (at your option) any later version. 8 | * 9 | * Authors: Pavel Emelianov <xemul@openvz.org> 10 | * 11 | */ 12 | 13 | #include <string.h> 14 | #include <net/if.h> 15 | #include <linux/veth.h> 16 | 17 | #include "utils.h" 18 | #include "ip_common.h" 19 | 20 | static void print_usage(FILE *f) 21 | { 22 | printf("Usage: ip link <options> type veth [peer <options>]\n" 23 | "To get <options> type 'ip link add help'\n"); 24 | } 25 | 26 | static void usage(void) 27 | { 28 | print_usage(stderr); 29 | } 30 | 31 | static int veth_parse_opt(struct link_util *lu, int argc, char **argv, 32 | struct nlmsghdr *hdr) 33 | { 34 | char *dev = NULL; 35 | char *name = NULL; 36 | char *link = NULL; 37 | char *type = NULL; 38 | int index = 0; 39 | int err, len; 40 | struct rtattr * data; 41 | int group; 42 | struct ifinfomsg *ifm, *peer_ifm; 43 | unsigned int ifi_flags, ifi_change; 44 | 45 | if (strcmp(argv[0], "peer") != 0) { 46 | usage(); 47 | return -1; 48 | } 49 | 50 | ifm = NLMSG_DATA(hdr); 51 | ifi_flags = ifm->ifi_flags; 52 | ifi_change = ifm->ifi_change; 53 | ifm->ifi_flags = 0; 54 | ifm->ifi_change = 0; 55 | 56 | data = NLMSG_TAIL(hdr); 57 | addattr_l(hdr, 1024, VETH_INFO_PEER, NULL, 0); 58 | 59 | hdr->nlmsg_len += sizeof(struct ifinfomsg); 60 | 61 | err = iplink_parse(argc - 1, argv + 1, (struct iplink_req *)hdr, 62 | &name, &type, &link, &dev, &group, &index); 63 | if (err < 0) 64 | return err; 65 | 66 | if (name) { 67 | len = strlen(name) + 1; 68 | if (len > IFNAMSIZ) 69 | invarg("\"name\" too long\n", *argv); 70 | addattr_l(hdr, 1024, IFLA_IFNAME, name, len); 71 | } 72 | 73 | peer_ifm = RTA_DATA(data); 74 | peer_ifm->ifi_index = index; 75 | peer_ifm->ifi_flags = ifm->ifi_flags; 76 | peer_ifm->ifi_change = ifm->ifi_change; 77 | ifm->ifi_flags = ifi_flags; 78 | ifm->ifi_change = ifi_change; 79 | 80 | if (group != -1) 81 | addattr32(hdr, 1024, IFLA_GROUP, group); 82 | 83 | data->rta_len = (void *)NLMSG_TAIL(hdr) - (void *)data; 84 | return argc - 1 - err; 85 | } 86 | 87 | static void veth_print_help(struct link_util *lu, int argc, char **argv, 88 | FILE *f) 89 | { 90 | print_usage(f); 91 | } 92 | 93 | struct link_util veth_link_util = { 94 | .id = "veth", 95 | .parse_opt = veth_parse_opt, 96 | .print_help = veth_print_help, 97 | }; 98 | -------------------------------------------------------------------------------- /iproute2-3.19.0/ip/routef: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | if [ -z "$*" ] ; then 4 | exec ip -4 ro flush scope global type unicast 5 | else 6 | echo "Usage: routef" 7 | echo 8 | echo "This script will flush the IPv4 routing table" 9 | fi 10 | -------------------------------------------------------------------------------- /iproute2-3.19.0/ip/routel: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | #$Id$ 3 | 4 | # 5 | # Script created by: Stephen R. van den Berg <srb@cuci.nl>, 1999/04/18 6 | # Donated to the public domain. 7 | # 8 | # This script transforms the output of "ip" into more readable text. 9 | # "ip" is the Linux-advanced-routing configuration tool part of the 10 | # iproute package. 11 | # 12 | 13 | test "X-h" = "X$1" && echo "Usage: $0 [tablenr [raw ip args...]]" && exit 64 14 | 15 | test -z "$*" && set 0 16 | 17 | ip route list table "$@" | 18 | while read network rest 19 | do set xx $rest 20 | shift 21 | proto="" 22 | via="" 23 | dev="" 24 | scope="" 25 | src="" 26 | table="" 27 | case $network in 28 | broadcast|local|unreachable) via=$network 29 | network=$1 30 | shift 31 | ;; 32 | esac 33 | while test $# != 0 34 | do 35 | key=$1 36 | val=$2 37 | eval "$key=$val" 38 | shift 2 39 | done 40 | echo "$network $via $src $proto $scope $dev $table" 41 | done | awk -F ' ' ' 42 | BEGIN { 43 | format="%15s%-3s %15s %15s %8s %8s%7s %s\n"; 44 | printf(format,"target","","gateway","source","proto","scope","dev","tbl"); 45 | } 46 | { network=$1; 47 | mask=""; 48 | if(match(network,"/")) 49 | { mask=" "substr(network,RSTART+1); 50 | network=substr(network,0,RSTART); 51 | } 52 | via=$2; 53 | src=$3; 54 | proto=$4; 55 | scope=$5; 56 | dev=$6; 57 | table=$7; 58 | printf(format,network,mask,via,src,proto,scope,dev,table); 59 | } 60 | ' 61 | -------------------------------------------------------------------------------- /iproute2-3.19.0/ip/rtpr: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | exec tr "[\\\\]" "[ 4 | ]" 5 | -------------------------------------------------------------------------------- /iproute2-3.19.0/ip/static-syms.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This file creates a dummy version of dynamic loading 3 | * for environments where dynamic linking 4 | * is not used or available. 5 | */ 6 | 7 | #include <string.h> 8 | #include "dlfcn.h" 9 | 10 | void *_dlsym(const char *sym) 11 | { 12 | #include "static-syms.h" 13 | return NULL; 14 | } 15 | -------------------------------------------------------------------------------- /iproute2-3.19.0/ip/tunnel.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C)2006 USAGI/WIDE Project 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, see <http://www.gnu.org/licenses>. 16 | */ 17 | /* 18 | * Author: 19 | * Masahide NAKAMURA @USAGI 20 | */ 21 | #ifndef __TUNNEL_H__ 22 | #define __TUNNEL_H__ 1 23 | 24 | #include <linux/types.h> 25 | 26 | const char *tnl_strproto(__u8 proto); 27 | 28 | int tnl_get_ioctl(const char *basedev, void *p); 29 | int tnl_add_ioctl(int cmd, const char *basedev, const char *name, void *p); 30 | int tnl_del_ioctl(const char *basedev, const char *name, void *p); 31 | int tnl_prl_ioctl(int cmd, const char *name, void *p); 32 | int tnl_6rd_ioctl(int cmd, const char *name, void *p); 33 | int tnl_ioctl_get_6rd(const char *name, void *p); 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /iproute2-3.19.0/lib/Makefile: -------------------------------------------------------------------------------- 1 | include ../Config 2 | 3 | ifeq ($(IP_CONFIG_SETNS),y) 4 | CFLAGS += -DHAVE_SETNS 5 | endif 6 | 7 | CFLAGS += -fPIC 8 | 9 | UTILOBJ=utils.o rt_names.o ll_types.o ll_proto.o ll_addr.o inet_proto.o namespace.o 10 | 11 | NLOBJ=libgenl.o ll_map.o libnetlink.o 12 | 13 | all: libnetlink.a libutil.a 14 | 15 | libnetlink.a: $(NLOBJ) 16 | $(AR) rcs $@ $(NLOBJ) 17 | 18 | libutil.a: $(UTILOBJ) $(ADDLIB) 19 | $(AR) rcs $@ $(UTILOBJ) $(ADDLIB) 20 | 21 | install: 22 | 23 | clean: 24 | rm -f $(NLOBJ) $(UTILOBJ) $(ADDLIB) libnetlink.a libutil.a 25 | 26 | -------------------------------------------------------------------------------- /iproute2-3.19.0/lib/dnet_ntop.c: -------------------------------------------------------------------------------- 1 | #include <errno.h> 2 | #include <string.h> 3 | #include <sys/types.h> 4 | #include <netinet/in.h> 5 | 6 | #include "utils.h" 7 | 8 | static __inline__ u_int16_t dn_ntohs(u_int16_t addr) 9 | { 10 | union { 11 | u_int8_t byte[2]; 12 | u_int16_t word; 13 | } u; 14 | 15 | u.word = addr; 16 | return ((u_int16_t)u.byte[0]) | (((u_int16_t)u.byte[1]) << 8); 17 | } 18 | 19 | static __inline__ int do_digit(char *str, u_int16_t *addr, u_int16_t scale, size_t *pos, size_t len, int *started) 20 | { 21 | u_int16_t tmp = *addr / scale; 22 | 23 | if (*pos == len) 24 | return 1; 25 | 26 | if (((tmp) > 0) || *started || (scale == 1)) { 27 | *str = tmp + '0'; 28 | *started = 1; 29 | (*pos)++; 30 | *addr -= (tmp * scale); 31 | } 32 | 33 | return 0; 34 | } 35 | 36 | 37 | static const char *dnet_ntop1(const struct dn_naddr *dna, char *str, size_t len) 38 | { 39 | u_int16_t addr, area; 40 | size_t pos = 0; 41 | int started = 0; 42 | 43 | memcpy(&addr, dna->a_addr, sizeof(addr)); 44 | addr = dn_ntohs(addr); 45 | area = addr >> 10; 46 | 47 | if (dna->a_len != 2) 48 | return NULL; 49 | 50 | addr &= 0x03ff; 51 | 52 | if (len == 0) 53 | return str; 54 | 55 | if (do_digit(str + pos, &area, 10, &pos, len, &started)) 56 | return str; 57 | 58 | if (do_digit(str + pos, &area, 1, &pos, len, &started)) 59 | return str; 60 | 61 | if (pos == len) 62 | return str; 63 | 64 | *(str + pos) = '.'; 65 | pos++; 66 | started = 0; 67 | 68 | if (do_digit(str + pos, &addr, 1000, &pos, len, &started)) 69 | return str; 70 | 71 | if (do_digit(str + pos, &addr, 100, &pos, len, &started)) 72 | return str; 73 | 74 | if (do_digit(str + pos, &addr, 10, &pos, len, &started)) 75 | return str; 76 | 77 | if (do_digit(str + pos, &addr, 1, &pos, len, &started)) 78 | return str; 79 | 80 | if (pos == len) 81 | return str; 82 | 83 | *(str + pos) = 0; 84 | 85 | return str; 86 | } 87 | 88 | 89 | const char *dnet_ntop(int af, const void *addr, char *str, size_t len) 90 | { 91 | switch(af) { 92 | case AF_DECnet: 93 | errno = 0; 94 | return dnet_ntop1((struct dn_naddr *)addr, str, len); 95 | default: 96 | errno = EAFNOSUPPORT; 97 | } 98 | 99 | return NULL; 100 | } 101 | 102 | 103 | -------------------------------------------------------------------------------- /iproute2-3.19.0/lib/dnet_pton.c: -------------------------------------------------------------------------------- 1 | #include <errno.h> 2 | #include <string.h> 3 | #include <sys/types.h> 4 | #include <netinet/in.h> 5 | 6 | #include "utils.h" 7 | 8 | static __inline__ u_int16_t dn_htons(u_int16_t addr) 9 | { 10 | union { 11 | u_int8_t byte[2]; 12 | u_int16_t word; 13 | } u; 14 | 15 | u.word = addr; 16 | return ((u_int16_t)u.byte[0]) | (((u_int16_t)u.byte[1]) << 8); 17 | } 18 | 19 | 20 | static int dnet_num(const char *src, u_int16_t * dst) 21 | { 22 | int rv = 0; 23 | int tmp; 24 | *dst = 0; 25 | 26 | while ((tmp = *src++) != 0) { 27 | tmp -= '0'; 28 | if ((tmp < 0) || (tmp > 9)) 29 | return rv; 30 | 31 | rv++; 32 | (*dst) *= 10; 33 | (*dst) += tmp; 34 | } 35 | 36 | return rv; 37 | } 38 | 39 | static int dnet_pton1(const char *src, struct dn_naddr *dna) 40 | { 41 | u_int16_t addr; 42 | u_int16_t area = 0; 43 | u_int16_t node = 0; 44 | int pos; 45 | 46 | pos = dnet_num(src, &area); 47 | if ((pos == 0) || (area > 63) || (*(src + pos) != '.')) 48 | return 0; 49 | pos = dnet_num(src + pos + 1, &node); 50 | if ((pos == 0) || (node > 1023)) 51 | return 0; 52 | dna->a_len = 2; 53 | addr = dn_htons((area << 10) | node); 54 | memcpy(dna->a_addr, &addr, sizeof(addr)); 55 | 56 | return 1; 57 | } 58 | 59 | int dnet_pton(int af, const char *src, void *addr) 60 | { 61 | int err; 62 | 63 | switch (af) { 64 | case AF_DECnet: 65 | errno = 0; 66 | err = dnet_pton1(src, (struct dn_naddr *)addr); 67 | break; 68 | default: 69 | errno = EAFNOSUPPORT; 70 | err = -1; 71 | } 72 | 73 | return err; 74 | } 75 | -------------------------------------------------------------------------------- /iproute2-3.19.0/lib/inet_proto.c: -------------------------------------------------------------------------------- 1 | /* 2 | * inet_proto.c 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 7 | * 2 of the License, or (at your option) any later version. 8 | * 9 | * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru> 10 | * 11 | */ 12 | 13 | #include <stdio.h> 14 | #include <stdlib.h> 15 | #include <unistd.h> 16 | #include <syslog.h> 17 | #include <fcntl.h> 18 | #include <sys/socket.h> 19 | #include <netinet/in.h> 20 | #include <netdb.h> 21 | #include <string.h> 22 | 23 | #include "rt_names.h" 24 | #include "utils.h" 25 | 26 | const char *inet_proto_n2a(int proto, char *buf, int len) 27 | { 28 | static char ncache[16]; 29 | static int icache = -1; 30 | struct protoent *pe; 31 | 32 | if (proto == icache) 33 | return ncache; 34 | 35 | pe = getprotobynumber(proto); 36 | if (pe) { 37 | icache = proto; 38 | strncpy(ncache, pe->p_name, 16); 39 | strncpy(buf, pe->p_name, len); 40 | return buf; 41 | } 42 | snprintf(buf, len, "ipproto-%d", proto); 43 | return buf; 44 | } 45 | 46 | int inet_proto_a2n(const char *buf) 47 | { 48 | static char ncache[16]; 49 | static int icache = -1; 50 | struct protoent *pe; 51 | 52 | if (icache>=0 && strcmp(ncache, buf) == 0) 53 | return icache; 54 | 55 | if (buf[0] >= '0' && buf[0] <= '9') { 56 | __u8 ret; 57 | if (get_u8(&ret, buf, 10)) 58 | return -1; 59 | return ret; 60 | } 61 | 62 | pe = getprotobyname(buf); 63 | if (pe) { 64 | icache = pe->p_proto; 65 | strncpy(ncache, pe->p_name, 16); 66 | return pe->p_proto; 67 | } 68 | return -1; 69 | } 70 | 71 | 72 | -------------------------------------------------------------------------------- /iproute2-3.19.0/lib/ipx_ntop.c: -------------------------------------------------------------------------------- 1 | #include <errno.h> 2 | #include <sys/types.h> 3 | #include <sys/socket.h> 4 | #include <netinet/in.h> 5 | 6 | #include "utils.h" 7 | 8 | static __inline__ int do_digit(char *str, u_int32_t addr, u_int32_t scale, size_t *pos, size_t len) 9 | { 10 | u_int32_t tmp = addr >> (scale * 4); 11 | 12 | if (*pos == len) 13 | return 1; 14 | 15 | tmp &= 0x0f; 16 | if (tmp > 9) 17 | *str = tmp + 'A' - 10; 18 | else 19 | *str = tmp + '0'; 20 | (*pos)++; 21 | 22 | return 0; 23 | } 24 | 25 | static const char *ipx_ntop1(const struct ipx_addr *addr, char *str, size_t len) 26 | { 27 | int i; 28 | size_t pos = 0; 29 | 30 | if (len == 0) 31 | return str; 32 | 33 | for(i = 7; i >= 0; i--) 34 | if (do_digit(str + pos, ntohl(addr->ipx_net), i, &pos, len)) 35 | return str; 36 | 37 | if (pos == len) 38 | return str; 39 | 40 | *(str + pos) = '.'; 41 | pos++; 42 | 43 | for(i = 0; i < 6; i++) { 44 | if (do_digit(str + pos, addr->ipx_node[i], 1, &pos, len)) 45 | return str; 46 | if (do_digit(str + pos, addr->ipx_node[i], 0, &pos, len)) 47 | return str; 48 | } 49 | 50 | if (pos == len) 51 | return str; 52 | 53 | *(str + pos) = 0; 54 | 55 | return str; 56 | } 57 | 58 | 59 | const char *ipx_ntop(int af, const void *addr, char *str, size_t len) 60 | { 61 | switch(af) { 62 | case AF_IPX: 63 | errno = 0; 64 | return ipx_ntop1((struct ipx_addr *)addr, str, len); 65 | default: 66 | errno = EAFNOSUPPORT; 67 | } 68 | 69 | return NULL; 70 | } 71 | 72 | 73 | -------------------------------------------------------------------------------- /iproute2-3.19.0/lib/ipx_pton.c: -------------------------------------------------------------------------------- 1 | #include <errno.h> 2 | #include <string.h> 3 | #include <sys/types.h> 4 | #include <sys/socket.h> 5 | #include <netinet/in.h> 6 | 7 | #include "utils.h" 8 | 9 | static u_int32_t hexget(char c) 10 | { 11 | if (c >= 'A' && c <= 'F') 12 | return c - 'A' + 10; 13 | if (c >= 'a' && c <= 'f') 14 | return c - 'a' + 10; 15 | if (c >= '0' && c <= '9') 16 | return c - '0'; 17 | 18 | return 0xf0; 19 | } 20 | 21 | static int ipx_getnet(u_int32_t *net, const char *str) 22 | { 23 | int i; 24 | u_int32_t tmp; 25 | 26 | for(i = 0; *str && (i < 8); i++) { 27 | 28 | if ((tmp = hexget(*str)) & 0xf0) { 29 | if (*str == '.') 30 | return 0; 31 | else 32 | return -1; 33 | } 34 | 35 | str++; 36 | (*net) <<= 4; 37 | (*net) |= tmp; 38 | } 39 | 40 | if (*str == 0) 41 | return 0; 42 | 43 | return -1; 44 | } 45 | 46 | static int ipx_getnode(u_int8_t *node, const char *str) 47 | { 48 | int i; 49 | u_int32_t tmp; 50 | 51 | for(i = 0; i < 6; i++) { 52 | if ((tmp = hexget(*str++)) & 0xf0) 53 | return -1; 54 | node[i] = (u_int8_t)tmp; 55 | node[i] <<= 4; 56 | if ((tmp = hexget(*str++)) & 0xf0) 57 | return -1; 58 | node[i] |= (u_int8_t)tmp; 59 | if (*str == ':') 60 | str++; 61 | } 62 | 63 | return 0; 64 | } 65 | 66 | static int ipx_pton1(const char *src, struct ipx_addr *addr) 67 | { 68 | char *sep = (char *)src; 69 | int no_node = 0; 70 | 71 | memset(addr, 0, sizeof(struct ipx_addr)); 72 | 73 | while(*sep && (*sep != '.')) 74 | sep++; 75 | 76 | if (*sep != '.') 77 | no_node = 1; 78 | 79 | if (ipx_getnet(&addr->ipx_net, src)) 80 | return 0; 81 | 82 | addr->ipx_net = htonl(addr->ipx_net); 83 | 84 | if (no_node) 85 | return 1; 86 | 87 | if (ipx_getnode(addr->ipx_node, sep + 1)) 88 | return 0; 89 | 90 | return 1; 91 | } 92 | 93 | int ipx_pton(int af, const char *src, void *addr) 94 | { 95 | int err; 96 | 97 | switch (af) { 98 | case AF_IPX: 99 | errno = 0; 100 | err = ipx_pton1(src, (struct ipx_addr *)addr); 101 | break; 102 | default: 103 | errno = EAFNOSUPPORT; 104 | err = -1; 105 | } 106 | 107 | return err; 108 | } 109 | -------------------------------------------------------------------------------- /iproute2-3.19.0/lib/libgenl.c: -------------------------------------------------------------------------------- 1 | /* 2 | * libgenl.c GENL library 3 | */ 4 | 5 | #include <stdio.h> 6 | #include <stdlib.h> 7 | #include <unistd.h> 8 | 9 | #include <linux/genetlink.h> 10 | #include "libgenl.h" 11 | 12 | static int genl_parse_getfamily(struct nlmsghdr *nlh) 13 | { 14 | struct rtattr *tb[CTRL_ATTR_MAX + 1]; 15 | struct genlmsghdr *ghdr = NLMSG_DATA(nlh); 16 | int len = nlh->nlmsg_len; 17 | struct rtattr *attrs; 18 | 19 | if (nlh->nlmsg_type != GENL_ID_CTRL) { 20 | fprintf(stderr, "Not a controller message, nlmsg_len=%d " 21 | "nlmsg_type=0x%x\n", nlh->nlmsg_len, nlh->nlmsg_type); 22 | return -1; 23 | } 24 | 25 | len -= NLMSG_LENGTH(GENL_HDRLEN); 26 | 27 | if (len < 0) { 28 | fprintf(stderr, "wrong controller message len %d\n", len); 29 | return -1; 30 | } 31 | 32 | if (ghdr->cmd != CTRL_CMD_NEWFAMILY) { 33 | fprintf(stderr, "Unknown controller command %d\n", ghdr->cmd); 34 | return -1; 35 | } 36 | 37 | attrs = (struct rtattr *) ((char *) ghdr + GENL_HDRLEN); 38 | parse_rtattr(tb, CTRL_ATTR_MAX, attrs, len); 39 | 40 | if (tb[CTRL_ATTR_FAMILY_ID] == NULL) { 41 | fprintf(stderr, "Missing family id TLV\n"); 42 | return -1; 43 | } 44 | 45 | return rta_getattr_u16(tb[CTRL_ATTR_FAMILY_ID]); 46 | } 47 | 48 | int genl_resolve_family(struct rtnl_handle *grth, const char *family) 49 | { 50 | GENL_REQUEST(req, 1024, GENL_ID_CTRL, 0, 0, CTRL_CMD_GETFAMILY, 51 | NLM_F_REQUEST); 52 | 53 | addattr_l(&req.n, sizeof(req), CTRL_ATTR_FAMILY_NAME, 54 | family, strlen(family) + 1); 55 | 56 | if (rtnl_talk(grth, &req.n, 0, 0, &req.n) < 0) { 57 | fprintf(stderr, "Error talking to the kernel\n"); 58 | return -2; 59 | } 60 | 61 | return genl_parse_getfamily(&req.n); 62 | } 63 | 64 | -------------------------------------------------------------------------------- /iproute2-3.19.0/lib/ll_addr.c: -------------------------------------------------------------------------------- 1 | /* 2 | * ll_addr.c 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 7 | * 2 of the License, or (at your option) any later version. 8 | * 9 | * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru> 10 | */ 11 | 12 | #include <stdio.h> 13 | #include <stdlib.h> 14 | #include <unistd.h> 15 | #include <syslog.h> 16 | #include <fcntl.h> 17 | #include <sys/ioctl.h> 18 | #include <sys/socket.h> 19 | #include <sys/ioctl.h> 20 | #include <netinet/in.h> 21 | #include <arpa/inet.h> 22 | #include <string.h> 23 | 24 | #include <linux/netdevice.h> 25 | #include <linux/if_arp.h> 26 | #include <linux/sockios.h> 27 | 28 | #include "rt_names.h" 29 | #include "utils.h" 30 | 31 | 32 | const char *ll_addr_n2a(unsigned char *addr, int alen, int type, char *buf, int blen) 33 | { 34 | int i; 35 | int l; 36 | 37 | if (alen == 4 && 38 | (type == ARPHRD_TUNNEL || type == ARPHRD_SIT || type == ARPHRD_IPGRE)) { 39 | return inet_ntop(AF_INET, addr, buf, blen); 40 | } 41 | if (alen == 16 && type == ARPHRD_TUNNEL6) { 42 | return inet_ntop(AF_INET6, addr, buf, blen); 43 | } 44 | l = 0; 45 | for (i=0; i<alen; i++) { 46 | if (i==0) { 47 | snprintf(buf+l, blen, "%02x", addr[i]); 48 | blen -= 2; 49 | l += 2; 50 | } else { 51 | snprintf(buf+l, blen, ":%02x", addr[i]); 52 | blen -= 3; 53 | l += 3; 54 | } 55 | } 56 | return buf; 57 | } 58 | 59 | /*NB: lladdr is char * (rather than u8 *) because sa_data is char * (1003.1g) */ 60 | int ll_addr_a2n(char *lladdr, int len, const char *arg) 61 | { 62 | if (strchr(arg, '.')) { 63 | inet_prefix pfx; 64 | if (get_addr_1(&pfx, arg, AF_INET)) { 65 | fprintf(stderr, "\"%s\" is invalid lladdr.\n", arg); 66 | return -1; 67 | } 68 | if (len < 4) 69 | return -1; 70 | memcpy(lladdr, pfx.data, 4); 71 | return 4; 72 | } else { 73 | int i; 74 | 75 | for (i=0; i<len; i++) { 76 | int temp; 77 | char *cp = strchr(arg, ':'); 78 | if (cp) { 79 | *cp = 0; 80 | cp++; 81 | } 82 | if (sscanf(arg, "%x", &temp) != 1) { 83 | fprintf(stderr, "\"%s\" is invalid lladdr.\n", arg); 84 | return -1; 85 | } 86 | if (temp < 0 || temp > 255) { 87 | fprintf(stderr, "\"%s\" is invalid lladdr.\n", arg); 88 | return -1; 89 | } 90 | lladdr[i] = temp; 91 | if (!cp) 92 | break; 93 | arg = cp; 94 | } 95 | return i+1; 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /iproute2-3.19.0/man/Makefile: -------------------------------------------------------------------------------- 1 | INSTALL=install 2 | INSTALLDIR=install -m 0755 -d 3 | INSTALLMAN=install -m 0644 4 | 5 | SUBDIRS = man3 man7 man8 6 | 7 | all clean install: 8 | @for subdir in $(SUBDIRS); do $(MAKE) -C $$subdir $@ || exit $$?; done 9 | 10 | distclean: clean 11 | 12 | .PHONY: install clean distclean 13 | 14 | .EXPORT_ALL_VARIABLES: 15 | -------------------------------------------------------------------------------- /iproute2-3.19.0/man/man3/Makefile: -------------------------------------------------------------------------------- 1 | MAN3PAGES=libnetlink.3 2 | 3 | all: 4 | 5 | distclean: clean 6 | 7 | clean: 8 | 9 | install: 10 | $(INSTALLDIR) $(DESTDIR)$(MANDIR)/man3 11 | $(INSTALLMAN) $(MAN3PAGES) $(DESTDIR)$(MANDIR)/man3 12 | 13 | .PHONY: install clean distclean 14 | -------------------------------------------------------------------------------- /iproute2-3.19.0/man/man7/Makefile: -------------------------------------------------------------------------------- 1 | MAN7PAGES = tc-hfsc.7 2 | 3 | all: 4 | 5 | distclean: clean 6 | 7 | clean: 8 | 9 | install: 10 | $(INSTALLDIR) $(DESTDIR)$(MANDIR)/man7 11 | $(INSTALLMAN) $(MAN7PAGES) $(DESTDIR)$(MANDIR)/man7 12 | 13 | .PHONY: install clean distclean 14 | -------------------------------------------------------------------------------- /iproute2-3.19.0/man/man8/.gitignore: -------------------------------------------------------------------------------- 1 | # these pages are built 2 | ip-address.8 3 | ip-link.8 4 | ip-route.8 5 | 6 | -------------------------------------------------------------------------------- /iproute2-3.19.0/man/man8/Makefile: -------------------------------------------------------------------------------- 1 | TARGETS = ip-address.8 ip-link.8 ip-route.8 2 | 3 | MAN8PAGES = $(TARGETS) ip.8 arpd.8 lnstat.8 routel.8 rtacct.8 rtmon.8 ss.8 \ 4 | tc.8 tc-bfifo.8 tc-cbq.8 tc-cbq-details.8 tc-choke.8 tc-codel.8 \ 5 | tc-drr.8 tc-ematch.8 tc-fq_codel.8 tc-hfsc.8 tc-htb.8 tc-pie.8 \ 6 | tc-mqprio.8 tc-netem.8 tc-pfifo.8 tc-pfifo_fast.8 tc-prio.8 tc-red.8 \ 7 | tc-sfb.8 tc-sfq.8 tc-stab.8 tc-tbf.8 \ 8 | bridge.8 rtstat.8 ctstat.8 nstat.8 routef.8 \ 9 | ip-addrlabel.8 ip-l2tp.8 \ 10 | ip-maddress.8 ip-monitor.8 ip-mroute.8 ip-neighbour.8 \ 11 | ip-netns.8 ip-ntable.8 ip-rule.8 ip-tunnel.8 ip-xfrm.8 \ 12 | ip-tcp_metrics.8 ip-netconf.8 ip-token.8 13 | 14 | all: $(TARGETS) 15 | 16 | ip-address.8: ip-address.8.in 17 | sed "s|@SYSCONFDIR@|$(CONFDIR)|g" $< > $@ 18 | 19 | ip-link.8: ip-link.8.in 20 | sed "s|@SYSCONFDIR@|$(CONFDIR)|g" $< > $@ 21 | 22 | ip-route.8: ip-route.8.in 23 | sed "s|@SYSCONFDIR@|$(CONFDIR)|g" $< > $@ 24 | 25 | distclean: clean 26 | 27 | clean: 28 | @rm -f $(TARGETS) 29 | 30 | install: 31 | $(INSTALLDIR) $(DESTDIR)$(MANDIR)/man8 32 | $(INSTALLMAN) $(MAN8PAGES) $(DESTDIR)$(MANDIR)/man8 33 | 34 | .PHONY: install clean distclean 35 | -------------------------------------------------------------------------------- /iproute2-3.19.0/man/man8/ctstat.8: -------------------------------------------------------------------------------- 1 | .so man8/lnstat.8 2 | -------------------------------------------------------------------------------- /iproute2-3.19.0/man/man8/ip-addrlabel.8: -------------------------------------------------------------------------------- 1 | .TH IP\-ADDRLABEL 8 "20 Dec 2011" "iproute2" "Linux" 2 | .SH "NAME" 3 | ip-addrlabel \- protocol address label management 4 | .SH "SYNOPSIS" 5 | .sp 6 | .ad l 7 | .in +8 8 | .ti -8 9 | .B ip 10 | .RI "[ " OPTIONS " ]" 11 | .B addrlabel 12 | .RI " { " COMMAND " | " 13 | .BR help " }" 14 | .sp 15 | 16 | .ti -8 17 | .IR OPTIONS " := { " 18 | \fB\-V\fR[\fIersion\fR] | 19 | \fB\-s\fR[\fItatistics\fR] | 20 | \fB\-r\fR[\fIesolve\fR] | 21 | \fB\-f\fR[\fIamily\fR] { 22 | .BR inet " | " inet6 " | " ipx " | " dnet " | " link " } | " 23 | \fB\-o\fR[\fIneline\fR] } 24 | 25 | .ti -8 26 | .BR "ip addrlabel" " { " add " | " del " } " prefix 27 | .BR PREFIX " [ " 28 | .B dev 29 | .IR DEV " ] [ " 30 | .B label 31 | .IR NUMBER " ]" 32 | 33 | .ti -8 34 | .BR "ip addrlabel" " { " list " | " flush " }" 35 | 36 | .SH "DESCRIPTION" 37 | IPv6 address labels are used for address selection; 38 | they are described in RFC 3484. Precedence is managed by userspace, 39 | and only the label itself is stored in the kernel. 40 | 41 | .SS ip addrlabel add - add an address label 42 | add an address label entry to the kernel. 43 | .TP 44 | .BI prefix " PREFIX" 45 | .TP 46 | .BI dev " DEV" 47 | the outgoing interface. 48 | .TP 49 | .BI label " NUMBER" 50 | the label for the prefix. 51 | 0xffffffff is reserved. 52 | .SS ip addrlabel del - delete an address label 53 | delete an address label entry from the kernel. 54 | .B Arguments: 55 | coincide with the arguments of 56 | .B ip addrlabel add 57 | but the label is not required. 58 | .SS ip addrlabel list - list address labels 59 | list the current address label entries in the kernel. 60 | .SS ip addrlabel flush - flush address labels 61 | flush all address labels in the kernel. This does not restore any default settings. 62 | 63 | .SH SEE ALSO 64 | .br 65 | .BR ip (8) 66 | 67 | .SH AUTHOR 68 | Manpage by Yoshifuji Hideaki / 吉藤英明 69 | 70 | -------------------------------------------------------------------------------- /iproute2-3.19.0/man/man8/ip-fou.8: -------------------------------------------------------------------------------- 1 | .TH IP\-FOU 8 "2 Nov 2014" "iproute2" "Linux" 2 | .SH "NAME" 3 | ip-fou \- Foo-over-UDP receive port configuration 4 | .P 5 | ip-gue \- Generic UDP Encapsulation receive port configuration 6 | .SH "SYNOPSIS" 7 | .sp 8 | .ad l 9 | .in +8 10 | .ti -8 11 | .B ip 12 | .RI "[ " OPTIONS " ]" 13 | .B fou 14 | .RI " { " COMMAND " | " 15 | .BR help " }" 16 | .sp 17 | .ti -8 18 | .BR "ip fou add" 19 | .B port 20 | .IR PORT 21 | .RB "{ " 22 | .B gue 23 | .RI "|" 24 | .B ipproto 25 | .IR PROTO 26 | .RB " }" 27 | .br 28 | .ti -8 29 | .BR "ip fou del" 30 | .B port 31 | .IR PORT 32 | .SH DESCRIPTION 33 | The 34 | .B ip fou 35 | commands are used to create and delete receive ports for Foo-over-UDP 36 | (FOU) as well as Generic UDP Encapsulation (GUE). 37 | .PP 38 | Foo-over-UDP allows encapsulating packets of an IP protocol directly 39 | over UDP. The receiver infers the protocol of a packet received on 40 | a FOU UDP port to be the protocol configured for the port. 41 | .PP 42 | Generic UDP Encapsulation (GUE) encapsulates packets of an IP protocol 43 | within UDP and an encapsulation header. The encapsulation header contains the 44 | IP protocol number for the encapsulated packet. 45 | .PP 46 | When creating a FOU or GUE receive port, the port number is specified in 47 | .I PORT 48 | argument. If FOU is used, the IP protocol number associated with the port is specified in 49 | .I PROTO 50 | argument. 51 | .PP 52 | A FOU or GUE receive port is deleted by specifying 53 | .I PORT 54 | in the delete command. 55 | .SH EXAMPLES 56 | .PP 57 | .SS Configure a FOU receive port for GRE bound to 7777 58 | .nf 59 | # ip fou add port 8888 ipproto 47 60 | .PP 61 | .SS Configure a FOU receive port for IPIP bound to 8888 62 | .nf 63 | # ip fou add port 8888 ipproto 4 64 | .PP 65 | .SS Configure a GUE receive port bound to 9999 66 | .nf 67 | # ip fou add port 9999 gue 68 | .PP 69 | .SS Delete the GUE receive port bound to 9999 70 | .nf 71 | # ip fou del port 9999 72 | .SH SEE ALSO 73 | .br 74 | .BR ip (8) 75 | .SH AUTHOR 76 | Tom Herbert <therbert@google.com> 77 | -------------------------------------------------------------------------------- /iproute2-3.19.0/man/man8/ip-gue.8: -------------------------------------------------------------------------------- 1 | .so man8/ip-fou.8 2 | -------------------------------------------------------------------------------- /iproute2-3.19.0/man/man8/ip-maddress.8: -------------------------------------------------------------------------------- 1 | .TH IP\-MADDRESS 8 "20 Dec 2011" "iproute2" "Linux" 2 | .SH "NAME" 3 | ip-maddress \- multicast addresses management 4 | .SH "SYNOPSIS" 5 | .sp 6 | .ad l 7 | .in +8 8 | .ti -8 9 | .B ip 10 | .RI "[ " OPTIONS " ]" 11 | .B maddress 12 | .RI " { " COMMAND " | " 13 | .BR help " }" 14 | .sp 15 | .ti -8 16 | 17 | .BR "ip maddress" " [ " add " | " del " ]" 18 | .IB MULTIADDR " dev " NAME 19 | 20 | .ti -8 21 | .BR "ip maddress show" " [ " dev 22 | .IR NAME " ]" 23 | 24 | .SH DESCRIPTION 25 | .B maddress 26 | objects are multicast addresses. 27 | 28 | .SS ip maddress show - list multicast addresses 29 | 30 | .TP 31 | .BI dev " NAME " (default) 32 | the device name. 33 | 34 | .TP 35 | .B ip maddress add - add a multicast address 36 | .TP 37 | .B ip maddress delete - delete a multicast address 38 | .sp 39 | These commands attach/detach a static link-layer multicast address 40 | to listen on the interface. 41 | Note that it is impossible to join protocol multicast groups 42 | statically. This command only manages link-layer addresses. 43 | 44 | .RS 45 | .TP 46 | .BI address " LLADDRESS " (default) 47 | the link-layer multicast address. 48 | 49 | .TP 50 | .BI dev " NAME" 51 | the device to join/leave this multicast address. 52 | .RE 53 | 54 | .SH SEE ALSO 55 | .br 56 | .BR ip (8) 57 | 58 | .SH AUTHOR 59 | Original Manpage by Michail Litvak <mci@owl.openwall.com> 60 | -------------------------------------------------------------------------------- /iproute2-3.19.0/man/man8/ip-monitor.8: -------------------------------------------------------------------------------- 1 | .TH IP\-MONITOR 8 "13 Dec 2012" "iproute2" "Linux" 2 | .SH "NAME" 3 | ip-monitor, rtmon \- state monitoring 4 | .SH "SYNOPSIS" 5 | .sp 6 | .ad l 7 | .in +8 8 | .ti -8 9 | .BR "ip " " [ " 10 | .IR ip-OPTIONS " ]" 11 | .BR "monitor" " [ " all " |" 12 | .IR OBJECT-LIST " ] [" 13 | .BI file " FILENAME " 14 | ] [ 15 | .BI dev " DEVICE " 16 | ] 17 | .sp 18 | 19 | .SH OPTIONS 20 | 21 | .TP 22 | .BR "\-t" , " \-timestamp" 23 | Prints timestamp before the event message on the separated line in format: 24 | Timestamp: <Day> <Month> <DD> <hh:mm:ss> <YYYY> <usecs> usec 25 | <EVENT> 26 | 27 | .TP 28 | .BR "\-ts" , " \-tshort" 29 | Prints short timestamp before the event message on the same line in format: 30 | [<YYYY>-<MM>-<DD>T<hh:mm:ss>.<ms>] <EVENT> 31 | 32 | .SH DESCRIPTION 33 | The 34 | .B ip 35 | utility can monitor the state of devices, addresses 36 | and routes continuously. This option has a slightly different format. 37 | Namely, the 38 | .B monitor 39 | command is the first in the command line and then the object list follows: 40 | 41 | .BR "ip monitor" " [ " all " |" 42 | .IR OBJECT-LIST " ] [" 43 | .BI file " FILENAME " 44 | ] [ 45 | .BI dev " DEVICE " 46 | ] 47 | 48 | .I OBJECT-LIST 49 | is the list of object types that we want to monitor. 50 | It may contain 51 | .BR link ", " address ", " route ", " mroute ", " prefix ", " 52 | .BR neigh " and " netconf "." 53 | If no 54 | .B file 55 | argument is given, 56 | .B ip 57 | opens RTNETLINK, listens on it and dumps state changes in the format 58 | described in previous sections. 59 | 60 | .P 61 | If the 62 | .BI file 63 | option is given, the program does not listen on RTNETLINK, 64 | but opens the given file, and dumps its contents. The file 65 | should contain RTNETLINK messages saved in binary format. 66 | Such a file can be generated with the 67 | .B rtmon 68 | utility. This utility has a command line syntax similar to 69 | .BR "ip monitor" . 70 | Ideally, 71 | .B rtmon 72 | should be started before the first network configuration command 73 | is issued. F.e. if you insert: 74 | .sp 75 | .in +8 76 | rtmon file /var/log/rtmon.log 77 | .in -8 78 | .sp 79 | in a startup script, you will be able to view the full history 80 | later. 81 | 82 | .P 83 | Nevertheless, it is possible to start 84 | .B rtmon 85 | at any time. 86 | It prepends the history with the state snapshot dumped at the moment 87 | of starting. 88 | 89 | .P 90 | If the 91 | .BI dev 92 | option is given, the program prints only events related to this device. 93 | 94 | .SH SEE ALSO 95 | .br 96 | .BR ip (8) 97 | 98 | .SH AUTHOR 99 | Original Manpage by Michail Litvak <mci@owl.openwall.com> 100 | -------------------------------------------------------------------------------- /iproute2-3.19.0/man/man8/ip-mroute.8: -------------------------------------------------------------------------------- 1 | .TH IP\-MROUTE 8 "13 Dec 2012" "iproute2" "Linux" 2 | .SH "NAME" 3 | ip-mroute \- multicast routing cache management 4 | .SH "SYNOPSIS" 5 | .sp 6 | .ad l 7 | .in +8 8 | .ti -8 9 | .BR "ip " " [ ip-OPTIONS ] " "mroute show" " [ [ " 10 | .BR " to " " ] " 11 | .IR PREFIX " ] [ " 12 | .B from 13 | .IR PREFIX " ] [ " 14 | .B iif 15 | .IR DEVICE " ] [ " 16 | .B table 17 | .IR TABLE_ID " ] " 18 | 19 | .SH DESCRIPTION 20 | .B mroute 21 | objects are multicast routing cache entries created by a user-level 22 | mrouting daemon (f.e. 23 | .B pimd 24 | or 25 | .B mrouted 26 | ). 27 | 28 | Due to the limitations of the current interface to the multicast routing 29 | engine, it is impossible to change 30 | .B mroute 31 | objects administratively, so we can only display them. This limitation 32 | will be removed in the future. 33 | 34 | .SS ip mroute show - list mroute cache entries 35 | 36 | .TP 37 | .BI to " PREFIX " (default) 38 | the prefix selecting the destination multicast addresses to list. 39 | 40 | .TP 41 | .BI iif " NAME" 42 | the interface on which multicast packets are received. 43 | 44 | .TP 45 | .BI from " PREFIX" 46 | the prefix selecting the IP source addresses of the multicast route. 47 | 48 | .TP 49 | .BI table " TABLE_ID" 50 | the table id selecting the multicast table. It can be 51 | .BR local ", " main ", " default ", " all " or a number." 52 | 53 | .SH SEE ALSO 54 | .br 55 | .BR ip (8) 56 | 57 | .SH AUTHOR 58 | Original Manpage by Michail Litvak <mci@owl.openwall.com> 59 | -------------------------------------------------------------------------------- /iproute2-3.19.0/man/man8/ip-netconf.8: -------------------------------------------------------------------------------- 1 | .TH IP\-NETCONF 8 "13 Dec 2012" "iproute2" "Linux" 2 | .SH "NAME" 3 | ip-netconf \- network configuration monitoring 4 | .SH "SYNOPSIS" 5 | .sp 6 | .ad l 7 | .in +8 8 | .ti -8 9 | .BR "ip " " [ ip-OPTIONS ] " "netconf show" " [ " 10 | .B dev 11 | .IR NAME " ]" 12 | 13 | .SH DESCRIPTION 14 | The 15 | .B ip netconf 16 | utility can monitor IPv4 and IPv6 parameters (see 17 | .BR "/proc/sys/net/ipv[4|6]/conf/[all|DEV]/" ")" 18 | like forwarding, rp_filter 19 | or mc_forwarding status. 20 | 21 | If no interface is specified, the entry 22 | .B all 23 | is displayed. 24 | 25 | .SS ip netconf show - display network parameters 26 | 27 | .TP 28 | .BI dev " NAME" 29 | the name of the device to display network parameters for. 30 | 31 | .SH SEE ALSO 32 | .br 33 | .BR ip (8) 34 | 35 | .SH AUTHOR 36 | Original Manpage by Nicolas Dichtel <nicolas.dichtel@6wind.com> 37 | -------------------------------------------------------------------------------- /iproute2-3.19.0/man/man8/ip-ntable.8: -------------------------------------------------------------------------------- 1 | .TH IP\-NTABLE 8 "20 Dec 2011" "iproute2" "Linux" 2 | .SH "NAME" 3 | ip-ntable - neighbour table configuration 4 | .SH "SYNOPSIS" 5 | .sp 6 | .ad l 7 | .in +8 8 | .ti -8 9 | .B ip 10 | .RI "[ " OPTIONS " ]" 11 | .B address 12 | .RI " { " COMMAND " | " 13 | .BR help " }" 14 | .sp 15 | 16 | .ti -8 17 | .BR "ip ntable change name" 18 | .IR NAME " [ " 19 | .B dev 20 | .IR DEV " ] " PARMS 21 | 22 | .ti -8 23 | .IR PARMS " := { " 24 | .B thresh1 25 | .IR VAL " | " 26 | .B thresh2 27 | .IR VAL " | " 28 | .B thresh3 29 | .IR VAL " | " 30 | .B gc_int 31 | .IR MSEC " | " 32 | .B base_reachable 33 | .IR MSEC " | " 34 | .B retrans 35 | .IR MSEC " | " "gc_stale MSEC " " | " 36 | .B delay_probe 37 | .IR MSEC " | " "queue LEN " " | " 38 | .B app_probs 39 | .IR VAL " | " 40 | .B ucast_probes 41 | .IR VAL " | " "mcast_probes VAL " " | " 42 | .B anycast_delay 43 | .IR MSEC " | " 44 | .B proxy_delay 45 | .IR MSEC " | " "proxy_queue LEN " " | " 46 | .B locktime 47 | .IR MSEC " }" 48 | 49 | .ti -8 50 | .BR "ip ntable show" " [ " 51 | .B dev 52 | .IR DEV " ] [ " 53 | .B name 54 | .IR NAME " ]" 55 | 56 | .SH DESCRIPTION 57 | .I ip ntable 58 | controls the parameters for the neighbour tables. 59 | 60 | .SS ip ntable show - list the ip neighbour tables 61 | 62 | This commands displays neighbour table parameters and statistics. 63 | 64 | .TP 65 | .BI dev " DEV" 66 | only list the table attached to this device. 67 | 68 | .TP 69 | .BI name " NAME" 70 | only lists the table with the given name. 71 | 72 | .SS ip ntable change - modify table parameter 73 | 74 | This command allows modifying table parameters such as timers and queue lengths. 75 | .TP 76 | .BI name " NAME" 77 | the name of the table to modify. 78 | 79 | .TP 80 | .BI dev " DEV" 81 | the name of the device to modify the table values. 82 | 83 | .SH EXAMPLES 84 | .PP 85 | ip ntable show dev eth0 86 | .RS 4 87 | Shows the neighbour table (IPv4 ARP and IPv6 ndisc) parameters on device eth0. 88 | .RE 89 | .PP 90 | ip ntable change name arp_cache queue 8 dev eth0 91 | .RS 4 92 | Changes the number of packets queued while address is being resolved from the 93 | default value (3) to 8 packets. 94 | .RE 95 | 96 | .SH SEE ALSO 97 | .br 98 | .BR ip (8) 99 | 100 | .SH AUTHOR 101 | Manpage by Stephen Hemminger 102 | -------------------------------------------------------------------------------- /iproute2-3.19.0/man/man8/ip-token.8: -------------------------------------------------------------------------------- 1 | .TH IP\-TOKEN 8 "28 Mar 2013" "iproute2" "Linux" 2 | .SH "NAME" 3 | ip-token \- tokenized interface identifier support 4 | .SH "SYNOPSIS" 5 | .sp 6 | .ad l 7 | .in +8 8 | .ti -8 9 | .B ip token 10 | .RI " { " COMMAND " | " 11 | .BR help " }" 12 | .sp 13 | 14 | .ti -8 15 | .BR "ip token" " { " set " } " 16 | .IR TOKEN 17 | .B dev 18 | .IR DEV 19 | 20 | .ti -8 21 | .BR "ip token" " { " get " } " 22 | .B dev 23 | .IR DEV 24 | 25 | .ti -8 26 | .BR "ip token" " { " list " }" 27 | 28 | .SH "DESCRIPTION" 29 | IPv6 tokenized interface identifier support is used for assigning well-known 30 | host-part addresses to nodes whilst still obtaining a global network prefix 31 | from Router advertisements. The primary target for tokenized identifiers are 32 | server platforms where addresses are usually manually configured, rather than 33 | using DHCPv6 or SLAAC. By using tokenized identifiers, hosts can still 34 | determine their network prefix by use of SLAAC, but more readily be 35 | automatically renumbered should their network prefix change [1]. Tokenized 36 | IPv6 Identifiers are described in the draft 37 | [1]: <draft-chown-6man-tokenised-ipv6-identifiers-02>. 38 | 39 | .SS ip token set - set an interface token 40 | set the interface token to the kernel. Once a token is set, it cannot be 41 | removed from the interface, only overwritten. 42 | .TP 43 | .I TOKEN 44 | the interface identifier token address. 45 | .TP 46 | .BI dev " DEV" 47 | the networking interface. 48 | 49 | .SS ip token get - get the interface token from the kernel 50 | show a tokenized interface identifier of a particular networking device. 51 | .B Arguments: 52 | coincide with the arguments of 53 | .B ip token set 54 | but the 55 | .I TOKEN 56 | must be left out. 57 | .SS ip token list - list all interface tokens 58 | list all tokenized interface identifiers for the networking interfaces from 59 | the kernel. 60 | 61 | .SH SEE ALSO 62 | .br 63 | .BR ip (8) 64 | 65 | .SH AUTHOR 66 | Manpage by Daniel Borkmann 67 | -------------------------------------------------------------------------------- /iproute2-3.19.0/man/man8/lnstat.8: -------------------------------------------------------------------------------- 1 | .TH LNSTAT 8 2 | .SH NAME 3 | lnstat \- unified linux network statistics 4 | .SH SYNOPSIS 5 | .B lnstat 6 | .RI [ options ] 7 | .SH DESCRIPTION 8 | This manual page documents briefly the 9 | .B lnstat 10 | command. 11 | .PP 12 | \fBlnstat\fP is a generalized and more feature-complete replacement for the old rtstat program. 13 | In addition to routing cache statistics, it supports any kind of statistics the linux kernel 14 | exports via a file in /proc/net/stat/. 15 | .SH OPTIONS 16 | lnstat supports the following options. 17 | .TP 18 | .B \-h, \-\-help 19 | Show summary of options. 20 | .TP 21 | .B \-V, \-\-version 22 | Show version of program. 23 | .TP 24 | .B \-c, \-\-count <count> 25 | Print <count> number of intervals. 26 | .TP 27 | .B \-d, \-\-dump 28 | Dump list of available files/keys. 29 | .TP 30 | .B \-f, \-\-file <file> 31 | Statistics file to use. 32 | .TP 33 | .B \-i, \-\-interval <intv> 34 | Set interval to 'intv' seconds. 35 | .TP 36 | .B \-j, \-\-json 37 | Display results in JSON format 38 | .TP 39 | .B \-k, \-\-keys k,k,k,... 40 | Display only keys specified. 41 | .TP 42 | .B \-s, \-\-subject [0-2] 43 | Specify display of subject/header. '0' means no header at all, '1' prints a header only at start of the program and '2' prints a header every 20 lines. 44 | .TP 45 | .B \-w, \-\-width n,n,n,... 46 | Width for each field. 47 | .SH USAGE EXAMPLES 48 | .TP 49 | .B # lnstat -d 50 | Get a list of supported statistics files. 51 | .TP 52 | .B # lnstat -k arp_cache:entries,rt_cache:in_hit,arp_cache:destroys 53 | Select the specified files and keys. 54 | .TP 55 | .B # lnstat -i 10 56 | Use an interval of 10 seconds. 57 | .TP 58 | .B # lnstat -f ip_conntrack 59 | Use only the specified file for statistics. 60 | .TP 61 | .B # lnstat -s 0 62 | Do not print a header at all. 63 | .TP 64 | .B # lnstat -s 20 65 | Print a header at start and every 20 lines. 66 | .TP 67 | .B # lnstat -c -1 -i 1 -f rt_cache -k entries,in_hit,in_slow_tot 68 | Display statistics for keys entries, in_hit and in_slow_tot of field rt_cache every second. 69 | .SH SEE ALSO 70 | .BR ip (8), 71 | and /usr/share/doc/iproute-doc/README.lnstat (package iproute-doc on Debian) 72 | .br 73 | .SH AUTHOR 74 | lnstat was written by Harald Welte <laforge@gnumonks.org>. 75 | .PP 76 | This manual page was written by Michael Prokop <mika@grml.org> for the Debian project (but may be used by others). 77 | -------------------------------------------------------------------------------- /iproute2-3.19.0/man/man8/nstat.8: -------------------------------------------------------------------------------- 1 | .so man8/rtacct.8 2 | -------------------------------------------------------------------------------- /iproute2-3.19.0/man/man8/routef.8: -------------------------------------------------------------------------------- 1 | .so man8/routel.8 2 | -------------------------------------------------------------------------------- /iproute2-3.19.0/man/man8/routel.8: -------------------------------------------------------------------------------- 1 | .TH "ROUTEL" "8" "3 Jan, 2008" "iproute2" "Linux" 2 | .SH "NAME" 3 | .LP 4 | routel \- list routes with pretty output format 5 | .br 6 | routef \- flush routes 7 | .SH "SYNTAX" 8 | .LP 9 | routel [\fItablenr\fP [\fIraw ip args...\fP]] 10 | .br 11 | routef 12 | .SH "DESCRIPTION" 13 | .LP 14 | These programs are a set of helper scripts you can use instead of raw iproute2 commands. 15 | .br 16 | The routel script will list routes in a format that some might consider easier to interpret then the ip route list equivalent. 17 | .br 18 | The routef script does not take any arguments and will simply flush the routing table down the drain. Beware! This means deleting all routes which will make your network unusable! 19 | 20 | .SH "FILES" 21 | .LP 22 | \fI/usr/bin/routef\fP 23 | .br 24 | \fI/usr/bin/routel\fP 25 | .SH "AUTHORS" 26 | .LP 27 | The routel script was written by Stephen R. van den Berg <srb@cuci.nl>, 1999/04/18 and donated to the public domain. 28 | .br 29 | This manual page was written by Andreas Henriksson <andreas@fatal.se>, for the Debian GNU/Linux system. 30 | .SH "SEE ALSO" 31 | .LP 32 | ip(8) 33 | -------------------------------------------------------------------------------- /iproute2-3.19.0/man/man8/rtacct.8: -------------------------------------------------------------------------------- 1 | .TH RTACCT 8 "27 June, 2007" 2 | 3 | .SH NAME 4 | nstat, rtacct - network statistics tools. 5 | 6 | .SH SYNOPSIS 7 | Usage: nstat [ -h?vVzrnasd:t: ] [ PATTERN [ PATTERN ] ] 8 | .br 9 | Usage: rtacct [ -h?vVzrnasd:t: ] [ ListOfRealms ] 10 | 11 | .SH DESCRIPTION 12 | .B nstat 13 | and 14 | .B rtacct 15 | are simple tools to monitor kernel snmp counters and network interface statistics. 16 | 17 | .SH OPTIONS 18 | .B \-h, \-\-help 19 | Print help 20 | .TP 21 | .B \-V, \-\-version 22 | Print version 23 | .TP 24 | .B \-z, \-\-zero 25 | Dump zero counters too. By default they are not shown. 26 | .TP 27 | .B \-r, \-\-reset 28 | Reset history. 29 | .TP 30 | .B \-n, \-\-nooutput 31 | Do not display anything, only update history. 32 | .TP 33 | .B \-a, \-\-ignore 34 | Dump absolute values of counters. The default is to calculate increments since the previous use. 35 | .TP 36 | .B \-s, \-\-noupdate 37 | Do not update history, so that the next time you will see counters including values accumulated to the moment of this measurement too. 38 | .B \-j, \-\-json 39 | Display results in JSON format. 40 | .TP 41 | .B \-d, \-\-interval <INTERVAL> 42 | Run in daemon mode collecting statistics. <INTERVAL> is interval between measurements in seconds. 43 | .TP 44 | 45 | Time interval to average rates. Default value is 60 seconds. 46 | .TP 47 | 48 | .SH SEE ALSO 49 | lnstat(8) 50 | 51 | -------------------------------------------------------------------------------- /iproute2-3.19.0/man/man8/rtmon.8: -------------------------------------------------------------------------------- 1 | .TH RTMON 8 2 | .SH NAME 3 | rtmon \- listens to and monitors RTnetlink 4 | .SH SYNOPSIS 5 | .B rtmon 6 | .RI "[ options ] file FILE [ all | LISTofOBJECTS ]" 7 | .SH DESCRIPTION 8 | This manual page documents briefly the 9 | .B rtmon 10 | command. 11 | .PP 12 | .B rtmon 13 | listens on 14 | .I netlink 15 | socket and monitors routing table changes. 16 | 17 | .I rtmon 18 | can be started before the first network configuration command is issued. 19 | For example if you insert: 20 | 21 | .B rtmon file /var/log/rtmon.log 22 | 23 | in a startup script, you will be able to view the full history later. 24 | Certainly, it is possible to start rtmon at any time. It prepends the history with the state snapshot dumped at the moment of starting. 25 | 26 | .SH OPTIONS 27 | .I rtmon supports the following options: 28 | .TP 29 | .B \-Version 30 | Print version and exit. 31 | .TP 32 | .B help 33 | Show summary of options. 34 | .TP 35 | .B file FILE [ all | LISTofOBJECTS ] 36 | Log output to FILE. LISTofOBJECTS is the list of object types that we 37 | want to monitor. It may contain 'link', 'address', 'route' 38 | and 'all'. 'link' specifies the network device, 'address' the protocol 39 | (IP or IPv6) address on a device, 'route' the routing table entry 40 | and 'all' does what the name says. 41 | .TP 42 | .B \-family [ inet | inet6 | link | help ] 43 | Specify protocol family. 'inet' is IPv4, 'inet6' is IPv6, 'link' 44 | means that no networking protocol is involved and 'help' prints usage information. 45 | .TP 46 | .B \-4 47 | Use IPv4. Shortcut for -family inet. 48 | .TP 49 | .B \-6 50 | Use IPv6. Shortcut for -family inet6. 51 | .TP 52 | .B \-0 53 | Use a special family identifier meaning that no networking protocol is involved. Shortcut for -family link. 54 | .SH USAGE EXAMPLES 55 | .TP 56 | .B # rtmon file /var/log/rtmon.log 57 | Log to file /var/log/rtmon.log, then run: 58 | .TP 59 | .B # ip monitor file /var/log/rtmon.log 60 | to display logged output from file. 61 | .SH SEE ALSO 62 | .BR ip (8) 63 | .SH AUTHOR 64 | .B rtmon 65 | was written by Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>. 66 | .PP 67 | This manual page was written by Michael Prokop <mika@grml.org>, 68 | for the Debian project (but may be used by others). 69 | -------------------------------------------------------------------------------- /iproute2-3.19.0/man/man8/rtstat.8: -------------------------------------------------------------------------------- 1 | .so man8/lnstat.8 2 | -------------------------------------------------------------------------------- /iproute2-3.19.0/man/man8/ss.8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upa/nshkmod/d336f2c749919199af0ea78d82b746fc5b183322/iproute2-3.19.0/man/man8/ss.8 -------------------------------------------------------------------------------- /iproute2-3.19.0/man/man8/tc-bfifo.8: -------------------------------------------------------------------------------- 1 | .TH PBFIFO 8 "10 January 2002" "iproute2" "Linux" 2 | .SH NAME 3 | pfifo \- Packet limited First In, First Out queue 4 | .P 5 | bfifo \- Byte limited First In, First Out queue 6 | 7 | .SH SYNOPSIS 8 | .B tc qdisc ... add pfifo 9 | .B [ limit 10 | packets 11 | .B ] 12 | .P 13 | .B tc qdisc ... add bfifo 14 | .B [ limit 15 | bytes 16 | .B ] 17 | 18 | .SH DESCRIPTION 19 | The pfifo and bfifo qdiscs are unadorned First In, First Out queues. They are the 20 | simplest queues possible and therefore have no overhead. 21 | .B pfifo 22 | constrains the queue size as measured in packets. 23 | .B bfifo 24 | does so as measured in bytes. 25 | 26 | Like all non-default qdiscs, they maintain statistics. This might be a reason to prefer 27 | pfifo or bfifo over the default. 28 | 29 | .SH ALGORITHM 30 | A list of packets is maintained, when a packet is enqueued it gets inserted at the tail of 31 | a list. When a packet needs to be sent out to the network, it is taken from the head of the list. 32 | 33 | If the list is too long, no further packets are allowed on. This is called 'tail drop'. 34 | 35 | .SH PARAMETERS 36 | .TP 37 | limit 38 | Maximum queue size. Specified in bytes for bfifo, in packets for pfifo. For pfifo, defaults 39 | to the interface txqueuelen, as specified with 40 | .BR ifconfig (8) 41 | or 42 | .BR ip (8). 43 | The range for this parameter is [0, UINT32_MAX]. 44 | 45 | For bfifo, it defaults to the txqueuelen multiplied by the interface MTU. 46 | The range for this parameter is [0, UINT32_MAX] bytes. 47 | 48 | Note: The link layer header was considered when counting packets length. 49 | 50 | .SH OUTPUT 51 | The output of 52 | .B tc -s qdisc ls 53 | contains the limit, either in packets or in bytes, and the number of bytes 54 | and packets actually sent. An unsent and dropped packet only appears between braces 55 | and is not counted as 'Sent'. 56 | 57 | In this example, the queue length is 100 packets, 45894 bytes were sent over 681 packets. 58 | No packets were dropped, and as the pfifo queue does not slow down packets, there were also no 59 | overlimits: 60 | .P 61 | .nf 62 | # tc -s qdisc ls dev eth0 63 | qdisc pfifo 8001: dev eth0 limit 100p 64 | Sent 45894 bytes 681 pkts (dropped 0, overlimits 0) 65 | .fi 66 | 67 | If a backlog occurs, this is displayed as well. 68 | .SH SEE ALSO 69 | .BR tc (8) 70 | 71 | .SH AUTHORS 72 | Alexey N. Kuznetsov, <kuznet@ms2.inr.ac.ru> 73 | 74 | This manpage maintained by bert hubert <ahu@ds9a.nl> 75 | 76 | 77 | -------------------------------------------------------------------------------- /iproute2-3.19.0/man/man8/tc-choke.8: -------------------------------------------------------------------------------- 1 | .TH TC 8 "August 2011" "iproute2" "Linux" 2 | .SH NAME 3 | choke \- choose and keep scheduler 4 | .SH SYNOPSIS 5 | .B tc qdisc ... choke 6 | .B limit 7 | packets 8 | .B min 9 | packets 10 | .B max 11 | packets 12 | .B avpkt 13 | bytes 14 | .B burst 15 | packets 16 | .B [ ecn ] [ bandwidth 17 | rate 18 | .B ] probability 19 | chance 20 | 21 | .SH DESCRIPTION 22 | 23 | CHOKe (CHOose and Keep for responsive flows, CHOose and Kill for unresponsive flows) 24 | is a classless qdisc designed to both identify and penalize flows that monopolize the 25 | queue. CHOKe is a variation of RED, and the configuration is similar to RED. 26 | 27 | .SH ALGORITHM 28 | Once the queue hits a certain average length, a random packet is drawn from the 29 | queue. If both the to-be-queued and the drawn packet belong to the same flow, 30 | both packets are dropped. Otherwise, if the queue length is still below the maximum length, 31 | the new packet has a configurable chance of being marked (which may mean dropped). 32 | If the queue length exceeds 33 | .BR max , 34 | the new packet will always be marked (or dropped). 35 | If the queue length exceeds 36 | .BR limit , 37 | the new packet is always dropped. 38 | 39 | The marking probability computation is the same as used by the RED qdisc. 40 | 41 | .SH PARAMETERS 42 | The parameters are the same as for RED, except that RED uses bytes whereas choke 43 | counts packets. See 44 | .BR tc-red (8) 45 | for a description. 46 | 47 | .SH SOURCE 48 | .TP 49 | o 50 | R. Pan, B. Prabhakar, and K. Psounis, "CHOKe, A Stateless 51 | Active Queue Management Scheme for Approximating Fair Bandwidth Allocation", 52 | IEEE INFOCOM, 2000. 53 | .TP 54 | o 55 | A. Tang, J. Wang, S. Low, "Understanding CHOKe: Throughput and Spatial 56 | Characteristics", IEEE/ACM Transactions on Networking, 2004 57 | 58 | .SH SEE ALSO 59 | .BR tc (8), 60 | .BR tc-red (8) 61 | 62 | .SH AUTHOR 63 | sched_choke was contributed by Stephen Hemminger. 64 | -------------------------------------------------------------------------------- /iproute2-3.19.0/man/man8/tc-hfsc.8: -------------------------------------------------------------------------------- 1 | .TH HFSC 8 "31 October 2011" iproute2 Linux 2 | . 3 | .SH NAME 4 | HFSC \- Hierarchical Fair Service Curve's control under linux 5 | . 6 | .SH SYNOPSIS 7 | .nf 8 | tc qdisc add ... hfsc [ \fBdefault\fR CLASSID ] 9 | 10 | tc class add ... hfsc [ [ \fBrt\fR SC ] [ \fBls\fR SC ] | [ \fBsc\fR SC ] ] [ \fBul\fR SC ] 11 | 12 | \fBrt\fR : realtime service curve 13 | \fBls\fR : linkshare service curve 14 | \fBsc\fR : rt+ls service curve 15 | \fBul\fR : upperlimit service curve 16 | 17 | \(bu at least one of \fBrt\fR, \fBls\fR or \fBsc\fR must be specified 18 | \(bu \fBul\fR can only be specified with \fBls\fR or \fBsc\fR 19 | . 20 | .IP "SC := [ [ \fBm1\fR BPS ] \fBd\fR SEC ] \fBm2\fR BPS" 21 | \fBm1\fR : slope of the first segment 22 | \fBd\fR : x\-coordinate of intersection 23 | \fBm2\fR : slope of the second segment 24 | .PP 25 | .IP "SC := [ [ \fBumax\fR BYTE ] \fBdmax\fR SEC ] \fBrate\fR BPS" 26 | \fBumax\fR : maximum unit of work 27 | \fBdmax\fR : maximum delay 28 | \fBrate\fR : rate 29 | .PP 30 | .fi 31 | For description of BYTE, BPS and SEC \- please see \fBUNITS\fR 32 | section of \fBtc\fR(8). 33 | . 34 | .SH DESCRIPTION (qdisc) 35 | HFSC qdisc has only one optional parameter \- \fBdefault\fR. CLASSID specifies 36 | the minor part of the default classid, where packets not classified by other 37 | means (e.g. u32 filter, CLASSIFY target of iptables) will be enqueued. If 38 | \fBdefault\fR is not specified, unclassified packets will be dropped. 39 | . 40 | .SH DESCRIPTION (class) 41 | HFSC class is used to create a class hierarchy for HFSC scheduler. For 42 | explanation of the algorithm, and the meaning behind \fBrt\fR, \fBls\fR, 43 | \fBsc\fR and \fBul\fR service curves \- please refer to \fBtc\-hfsc\fR(7). 44 | 45 | As you can see in \fBSYNOPSIS\fR, service curve (SC) can be specified in two 46 | ways. Either as maximum delay for certain amount of work, or as a bandwidth 47 | assigned for certain amount of time. Obviously, \fBm1\fR is simply 48 | \fBumax\fR/\fBdmax\fR. 49 | 50 | Both \fBm2\fR and \fBrate\fR are mandatory. If you omit other 51 | parameters, you will specify linear service curve. 52 | . 53 | .SH "SEE ALSO" 54 | . 55 | \fBtc\fR(8), \fBtc\-hfsc\fR(7), \fBtc\-stab\fR(8) 56 | 57 | Please direct bugreports and patches to: <net...@vger.kernel.org> 58 | . 59 | .SH "AUTHOR" 60 | . 61 | Manpage created by Michal Soltys (sol...@ziu.info) 62 | -------------------------------------------------------------------------------- /iproute2-3.19.0/man/man8/tc-pfifo.8: -------------------------------------------------------------------------------- 1 | .so man8/tc-bfifo.8 2 | -------------------------------------------------------------------------------- /iproute2-3.19.0/man/man8/tc-pfifo_fast.8: -------------------------------------------------------------------------------- 1 | .TH PFIFO_FAST 8 "10 January 2002" "iproute2" "Linux" 2 | .SH NAME 3 | pfifo_fast \- three-band first in, first out queue 4 | 5 | .SH DESCRIPTION 6 | pfifo_fast is the default qdisc of each interface. 7 | 8 | Whenever an interface is created, the pfifo_fast qdisc is automatically used 9 | as a queue. If another qdisc is attached, it preempts the default 10 | pfifo_fast, which automatically returns to function when an existing qdisc 11 | is detached. 12 | 13 | In this sense this qdisc is magic, and unlike other qdiscs. 14 | 15 | .SH ALGORITHM 16 | The algorithm is very similar to that of the classful 17 | .BR tc-prio (8) 18 | qdisc. 19 | .B pfifo_fast 20 | is like three 21 | .BR tc-pfifo (8) 22 | queues side by side, where packets can be enqueued in any of the three bands 23 | based on their Type of Service bits or assigned priority. 24 | 25 | Not all three bands are dequeued simultaneously - as long as lower bands 26 | have traffic, higher bands are never dequeued. This can be used to 27 | prioritize interactive traffic or penalize 'lowest cost' traffic. 28 | 29 | Each band can be txqueuelen packets long, as configured with 30 | .BR ifconfig (8) 31 | or 32 | .BR ip (8). 33 | Additional packets coming in are not enqueued but are instead dropped. 34 | 35 | See 36 | .BR tc-prio (8) 37 | for complete details on how TOS bits are translated into bands. 38 | .SH PARAMETERS 39 | .TP 40 | txqueuelen 41 | The length of the three bands depends on the interface txqueuelen, as 42 | specified with 43 | .BR ifconfig (8) 44 | or 45 | .BR ip (8). 46 | 47 | .SH BUGS 48 | Does not maintain statistics and does not show up in tc qdisc ls. This is because 49 | it is the automatic default in the absence of a configured qdisc. 50 | 51 | .SH SEE ALSO 52 | .BR tc (8) 53 | 54 | .SH AUTHORS 55 | Alexey N. Kuznetsov, <kuznet@ms2.inr.ac.ru> 56 | 57 | This manpage maintained by bert hubert <ahu@ds9a.nl> 58 | 59 | 60 | -------------------------------------------------------------------------------- /iproute2-3.19.0/misc/.gitignore: -------------------------------------------------------------------------------- 1 | arpd 2 | ifstat 3 | ss 4 | ssfilter.c 5 | nstat 6 | lnstat 7 | rtacct 8 | -------------------------------------------------------------------------------- /iproute2-3.19.0/misc/Makefile: -------------------------------------------------------------------------------- 1 | SSOBJ=ss.o ssfilter.o 2 | LNSTATOBJ=lnstat.o lnstat_util.o 3 | 4 | TARGETS=ss nstat ifstat rtacct arpd lnstat 5 | 6 | include ../Config 7 | 8 | ifeq ($(HAVE_SELINUX),y) 9 | LDLIBS += $(shell pkg-config --libs libselinux) 10 | CFLAGS += $(shell pkg-config --cflags libselinux) -DHAVE_SELINUX 11 | endif 12 | 13 | all: $(TARGETS) 14 | 15 | ss: $(SSOBJ) 16 | 17 | nstat: nstat.c 18 | $(CC) $(CFLAGS) $(LDFLAGS) -o nstat nstat.c -lm 19 | 20 | ifstat: ifstat.c 21 | $(CC) $(CFLAGS) $(LDFLAGS) -o ifstat ifstat.c $(LIBNETLINK) -lm 22 | 23 | rtacct: rtacct.c 24 | $(CC) $(CFLAGS) $(LDFLAGS) -o rtacct rtacct.c $(LIBNETLINK) -lm 25 | 26 | arpd: arpd.c 27 | $(CC) $(CFLAGS) -I$(DBM_INCLUDE) $(LDFLAGS) -o arpd arpd.c $(LIBNETLINK) -ldb -lpthread 28 | 29 | ssfilter.c: ssfilter.y 30 | bison ssfilter.y -o ssfilter.c 31 | 32 | lnstat: $(LNSTATOBJ) 33 | 34 | install: all 35 | install -m 0755 $(TARGETS) $(DESTDIR)$(SBINDIR) 36 | ln -sf lnstat $(DESTDIR)$(SBINDIR)/rtstat 37 | ln -sf lnstat $(DESTDIR)$(SBINDIR)/ctstat 38 | 39 | clean: 40 | rm -f *.o $(TARGETS) ssfilter.c 41 | -------------------------------------------------------------------------------- /iproute2-3.19.0/misc/lnstat.h: -------------------------------------------------------------------------------- 1 | #ifndef _LNSTAT_H 2 | #define _LNSTAT_H 3 | 4 | #include <limits.h> 5 | #include <sys/select.h> 6 | 7 | #define LNSTAT_VERSION "0.02 041002" 8 | 9 | #define PROC_NET_STAT "/proc/net/stat" 10 | 11 | #define LNSTAT_MAX_FILES 32 12 | #define LNSTAT_MAX_FIELDS_PER_LINE 32 13 | #define LNSTAT_MAX_FIELD_NAME_LEN 32 14 | 15 | struct lnstat_file; 16 | 17 | struct lnstat_field { 18 | struct lnstat_file *file; 19 | unsigned int num; /* field number in line */ 20 | char name[LNSTAT_MAX_FIELD_NAME_LEN+1]; 21 | unsigned long values[2]; /* two buffers for values */ 22 | unsigned long result; 23 | }; 24 | 25 | struct lnstat_file { 26 | struct lnstat_file *next; 27 | char path[PATH_MAX+1]; 28 | char basename[NAME_MAX+1]; 29 | struct timeval last_read; /* last time of read */ 30 | struct timeval interval; /* interval */ 31 | int compat; /* 1 == backwards compat mode */ 32 | FILE *fp; 33 | unsigned int num_fields; /* number of fields */ 34 | struct lnstat_field fields[LNSTAT_MAX_FIELDS_PER_LINE]; 35 | }; 36 | 37 | 38 | struct lnstat_file *lnstat_scan_dir(const char *path, const int num_req_files, 39 | const char **req_files); 40 | int lnstat_update(struct lnstat_file *lnstat_files); 41 | int lnstat_dump(FILE *outfd, struct lnstat_file *lnstat_files); 42 | struct lnstat_field *lnstat_find_field(struct lnstat_file *lnstat_files, 43 | const char *name); 44 | #endif /* _LNSTAT_H */ 45 | -------------------------------------------------------------------------------- /iproute2-3.19.0/misc/ssfilter.h: -------------------------------------------------------------------------------- 1 | #define SSF_DCOND 0 2 | #define SSF_SCOND 1 3 | #define SSF_OR 2 4 | #define SSF_AND 3 5 | #define SSF_NOT 4 6 | #define SSF_D_GE 5 7 | #define SSF_D_LE 6 8 | #define SSF_S_GE 7 9 | #define SSF_S_LE 8 10 | #define SSF_S_AUTO 9 11 | 12 | struct ssfilter 13 | { 14 | int type; 15 | struct ssfilter *post; 16 | struct ssfilter *pred; 17 | }; 18 | 19 | int ssfilter_parse(struct ssfilter **f, int argc, char **argv, FILE *fp); 20 | void *parse_hostcond(char*); 21 | 22 | -------------------------------------------------------------------------------- /iproute2-3.19.0/netem/.gitignore: -------------------------------------------------------------------------------- 1 | *.dist 2 | maketable 3 | normal 4 | pareto 5 | paretonormal 6 | -------------------------------------------------------------------------------- /iproute2-3.19.0/netem/Makefile: -------------------------------------------------------------------------------- 1 | DISTGEN = maketable normal pareto paretonormal 2 | DISTDATA = normal.dist pareto.dist paretonormal.dist experimental.dist 3 | 4 | HOSTCC ?= $(CC) 5 | CCOPTS = $(CBUILD_CFLAGS) 6 | LDLIBS += -lm 7 | 8 | all: $(DISTGEN) $(DISTDATA) 9 | 10 | $(DISTGEN): 11 | $(HOSTCC) $(CCOPTS) -I../include -o $@ $@.c -lm 12 | 13 | %.dist: % 14 | ./$* > $@ 15 | 16 | experimental.dist: maketable experimental.dat 17 | ./maketable experimental.dat > experimental.dist 18 | 19 | stats: stats.c 20 | $(HOSTCC) $(CCOPTS) -I../include -o $@ $@.c -lm 21 | 22 | install: all 23 | mkdir -p $(DESTDIR)$(LIBDIR)/tc 24 | for i in $(DISTDATA); \ 25 | do install -m 644 $$i $(DESTDIR)$(LIBDIR)/tc; \ 26 | done 27 | 28 | clean: 29 | rm -f $(DISTDATA) $(DISTGEN) 30 | -------------------------------------------------------------------------------- /iproute2-3.19.0/netem/normal.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Normal distribution table generator 3 | * Taken from the uncopyrighted NISTnet code. 4 | */ 5 | #include <stdio.h> 6 | #include <stdlib.h> 7 | #include <math.h> 8 | #include <string.h> 9 | #include <limits.h> 10 | 11 | #include <linux/types.h> 12 | #include <linux/pkt_sched.h> 13 | 14 | #define TABLESIZE 16384 15 | #define TABLEFACTOR NETEM_DIST_SCALE 16 | 17 | static double 18 | normal(double x, double mu, double sigma) 19 | { 20 | return .5 + .5*erf((x-mu)/(sqrt(2.0)*sigma)); 21 | } 22 | 23 | 24 | int 25 | main(int argc, char **argv) 26 | { 27 | int i, n; 28 | double x; 29 | double table[TABLESIZE+1]; 30 | 31 | for (x = -10.0; x < 10.05; x += .00005) { 32 | i = rint(TABLESIZE * normal(x, 0.0, 1.0)); 33 | table[i] = x; 34 | } 35 | 36 | 37 | printf("# This is the distribution table for the normal distribution.\n"); 38 | for (i = n = 0; i < TABLESIZE; i += 4) { 39 | int value = (int) rint(table[i]*TABLEFACTOR); 40 | if (value < SHRT_MIN) value = SHRT_MIN; 41 | if (value > SHRT_MAX) value = SHRT_MAX; 42 | 43 | printf(" %d", value); 44 | if (++n == 8) { 45 | putchar('\n'); 46 | n = 0; 47 | } 48 | } 49 | 50 | return 0; 51 | } 52 | -------------------------------------------------------------------------------- /iproute2-3.19.0/netem/pareto.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Pareto distribution table generator 3 | * Taken from the uncopyrighted NISTnet code. 4 | */ 5 | #include <stdio.h> 6 | #include <stdlib.h> 7 | #include <math.h> 8 | #include <limits.h> 9 | 10 | #include <linux/types.h> 11 | #include <linux/pkt_sched.h> 12 | 13 | static const double a=3.0; 14 | #define TABLESIZE 16384 15 | #define TABLEFACTOR NETEM_DIST_SCALE 16 | 17 | int 18 | main(int argc, char **argv) 19 | { 20 | int i, n; 21 | double dvalue; 22 | 23 | printf("# This is the distribution table for the pareto distribution.\n"); 24 | 25 | for (i = 65536, n = 0; i > 0; i -= 16) { 26 | dvalue = (double)i/(double)65536; 27 | dvalue = 1.0/pow(dvalue, 1.0/a); 28 | dvalue -= 1.5; 29 | dvalue *= (4.0/3.0)*(double)TABLEFACTOR; 30 | if (dvalue > 32767) 31 | dvalue = 32767; 32 | 33 | printf(" %d", (int)rint(dvalue)); 34 | if (++n == 8) { 35 | putchar('\n'); 36 | n = 0; 37 | } 38 | } 39 | 40 | return 0; 41 | } 42 | -------------------------------------------------------------------------------- /iproute2-3.19.0/netem/paretonormal.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Paretoormal distribution table generator 3 | * 4 | * This distribution is simply .25*normal + .75*pareto; a combination 5 | * which seems to match experimentally observed distributions reasonably 6 | * well, but is computationally easy to handle. 7 | * The entries represent a scaled inverse of the cumulative distribution 8 | * function. 9 | * 10 | * Taken from the uncopyrighted NISTnet code. 11 | */ 12 | #include <stdio.h> 13 | #include <stdlib.h> 14 | #include <stdlib.h> 15 | #include <string.h> 16 | #include <math.h> 17 | #include <limits.h> 18 | #include <malloc.h> 19 | 20 | #include <linux/types.h> 21 | #include <linux/pkt_sched.h> 22 | 23 | #define TABLESIZE 16384 24 | #define TABLEFACTOR NETEM_DIST_SCALE 25 | 26 | static double 27 | normal(double x, double mu, double sigma) 28 | { 29 | return .5 + .5*erf((x-mu)/(sqrt(2.0)*sigma)); 30 | } 31 | 32 | static const double a=3.0; 33 | 34 | static int 35 | paretovalue(int i) 36 | { 37 | double dvalue; 38 | 39 | i = 65536-4*i; 40 | dvalue = (double)i/(double)65536; 41 | dvalue = 1.0/pow(dvalue, 1.0/a); 42 | dvalue -= 1.5; 43 | dvalue *= (4.0/3.0)*(double)TABLEFACTOR; 44 | if (dvalue > 32767) 45 | dvalue = 32767; 46 | return (int)rint(dvalue); 47 | } 48 | 49 | int 50 | main(int argc, char **argv) 51 | { 52 | int i,n; 53 | double x; 54 | double table[TABLESIZE+1]; 55 | 56 | for (x = -10.0; x < 10.05; x += .00005) { 57 | i = rint(TABLESIZE*normal(x, 0.0, 1.0)); 58 | table[i] = x; 59 | } 60 | printf( 61 | "# This is the distribution table for the paretonormal distribution.\n" 62 | ); 63 | 64 | for (i = n = 0; i < TABLESIZE; i += 4) { 65 | int normvalue, parvalue, value; 66 | 67 | normvalue = (int) rint(table[i]*TABLEFACTOR); 68 | parvalue = paretovalue(i); 69 | 70 | value = (normvalue+3*parvalue)/4; 71 | if (value < SHRT_MIN) value = SHRT_MIN; 72 | if (value > SHRT_MAX) value = SHRT_MAX; 73 | 74 | printf(" %d", value); 75 | if (++n == 8) { 76 | putchar('\n'); 77 | n = 0; 78 | } 79 | } 80 | 81 | return 0; 82 | } 83 | -------------------------------------------------------------------------------- /iproute2-3.19.0/netem/stats.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Experimental data distribution table generator 3 | * Taken from the uncopyrighted NISTnet code (public domain). 4 | * 5 | * Rread in a series of "random" data values, either 6 | * experimentally or generated from some probability distribution. 7 | * From this, report statistics. 8 | */ 9 | 10 | #include <stdio.h> 11 | #include <stdlib.h> 12 | #include <math.h> 13 | #include <malloc.h> 14 | #include <sys/types.h> 15 | #include <sys/stat.h> 16 | 17 | void 18 | stats(FILE *fp) 19 | { 20 | struct stat info; 21 | double *x; 22 | int limit; 23 | int n=0, i; 24 | double mu=0.0, sigma=0.0, sumsquare=0.0, sum=0.0, top=0.0, rho=0.0; 25 | double sigma2=0.0; 26 | 27 | fstat(fileno(fp), &info); 28 | if (info.st_size > 0) { 29 | limit = 2*info.st_size/sizeof(double); /* @@ approximate */ 30 | } else { 31 | limit = 10000; 32 | } 33 | x = (double *)malloc(limit*sizeof(double)); 34 | 35 | for (i=0; i<limit; ++i){ 36 | fscanf(fp, "%lf", &x[i]); 37 | if (feof(fp)) 38 | break; 39 | sumsquare += x[i]*x[i]; 40 | sum += x[i]; 41 | ++n; 42 | } 43 | mu = sum/(double)n; 44 | sigma = sqrt((sumsquare - (double)n*mu*mu)/(double)(n-1)); 45 | 46 | for (i=1; i < n; ++i){ 47 | top += ((double)x[i]-mu)*((double)x[i-1]-mu); 48 | sigma2 += ((double)x[i-1] - mu)*((double)x[i-1] - mu); 49 | 50 | } 51 | rho = top/sigma2; 52 | 53 | printf("mu = %12.6f\n", mu); 54 | printf("sigma = %12.6f\n", sigma); 55 | printf("rho = %12.6f\n", rho); 56 | /*printf("sigma2 = %10.4f\n", sqrt(sigma2/(double)(n-1)));*/ 57 | /*printf("correlation rho = %10.6f\n", top/((double)(n-1)*sigma*sigma));*/ 58 | } 59 | 60 | 61 | int 62 | main(int argc, char **argv) 63 | { 64 | FILE *fp; 65 | 66 | if (argc > 1) { 67 | fp = fopen(argv[1], "r"); 68 | if (!fp) { 69 | perror(argv[1]); 70 | exit(1); 71 | } 72 | } else { 73 | fp = stdin; 74 | } 75 | stats(fp); 76 | return 0; 77 | } 78 | -------------------------------------------------------------------------------- /iproute2-3.19.0/tc/.gitignore: -------------------------------------------------------------------------------- 1 | *.yacc.c 2 | *.lex.c 3 | *.output 4 | *.yacc.h 5 | tc 6 | -------------------------------------------------------------------------------- /iproute2-3.19.0/tc/README.last: -------------------------------------------------------------------------------- 1 | Kernel code and interface. 2 | -------------------------- 3 | 4 | * Compile time switches 5 | 6 | There is only one, but very important, compile time switch. 7 | It is not settable by "make config", but should be selected 8 | manually and after a bit of thinking in <include/net/pkt_sched.h> 9 | 10 | PSCHED_CLOCK_SOURCE can take three values: 11 | 12 | PSCHED_GETTIMEOFDAY 13 | PSCHED_JIFFIES 14 | PSCHED_CPU 15 | 16 | 17 | PSCHED_GETTIMEOFDAY 18 | 19 | Default setting is the most conservative PSCHED_GETTIMEOFDAY. 20 | It is very slow both because of weird slowness of do_gettimeofday() 21 | and because it forces code to use unnatural "timeval" format, 22 | where microseconds and seconds fields are separate. 23 | Besides that, it will misbehave, when delays exceed 2 seconds 24 | (f.e. very slow links or classes bounded to small slice of bandwidth) 25 | To resume: as only you will get it working, select correct clock 26 | source and forget about PSCHED_GETTIMEOFDAY forever. 27 | 28 | 29 | PSCHED_JIFFIES 30 | 31 | Clock is derived from jiffies. On architectures with HZ=100 32 | granularity of this clock is not enough to make reasonable 33 | bindings to real time. However, taking into account Linux 34 | architecture problems, which force us to use artificial 35 | integrated clock in any case, this switch is not so bad 36 | for schduling even on high speed networks, though policing 37 | is not reliable. 38 | 39 | 40 | PSCHED_CPU 41 | 42 | It is available only for alpha and pentiums with correct 43 | CPU timestamp. It is the fastest way, use it when it is available, 44 | but remember: not all pentiums have this facility, and 45 | a lot of them have clock, broken by APM etc. etc. 46 | 47 | 48 | -------------------------------------------------------------------------------- /iproute2-3.19.0/tc/emp_ematch.y: -------------------------------------------------------------------------------- 1 | %{ 2 | #include <stdio.h> 3 | #include <stdlib.h> 4 | #include <malloc.h> 5 | #include <string.h> 6 | #include "m_ematch.h" 7 | %} 8 | 9 | %locations 10 | %token-table 11 | %error-verbose 12 | %name-prefix "ematch_" 13 | 14 | %union { 15 | unsigned int i; 16 | struct bstr *b; 17 | struct ematch *e; 18 | } 19 | 20 | %{ 21 | extern int ematch_lex(void); 22 | extern void yyerror(const char *s); 23 | extern struct ematch *ematch_root; 24 | extern char *ematch_err; 25 | %} 26 | 27 | %token <i> ERROR 28 | %token <b> ATTRIBUTE 29 | %token <i> AND OR NOT 30 | %type <i> invert relation 31 | %type <e> match expr 32 | %type <b> args 33 | %right AND OR 34 | %start input 35 | %% 36 | input: 37 | /* empty */ 38 | | expr 39 | { ematch_root = $1; } 40 | | expr error 41 | { 42 | ematch_root = $1; 43 | YYACCEPT; 44 | } 45 | ; 46 | 47 | expr: 48 | match 49 | { $$ = $1; } 50 | | match relation expr 51 | { 52 | $1->relation = $2; 53 | $1->next = $3; 54 | $$ = $1; 55 | } 56 | ; 57 | 58 | match: 59 | invert ATTRIBUTE '(' args ')' 60 | { 61 | $2->next = $4; 62 | $$ = new_ematch($2, $1); 63 | if ($$ == NULL) 64 | YYABORT; 65 | } 66 | | invert '(' expr ')' 67 | { 68 | $$ = new_ematch(NULL, $1); 69 | if ($$ == NULL) 70 | YYABORT; 71 | $$->child = $3; 72 | } 73 | ; 74 | 75 | args: 76 | ATTRIBUTE 77 | { $$ = $1; } 78 | | ATTRIBUTE args 79 | { $1->next = $2; } 80 | ; 81 | 82 | relation: 83 | AND 84 | { $$ = TCF_EM_REL_AND; } 85 | | OR 86 | { $$ = TCF_EM_REL_OR; } 87 | ; 88 | 89 | invert: 90 | /* empty */ 91 | { $$ = 0; } 92 | | NOT 93 | { $$ = 1; } 94 | ; 95 | %% 96 | 97 | void yyerror(const char *s) 98 | { 99 | ematch_err = strdup(s); 100 | } 101 | 102 | -------------------------------------------------------------------------------- /iproute2-3.19.0/tc/m_ematch.h: -------------------------------------------------------------------------------- 1 | #ifndef __TC_EMATCH_H_ 2 | #define __TC_EMATCH_H_ 3 | 4 | #include <ctype.h> 5 | #include <stdlib.h> 6 | #include <string.h> 7 | #include <limits.h> 8 | 9 | #include "utils.h" 10 | #include "tc_util.h" 11 | 12 | #define EMATCHKINDSIZ 16 13 | 14 | struct bstr 15 | { 16 | char *data; 17 | unsigned int len; 18 | int quoted; 19 | struct bstr *next; 20 | }; 21 | 22 | extern struct bstr * bstr_alloc(const char *text); 23 | 24 | static inline struct bstr * bstr_new(char *data, unsigned int len) 25 | { 26 | struct bstr *b = calloc(1, sizeof(*b)); 27 | 28 | if (b == NULL) 29 | return NULL; 30 | 31 | b->data = data; 32 | b->len = len; 33 | 34 | return b; 35 | } 36 | 37 | static inline int bstrcmp(struct bstr *b, const char *text) 38 | { 39 | int len = strlen(text); 40 | int d = b->len - len; 41 | 42 | if (d == 0) 43 | return strncmp(b->data, text, len); 44 | 45 | return d; 46 | } 47 | 48 | static inline struct bstr *bstr_next(struct bstr *b) 49 | { 50 | return b->next; 51 | } 52 | 53 | extern unsigned long bstrtoul(const struct bstr *b); 54 | extern void bstr_print(FILE *fd, const struct bstr *b, int ascii); 55 | 56 | 57 | struct ematch 58 | { 59 | struct bstr *args; 60 | int index; 61 | int inverted; 62 | int relation; 63 | int child_ref; 64 | struct ematch *child; 65 | struct ematch *next; 66 | }; 67 | 68 | static inline struct ematch * new_ematch(struct bstr *args, int inverted) 69 | { 70 | struct ematch *e = calloc(1, sizeof(*e)); 71 | 72 | if (e == NULL) 73 | return NULL; 74 | 75 | e->args = args; 76 | e->inverted = inverted; 77 | 78 | return e; 79 | } 80 | 81 | extern void print_ematch_tree(const struct ematch *tree); 82 | 83 | 84 | struct ematch_util 85 | { 86 | char kind[EMATCHKINDSIZ]; 87 | int kind_num; 88 | int (*parse_eopt)(struct nlmsghdr *,struct tcf_ematch_hdr *, 89 | struct bstr *); 90 | int (*print_eopt)(FILE *, struct tcf_ematch_hdr *, void *, int); 91 | void (*print_usage)(FILE *); 92 | struct ematch_util *next; 93 | }; 94 | 95 | static inline int parse_layer(struct bstr *b) 96 | { 97 | if (*((char *) b->data) == 'l') 98 | return TCF_LAYER_LINK; 99 | else if (*((char *) b->data) == 'n') 100 | return TCF_LAYER_NETWORK; 101 | else if (*((char *) b->data) == 't') 102 | return TCF_LAYER_TRANSPORT; 103 | else 104 | return INT_MAX; 105 | } 106 | 107 | extern int em_parse_error(int err, struct bstr *args, struct bstr *carg, 108 | struct ematch_util *, char *fmt, ...); 109 | extern int print_ematch(FILE *, const struct rtattr *); 110 | extern int parse_ematch(int *, char ***, int, struct nlmsghdr *); 111 | 112 | #endif 113 | -------------------------------------------------------------------------------- /iproute2-3.19.0/tc/m_estimator.c: -------------------------------------------------------------------------------- 1 | /* 2 | * m_estimator.c Parse/print estimator module options. 3 | * 4 | * This program is free software; you can u32istribute it and/or 5 | * modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 7 | * 2 of the License, or (at your option) any later version. 8 | * 9 | * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru> 10 | * 11 | */ 12 | 13 | #include <stdio.h> 14 | #include <stdlib.h> 15 | #include <unistd.h> 16 | #include <syslog.h> 17 | #include <fcntl.h> 18 | #include <sys/socket.h> 19 | #include <netinet/in.h> 20 | #include <arpa/inet.h> 21 | #include <string.h> 22 | 23 | #include "utils.h" 24 | #include "tc_util.h" 25 | #include "tc_common.h" 26 | 27 | static void est_help(void); 28 | 29 | static void est_help(void) 30 | { 31 | fprintf(stderr, "Usage: ... estimator INTERVAL TIME-CONST\n"); 32 | fprintf(stderr, " INTERVAL is interval between measurements\n"); 33 | fprintf(stderr, " TIME-CONST is averaging time constant\n"); 34 | fprintf(stderr, "Example: ... est 1sec 8sec\n"); 35 | } 36 | 37 | int parse_estimator(int *p_argc, char ***p_argv, struct tc_estimator *est) 38 | { 39 | int argc = *p_argc; 40 | char **argv = *p_argv; 41 | unsigned A, time_const; 42 | 43 | NEXT_ARG(); 44 | if (est->ewma_log) 45 | duparg("estimator", *argv); 46 | if (matches(*argv, "help") == 0) 47 | est_help(); 48 | if (get_time(&A, *argv)) 49 | invarg("estimator", "invalid estimator interval"); 50 | NEXT_ARG(); 51 | if (matches(*argv, "help") == 0) 52 | est_help(); 53 | if (get_time(&time_const, *argv)) 54 | invarg("estimator", "invalid estimator time constant"); 55 | if (tc_setup_estimator(A, time_const, est) < 0) { 56 | fprintf(stderr, "Error: estimator parameters are out of range.\n"); 57 | return -1; 58 | } 59 | if (show_raw) 60 | fprintf(stderr, "[estimator i=%u e=%u]\n", est->interval, est->ewma_log); 61 | *p_argc = argc; 62 | *p_argv = argv; 63 | return 0; 64 | } 65 | -------------------------------------------------------------------------------- /iproute2-3.19.0/tc/m_pedit.h: -------------------------------------------------------------------------------- 1 | /* 2 | * m_pedit.h generic packet editor actions module 3 | * 4 | * This program is free software; you can distribute it and/or 5 | * modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 7 | * 2 of the License, or (at your option) any later version. 8 | * 9 | * Authors: J Hadi Salim (hadi@cyberus.ca) 10 | * 11 | */ 12 | 13 | #ifndef _ACT_PEDIT_H_ 14 | #define _ACT_PEDIT_H_ 1 15 | 16 | #include <stdio.h> 17 | #include <stdlib.h> 18 | #include <unistd.h> 19 | #include <syslog.h> 20 | #include <fcntl.h> 21 | #include <sys/socket.h> 22 | #include <netinet/in.h> 23 | #include <arpa/inet.h> 24 | #include <string.h> 25 | #include "utils.h" 26 | #include "tc_util.h" 27 | #include <linux/tc_act/tc_pedit.h> 28 | 29 | #define MAX_OFFS 128 30 | 31 | #define TIPV4 1 32 | #define TIPV6 2 33 | #define TINT 3 34 | #define TU32 4 35 | 36 | #define RU32 0xFFFFFFFF 37 | #define RU16 0xFFFF 38 | #define RU8 0xFF 39 | 40 | #define PEDITKINDSIZ 16 41 | 42 | struct m_pedit_util 43 | { 44 | struct m_pedit_util *next; 45 | char id[PEDITKINDSIZ]; 46 | int (*parse_peopt)(int *argc_p, char ***argv_p,struct tc_pedit_sel *sel,struct tc_pedit_key *tkey); 47 | }; 48 | 49 | 50 | extern int parse_cmd(int *argc_p, char ***argv_p, __u32 len, int type,__u32 retain,struct tc_pedit_sel *sel,struct tc_pedit_key *tkey); 51 | extern int pack_key(struct tc_pedit_sel *sel,struct tc_pedit_key *tkey); 52 | extern int pack_key32(__u32 retain,struct tc_pedit_sel *sel,struct tc_pedit_key *tkey); 53 | extern int pack_key16(__u32 retain,struct tc_pedit_sel *sel,struct tc_pedit_key *tkey); 54 | extern int pack_key8(__u32 retain,struct tc_pedit_sel *sel,struct tc_pedit_key *tkey); 55 | extern int parse_val(int *argc_p, char ***argv_p, __u32 * val, int type); 56 | extern int parse_cmd(int *argc_p, char ***argv_p, __u32 len, int type,__u32 retain,struct tc_pedit_sel *sel,struct tc_pedit_key *tkey); 57 | extern int parse_offset(int *argc_p, char ***argv_p,struct tc_pedit_sel *sel,struct tc_pedit_key *tkey); 58 | int parse_pedit(struct action_util *a, int *argc_p, char ***argv_p, int tca_id, struct nlmsghdr *n); 59 | extern int print_pedit(struct action_util *au,FILE * f, struct rtattr *arg); 60 | extern int pedit_print_xstats(struct action_util *au, FILE *f, struct rtattr *xstats); 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /iproute2-3.19.0/tc/p_icmp.c: -------------------------------------------------------------------------------- 1 | /* 2 | * m_pedit_icmp.c packet editor: ICMP header 3 | * 4 | * This program is free software; you can distribute it and/or 5 | * modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 7 | * 2 of the License, or (at your option) any later version. 8 | * 9 | * Authors: J Hadi Salim (hadi@cyberus.ca) 10 | * 11 | */ 12 | 13 | #include <stdio.h> 14 | #include <stdlib.h> 15 | #include <unistd.h> 16 | #include <syslog.h> 17 | #include <fcntl.h> 18 | #include <sys/socket.h> 19 | #include <netinet/in.h> 20 | #include <arpa/inet.h> 21 | #include <string.h> 22 | #include "utils.h" 23 | #include "tc_util.h" 24 | #include "m_pedit.h" 25 | 26 | 27 | static int 28 | parse_icmp(int *argc_p, char ***argv_p,struct tc_pedit_sel *sel,struct tc_pedit_key *tkey) 29 | { 30 | int res = -1; 31 | #if 0 32 | int argc = *argc_p; 33 | char **argv = *argv_p; 34 | 35 | if (argc < 2) 36 | return -1; 37 | 38 | if (strcmp(*argv, "type") == 0) { 39 | NEXT_ARG(); 40 | res = parse_u8(&argc, &argv, 0); 41 | goto done; 42 | } 43 | if (strcmp(*argv, "code") == 0) { 44 | NEXT_ARG(); 45 | res = parse_u8(&argc, &argv, 1); 46 | goto done; 47 | } 48 | return -1; 49 | 50 | done: 51 | *argc_p = argc; 52 | *argv_p = argv; 53 | #endif 54 | return res; 55 | } 56 | 57 | struct m_pedit_util p_pedit_icmp = { 58 | NULL, 59 | "icmp", 60 | parse_icmp, 61 | }; 62 | -------------------------------------------------------------------------------- /iproute2-3.19.0/tc/p_tcp.c: -------------------------------------------------------------------------------- 1 | /* 2 | * m_pedit_tcp.c packet editor: TCP header 3 | * 4 | * This program is free software; you can distribute it and/or 5 | * modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 7 | * 2 of the License, or (at your option) any later version. 8 | * 9 | * Authors: J Hadi Salim (hadi@cyberus.ca) 10 | * 11 | */ 12 | 13 | #include <stdio.h> 14 | #include <stdlib.h> 15 | #include <unistd.h> 16 | #include <syslog.h> 17 | #include <fcntl.h> 18 | #include <sys/socket.h> 19 | #include <netinet/in.h> 20 | #include <arpa/inet.h> 21 | #include <string.h> 22 | #include "utils.h" 23 | #include "tc_util.h" 24 | #include "m_pedit.h" 25 | 26 | static int 27 | parse_tcp(int *argc_p, char ***argv_p,struct tc_pedit_sel *sel,struct tc_pedit_key *tkey) 28 | { 29 | int res = -1; 30 | return res; 31 | } 32 | struct m_pedit_util p_pedit_tcp = { 33 | NULL, 34 | "tcp", 35 | parse_tcp, 36 | }; 37 | 38 | 39 | -------------------------------------------------------------------------------- /iproute2-3.19.0/tc/p_udp.c: -------------------------------------------------------------------------------- 1 | /* 2 | * m_pedit_udp.c packet editor: UDP header 3 | * 4 | * This program is free software; you can distribute it and/or 5 | * modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 7 | * 2 of the License, or (at your option) any later version. 8 | * 9 | * Authors: J Hadi Salim (hadi@cyberus.ca) 10 | * 11 | */ 12 | 13 | #include <stdio.h> 14 | #include <stdlib.h> 15 | #include <unistd.h> 16 | #include <syslog.h> 17 | #include <fcntl.h> 18 | #include <sys/socket.h> 19 | #include <netinet/in.h> 20 | #include <arpa/inet.h> 21 | #include <string.h> 22 | #include "utils.h" 23 | #include "tc_util.h" 24 | #include "m_pedit.h" 25 | 26 | static int 27 | parse_udp(int *argc_p, char ***argv_p,struct tc_pedit_sel *sel,struct tc_pedit_key *tkey) 28 | { 29 | int res = -1; 30 | return res; 31 | } 32 | 33 | struct m_pedit_util p_pedit_udp = { 34 | NULL, 35 | "udp", 36 | parse_udp, 37 | }; 38 | 39 | -------------------------------------------------------------------------------- /iproute2-3.19.0/tc/q_fifo.c: -------------------------------------------------------------------------------- 1 | /* 2 | * q_fifo.c FIFO. 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 7 | * 2 of the License, or (at your option) any later version. 8 | * 9 | * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru> 10 | * 11 | */ 12 | 13 | #include <stdio.h> 14 | #include <stdlib.h> 15 | #include <unistd.h> 16 | #include <syslog.h> 17 | #include <fcntl.h> 18 | #include <sys/socket.h> 19 | #include <netinet/in.h> 20 | #include <arpa/inet.h> 21 | #include <string.h> 22 | 23 | #include "utils.h" 24 | #include "tc_util.h" 25 | 26 | static void explain(void) 27 | { 28 | fprintf(stderr, "Usage: ... <[p|b]fifo | pfifo_head_drop> [ limit NUMBER ]\n"); 29 | } 30 | 31 | static int fifo_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n) 32 | { 33 | int ok=0; 34 | struct tc_fifo_qopt opt; 35 | memset(&opt, 0, sizeof(opt)); 36 | 37 | while (argc > 0) { 38 | if (strcmp(*argv, "limit") == 0) { 39 | NEXT_ARG(); 40 | if (get_size(&opt.limit, *argv)) { 41 | fprintf(stderr, "%s: Illegal value for \"limit\": \"%s\"\n", qu->id, *argv); 42 | return -1; 43 | } 44 | ok++; 45 | } else if (strcmp(*argv, "help") == 0) { 46 | explain(); 47 | return -1; 48 | } else { 49 | fprintf(stderr, "%s: unknown parameter \"%s\"\n", qu->id, *argv); 50 | explain(); 51 | return -1; 52 | } 53 | argc--; argv++; 54 | } 55 | 56 | if (ok) 57 | addattr_l(n, 1024, TCA_OPTIONS, &opt, sizeof(opt)); 58 | return 0; 59 | } 60 | 61 | static int fifo_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) 62 | { 63 | struct tc_fifo_qopt *qopt; 64 | 65 | if (opt == NULL) 66 | return 0; 67 | 68 | if (RTA_PAYLOAD(opt) < sizeof(*qopt)) 69 | return -1; 70 | qopt = RTA_DATA(opt); 71 | if (strcmp(qu->id, "bfifo") == 0) { 72 | SPRINT_BUF(b1); 73 | fprintf(f, "limit %s", sprint_size(qopt->limit, b1)); 74 | } else 75 | fprintf(f, "limit %up", qopt->limit); 76 | return 0; 77 | } 78 | 79 | 80 | struct qdisc_util bfifo_qdisc_util = { 81 | .id = "bfifo", 82 | .parse_qopt = fifo_parse_opt, 83 | .print_qopt = fifo_print_opt, 84 | }; 85 | 86 | struct qdisc_util pfifo_qdisc_util = { 87 | .id = "pfifo", 88 | .parse_qopt = fifo_parse_opt, 89 | .print_qopt = fifo_print_opt, 90 | }; 91 | 92 | struct qdisc_util pfifo_head_drop_qdisc_util = { 93 | .id = "pfifo_head_drop", 94 | .parse_qopt = fifo_parse_opt, 95 | .print_qopt = fifo_print_opt, 96 | }; 97 | 98 | extern int prio_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt); 99 | struct qdisc_util pfifo_fast_qdisc_util = { 100 | .id = "pfifo_fast", 101 | .print_qopt = prio_print_opt, 102 | }; 103 | -------------------------------------------------------------------------------- /iproute2-3.19.0/tc/q_ingress.c: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * q_ingress.c INGRESS. 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU General Public License 7 | * as published by the Free Software Foundation; either version 8 | * 2 of the License, or (at your option) any later version. 9 | * 10 | * Authors: J Hadi Salim 11 | * 12 | * This is here just in case it is needed 13 | * useless right now; might be useful in the future 14 | * 15 | */ 16 | 17 | #include <stdio.h> 18 | #include <stdlib.h> 19 | #include <unistd.h> 20 | #include <syslog.h> 21 | #include <fcntl.h> 22 | #include <sys/socket.h> 23 | #include <netinet/in.h> 24 | #include <arpa/inet.h> 25 | #include <string.h> 26 | 27 | #include "utils.h" 28 | #include "tc_util.h" 29 | 30 | static void explain(void) 31 | { 32 | fprintf(stderr, "Usage: ... ingress \n"); 33 | } 34 | 35 | static int ingress_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n) 36 | { 37 | 38 | if (argc > 0) { 39 | while (argc > 0) { 40 | 41 | if (strcmp(*argv, "handle") == 0) { 42 | NEXT_ARG(); 43 | argc--; argv++; 44 | } else { 45 | fprintf(stderr, "What is \"%s\"?\n", *argv); 46 | explain(); 47 | return -1; 48 | } 49 | } 50 | } 51 | 52 | addattr_l(n, 1024, TCA_OPTIONS, NULL, 0); 53 | return 0; 54 | } 55 | 56 | static int ingress_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) 57 | { 58 | 59 | fprintf(f, "---------------- "); 60 | return 0; 61 | } 62 | 63 | struct qdisc_util ingress_qdisc_util = { 64 | .id = "ingress", 65 | .parse_qopt = ingress_parse_opt, 66 | .print_qopt = ingress_print_opt, 67 | }; 68 | -------------------------------------------------------------------------------- /iproute2-3.19.0/tc/q_multiq.c: -------------------------------------------------------------------------------- 1 | /* 2 | * q_multiq.c Multiqueue aware qdisc 3 | * 4 | * Copyright (c) 2008, Intel Corporation. 5 | * 6 | * This program is free software; you can redistribute it and/or modify it 7 | * under the terms and conditions of the GNU General Public License, 8 | * version 2, as published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope it will be useful, but WITHOUT 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 13 | * more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, see <http://www.gnu.org/licenses>. 17 | * 18 | * Author: Alexander Duyck <alexander.h.duyck@intel.com> 19 | * 20 | * Original Authors: PJ Waskiewicz, <peter.p.waskiewicz.jr@intel.com> (RR) 21 | * Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru> (from PRIO) 22 | * 23 | */ 24 | 25 | #include <stdio.h> 26 | #include <stdlib.h> 27 | #include <unistd.h> 28 | #include <syslog.h> 29 | #include <fcntl.h> 30 | #include <sys/socket.h> 31 | #include <netinet/in.h> 32 | #include <arpa/inet.h> 33 | #include <string.h> 34 | 35 | #include "utils.h" 36 | #include "tc_util.h" 37 | 38 | static void explain(void) 39 | { 40 | fprintf(stderr, "Usage: ... multiq [help]\n"); 41 | } 42 | 43 | static int multiq_parse_opt(struct qdisc_util *qu, int argc, char **argv, 44 | struct nlmsghdr *n) 45 | { 46 | struct tc_multiq_qopt opt; 47 | 48 | if (argc) { 49 | if (strcmp(*argv, "help") == 0) { 50 | explain(); 51 | return -1; 52 | } else { 53 | fprintf(stderr, "What is \"%s\"?\n", *argv); 54 | explain(); 55 | return -1; 56 | } 57 | } 58 | 59 | addattr_l(n, 1024, TCA_OPTIONS, &opt, sizeof(opt)); 60 | return 0; 61 | } 62 | 63 | static int multiq_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) 64 | { 65 | struct tc_multiq_qopt *qopt; 66 | 67 | if (opt == NULL) 68 | return 0; 69 | if (RTA_PAYLOAD(opt) < sizeof(*qopt)) 70 | return 0; 71 | 72 | qopt = RTA_DATA(opt); 73 | 74 | fprintf(f, "bands %u/%u ", qopt->bands, qopt->max_bands); 75 | 76 | return 0; 77 | } 78 | 79 | struct qdisc_util multiq_qdisc_util = { 80 | .id = "multiq", 81 | .parse_qopt = multiq_parse_opt, 82 | .print_qopt = multiq_print_opt, 83 | }; 84 | -------------------------------------------------------------------------------- /iproute2-3.19.0/tc/static-syms.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This file creates a dummy version of dynamic loading 3 | * for environments where dynamic linking 4 | * is not used or available. 5 | */ 6 | 7 | #include <string.h> 8 | #include "dlfcn.h" 9 | 10 | void *_dlsym(const char *sym) 11 | { 12 | #include "static-syms.h" 13 | return NULL; 14 | } 15 | -------------------------------------------------------------------------------- /iproute2-3.19.0/tc/tc_cbq.c: -------------------------------------------------------------------------------- 1 | /* 2 | * tc_cbq.c CBQ maintanance routines. 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 7 | * 2 of the License, or (at your option) any later version. 8 | * 9 | * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru> 10 | * 11 | */ 12 | 13 | #include <stdio.h> 14 | #include <stdlib.h> 15 | #include <unistd.h> 16 | #include <syslog.h> 17 | #include <fcntl.h> 18 | #include <math.h> 19 | #include <sys/socket.h> 20 | #include <netinet/in.h> 21 | #include <arpa/inet.h> 22 | #include <string.h> 23 | 24 | #include "tc_core.h" 25 | #include "tc_cbq.h" 26 | 27 | unsigned tc_cbq_calc_maxidle(unsigned bndw, unsigned rate, unsigned avpkt, 28 | int ewma_log, unsigned maxburst) 29 | { 30 | double maxidle; 31 | double g = 1.0 - 1.0/(1<<ewma_log); 32 | double xmt = (double)avpkt/bndw; 33 | 34 | maxidle = xmt*(1-g); 35 | if (bndw != rate && maxburst) { 36 | double vxmt = (double)avpkt/rate - xmt; 37 | vxmt *= (pow(g, -(double)maxburst) - 1); 38 | if (vxmt > maxidle) 39 | maxidle = vxmt; 40 | } 41 | return tc_core_time2tick(maxidle*(1<<ewma_log)*TIME_UNITS_PER_SEC); 42 | } 43 | 44 | unsigned tc_cbq_calc_offtime(unsigned bndw, unsigned rate, unsigned avpkt, 45 | int ewma_log, unsigned minburst) 46 | { 47 | double g = 1.0 - 1.0/(1<<ewma_log); 48 | double offtime = (double)avpkt/rate - (double)avpkt/bndw; 49 | 50 | if (minburst == 0) 51 | return 0; 52 | if (minburst == 1) 53 | offtime *= pow(g, -(double)minburst) - 1; 54 | else 55 | offtime *= 1 + (pow(g, -(double)(minburst-1)) - 1)/(1-g); 56 | return tc_core_time2tick(offtime*TIME_UNITS_PER_SEC); 57 | } 58 | -------------------------------------------------------------------------------- /iproute2-3.19.0/tc/tc_cbq.h: -------------------------------------------------------------------------------- 1 | #ifndef _TC_CBQ_H_ 2 | #define _TC_CBQ_H_ 1 3 | 4 | unsigned tc_cbq_calc_maxidle(unsigned bndw, unsigned rate, unsigned avpkt, 5 | int ewma_log, unsigned maxburst); 6 | unsigned tc_cbq_calc_offtime(unsigned bndw, unsigned rate, unsigned avpkt, 7 | int ewma_log, unsigned minburst); 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /iproute2-3.19.0/tc/tc_common.h: -------------------------------------------------------------------------------- 1 | 2 | #define TCA_BUF_MAX (64*1024) 3 | 4 | extern struct rtnl_handle rth; 5 | extern int do_qdisc(int argc, char **argv); 6 | extern int do_class(int argc, char **argv); 7 | extern int do_filter(int argc, char **argv); 8 | extern int do_action(int argc, char **argv); 9 | extern int do_tcmonitor(int argc, char **argv); 10 | extern int print_action(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg); 11 | extern int print_filter(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg); 12 | extern int print_qdisc(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg); 13 | extern int print_class(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg); 14 | extern void print_size_table(FILE *fp, const char *prefix, struct rtattr *rta); 15 | 16 | struct tc_estimator; 17 | extern int parse_estimator(int *p_argc, char ***p_argv, struct tc_estimator *est); 18 | 19 | struct tc_sizespec; 20 | extern int parse_size_table(int *p_argc, char ***p_argv, struct tc_sizespec *s); 21 | extern int check_size_table_opts(struct tc_sizespec *s); 22 | 23 | extern int show_graph; 24 | -------------------------------------------------------------------------------- /iproute2-3.19.0/tc/tc_core.h: -------------------------------------------------------------------------------- 1 | #ifndef _TC_CORE_H_ 2 | #define _TC_CORE_H_ 1 3 | 4 | #include <asm/types.h> 5 | #include <linux/pkt_sched.h> 6 | 7 | #define TIME_UNITS_PER_SEC 1000000 8 | 9 | enum link_layer { 10 | LINKLAYER_UNSPEC, 11 | LINKLAYER_ETHERNET, 12 | LINKLAYER_ATM, 13 | }; 14 | 15 | 16 | int tc_core_time2big(unsigned time); 17 | unsigned tc_core_time2tick(unsigned time); 18 | unsigned tc_core_tick2time(unsigned tick); 19 | unsigned tc_core_time2ktime(unsigned time); 20 | unsigned tc_core_ktime2time(unsigned ktime); 21 | unsigned tc_calc_xmittime(__u64 rate, unsigned size); 22 | unsigned tc_calc_xmitsize(__u64 rate, unsigned ticks); 23 | int tc_calc_rtable(struct tc_ratespec *r, __u32 *rtab, 24 | int cell_log, unsigned mtu, enum link_layer link_layer); 25 | int tc_calc_size_table(struct tc_sizespec *s, __u16 **stab); 26 | 27 | int tc_setup_estimator(unsigned A, unsigned time_const, struct tc_estimator *est); 28 | 29 | int tc_core_init(void); 30 | 31 | extern struct rtnl_handle g_rth; 32 | extern int is_batch_mode; 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /iproute2-3.19.0/tc/tc_estimator.c: -------------------------------------------------------------------------------- 1 | /* 2 | * tc_core.c TC core library. 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 7 | * 2 of the License, or (at your option) any later version. 8 | * 9 | * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru> 10 | * 11 | */ 12 | 13 | #include <stdio.h> 14 | #include <stdlib.h> 15 | #include <unistd.h> 16 | #include <syslog.h> 17 | #include <fcntl.h> 18 | #include <math.h> 19 | #include <sys/socket.h> 20 | #include <netinet/in.h> 21 | #include <arpa/inet.h> 22 | #include <string.h> 23 | 24 | #include "tc_core.h" 25 | 26 | int tc_setup_estimator(unsigned A, unsigned time_const, struct tc_estimator *est) 27 | { 28 | for (est->interval=0; est->interval<=5; est->interval++) { 29 | if (A <= (1<<est->interval)*(TIME_UNITS_PER_SEC/4)) 30 | break; 31 | } 32 | if (est->interval > 5) 33 | return -1; 34 | est->interval -= 2; 35 | for (est->ewma_log=1; est->ewma_log<32; est->ewma_log++) { 36 | double w = 1.0 - 1.0/(1<<est->ewma_log); 37 | if (A/(-log(w)) > time_const) 38 | break; 39 | } 40 | est->ewma_log--; 41 | if (est->ewma_log==0 || est->ewma_log >= 31) 42 | return -1; 43 | return 0; 44 | } 45 | -------------------------------------------------------------------------------- /iproute2-3.19.0/tc/tc_red.c: -------------------------------------------------------------------------------- 1 | /* 2 | * tc_red.c RED maintanance routines. 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 7 | * 2 of the License, or (at your option) any later version. 8 | * 9 | * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru> 10 | * 11 | */ 12 | 13 | #include <stdio.h> 14 | #include <stdlib.h> 15 | #include <unistd.h> 16 | #include <syslog.h> 17 | #include <fcntl.h> 18 | #include <math.h> 19 | #include <sys/socket.h> 20 | #include <netinet/in.h> 21 | #include <arpa/inet.h> 22 | #include <string.h> 23 | 24 | #include "tc_core.h" 25 | #include "tc_red.h" 26 | 27 | /* 28 | Plog = log(prob/(qmax - qmin)) 29 | */ 30 | int tc_red_eval_P(unsigned qmin, unsigned qmax, double prob) 31 | { 32 | int i = qmax - qmin; 33 | 34 | if (i <= 0) 35 | return -1; 36 | 37 | prob /= i; 38 | 39 | for (i=0; i<32; i++) { 40 | if (prob > 1.0) 41 | break; 42 | prob *= 2; 43 | } 44 | if (i>=32) 45 | return -1; 46 | return i; 47 | } 48 | 49 | /* 50 | burst + 1 - qmin/avpkt < (1-(1-W)^burst)/W 51 | */ 52 | 53 | int tc_red_eval_ewma(unsigned qmin, unsigned burst, unsigned avpkt) 54 | { 55 | int wlog = 1; 56 | double W = 0.5; 57 | double a = (double)burst + 1 - (double)qmin/avpkt; 58 | 59 | if (a < 1.0) { 60 | fprintf(stderr, "tc_red_eval_ewma() burst %u is too small ?" 61 | " Try burst %u\n", burst, 1 + qmin/avpkt); 62 | return -1; 63 | } 64 | for (wlog=1; wlog<32; wlog++, W /= 2) { 65 | if (a <= (1 - pow(1-W, burst))/W) 66 | return wlog; 67 | } 68 | return -1; 69 | } 70 | 71 | /* 72 | Stab[t>>Scell_log] = -log(1-W) * t/xmit_time 73 | */ 74 | 75 | int tc_red_eval_idle_damping(int Wlog, unsigned avpkt, unsigned bps, __u8 *sbuf) 76 | { 77 | double xmit_time = tc_calc_xmittime(bps, avpkt); 78 | double lW = -log(1.0 - 1.0/(1<<Wlog))/xmit_time; 79 | double maxtime = 31/lW; 80 | int clog; 81 | int i; 82 | 83 | for (clog=0; clog<32; clog++) { 84 | if (maxtime/(1<<clog) < 512) 85 | break; 86 | } 87 | if (clog >= 32) 88 | return -1; 89 | 90 | sbuf[0] = 0; 91 | for (i=1; i<255; i++) { 92 | sbuf[i] = (i<<clog)*lW; 93 | if (sbuf[i] > 31) 94 | sbuf[i] = 31; 95 | } 96 | sbuf[255] = 31; 97 | return clog; 98 | } 99 | -------------------------------------------------------------------------------- /iproute2-3.19.0/tc/tc_red.h: -------------------------------------------------------------------------------- 1 | #ifndef _TC_RED_H_ 2 | #define _TC_RED_H_ 1 3 | 4 | extern int tc_red_eval_P(unsigned qmin, unsigned qmax, double prob); 5 | extern int tc_red_eval_ewma(unsigned qmin, unsigned burst, unsigned avpkt); 6 | extern int tc_red_eval_idle_damping(int wlog, unsigned avpkt, unsigned bandwidth, __u8 *sbuf); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /iproute2-3.19.0/testsuite/Makefile: -------------------------------------------------------------------------------- 1 | ## -- Config -- 2 | DEV := lo 3 | PREFIX := sudo -E 4 | RESULTS_DIR := results 5 | ## -- End Config -- 6 | 7 | rwildcard=$(wildcard $1$2) $(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2)) 8 | 9 | TESTS := $(patsubst tests/%,%,$(call rwildcard,tests/,*.t)) 10 | TESTS_DIR := $(dir $(TESTS)) 11 | 12 | IPVERS := $(filter-out iproute2/Makefile,$(wildcard iproute2/*)) 13 | 14 | ifneq (,$(wildcard /proc/config.gz)) 15 | KENV := $(shell cat /proc/config.gz | gunzip | grep ^CONFIG) 16 | endif 17 | 18 | .PHONY: compile listtests alltests configure $(TESTS) 19 | 20 | configure: 21 | echo "Entering iproute2" && cd iproute2 && $(MAKE) configure && cd ..; 22 | 23 | compile: configure 24 | echo "Entering iproute2" && cd iproute2 && $(MAKE) && cd ..; 25 | 26 | listtests: 27 | @for t in $(TESTS); do \ 28 | echo "$$t"; \ 29 | done 30 | 31 | alltests: $(TESTS) 32 | 33 | clean: 34 | @echo "Removing $(RESULTS_DIR) dir ..." 35 | @rm -rf $(RESULTS_DIR) 36 | 37 | distclean: clean 38 | echo "Entering iproute2" && cd iproute2 && $(MAKE) distclean && cd ..; 39 | 40 | $(TESTS): clean 41 | @mkdir -p $(RESULTS_DIR) 42 | 43 | @for d in $(TESTS_DIR); do \ 44 | mkdir -p $(RESULTS_DIR)/$$d; \ 45 | done 46 | 47 | @for i in $(IPVERS); do \ 48 | o=`echo $$i | sed -e 's/iproute2\///'`; \ 49 | echo -n "Running $@ [$$o/`uname -r`]: "; \ 50 | TC="$$i/tc/tc" IP="$$i/ip/ip" DEV="$(DEV)" IPVER="$@" SNAME="$$i" \ 51 | ERRF="$(RESULTS_DIR)/$@.$$o.err" $(KENV) $(PREFIX) tests/$@ > $(RESULTS_DIR)/$@.$$o.out; \ 52 | if [ "$$?" = "127" ]; then \ 53 | echo "SKIPPED"; \ 54 | elif [ -e "$(RESULTS_DIR)/$@.$$o.err" ]; then \ 55 | echo "FAILED"; \ 56 | else \ 57 | echo "PASS"; \ 58 | fi; \ 59 | dmesg > $(RESULTS_DIR)/$@.$$o.dmesg; \ 60 | done 61 | -------------------------------------------------------------------------------- /iproute2-3.19.0/testsuite/iproute2/Makefile: -------------------------------------------------------------------------------- 1 | SUBDIRS := $(filter-out Makefile,$(wildcard *)) 2 | .PHONY: all configure clean distclean show $(SUBDIRS) 3 | 4 | all: configure 5 | @for dir in $(SUBDIRS); do \ 6 | echo "Entering $$dir" && cd $$dir && $(MAKE) && cd ..; \ 7 | done 8 | 9 | link: 10 | @if [ ! -L iproute2-this ]; then \ 11 | ln -s ../.. iproute2-this; \ 12 | fi 13 | 14 | configure: link 15 | @for dir in $(SUBDIRS); do \ 16 | echo "Entering $$dir" && cd $$dir && if [ -f configure ]; then ./configure; fi && cd ..; \ 17 | done 18 | 19 | clean: link 20 | @for dir in $(SUBDIRS); do \ 21 | echo "Entering $$dir" && cd $$dir && $(MAKE) clean && cd ..; \ 22 | done 23 | 24 | distclean: clean 25 | @for dir in $(SUBDIRS); do \ 26 | echo "Entering $$dir" && cd $$dir && $(MAKE) distclean && cd ..; \ 27 | done 28 | 29 | show: link 30 | @echo "$(SUBDIRS)" 31 | 32 | $(SUBDIRS): 33 | cd $@ && $(MAKE) 34 | -------------------------------------------------------------------------------- /iproute2-3.19.0/testsuite/lib/generic.sh: -------------------------------------------------------------------------------- 1 | 2 | export DEST="127.0.0.1" 3 | 4 | ts_log() 5 | { 6 | echo "$@" 7 | } 8 | 9 | ts_err() 10 | { 11 | ts_log "$@" | tee >> $ERRF 12 | } 13 | 14 | ts_cat() 15 | { 16 | cat "$@" 17 | } 18 | 19 | ts_err_cat() 20 | { 21 | ts_cat "$@" | tee >> $ERRF 22 | } 23 | 24 | ts_skip() 25 | { 26 | exit 127 27 | } 28 | 29 | ts_tc() 30 | { 31 | SCRIPT=$1; shift 32 | DESC=$1; shift 33 | TMP_ERR=`mktemp /tmp/tc_testsuite.XXXXXX` || exit 34 | TMP_OUT=`mktemp /tmp/tc_testsuite.XXXXXX` || exit 35 | 36 | $TC $@ 2> $TMP_ERR > $TMP_OUT 37 | 38 | if [ -s $TMP_ERR ]; then 39 | ts_err "${SCRIPT}: ${DESC} failed:" 40 | ts_err "command: $TC $@" 41 | ts_err "stderr output:" 42 | ts_err_cat $TMP_ERR 43 | if [ -s $TMP_OUT ]; then 44 | ts_err "stdout output:" 45 | ts_err_cat $TMP_OUT 46 | fi 47 | elif [ -s $TMP_OUT ]; then 48 | echo "${SCRIPT}: ${DESC} succeeded with output:" 49 | cat $TMP_OUT 50 | else 51 | echo "${SCRIPT}: ${DESC} succeeded" 52 | fi 53 | 54 | rm $TMP_ERR $TMP_OUT 55 | } 56 | 57 | ts_ip() 58 | { 59 | SCRIPT=$1; shift 60 | DESC=$1; shift 61 | TMP_ERR=`mktemp /tmp/tc_testsuite.XXXXXX` || exit 62 | TMP_OUT=`mktemp /tmp/tc_testsuite.XXXXXX` || exit 63 | 64 | $IP $@ 2> $TMP_ERR > $TMP_OUT 65 | RET=$? 66 | 67 | if [ -s $TMP_ERR ] || [ "$RET" != "0" ]; then 68 | ts_err "${SCRIPT}: ${DESC} failed:" 69 | ts_err "command: $IP $@" 70 | ts_err "stderr output:" 71 | ts_err_cat $TMP_ERR 72 | if [ -s $TMP_OUT ]; then 73 | ts_err "stdout output:" 74 | ts_err_cat $TMP_OUT 75 | fi 76 | elif [ -s $TMP_OUT ]; then 77 | echo "${SCRIPT}: ${DESC} succeeded with output:" 78 | cat $TMP_OUT 79 | else 80 | echo "${SCRIPT}: ${DESC} succeeded" 81 | fi 82 | 83 | rm $TMP_ERR $TMP_OUT 84 | } 85 | 86 | ts_qdisc_available() 87 | { 88 | HELPOUT=`$TC qdisc add $1 help 2>&1` 89 | if [ "`echo $HELPOUT | grep \"^Unknown qdisc\"`" ]; then 90 | return 0; 91 | else 92 | return 1; 93 | fi 94 | } 95 | 96 | rand_dev() 97 | { 98 | echo "dev-$(tr -dc "[:alpha:]" < /dev/urandom | head -c 6)" 99 | } 100 | -------------------------------------------------------------------------------- /iproute2-3.19.0/testsuite/tests/ip/link/dev_wo_vf_rate.nl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upa/nshkmod/d336f2c749919199af0ea78d82b746fc5b183322/iproute2-3.19.0/testsuite/tests/ip/link/dev_wo_vf_rate.nl -------------------------------------------------------------------------------- /iproute2-3.19.0/testsuite/tests/ip/link/new_link.t: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | source lib/generic.sh 4 | 5 | ts_log "[Testing add/del virtual links]" 6 | 7 | NEW_DEV="$(rand_dev)" 8 | 9 | ts_ip "$0" "Add $NEW_DEV dummy interface" link add dev $NEW_DEV type dummy 10 | ts_ip "$0" "Show $NEW_DEV dummy interface" link show dev $NEW_DEV 11 | ts_ip "$0" "Del $NEW_DEV dummy interface" link del dev $NEW_DEV 12 | -------------------------------------------------------------------------------- /iproute2-3.19.0/testsuite/tests/ip/link/show_dev_wo_vf_rate.t: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | source lib/generic.sh 4 | 5 | NL_FILE="tests/ip/link/dev_wo_vf_rate.nl" 6 | ts_ip "$0" "Show VF devices w/o VF rate info" -d monitor file $NL_FILE 7 | -------------------------------------------------------------------------------- /iproute2-3.19.0/testsuite/tests/tc/cbq.t: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | $TC qdisc del dev $DEV root >/dev/null 2>&1 3 | $TC qdisc add dev $DEV root handle 10:0 cbq bandwidth 100Mbit avpkt 1400 mpu 64 4 | $TC class add dev $DEV parent 10:0 classid 10:12 cbq bandwidth 100mbit rate 100mbit allot 1514 prio 3 maxburst 1 avpkt 500 bounded 5 | $TC qdisc list dev $DEV 6 | $TC qdisc del dev $DEV root 7 | $TC qdisc list dev $DEV 8 | $TC qdisc add dev $DEV root handle 10:0 cbq bandwidth 100Mbit avpkt 1400 mpu 64 9 | $TC class add dev $DEV parent 10:0 classid 10:12 cbq bandwidth 100mbit rate 100mbit allot 1514 prio 3 maxburst 1 avpkt 500 bounded 10 | $TC qdisc del dev $DEV root 11 | -------------------------------------------------------------------------------- /iproute2-3.19.0/testsuite/tests/tc/cls-testbed.t: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # vim: ft=sh 3 | 4 | source lib/generic.sh 5 | 6 | QDISCS="cbq htb dsmark" 7 | 8 | if [ ! -d tests/cls ]; then 9 | ts_log "tests/cls folder does not exist" 10 | ts_skip 11 | fi 12 | 13 | for q in ${QDISCS}; do 14 | ts_log "Preparing classifier testbed with qdisc $q" 15 | 16 | for c in tests/cls/*.c; do 17 | 18 | case "$q" in 19 | cbq) 20 | ts_tc "cls-testbed" "cbq root qdisc creation" \ 21 | qdisc add dev $DEV root handle 10:0 \ 22 | cbq bandwidth 100Mbit avpkt 1400 mpu 64 23 | ts_tc "cls-testbed" "cbq root class creation" \ 24 | class add dev $DEV parent 10:0 classid 10:12 \ 25 | cbq bandwidth 100mbit rate 100mbit allot 1514 prio 3 \ 26 | maxburst 1 avpkt 500 bounded 27 | ;; 28 | htb) 29 | ts_qdisc_available "htb" 30 | if [ $? -eq 0 ]; then 31 | ts_log "cls-testbed: HTB is unsupported by $TC, skipping" 32 | continue; 33 | fi 34 | ts_tc "cls-testbed" "htb root qdisc creation" \ 35 | qdisc add dev $DEV root handle 10:0 htb 36 | ts_tc "cls-testbed" "htb root class creation" \ 37 | class add dev $DEV parent 10:0 classid 10:12 \ 38 | htb rate 100Mbit quantum 1514 39 | ;; 40 | dsmark) 41 | ts_qdisc_available "dsmark" 42 | if [ $? -eq 0 ]; then 43 | ts_log "cls-testbed: dsmark is unsupported by $TC, skipping" 44 | continue; 45 | fi 46 | ts_tc "cls-testbed" "dsmark root qdisc creation" \ 47 | qdisc add dev $DEV root handle 20:0 \ 48 | dsmark indices 64 default_index 1 set_tc_index 49 | ts_tc "cls-testbed" "dsmark class creation" \ 50 | class change dev $DEV parent 20:0 classid 20:12 \ 51 | dsmark mask 0xff value 2 52 | ts_tc "cls-testbed" "prio inner qdisc creation" \ 53 | qdisc add dev $DEV parent 20:0 handle 10:0 prio 54 | ;; 55 | *) 56 | ts_err "cls-testbed: no testbed configuration found for qdisc $q" 57 | continue 58 | ;; 59 | esac 60 | 61 | ts_tc "cls-testbed" "tree listing" qdisc list dev eth0 62 | ts_tc "cls-testbed" "tree class listing" class list dev eth0 63 | ts_log "cls-testbed: starting classifier test $c" 64 | $c 65 | 66 | case "$q" in 67 | *) 68 | ts_tc "cls-testbed" "generic qdisc tree deletion" \ 69 | qdisc del dev $DEV root 70 | ;; 71 | esac 72 | done 73 | done 74 | -------------------------------------------------------------------------------- /iproute2-3.19.0/testsuite/tests/tc/dsmark.t: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # vim: ft=sh 3 | 4 | source lib/generic.sh 5 | 6 | ts_qdisc_available "dsmark" 7 | if [ $? -eq 0 ]; then 8 | ts_log "dsmark: Unsupported by $TC, skipping" 9 | exit 127 10 | fi 11 | 12 | ts_tc "dsmark" "dsmark root qdisc creation" \ 13 | qdisc add dev $DEV root handle 10:0 \ 14 | dsmark indices 64 default_index 1 set_tc_index 15 | 16 | ts_tc "dsmark" "dsmark class 1 creation" \ 17 | class change dev $DEV parent 10:0 classid 10:12 \ 18 | dsmark mask 0xff value 2 19 | 20 | ts_tc "dsmark" "dsmark class 2 creation" \ 21 | class change dev $DEV parent 10:0 classid 10:13 \ 22 | dsmark mask 0xfc value 4 23 | 24 | ts_tc "dsmark" "dsmark dump qdisc" \ 25 | qdisc list dev $DEV 26 | 27 | ts_tc "dsmark" "dsmark dump class" \ 28 | class list dev $DEV parent 10:0 29 | 30 | ts_tc "dsmark" "generic qdisc tree deletion" \ 31 | qdisc del dev $DEV root 32 | -------------------------------------------------------------------------------- /iproute2-3.19.0/testsuite/tests/tc/policer.t: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | $TC qdisc del dev $DEV root >/dev/null 2>&1 3 | $TC qdisc add dev $DEV root handle 10:0 cbq bandwidth 100Mbit avpkt 1400 mpu 64 4 | $TC class add dev $DEV parent 10:0 classid 10:12 cbq bandwidth 100mbit rate 100mbit allot 1514 prio 3 maxburst 1 avpkt 500 bounded 5 | $TC filter add dev $DEV parent 10:0 protocol ip prio 10 u32 match ip protocol 1 0xff police rate 2kbit buffer 10k drop flowid 10:12 6 | $TC qdisc list dev $DEV 7 | $TC filter list dev $DEV parent 10:0 8 | $TC qdisc del dev $DEV root 9 | $TC qdisc list dev $DEV 10 | $TC qdisc add dev $DEV root handle 10:0 cbq bandwidth 100Mbit avpkt 1400 mpu 64 11 | $TC class add dev $DEV parent 10:0 classid 10:12 cbq bandwidth 100mbit rate 100mbit allot 1514 prio 3 maxburst 1 avpkt 500 bounded 12 | $TC filter add dev $DEV parent 10:0 protocol ip prio 10 u32 match ip protocol 1 0xff police rate 2kbit buffer 10k drop flowid 10:12 13 | $TC qdisc del dev $DEV root 14 | -------------------------------------------------------------------------------- /nshkmod.h: -------------------------------------------------------------------------------- 1 | #ifndef _NSHKMOD_H_ 2 | #define _NSHKMOD_H_ 3 | 4 | /* nshkmod.h 5 | * generic netlink definition for nshkmod. 6 | */ 7 | 8 | /* IFLA parameter */ 9 | enum { 10 | IFLA_NSHKMOD_UNSPEC, 11 | IFLA_NSHKMOD_SPI, 12 | IFLA_NSHKMOD_SI, 13 | __IFLA_NSHKMOD_MAX 14 | }; 15 | #define IFLA_NSHKMOD_MAX (__IFLA_NSHKMOD_MAX - 1) 16 | 17 | 18 | 19 | #define NSHKMOD_GENL_NAME "nshkmod" 20 | #define NSHKMOD_GENL_VERSION 0x01 21 | 22 | 23 | /* attrs */ 24 | enum { 25 | NSHKMOD_ATTR_UNSPEC, 26 | NSHKMOD_ATTR_IFINDEX, /* 32bit interface index */ 27 | NSHKMOD_ATTR_SPI, /* 24bit service path index */ 28 | NSHKMOD_ATTR_SI, /* 8bit service index */ 29 | NSHKMOD_ATTR_MDTYPE, /* 8bit MD-type */ 30 | NSHKMOD_ATTR_ENCAP, /* 8bit outer encapsulation type */ 31 | NSHKMOD_ATTR_REMOTE, /* 32bit IPv4 address for destination */ 32 | NSHKMOD_ATTR_LOCAL, /* 32bit IPv4 address for source */ 33 | NSHKMOD_ATTR_VNI, /* 32bit (24bit) VNI for vxlan encap */ 34 | NSHKMOD_ATTR_ETHADDR, /* 48bit destination mac addr */ 35 | __NSHKMOD_ATTR_MAX, 36 | }; 37 | #define NSHKMOD_ATTR_MAX (__NSHKMOD_ATTR_MAX) 38 | 39 | /* NSHKMOD_ATTR_ENCAP values */ 40 | enum { 41 | NSH_ENCAP_TYPE_NONE, /* destination is inner device */ 42 | NSH_ENCAP_TYPE_VXLAN, 43 | NSH_ENCAP_TYPE_ETHER, 44 | NSH_ENCAP_TYPE_GRE, /* not implemented */ 45 | NSH_ENCAP_TYPE_GUE /* not implemented */ 46 | }; 47 | 48 | /* commands */ 49 | enum { 50 | NSHKMOD_CMD_PATH_DST_SET, /* set dst (ifi or remote) of path */ 51 | NSHKMOD_CMD_PATH_DST_UNSET, /* set dst (ifi or remote) of path */ 52 | NSHKMOD_CMD_DEV_PATH_SET, /* set dest path of dev */ 53 | NSHKMOD_CMD_DEV_PATH_UNSET, /* set dest path of dev */ 54 | NSHKMOD_CMD_PATH_DUMP, /* dump path information */ 55 | NSHKMOD_CMD_DEV_DUMP, /* dump device path info*/ 56 | __NSHKMOD_CMD_MAX, 57 | }; 58 | #define NSHKMOD_CMD_MAX (__NSHKMOD_CMD_MAX - 1) 59 | 60 | #endif 61 | --------------------------------------------------------------------------------