]> rtime.felk.cvut.cz Git - lisovros/iproute2_canprio.git/commitdiff
Merge branch 'master' into net-2.6.25
authorStephen Hemminger <shemminger@linux-foundation.org>
Tue, 11 Dec 2007 18:04:33 +0000 (10:04 -0800)
committerStephen Hemminger <shemminger@linux-foundation.org>
Tue, 11 Dec 2007 18:04:33 +0000 (10:04 -0800)
include/linux/if.h
include/linux/netfilter.h [new file with mode: 0644]
include/linux/netfilter_ipv4/ip_tables.h
include/linux/rtnetlink.h
include/linux/socket.h
tc/m_ipt.c
tc/q_rlim.c [new file with mode: 0644]

index 296cd61562eab0b0e3ae62c4101afcf363c54755..40eb61f93a3751964776befd1e8592e4e8397006 100644 (file)
@@ -49,7 +49,9 @@
 #define IFF_LOWER_UP   0x10000         /* driver signals L1 up         */
 #define IFF_DORMANT    0x20000         /* driver signals dormant       */
 
-#define IFF_VOLATILE   (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST|\
+#define IFF_ECHO       0x40000         /* echo sent packets            */
+
+#define IFF_VOLATILE   (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST|IFF_ECHO|\
                IFF_MASTER|IFF_SLAVE|IFF_RUNNING|IFF_LOWER_UP|IFF_DORMANT)
 
 /* Private (from user) interface flags (netdevice->priv_flags). */
@@ -60,6 +62,7 @@
 #define IFF_MASTER_ALB 0x10            /* bonding master, balance-alb. */
 #define IFF_BONDING    0x20            /* bonding master or slave      */
 #define IFF_SLAVE_NEEDARP 0x40         /* need ARPs for validation     */
+#define IFF_ISATAP     0x80            /* ISATAP interface (RFC4214)   */
 
 #define IF_GET_IFACE   0x0001          /* for querying only */
 #define IF_GET_PROTO   0x0002
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
new file mode 100644 (file)
index 0000000..392487e
--- /dev/null
@@ -0,0 +1,39 @@
+#ifndef __LINUX_NETFILTER_H
+#define __LINUX_NETFILTER_H
+
+
+/* Responses from hook functions. */
+#define NF_DROP 0
+#define NF_ACCEPT 1
+#define NF_STOLEN 2
+#define NF_QUEUE 3
+#define NF_REPEAT 4
+#define NF_STOP 5
+#define NF_MAX_VERDICT NF_STOP
+
+/* we overload the higher bits for encoding auxiliary data such as the queue
+ * number. Not nice, but better than additional function arguments. */
+#define NF_VERDICT_MASK 0x0000ffff
+#define NF_VERDICT_BITS 16
+
+#define NF_VERDICT_QMASK 0xffff0000
+#define NF_VERDICT_QBITS 16
+
+#define NF_QUEUE_NR(x) (((x << NF_VERDICT_QBITS) & NF_VERDICT_QMASK) | NF_QUEUE)
+
+/* only for userspace compatibility */
+/* Generic cache responses from hook functions.
+   <= 0x2000 is used for protocol-flags. */
+#define NFC_UNKNOWN 0x4000
+#define NFC_ALTERED 0x8000
+
+enum nf_inet_hooks {
+       NF_INET_PRE_ROUTING,
+       NF_INET_LOCAL_IN,
+       NF_INET_FORWARD,
+       NF_INET_LOCAL_OUT,
+       NF_INET_POST_ROUTING,
+       NF_INET_NUMHOOKS
+};
+
+#endif /*__LINUX_NETFILTER_H*/
index b83623321f64622300713da758d703126cc8a969..f1754d1048e6d9fc91881778dd6da2cba4f21472 100644 (file)
@@ -148,10 +148,10 @@ struct ipt_getinfo
        unsigned int valid_hooks;
 
        /* Hook entry points: one per netfilter hook. */
-       unsigned int hook_entry[NF_IP_NUMHOOKS];
+       unsigned int hook_entry[NF_INET_NUMHOOKS];
 
        /* Underflow points. */
-       unsigned int underflow[NF_IP_NUMHOOKS];
+       unsigned int underflow[NF_INET_NUMHOOKS];
 
        /* Number of entries */
        unsigned int num_entries;
@@ -177,10 +177,10 @@ struct ipt_replace
        unsigned int size;
 
        /* Hook entry points. */
-       unsigned int hook_entry[NF_IP_NUMHOOKS];
+       unsigned int hook_entry[NF_INET_NUMHOOKS];
 
        /* Underflow points. */
-       unsigned int underflow[NF_IP_NUMHOOKS];
+       unsigned int underflow[NF_INET_NUMHOOKS];
 
        /* Information about old entries: */
        /* Number of counters (must be equal to current number of entries). */
index 4cd0abf540caa1d72350dd9ed3a26d0583317810..3b90a9749c76b3fab0c69b6b22f2b89b113bd292 100644 (file)
@@ -100,6 +100,13 @@ enum {
        RTM_NEWNDUSEROPT = 68,
 #define RTM_NEWNDUSEROPT RTM_NEWNDUSEROPT
 
+       RTM_NEWADDRLABEL = 72,
+#define RTM_NEWADDRLABEL RTM_NEWADDRLABEL
+       RTM_DELADDRLABEL,
+#define RTM_NEWADDRLABEL RTM_NEWADDRLABEL
+       RTM_GETADDRLABEL,
+#define RTM_GETADDRLABEL RTM_GETADDRLABEL
+
        __RTM_MAX,
 #define RTM_MAX                (((__RTM_MAX + 3) & ~3) - 1)
 };
