complete nfnl_talk
PATCH 1/1 complete nfnl_talk
Hi Harald,
this patch completes nfnl_talk and removes a couple of compiler warnings.
Best regards,
Patrick
? ChangeLog
Index: iptables2/libctnetlink/libctnetlink.c
===================================================================
RCS file: /cvspublic/netfilter/iptables2/libctnetlink/libctnetlink.c,v retrieving revision 1.3
libctnetlink/libctnetlink.c +1 -1
@@ -34,7 +34,7 @@#include "libctnetlink.h" #define ctnl_error(format, args...) \ - fprintf(stderr, __FUNCTION__ ": " format, ## args) + fprintf(stderr, "%s: " format, __FUNCTION__, ## args)/*********************************************************************** * low level stuff
Index: iptables2/libnfnetlink/libnfnetlink.c
===================================================================
RCS file: /cvspublic/netfilter/iptables2/libnfnetlink/libnfnetlink.c,v retrieving revision 1.2
libnfnetlink/libnfnetlink.c +56 -7
98 lines not on this page · raw message
Quoted 3 lines · Patrick McHardy
Hi Harald,
this patch completesnfnl_talkand removes a couple of compiler warnings.
Hi Patrick
Good thing that you are fixing up this stuff.
I have two patches that might be of interest. They are old and quite ugly...
http://kashyyyk.netfilter.org/~gandalf/patches/nfnetlink_conntrack-fix.diff
Without this patch it's very easy for a regular user to cause a NULL pointer dereference. Harald has already included the kfree hunk in cvs but not the memset's.
http://kashyyyk.netfilter.org/~gandalf/patches/libctnetlink-020809-2.diff
Change the ctnl_get_conntrack() interface a bit (incremental to my earlier fixes to that stuff).
And finally the patch I use for oidentd
http://kashyyyk.netfilter.org/~gandalf/patches/oidentd-2.0.3+cvs20020603-ctnetlink-diff
Just here so people can see the interface.
Signature · 1 line
/Martin
Hi Martin,
Quoted 4 lines · Martin Josefsson
Hi Patrick
Good thing that you are fixing up this stuff.
Quoted 8 lines
I have two patches that might be of interest. They are old and quite ugly...
http://kashyyyk.netfilter.org/~gandalf/patches/nfnetlink_conntrack-fix.diff
Without this patch it's very easy for a regular user to cause a NULL pointer dereference. Harald has already included the kfree hunk in cvs but not the memset's.
I don't know if you've seen my changes to nfnetlink, i've added the memsets to nfnetlink_check_attributes and changed ctnl_dump_table (iirc thats where the kfree_skb was) quite a bit.
Quoted 9 lines
http://kashyyyk.netfilter.org/~gandalf/patches/libctnetlink-020809-2.diff
Change thectnl_get_conntrack()interface a bit (incremental to my earlier fixes to that stuff).And finally the patch I use for oidentd
http://kashyyyk.netfilter.org/~gandalf/patches/oidentd-2.0.3+cvs20020603-ctnetlink-diff
Just here so people can see the interface.
I have to get the source and patch it, i tried figuring out what exactly it does from the diffs but didn't got it ;)
Thanks for the hints,
Patrick
One tought about the patch:
Quoted 6 lines
int nfnl_talk(struct
nfnl_handle*nfnlh, struct nlmsghdr *n,pid_tpeer,
unsigned groups, struct nlmsghdr *answer,
int (*junk)(structsockaddr_nl*, struct nlmsghdr *n, void *), void *jarg)
...
Quoted 7 lines
libnfnetlink/libnfnetlink.c +4
-0+if (h->nlmsg_type ==NLMSG_ERROR ) { +struct nlmsgerr *err =NLMSG_DATA (h); +if (l <sizeof (struct nlmsgerr )) +nfnl_error ("ERROR truncated\n" );
libnfnetlink/libnfnetlink.c line 346
Quoted 10 lines
libnfnetlink/libnfnetlink.c +10
-0+else { + errno = -err->error; +if (errno ==0 ) { +if (answer) +memcpy (answer, h, h->nlmsg_len); +return 0 ; + } +perror ("CTNETLINK answers" ); + } +return -1 ;
applications might want to handle the error themselves, an alternative would be:
errno = -err->error;
if (anwer) {
memcpy(answer, h, h->nlmsg_len);
return errno;
} else if (errno)
perror("CTNETLINK answers);return errno;
What do you think ?
Patrick