SOURCES (LINUX_2_6): pom-ng-IPMARK-20061213.patch (NEW), pom-ng-IP...
mguevara
mguevara at pld-linux.org
Thu Dec 14 14:06:12 CET 2006
Author: mguevara Date: Thu Dec 14 13:06:12 2006 GMT
Module: SOURCES Tag: LINUX_2_6
---- Log message:
- 2.6.19 work in progress
---- Files affected:
SOURCES:
pom-ng-IPMARK-20061213.patch (NONE -> 1.1.2.1) (NEW), pom-ng-IPV4OPTSSTRIP-20061213.patch (NONE -> 1.1.2.1) (NEW), pom-ng-ROUTE-20061213.patch (NONE -> 1.1.2.1) (NEW), pom-ng-TARPIT-20061213.patch (NONE -> 1.1.2.1) (NEW), pom-ng-connlimit-20061213.patch (NONE -> 1.1.2.1) (NEW), pom-ng-geoip-20061213.patch (NONE -> 1.1.2.1) (NEW), pom-ng-ipp2p-20061213.patch (NONE -> 1.1.2.1) (NEW), pom-ng-ipv4options-20061213.patch (NONE -> 1.1.2.1) (NEW), pom-ng-mms-conntrack-nat-20061213.patch (NONE -> 1.1.2.1) (NEW), pom-ng-quake3-conntrack-nat-20061213.patch (NONE -> 1.1.2.1) (NEW), pom-ng-rpc-20061213.patch (NONE -> 1.1.2.1) (NEW), pom-ng-rsh-20061213.patch (NONE -> 1.1.2.1) (NEW), pom-ng-rtsp-conntrack-20061213.patch (NONE -> 1.1.2.1) (NEW), pom-ng-set-20061213.patch (NONE -> 1.1.2.1) (NEW), pom-ng-talk-conntrack-nat-20061213.patch (NONE -> 1.1.2.1) (NEW), pom-ng-time-20061213.patch (NONE -> 1.1.2.1) (NEW), pom-ng-u32-20061213.patch (NONE -> 1.1.2.1) (NEW), bootsplas
h-3.1.6-2.6.15.diff (1.3.4.1 -> 1.3.4.2)
---- Diffs:
================================================================
Index: SOURCES/pom-ng-IPMARK-20061213.patch
diff -u /dev/null SOURCES/pom-ng-IPMARK-20061213.patch:1.1.2.1
--- /dev/null Thu Dec 14 14:06:12 2006
+++ SOURCES/pom-ng-IPMARK-20061213.patch Thu Dec 14 14:06:07 2006
@@ -0,0 +1,155 @@
+diff -NurpP --minimal linux-2.6.19-pom-ng/include/linux/netfilter_ipv4/ipt_IPMARK.h linux-2.6.19/include/linux/netfilter_ipv4/ipt_IPMARK.h
+--- linux-2.6.19-pom-ng/include/linux/netfilter_ipv4/ipt_IPMARK.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.19/include/linux/netfilter_ipv4/ipt_IPMARK.h 2006-12-14 12:34:42.000000000 +0100
+@@ -0,0 +1,13 @@
++#ifndef _IPT_IPMARK_H_target
++#define _IPT_IPMARK_H_target
++
++struct ipt_ipmark_target_info {
++ unsigned long andmask;
++ unsigned long ormask;
++ unsigned char addr;
++};
++
++#define IPT_IPMARK_SRC 0
++#define IPT_IPMARK_DST 1
++
++#endif /*_IPT_IPMARK_H_target*/
+diff -NurpP --minimal linux-2.6.19-pom-ng/net/ipv4/netfilter/Kconfig linux-2.6.19/net/ipv4/netfilter/Kconfig
+--- linux-2.6.19-pom-ng/net/ipv4/netfilter/Kconfig 2006-12-14 11:44:16.000000000 +0100
++++ linux-2.6.19/net/ipv4/netfilter/Kconfig 2006-12-14 12:34:42.000000000 +0100
+@@ -932,5 +932,23 @@ config IP_NF_TALK
+ If you want to compile it as a module, say 'M' here and read
+ Documentation/modules.txt. If unsure, say 'N'.
+
++config IP_NF_TARGET_IPMARK
++ tristate 'IPMARK target support'
++ depends on IP_NF_MANGLE
++ help
++ This option adds a `IPMARK' target, which allows you to create rules
++ in the `mangle' table which alter the netfilter mark field basing
++ on the source or destination ip address of the packet.
++ This is very useful for very fast massive shaping - using only one
++ rule you can direct packets to houndreds different queues.
++ You will probably find it helpful only if your linux machine acts as
++ a shaper for many others computers.
++
++ If you want to compile it as a module, say M here and read
++ <file:Documentation/modules.txt>. The module will be called
++ ipt_IPMARK.o. If unsure, say `N'.
++
++
++
+ endmenu
+
+diff -NurpP --minimal linux-2.6.19-pom-ng/net/ipv4/netfilter/Makefile linux-2.6.19/net/ipv4/netfilter/Makefile
+--- linux-2.6.19-pom-ng/net/ipv4/netfilter/Makefile 2006-12-14 11:44:16.000000000 +0100
++++ linux-2.6.19/net/ipv4/netfilter/Makefile 2006-12-14 12:34:42.000000000 +0100
+@@ -100,6 +100,7 @@ obj-$(CONFIG_IP_NF_TARGET_ULOG) += ipt_U
+ obj-$(CONFIG_IP_NF_TARGET_TCPMSS) += ipt_TCPMSS.o
+ obj-$(CONFIG_IP_NF_TARGET_CLUSTERIP) += ipt_CLUSTERIP.o
+ obj-$(CONFIG_IP_NF_TARGET_TTL) += ipt_TTL.o
++obj-$(CONFIG_IP_NF_TARGET_IPMARK) += ipt_IPMARK.o
+ obj-$(CONFIG_IP_NF_TARGET_SET) += ipt_SET.o
+
+ # sets
+diff -NurpP --minimal linux-2.6.19-pom-ng/net/ipv4/netfilter/ipt_IPMARK.c linux-2.6.19/net/ipv4/netfilter/ipt_IPMARK.c
+--- linux-2.6.19-pom-ng/net/ipv4/netfilter/ipt_IPMARK.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.19/net/ipv4/netfilter/ipt_IPMARK.c 2006-12-14 12:34:42.000000000 +0100
+@@ -0,0 +1,96 @@
++#include <linux/module.h>
++#include <linux/skbuff.h>
++#include <linux/version.h>
++#include <linux/ip.h>
++#include <net/checksum.h>
++
++#include <linux/netfilter_ipv4/ip_tables.h>
++#include <linux/netfilter_ipv4/ipt_IPMARK.h>
++
++MODULE_AUTHOR("Grzegorz Janoszka <Grzegorz at Janoszka.pl>");
++MODULE_DESCRIPTION("IP tables IPMARK: mark based on ip address");
++MODULE_LICENSE("GPL");
++
++static unsigned int
++target(struct sk_buff **pskb,
++ const struct net_device *in,
++ const struct net_device *out,
++ unsigned int hooknum,
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,17)
++ const struct xt_target *target,
++#endif
++ const void *targinfo,
++ void *userinfo)
++{
++ const struct ipt_ipmark_target_info *ipmarkinfo = targinfo;
++ struct iphdr *iph = (*pskb)->nh.iph;
++ unsigned long mark;
++
++ if (ipmarkinfo->addr == IPT_IPMARK_SRC)
++ mark = (unsigned long) ntohl(iph->saddr);
++ else
++ mark = (unsigned long) ntohl(iph->daddr);
++
++ mark &= ipmarkinfo->andmask;
++ mark |= ipmarkinfo->ormask;
++
++ if ((*pskb)->nfmark != mark)
++ (*pskb)->nfmark = mark;
++
++ return IPT_CONTINUE;
++}
++
++static int
++checkentry(const char *tablename,
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
++ const void *e,
++#else
++ const struct ipt_entry *e,
++#endif
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,17)
++ const struct xt_target *target,
++#endif
++ void *targinfo,
++ unsigned int targinfosize,
++ unsigned int hook_mask)
++{
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,17)
++ if (targinfosize != IPT_ALIGN(sizeof(struct ipt_ipmark_target_info))) {
++ printk(KERN_WARNING "IPMARK: targinfosize %u != %Zu\n",
++ targinfosize,
++ IPT_ALIGN(sizeof(struct ipt_ipmark_target_info)));
++ return 0;
++ }
++#endif
++
++ if (strcmp(tablename, "mangle") != 0) {
++ printk(KERN_WARNING "IPMARK: can only be called from \"mangle\" table, not \"%s\"\n", tablename);
++ return 0;
++ }
++
++ return 1;
++}
++
++static struct ipt_target ipt_ipmark_reg = {
++ .name = "IPMARK",
++ .target = target,
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,17)
++ .targetsize = sizeof(struct ipt_ipmark_target_info),
++#endif
++ .checkentry = checkentry,
++ .me = THIS_MODULE
++};
++
++static int __init init(void)
++{
++ return ipt_register_target(&ipt_ipmark_reg);
++}
++
++static void __exit fini(void)
++{
++ ipt_unregister_target(&ipt_ipmark_reg);
++}
++
++module_init(init);
++module_exit(fini);
================================================================
Index: SOURCES/pom-ng-IPV4OPTSSTRIP-20061213.patch
diff -u /dev/null SOURCES/pom-ng-IPV4OPTSSTRIP-20061213.patch:1.1.2.1
--- /dev/null Thu Dec 14 14:06:12 2006
+++ SOURCES/pom-ng-IPV4OPTSSTRIP-20061213.patch Thu Dec 14 14:06:07 2006
@@ -0,0 +1,121 @@
+diff -NurpP --minimal /home/users/builder/linux-2.6.19/net/ipv4/netfilter/Kconfig linux-2.6.19/net/ipv4/netfilter/Kconfig
+--- /home/users/builder/linux-2.6.19/net/ipv4/netfilter/Kconfig 2006-11-29 22:57:37.000000000 +0100
++++ linux-2.6.19/net/ipv4/netfilter/Kconfig 2006-12-14 09:49:45.000000000 +0100
+@@ -623,5 +623,15 @@ config IP_NF_ARP_MANGLE
+ Allows altering the ARP packet payload: source and destination
+ hardware and network addresses.
+
++config IP_NF_TARGET_IPV4OPTSSTRIP
++ tristate 'IPV4OPTSSTRIP target support'
++ depends on IP_NF_MANGLE
++ help
++ This option adds an IPV4OPTSSTRIP target.
++ This target allows you to strip all IP options in a packet.
++
++ If you want to compile it as a module, say M here and read
++ Documentation/modules.txt. If unsure, say `N'.
++
+ endmenu
+
+diff -NurpP --minimal /home/users/builder/linux-2.6.19/net/ipv4/netfilter/Makefile linux-2.6.19/net/ipv4/netfilter/Makefile
+--- /home/users/builder/linux-2.6.19/net/ipv4/netfilter/Makefile 2006-11-29 22:57:37.000000000 +0100
++++ linux-2.6.19/net/ipv4/netfilter/Makefile 2006-12-14 09:49:45.000000000 +0100
+@@ -73,6 +73,7 @@ obj-$(CONFIG_IP_NF_TARGET_NETMAP) += ipt
+ obj-$(CONFIG_IP_NF_TARGET_SAME) += ipt_SAME.o
+ obj-$(CONFIG_IP_NF_NAT_SNMP_BASIC) += ip_nat_snmp_basic.o
+ obj-$(CONFIG_IP_NF_TARGET_LOG) += ipt_LOG.o
++obj-$(CONFIG_IP_NF_TARGET_IPV4OPTSSTRIP) += ipt_IPV4OPTSSTRIP.o
+ obj-$(CONFIG_IP_NF_TARGET_ULOG) += ipt_ULOG.o
+ obj-$(CONFIG_IP_NF_TARGET_TCPMSS) += ipt_TCPMSS.o
+ obj-$(CONFIG_IP_NF_TARGET_CLUSTERIP) += ipt_CLUSTERIP.o
+diff -NurpP --minimal /home/users/builder/linux-2.6.19/net/ipv4/netfilter/ipt_IPV4OPTSSTRIP.c linux-2.6.19/net/ipv4/netfilter/ipt_IPV4OPTSSTRIP.c
+--- /home/users/builder/linux-2.6.19/net/ipv4/netfilter/ipt_IPV4OPTSSTRIP.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.19/net/ipv4/netfilter/ipt_IPV4OPTSSTRIP.c 2006-12-14 09:49:45.000000000 +0100
+@@ -0,0 +1,87 @@
++/**
++ * Strip all IP options in the IP packet header.
++ *
++ * (C) 2001 by Fabrice MARIE <fabrice at netfilter.org>
++ * This software is distributed under GNU GPL v2, 1991
++ */
++
++#include <linux/module.h>
++#include <linux/skbuff.h>
++#include <net/ip.h>
++#include <net/checksum.h>
++
++#include <linux/netfilter_ipv4/ip_tables.h>
++
++MODULE_AUTHOR("Fabrice MARIE <fabrice at netfilter.org>");
++MODULE_DESCRIPTION("Strip all options in IPv4 packets");
++MODULE_LICENSE("GPL");
++
++static unsigned int
++target(struct sk_buff **pskb,
++ const struct net_device *in,
++ const struct net_device *out,
++ unsigned int hooknum,
++ const void *targinfo,
++ void *userinfo)
++{
++ struct iphdr *iph;
++ struct sk_buff *skb;
++ struct ip_options *opt;
++ unsigned char *optiph;
++ int l;
++
++ if (!skb_ip_make_writable(pskb, (*pskb)->len))
++ return NF_DROP;
++
++ skb = (*pskb);
++ iph = (*pskb)->nh.iph;
++ optiph = skb->nh.raw;
++ l = ((struct ip_options *)(&(IPCB(skb)->opt)))->optlen;
++
++ /* if no options in packet then nothing to clear. */
++ if (iph->ihl * 4 == sizeof(struct iphdr))
++ return IPT_CONTINUE;
++
++ /* else clear all options */
++ memset(&(IPCB(skb)->opt), 0, sizeof(struct ip_options));
++ memset(optiph+sizeof(struct iphdr), IPOPT_NOOP, l);
++ opt = &(IPCB(skb)->opt);
++ opt->is_data = 0;
++ opt->optlen = l;
++
++ return IPT_CONTINUE;
++}
++
++static int
++checkentry(const char *tablename,
++ const struct ipt_entry *e,
++ void *targinfo,
++ unsigned int targinfosize,
++ unsigned int hook_mask)
++{
++ if (strcmp(tablename, "mangle")) {
++ printk(KERN_WARNING "IPV4OPTSSTRIP: can only be called from \"mangle\" table, not \"%s\"\n", tablename);
++ return 0;
++ }
++ /* nothing else to check because no parameters */
++ return 1;
++}
++
++static struct ipt_target ipt_ipv4optsstrip_reg = {
++ .name = "IPV4OPTSSTRIP",
++ .target = target,
++ .checkentry = checkentry,
++ .me = THIS_MODULE };
++
++static int __init init(void)
++{
++ return ipt_register_target(&ipt_ipv4optsstrip_reg);
++}
++
++static void __exit fini(void)
++{
++ ipt_unregister_target(&ipt_ipv4optsstrip_reg);
++}
++
++module_init(init);
++module_exit(fini);
================================================================
Index: SOURCES/pom-ng-ROUTE-20061213.patch
diff -u /dev/null SOURCES/pom-ng-ROUTE-20061213.patch:1.1.2.1
--- /dev/null Thu Dec 14 14:06:12 2006
+++ SOURCES/pom-ng-ROUTE-20061213.patch Thu Dec 14 14:06:07 2006
@@ -0,0 +1,959 @@
+diff -NurpP --minimal /home/users/builder/linux-2.6.19/include/linux/netfilter_ipv4/ipt_ROUTE.h linux-2.6.19/include/linux/netfilter_ipv4/ipt_ROUTE.h
+--- /home/users/builder/linux-2.6.19/include/linux/netfilter_ipv4/ipt_ROUTE.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.19/include/linux/netfilter_ipv4/ipt_ROUTE.h 2006-12-14 10:26:46.000000000 +0100
+@@ -0,0 +1,23 @@
++/* Header file for iptables ipt_ROUTE target
++ *
++ * (C) 2002 by Cédric de Launois <delaunois at info.ucl.ac.be>
++ *
++ * This software is distributed under GNU GPL v2, 1991
++ */
++#ifndef _IPT_ROUTE_H_target
++#define _IPT_ROUTE_H_target
++
++#define IPT_ROUTE_IFNAMSIZ 16
++
++struct ipt_route_target_info {
++ char oif[IPT_ROUTE_IFNAMSIZ]; /* Output Interface Name */
++ char iif[IPT_ROUTE_IFNAMSIZ]; /* Input Interface Name */
++ u_int32_t gw; /* IP address of gateway */
++ u_int8_t flags;
++};
++
++/* Values for "flags" field */
++#define IPT_ROUTE_CONTINUE 0x01
++#define IPT_ROUTE_TEE 0x02
++
++#endif /*_IPT_ROUTE_H_target*/
+diff -NurpP --minimal /home/users/builder/linux-2.6.19/include/linux/netfilter_ipv6/ip6t_ROUTE.h linux-2.6.19/include/linux/netfilter_ipv6/ip6t_ROUTE.h
+--- /home/users/builder/linux-2.6.19/include/linux/netfilter_ipv6/ip6t_ROUTE.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.19/include/linux/netfilter_ipv6/ip6t_ROUTE.h 2006-12-14 10:26:46.000000000 +0100
+@@ -0,0 +1,23 @@
++/* Header file for iptables ip6t_ROUTE target
++ *
++ * (C) 2003 by Cédric de Launois <delaunois at info.ucl.ac.be>
++ *
++ * This software is distributed under GNU GPL v2, 1991
++ */
++#ifndef _IPT_ROUTE_H_target
++#define _IPT_ROUTE_H_target
++
++#define IP6T_ROUTE_IFNAMSIZ 16
++
++struct ip6t_route_target_info {
++ char oif[IP6T_ROUTE_IFNAMSIZ]; /* Output Interface Name */
++ char iif[IP6T_ROUTE_IFNAMSIZ]; /* Input Interface Name */
++ u_int32_t gw[4]; /* IPv6 address of gateway */
++ u_int8_t flags;
++};
++
++/* Values for "flags" field */
++#define IP6T_ROUTE_CONTINUE 0x01
++#define IP6T_ROUTE_TEE 0x02
++
++#endif /*_IP6T_ROUTE_H_target*/
+diff -NurpP --minimal /home/users/builder/linux-2.6.19/net/ipv4/netfilter/Kconfig linux-2.6.19/net/ipv4/netfilter/Kconfig
+--- /home/users/builder/linux-2.6.19/net/ipv4/netfilter/Kconfig 2006-11-29 22:57:37.000000000 +0100
++++ linux-2.6.19/net/ipv4/netfilter/Kconfig 2006-12-14 10:26:46.000000000 +0100
+@@ -623,5 +623,22 @@ config IP_NF_ARP_MANGLE
+ Allows altering the ARP packet payload: source and destination
+ hardware and network addresses.
+
++config IP_NF_TARGET_ROUTE
++ tristate 'ROUTE target support'
++ depends on IP_NF_MANGLE
++ help
++ This option adds a `ROUTE' target, which enables you to setup unusual
++ routes. For example, the ROUTE lets you route a received packet through
++ an interface or towards a host, even if the regular destination of the
++ packet is the router itself. The ROUTE target is also able to change the
++ incoming interface of a packet.
++
++ The target can be or not a final target. It has to be used inside the
++ mangle table.
++
++ If you want to compile it as a module, say M here and read
++ Documentation/modules.txt. The module will be called ipt_ROUTE.o.
++ If unsure, say `N'.
++
+ endmenu
+
+diff -NurpP --minimal /home/users/builder/linux-2.6.19/net/ipv4/netfilter/Makefile linux-2.6.19/net/ipv4/netfilter/Makefile
+--- /home/users/builder/linux-2.6.19/net/ipv4/netfilter/Makefile 2006-11-29 22:57:37.000000000 +0100
++++ linux-2.6.19/net/ipv4/netfilter/Makefile 2006-12-14 10:26:46.000000000 +0100
+@@ -69,6 +69,7 @@ obj-$(CONFIG_IP_NF_TARGET_TOS) += ipt_TO
+ obj-$(CONFIG_IP_NF_TARGET_ECN) += ipt_ECN.o
+ obj-$(CONFIG_IP_NF_TARGET_MASQUERADE) += ipt_MASQUERADE.o
+ obj-$(CONFIG_IP_NF_TARGET_REDIRECT) += ipt_REDIRECT.o
++obj-$(CONFIG_IP_NF_TARGET_ROUTE) += ipt_ROUTE.o
+ obj-$(CONFIG_IP_NF_TARGET_NETMAP) += ipt_NETMAP.o
+ obj-$(CONFIG_IP_NF_TARGET_SAME) += ipt_SAME.o
+ obj-$(CONFIG_IP_NF_NAT_SNMP_BASIC) += ip_nat_snmp_basic.o
+diff -NurpP --minimal /home/users/builder/linux-2.6.19/net/ipv4/netfilter/ipt_ROUTE.c linux-2.6.19/net/ipv4/netfilter/ipt_ROUTE.c
+--- /home/users/builder/linux-2.6.19/net/ipv4/netfilter/ipt_ROUTE.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.19/net/ipv4/netfilter/ipt_ROUTE.c 2006-12-14 10:26:46.000000000 +0100
+@@ -0,0 +1,464 @@
++/*
++ * This implements the ROUTE target, which enables you to setup unusual
++ * routes not supported by the standard kernel routing table.
++ *
++ * Copyright (C) 2002 Cedric de Launois <delaunois at info.ucl.ac.be>
++ *
++ * v 1.11 2004/11/23
++ *
++ * This software is distributed under GNU GPL v2, 1991
++ */
++
++#include <linux/module.h>
++#include <linux/skbuff.h>
++#include <linux/ip.h>
++#include <linux/netfilter_ipv4/ip_tables.h>
++#include <linux/netfilter_ipv4/ip_conntrack.h>
++#include <linux/netfilter_ipv4/ipt_ROUTE.h>
++#include <linux/netdevice.h>
++#include <linux/route.h>
++#include <linux/if_arp.h>
++#include <net/ip.h>
++#include <net/route.h>
++#include <net/icmp.h>
++#include <net/checksum.h>
++
++#if 0
++#define DEBUGP printk
++#else
++#define DEBUGP(format, args...)
++#endif
++
++MODULE_LICENSE("GPL");
++MODULE_AUTHOR("Cedric de Launois <delaunois at info.ucl.ac.be>");
++MODULE_DESCRIPTION("iptables ROUTE target module");
++
++/* Try to route the packet according to the routing keys specified in
++ * route_info. Keys are :
++ * - ifindex :
++ * 0 if no oif preferred,
++ * otherwise set to the index of the desired oif
++ * - route_info->gw :
++ * 0 if no gateway specified,
++ * otherwise set to the next host to which the pkt must be routed
++ * If success, skb->dev is the output device to which the packet must
++ * be sent and skb->dst is not NULL
++ *
++ * RETURN: -1 if an error occured
++ * 1 if the packet was succesfully routed to the
++ * destination desired
++ * 0 if the kernel routing table could not route the packet
++ * according to the keys specified
++ */
++static int route(struct sk_buff *skb,
++ unsigned int ifindex,
++ const struct ipt_route_target_info *route_info)
++{
++ int err;
++ struct rtable *rt;
++ struct iphdr *iph = skb->nh.iph;
++ struct flowi fl = {
++ .oif = ifindex,
++ .nl_u = {
++ .ip4_u = {
++ .daddr = iph->daddr,
++ .saddr = 0,
++ .tos = RT_TOS(iph->tos),
++ .scope = RT_SCOPE_UNIVERSE,
++ }
++ }
++ };
++
++ /* The destination address may be overloaded by the target */
++ if (route_info->gw)
++ fl.fl4_dst = route_info->gw;
++
++ /* Trying to route the packet using the standard routing table. */
++ if ((err = ip_route_output_key(&rt, &fl))) {
++ if (net_ratelimit())
++ DEBUGP("ipt_ROUTE: couldn't route pkt (err: %i)",err);
++ return -1;
++ }
++
++ /* Drop old route. */
++ dst_release(skb->dst);
++ skb->dst = NULL;
++
++ /* Success if no oif specified or if the oif correspond to the
++ * one desired */
++ if (!ifindex || rt->u.dst.dev->ifindex == ifindex) {
++ skb->dst = &rt->u.dst;
++ skb->dev = skb->dst->dev;
++ skb->protocol = htons(ETH_P_IP);
++ return 1;
++ }
++
++ /* The interface selected by the routing table is not the one
++ * specified by the user. This may happen because the dst address
++ * is one of our own addresses.
++ */
++ if (net_ratelimit())
++ DEBUGP("ipt_ROUTE: failed to route as desired gw=%u.%u.%u.%u oif=%i (got oif=%i)\n",
++ NIPQUAD(route_info->gw), ifindex, rt->u.dst.dev->ifindex);
++
++ return 0;
++}
++
++
++/* Stolen from ip_finish_output2
++ * PRE : skb->dev is set to the device we are leaving by
++ * skb->dst is not NULL
++ * POST: the packet is sent with the link layer header pushed
++ * the packet is destroyed
++ */
++static void ip_direct_send(struct sk_buff *skb)
++{
++ struct dst_entry *dst = skb->dst;
++ struct hh_cache *hh = dst->hh;
++ struct net_device *dev = dst->dev;
++ int hh_len = LL_RESERVED_SPACE(dev);
++
++ /* Be paranoid, rather than too clever. */
++ if (unlikely(skb_headroom(skb) < hh_len && dev->hard_header)) {
++ struct sk_buff *skb2;
++
++ skb2 = skb_realloc_headroom(skb, LL_RESERVED_SPACE(dev));
++ if (skb2 == NULL) {
++ kfree_skb(skb);
++ return;
++ }
++ if (skb->sk)
++ skb_set_owner_w(skb2, skb->sk);
++ kfree_skb(skb);
++ skb = skb2;
++ }
++
++ if (hh) {
++ int hh_alen;
++
++ read_lock_bh(&hh->hh_lock);
++ hh_alen = HH_DATA_ALIGN(hh->hh_len);
++ memcpy(skb->data - hh_alen, hh->hh_data, hh_alen);
++ read_unlock_bh(&hh->hh_lock);
++ skb_push(skb, hh->hh_len);
++ hh->hh_output(skb);
++ } else if (dst->neighbour)
++ dst->neighbour->output(skb);
++ else {
++ if (net_ratelimit())
++ DEBUGP(KERN_DEBUG "ipt_ROUTE: no hdr & no neighbour cache!\n");
++ kfree_skb(skb);
++ }
++}
++
++
++/* PRE : skb->dev is set to the device we are leaving by
++ * POST: - the packet is directly sent to the skb->dev device, without
++ * pushing the link layer header.
++ * - the packet is destroyed
++ */
++static inline int dev_direct_send(struct sk_buff *skb)
++{
++ return dev_queue_xmit(skb);
++}
++
++
++static unsigned int route_oif(const struct ipt_route_target_info *route_info,
++ struct sk_buff *skb)
++{
++ unsigned int ifindex = 0;
++ struct net_device *dev_out = NULL;
++
++ /* The user set the interface name to use.
++ * Getting the current interface index.
++ */
++ if ((dev_out = dev_get_by_name(route_info->oif))) {
++ ifindex = dev_out->ifindex;
++ } else {
++ /* Unknown interface name : packet dropped */
++ if (net_ratelimit())
++ DEBUGP("ipt_ROUTE: oif interface %s not found\n", route_info->oif);
++ return NF_DROP;
++ }
++
++ /* Trying the standard way of routing packets */
++ switch (route(skb, ifindex, route_info)) {
++ case 1:
++ dev_put(dev_out);
++ if (route_info->flags & IPT_ROUTE_CONTINUE)
++ return IPT_CONTINUE;
++
++ ip_direct_send(skb);
++ return NF_STOLEN;
++
++ case 0:
++ /* Failed to send to oif. Trying the hard way */
++ if (route_info->flags & IPT_ROUTE_CONTINUE)
++ return NF_DROP;
++
++ if (net_ratelimit())
++ DEBUGP("ipt_ROUTE: forcing the use of %i\n",
++ ifindex);
++
++ /* We have to force the use of an interface.
++ * This interface must be a tunnel interface since
++ * otherwise we can't guess the hw address for
++ * the packet. For a tunnel interface, no hw address
++ * is needed.
++ */
<<Diff was trimmed, longer than 597 lines>>
---- CVS-web:
http://cvs.pld-linux.org/SOURCES/bootsplash-3.1.6-2.6.15.diff?r1=1.3.4.1&r2=1.3.4.2&f=u
More information about the pld-cvs-commit
mailing list