index 7028e8315fe05d7770169ac1b26e96a7155e13d5..0d4c15f2e24ef4120835dc3971f0da38801da205 100644 (file)
@@ -23,7 +23,6 @@ struct __kernel_sockaddr_storage {
 #include <linux/uio.h>                 /* iovec support                */
 #include <linux/types.h>               /* pid_t                        */
 
-extern int sysctl_somaxconn;
 #ifdef CONFIG_PROC_FS
 struct seq_file;
 extern void socket_seq_show(struct seq_file *seq);
@@ -182,6 +181,7 @@ struct ucred {
 #define AF_PPPOX       24      /* PPPoX sockets                */
 #define AF_WANPIPE     25      /* Wanpipe API Sockets */
 #define AF_LLC         26      /* Linux LLC                    */
+#define AF_CAN         29      /* Controller Area Network      */
 #define AF_TIPC                30      /* TIPC sockets                 */
 #define AF_BLUETOOTH   31      /* Bluetooth sockets            */
 #define AF_IUCV                32      /* IUCV sockets                 */
@@ -217,6 +217,7 @@ struct ucred {
 #define PF_PPPOX       AF_PPPOX
 #define PF_WANPIPE     AF_WANPIPE
 #define PF_LLC         AF_LLC
+#define PF_CAN         AF_CAN
 #define PF_TIPC                AF_TIPC
 #define PF_BLUETOOTH   AF_BLUETOOTH
 #define PF_IUCV                AF_IUCV
index acbb8d2d89ca619171397af6acd6606acff88328..1539dc180af197acd3117f05086af3b9bbfe2ccc 100644 (file)
@@ -16,6 +16,7 @@
 #include <arpa/inet.h>
 #include <linux/if.h>
 #include <iptables.h>
+#include <linux/netfilter.h>
 #include <linux/netfilter_ipv4/ip_tables.h>
 #include "utils.h"
 #include "tc_util.h"
diff --git a/tc/q_rlim.c b/tc/q_rlim.c
new file mode 100644 (file)
index 0000000..c90796d
--- /dev/null
@@ -0,0 +1,129 @@
+/*
+ * q_rtlim.c           RTLIM.
+ *
+ *             This program is free software; you can redistribute it and/or
+ *             modify it under the terms of the GNU General Public License
+ *             as published by the Free Software Foundation; either version
+ *             2 of the License, or (at your option) any later version.
+ *
+ * Authors:    Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <syslog.h>
+#include <fcntl.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <string.h>
+
+#include "utils.h"
+#include "tc_util.h"
+
+static void explain(void)
+{
+       fprintf(stderr, 
+               "Usage: ... rlim limit PACKETS rate KBPS [ overhead BYTES ]\n");
+}
+
+static void explain1(char *arg)
+{
+       fprintf(stderr, "Illegal \"%s\"\n", arg);
+}
+
+
+#define usage() return(-1)
+
+static int rlim_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n)
+{
+       unsigned x;
+       struct tc_rlim_qopt opt = { 
+               .overhead = 24,         /* Ether IPG + Preamble + CRC */
+       };
+       struct rtattr *tail;
+
+       while (argc > 0) {
+               if (matches(*argv, "limit") == 0) {
+                       NEXT_ARG();
+                       if (opt.limit) {
+                               fprintf(stderr, "Double \"limit\" spec\n");
+                               return -1;
+                       }
+                       if (get_size(&opt.limit, *argv)) {
+                               explain1("limit");
+                               return -1;
+                       }
+               } else if (strcmp(*argv, "rate") == 0) {
+                       NEXT_ARG();
+                       if (opt.rate) {
+                               fprintf(stderr, "Double \"rate\" spec\n");
+                               return -1;
+                       }
+
+                       if (get_rate(&x, *argv)) {
+                               explain1("rate");
+                               return -1;
+                       }
+                       opt.rate = x;
+               } else if (strcmp(*argv, "help") == 0) {
+                       explain();
+                       return -1;
+               } else {
+                       fprintf(stderr, "What is \"%s\"?\n", *argv);
+                       explain();
+                       return -1;
+               }
+               argc--; argv++;
+       }
+
+       if (opt.rate == 0) {
+               fprintf(stderr, "\"rate\" is required.\n");
+               return -1;
+       }
+
+       if (opt.limit == 0)
+               opt.limit = 1000;
+
+       tail = NLMSG_TAIL(n);
+       addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
+       addattr_l(n, 2024, TCA_RLIM_PARMS, &opt, sizeof(opt));
+       tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
+
+       return 0;
+}
+
+static int rlim_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
+{
+       struct rtattr *tb[TCA_RLIM_PARMS+1];
+       struct tc_rlim_qopt *qopt;
+       SPRINT_BUF(b1);
+       SPRINT_BUF(b2);
+
+       if (opt == NULL)
+               return 0;
+
+       parse_rtattr_nested(tb, TCA_RLIM_PARMS, opt);
+       if (tb[TCA_RLIM_PARMS] == NULL)
+               return -1;
+
+       qopt = RTA_DATA(tb[TCA_RLIM_PARMS]);
+       if (RTA_PAYLOAD(tb[TCA_RLIM_PARMS])  < sizeof(*qopt))
+               return -1;
+
+       fprintf(f, "limit %s rate %s overhead %u", 
+               sprint_size(qopt->limit, b1),
+               sprint_rate(qopt->rate, b2),
+               qopt->overhead);
+
+       return 0;
+}
+
+struct qdisc_util rlim_qdisc_util = {
+       .id             = "rlim",
+       .parse_qopt     = rlim_parse_opt,
+       .print_qopt     = rlim_print_opt,
+};
+