From 97f550cafe24611d5bd374e57f2b7608db5516a8 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Wed, 5 Mar 2008 10:40:03 -0800 Subject: [PATCH 1/4] Revert "I found out when I was writing manual page, that options ALGO_NAME and" This change is bogus, it perfectly possible to use ALGO_NAME. This reverts commit 8a1485bb21bf84a7932ca849e29300853e647afc. --- ip/xfrm_state.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ip/xfrm_state.c b/ip/xfrm_state.c index 93b4a2a1..0e212033 100644 --- a/ip/xfrm_state.c +++ b/ip/xfrm_state.c @@ -88,7 +88,7 @@ static void usage(void) fprintf(stderr, "ENCAP-TYPE := espinudp | espinudp-nonike\n"); fprintf(stderr, "ALGO-LIST := [ ALGO-LIST ] | [ ALGO ]\n"); - fprintf(stderr, "ALGO := ALGO_TYPE\n"); + fprintf(stderr, "ALGO := ALGO_TYPE ALGO_NAME ALGO_KEY\n"); fprintf(stderr, "ALGO_TYPE := [ "); fprintf(stderr, "%s | ", strxf_algotype(XFRMA_ALG_CRYPT)); fprintf(stderr, "%s | ", strxf_algotype(XFRMA_ALG_AUTH)); From 5a67f8f9d3a7f80a49554fb1ca4e68a1effd5399 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Mon, 15 Sep 2008 12:05:11 -0700 Subject: [PATCH 2/4] Update to 2.6.27 API The one issue was the old multiqueue API, so that is handled by tc_util.h --- include/linux/atm.h | 1 + include/linux/if.h | 15 ++++++------ include/linux/if_vlan.h | 1 + include/linux/ip6_tunnel.h | 4 ---- include/linux/netfilter.h | 1 + include/linux/netfilter_ipv4.h | 1 + include/linux/netfilter_ipv4/ip_tables.h | 1 + include/linux/pkt_cls.h | 1 + include/linux/pkt_sched.h | 29 ++++++++++++++++-------- include/linux/rtnetlink.h | 1 + include/linux/socket.h | 5 +++- tc/tc_util.h | 12 ++++++++++ 12 files changed, 51 insertions(+), 21 deletions(-) diff --git a/include/linux/atm.h b/include/linux/atm.h index 9846c8dd..6de16270 100644 --- a/include/linux/atm.h +++ b/include/linux/atm.h @@ -16,6 +16,7 @@ * documentation. Do not change them. */ + #include #include #include diff --git a/include/linux/if.h b/include/linux/if.h index 40eb61f9..45d5b848 100644 --- a/include/linux/if.h +++ b/include/linux/if.h @@ -21,6 +21,7 @@ #include /* for "__kernel_caddr_t" et al */ #include /* for "struct sockaddr" et al */ + /* for "__user" et al */ #define IFNAMSIZ 16 #include @@ -135,15 +136,15 @@ struct if_settings unsigned int size; /* Size of the data allocated by the caller */ union { /* {atm/eth/dsl}_settings anyone ? */ - raw_hdlc_proto *raw_hdlc; - cisco_proto *cisco; - fr_proto *fr; - fr_proto_pvc *fr_pvc; - fr_proto_pvc_info *fr_pvc_info; + raw_hdlc_proto *raw_hdlc; + cisco_proto *cisco; + fr_proto *fr; + fr_proto_pvc *fr_pvc; + fr_proto_pvc_info *fr_pvc_info; /* interface settings */ - sync_serial_settings *sync; - te1_settings *te1; + sync_serial_settings *sync; + te1_settings *te1; } ifs_ifsu; }; diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h index 4014ba93..2dc4a57d 100644 --- a/include/linux/if_vlan.h +++ b/include/linux/if_vlan.h @@ -32,6 +32,7 @@ enum vlan_ioctl_cmds { enum vlan_flags { VLAN_FLAG_REORDER_HDR = 0x1, + VLAN_FLAG_GVRP = 0x2, }; enum vlan_name_types { diff --git a/include/linux/ip6_tunnel.h b/include/linux/ip6_tunnel.h index af3f4a70..1e7cc4af 100644 --- a/include/linux/ip6_tunnel.h +++ b/include/linux/ip6_tunnel.h @@ -1,7 +1,3 @@ -/* - * $Id$ - */ - #ifndef _IP6_TUNNEL_H #define _IP6_TUNNEL_H diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h index 6ea935f7..b1022f82 100644 --- a/include/linux/netfilter.h +++ b/include/linux/netfilter.h @@ -3,6 +3,7 @@ #include + /* Responses from hook functions. */ #define NF_DROP 0 #define NF_ACCEPT 1 diff --git a/include/linux/netfilter_ipv4.h b/include/linux/netfilter_ipv4.h index da7e16c7..4d7ba3e4 100644 --- a/include/linux/netfilter_ipv4.h +++ b/include/linux/netfilter_ipv4.h @@ -58,6 +58,7 @@ enum nf_ip_hook_priorities { NF_IP_PRI_MANGLE = -150, NF_IP_PRI_NAT_DST = -100, NF_IP_PRI_FILTER = 0, + NF_IP_PRI_SECURITY = 50, NF_IP_PRI_NAT_SRC = 100, NF_IP_PRI_SELINUX_LAST = 225, NF_IP_PRI_CONNTRACK_CONFIRM = INT_MAX, diff --git a/include/linux/netfilter_ipv4/ip_tables.h b/include/linux/netfilter_ipv4/ip_tables.h index c42c73f7..a9f21c9b 100644 --- a/include/linux/netfilter_ipv4/ip_tables.h +++ b/include/linux/netfilter_ipv4/ip_tables.h @@ -16,6 +16,7 @@ #define _IPTABLES_H #include + #include #include diff --git a/include/linux/pkt_cls.h b/include/linux/pkt_cls.h index 99efbed8..7cf7824d 100644 --- a/include/linux/pkt_cls.h +++ b/include/linux/pkt_cls.h @@ -374,6 +374,7 @@ enum TCA_FLOW_ACT, TCA_FLOW_POLICE, TCA_FLOW_EMATCHES, + TCA_FLOW_PERTURB, __TCA_FLOW_MAX }; diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h index dbb7ac37..e5de421a 100644 --- a/include/linux/pkt_sched.h +++ b/include/linux/pkt_sched.h @@ -85,6 +85,26 @@ struct tc_ratespec #define TC_RTAB_SIZE 1024 +struct tc_sizespec { + unsigned char cell_log; + unsigned char size_log; + short cell_align; + int overhead; + unsigned int linklayer; + unsigned int mpu; + unsigned int mtu; + unsigned int tsize; +}; + +enum { + TCA_STAB_UNSPEC, + TCA_STAB_BASE, + TCA_STAB_DATA, + __TCA_STAB_MAX +}; + +#define TCA_STAB_MAX (__TCA_STAB_MAX - 1) + /* FIFO section */ struct tc_fifo_qopt @@ -103,15 +123,6 @@ struct tc_prio_qopt __u8 priomap[TC_PRIO_MAX+1]; /* Map: logical priority -> PRIO band */ }; -enum -{ - TCA_PRIO_UNSPEC, - TCA_PRIO_MQ, - __TCA_PRIO_MAX -}; - -#define TCA_PRIO_MAX (__TCA_PRIO_MAX - 1) - /* TBF section */ struct tc_tbf_qopt diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h index c1f2d502..a1256928 100644 --- a/include/linux/rtnetlink.h +++ b/include/linux/rtnetlink.h @@ -482,6 +482,7 @@ enum TCA_RATE, TCA_FCNT, TCA_STATS2, + TCA_STAB, __TCA_MAX }; diff --git a/include/linux/socket.h b/include/linux/socket.h index 0d4c15f2..b599cfcd 100644 --- a/include/linux/socket.h +++ b/include/linux/socket.h @@ -22,6 +22,7 @@ struct __kernel_sockaddr_storage { #include /* the SIOCxxx I/O controls */ #include /* iovec support */ #include /* pid_t */ + /* */ #ifdef CONFIG_PROC_FS struct seq_file; @@ -186,7 +187,8 @@ struct ucred { #define AF_BLUETOOTH 31 /* Bluetooth sockets */ #define AF_IUCV 32 /* IUCV sockets */ #define AF_RXRPC 33 /* RxRPC sockets */ -#define AF_MAX 34 /* For now.. */ +#define AF_ISDN 34 /* mISDN sockets */ +#define AF_MAX 35 /* For now.. */ /* Protocol families, same as address families. */ #define PF_UNSPEC AF_UNSPEC @@ -222,6 +224,7 @@ struct ucred { #define PF_BLUETOOTH AF_BLUETOOTH #define PF_IUCV AF_IUCV #define PF_RXRPC AF_RXRPC +#define PF_ISDN AF_ISDN #define PF_MAX AF_MAX /* Maximum queue length specifiable by listen. */ diff --git a/tc/tc_util.h b/tc/tc_util.h index 796da542..39d53679 100644 --- a/tc/tc_util.h +++ b/tc/tc_util.h @@ -7,6 +7,18 @@ #include #include "tc_core.h" +/* This is the deprecated multiqueue interface */ +#ifndef TCA_PRIO_MAX +enum +{ + TCA_PRIO_UNSPEC, + TCA_PRIO_MQ, + __TCA_PRIO_MAX +}; + +#define TCA_PRIO_MAX (__TCA_PRIO_MAX - 1) +#endif + struct qdisc_util { struct qdisc_util *next; From 2ca4abdcb823e708b88156f947fa5b493055618a Mon Sep 17 00:00:00 2001 From: Andreas Henriksson Date: Fri, 29 Aug 2008 19:26:42 +0200 Subject: [PATCH 3/4] ip: abbreviation of network-prefix is no longer possible with ip route Commit 516ffb6b7724e97ca035293dcfd9f94cf6ce3a47 says: Stephen Hemminger [Thu, 22 May 2008 20:41:40 +0000 (13:41 -0700)] > Use the standard POSIX inet_pton to convert from string to IPV4 > address. This avoids problems where ip parses "127.2" wrong. Apparently inet_pton doesn't support abbreviated/shortened/classful ipv4 addresses at all, but inet_aton does. Since the function only deals with AF_INET anyway maybe using inet_aton "to increse backwards compatability" (please those who still want to use the format) could be considered? (This will still not restore the 10/8 format which apparently used to work in iproute, so people would have to settle for 10.0/8) (See http://bugs.debian.org/497011) --- lib/utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/utils.c b/lib/utils.c index a88f82b5..21cf0ea0 100644 --- a/lib/utils.c +++ b/lib/utils.c @@ -284,7 +284,7 @@ int get_addr_1(inet_prefix *addr, const char *name, int family) addr->family = AF_INET; if (family != AF_UNSPEC && family != AF_INET) return -1; - if (inet_pton(AF_INET, name, addr->data) <= 0) + if (inet_aton(name, addr->data) <= 0) return -1; addr->bytelen = 4; addr->bitlen = -1; From f0b34d2d98ffcd135c92dcba563d4bc47632333c Mon Sep 17 00:00:00 2001 From: Andreas Henriksson Date: Fri, 29 Aug 2008 19:52:48 +0200 Subject: [PATCH 4/4] ip a flush: unnecessarily chatty when there's nothing to flush On tis, 2008-07-22 at 20:21 +0200, martin f krafft wrote: > piper:~|master|% sudo ip a flush dev eth0 >/dev/null > Nothing to flush. > > It should just shut up, shouldn't it? :) The patch below makes the "Nothing to flush" only visible when show statistics flag is given, and then only to stdout rather then stderr. $ sudo ./ip/ip -s addr flush dev skif Nothing to flush. $ sudo ./ip/ip addr flush dev skif $ (See http://bugs.debian.org/492196 ) --- ip/ipaddress.c | 10 ++++++---- ip/ipneigh.c | 10 ++++++---- ip/iproute.c | 11 ++++++----- 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/ip/ipaddress.c b/ip/ipaddress.c index 373312f2..51471e86 100644 --- a/ip/ipaddress.c +++ b/ip/ipaddress.c @@ -697,10 +697,12 @@ static int ipaddr_list_or_flush(int argc, char **argv, int flush) exit(1); } if (filter.flushed == 0) { - if (round == 0) { - fprintf(stderr, "Nothing to flush.\n"); - } else if (show_stats) - printf("*** Flush is complete after %d round%s ***\n", round, round>1?"s":""); + if (show_stats) { + if (round == 0) + printf("Nothing to flush.\n"); + else + printf("*** Flush is complete after %d round%s ***\n", round, round>1?"s":""); + } fflush(stdout); return 0; } diff --git a/ip/ipneigh.c b/ip/ipneigh.c index fa0e41dc..30c7c72d 100644 --- a/ip/ipneigh.c +++ b/ip/ipneigh.c @@ -402,10 +402,12 @@ int do_show_or_flush(int argc, char **argv, int flush) exit(1); } if (filter.flushed == 0) { - if (round == 0) { - fprintf(stderr, "Nothing to flush.\n"); - } else if (show_stats) - printf("*** Flush is complete after %d round%s ***\n", round, round>1?"s":""); + if (show_stats) { + if (round == 0) + printf("Nothing to flush.\n"); + else + printf("*** Flush is complete after %d round%s ***\n", round, round>1?"s":""); + } fflush(stdout); return 0; } diff --git a/ip/iproute.c b/ip/iproute.c index 2a8f3f83..6a2ea05f 100644 --- a/ip/iproute.c +++ b/ip/iproute.c @@ -1209,11 +1209,12 @@ static int iproute_list_or_flush(int argc, char **argv, int flush) exit(1); } if (filter.flushed == 0) { - if (round == 0) { - if (!filter.cloned || do_ipv6 == AF_INET6) - fprintf(stderr, "Nothing to flush.\n"); - } else if (show_stats) - printf("*** Flush is complete after %d round%s ***\n", round, round>1?"s":""); + if (show_stats) { + if (round == 0 && (!filter.cloned || do_ipv6 == AF_INET6)) + printf("Nothing to flush.\n"); + else + printf("*** Flush is complete after %d round%s ***\n", round, round>1?"s":""); + } fflush(stdout); return 0; }