Mr. Harald,

      Here's a patch to add the check_proto() facility to
ip_conntrack_protocol_register(). The comment at the top of that function
talked about checking the *proto argument for missing functions and adding
pointers to the generic protocol entry for it. This patch does that.
I'm not expecting this patch to be applied anytime soon, since it's not really
needed ;)

      Patch is enclosed and MIME'd.

Brad

<snip>

--- ip_conntrack_standalone.c.2 Fri Apr 19 17:21:32 2002
+++ ip_conntrack_standalone.c   Fri Apr 19 17:55:32 2002
@@ -389,8 +389,6 @@
        return ret;
 }
 
-/* FIXME: Allow NULL functions and sub in pointers to generic for
-   them. --RR */
 int ip_conntrack_protocol_register(struct ip_conntrack_protocol *proto)
 {
        int ret = 0;
@@ -405,6 +403,8 @@
                }
        }
 
+       /* See linux/netfilter_ipv4/ip_conntrack_protocol.h -- BC */
+       check_proto(proto);
        list_prepend(&protocol_list, proto);
        MOD_INC_USE_COUNT;

--- ip_conntrack_protocol.h.orig        Fri Apr 19 17:48:00 2002
+++ ip_conntrack_protocol.h     Fri Apr 19 17:50:50 2002
@@ -61,5 +61,26 @@
 extern struct ip_conntrack_protocol ip_conntrack_protocol_tcp;
 extern struct ip_conntrack_protocol ip_conntrack_protocol_udp;
 extern struct ip_conntrack_protocol ip_conntrack_protocol_icmp;
+
+extern struct ip_conntrack_protocol ip_conntrack_generic_protocol;
+#define GENERIC_PKT_TO_TUPLE       ip_conntrack_generic_protocol.pkt_to_tuple
+#define GENERIC_INVERT_TUPLE       ip_conntrack_generic_protocol.invert_tuple
+#define GENERIC_PRINT_TUPLE        ip_conntrack_generic_protocol.print_tuple
+#define GENERIC_PRINT_CONNTRACK            
+ip_conntrack_generic_protocol.print_conntrack
+#define GENERIC_PACKET             ip_conntrack_generic_protocol.packet
+#define GENERIC_NEW                ip_conntrack_generic_protocol.new
+#define GENERIC_EXP_MATCHES_PKT            
+ip_conntrack_generic_protocol.exp_matches_pkt
+
+extern __inline__ void check_proto(struct ip_conntrack_protocol *proto)
+{
+       if (!proto->pkt_to_tuple)       proto->pkt_to_tuple = GENERIC_PKT_TO_TUPLE;
+       if (!proto->invert_tuple)       proto->invert_tuple = GENERIC_INVER_TUPLE;
+       if (!proto->print_tuple)        proto->print_tuple = GENERIC_PRINT_TUPLE;
+       if (!proto->print_conntrack)    proto->print_conntrack = 
+GENERIC_PRINT_CONNTRACK;
+       if (!proto->packet)             proto->packet = GENERIC_PACKET;
+       if (!proto->new)                proto->new = GENERIC_NEW;
+       if (!proto->exp_matches_pkt)    proto->exp_matches_pkt = 
+GENERIC_EXP_MATCHES_PKT;
+}
+
 extern int ip_conntrack_protocol_tcp_init(void);
 #endif /*_IP_CONNTRACK_PROTOCOL_H*/

</snip>

=====
Brad Chapman

Permanent e-mail: [EMAIL PROTECTED]
Current e-mail: [EMAIL PROTECTED]
Alternate e-mail: [EMAIL PROTECTED]

__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/

Attachment: check_proto.patch
Description: check_proto.patch

Attachment: check_proto.patch.2
Description: check_proto.patch.2

Reply via email to