Introduce mnl_socket_open2()
cover Introduce mnl_socket_open2()
mnl_socket_open2() extends mnl_socket_open() with user provided flags, to be used in the socket() call.
Patch #1 implements the new function while patch #2 updates the examples by applying the SOCK_CLOEXEC flag on netlink sockets. Though it's a safe default, this flag isn't necessary for the simple programs under examples/. So feel free to drop patch #2 if considered of too little value.
Guillaume Nault (2):
socket: introduce mnl_socket_open2()
examples: use mnl_socket_open2()
examples/genl/genl-family-get.c | 4 ++-- examples/genl/genl-group-events.c | 4 ++-- examples/kobject/kobject-event.c | 4 ++-- examples/netfilter/nf-log.c | 4 ++-- examples/netfilter/nf-queue.c | 4 ++-- examples/netfilter/nfct-create-batch.c | 4 ++-- examples/netfilter/nfct-daemon.c | 4 ++-- examples/netfilter/nfct-dump.c | 4 ++-- examples/netfilter/nfct-event.c | 4 ++-- examples/rtnl/rtnl-addr-dump.c | 4 ++-- examples/rtnl/rtnl-link-dump.c | 4 ++-- examples/rtnl/rtnl-link-dump2.c | 4 ++-- examples/rtnl/rtnl-link-dump3.c | 4 ++-- examples/rtnl/rtnl-link-event.c | 4 ++-- examples/rtnl/rtnl-link-set.c | 4 ++-- examples/rtnl/rtnl-route-add.c | 4 ++-- examples/rtnl/rtnl-route-dump.c | 4 ++-- examples/rtnl/rtnl-route-event.c | 4 ++-- include/libmnl/libmnl.h | 3 ++- src/libmnl.map | 1 + src/socket.c | 41 ++++++++++++++++++++++++++-------- 21 files changed, 71 insertions(+), 46 deletions(-)
Signature · 1 line
2.6.0
PATCH 1/2 socket: introduce mnl_socket_open2()
Define mnl_socket_open2() so that user can pass a set of SOCK_* flags at socket creation time.
--- include/libmnl/libmnl.h | 3 ++- src/libmnl.map | 1 + src/socket.c | 41 ++++++++++++++++++++++++++++++++--------- 3 files changed, 35 insertions(+), 10 deletions(-)
include/libmnl/libmnl.h +2 -1
@@ -21,7 +21,8 @@ extern "C" {struct mnl_socket ; -extern struct mnl_socket *mnl_socket_open (int type); +extern struct mnl_socket *mnl_socket_open (int bus); +extern struct mnl_socket *mnl_socket_open2 (int bus,int flags);extern struct mnl_socket *mnl_socket_fdopen (int fd);extern int mnl_socket_bind (struct mnl_socket *nl,unsigned int groups,pid_t pid);extern int mnl_socket_close (struct mnl_socket *nl);
src/libmnl.map +1 -0
@@ -74,5 +74,6 @@ LIBMNL_1.1 { } LIBMNL_1.0; LIBMNL_1.2 { + mnl_socket_open2; mnl_socket_fdopen; } LIBMNL_1.1;
src/socket.c +32 -9
62 lines not on this page · raw message
Signature · 1 line
2.6.0
Pablo Neira Ayuso
maintainerRe: [PATCH libmnl 1/2] socket: introduce mnl_socket_open2()
Quoted 15 lines · Guillaume Nault
Define
mnl_socket_open2()so that user can pass a set of SOCK_* flags at socket creation time.Signed-off-by Guillaume Nault <[email protected]>--- include/libmnl/libmnl.h | 3 ++- src/libmnl.map | 1 + src/socket.c | 41 ++++++++++++++++++++++++++++++++--------- 3 files changed, 35 insertions(+), 10 deletions(-)include/libmnl/libmnl.h +0
-0
include/libmnl/libmnl.h extern "C" { · line 25
Quoted 6 lines
include/libmnl/libmnl.h +2
-1@@ -21,7 +21,8 @@ extern "C" {struct mnl_socket ; -extern struct mnl_socket *mnl_socket_open (int type); +extern struct mnl_socket *mnl_socket_open (int bus); +extern struct mnl_socket *mnl_socket_open2 (int bus,int flags);
Looks good, but we should be using 'unsigned int flags' instead, right?
Or am I missing anything?
Re: [PATCH libmnl 1/2] socket: introduce mnl_socket_open2()
Quoted 19 lines · Pablo Neira Ayuso
Quoted 18 lines · Guillaume Nault
Define
mnl_socket_open2()so that user can pass a set of SOCK_* flags at socket creation time.Signed-off-by Guillaume Nault <[email protected]>--- include/libmnl/libmnl.h | 3 ++- src/libmnl.map | 1 + src/socket.c | 41 ++++++++++++++++++++++++++++++++--------- 3 files changed, 35 insertions(+), 10 deletions(-)include/libmnl/libmnl.h +0
-0@@ -21,7 +21,8 @@ extern "C" {struct mnl_socket ;
Quoted 7 lines
include/libmnl/libmnl.h extern "C" { · line 25
Quoted 3 lines
include/libmnl/libmnl.h +2
-1-extern struct mnl_socket *mnl_socket_open (int type); +extern struct mnl_socket *mnl_socket_open (int bus); +extern struct mnl_socket *mnl_socket_open2 (int bus,int flags);Looks good, but we should be using 'unsigned int flags' instead, right?
Or am I missing anything?
Generally speaking, I'd also consider unsigned integers to be more appropriate for flag parameters.
But all socket() parameters are signed integers, including "type" which is bitwise OR-ed with "flags". Furthermore, others libc's functions introduced for the same purpose (race-free setting of CLOEXEC flag), also use a signed integer as flag parameter (like dup3()).
So I've used int for consistency. But I can repost if you prefer.
Re: [PATCH libmnl 1/2] socket: introduce mnl_socket_open2()
In reply to Guillaume NaultHi,
Quoted 29 lines · Guillaume Nault
Define
mnl_socket_open2()so that user can pass a set of SOCK_* flags at socket creation time.Signed-off-by Guillaume Nault <[email protected]>--- include/libmnl/libmnl.h | 3 ++- src/libmnl.map | 1 + src/socket.c | 41 ++++++++++++++++++++++++++++++++--------- 3 files changed, 35 insertions(+), 10 deletions(-)include/libmnl/libmnl.h +2
-1@@ -21,7 +21,8 @@ extern "C" {struct mnl_socket ; -extern struct mnl_socket *mnl_socket_open (int type); +extern struct mnl_socket *mnl_socket_open (int bus); +extern struct mnl_socket *mnl_socket_open2 (int bus,int flags);extern struct mnl_socket *mnl_socket_fdopen (int fd);extern int mnl_socket_bind (struct mnl_socket *nl,unsigned int groups,pid_t pid);extern int mnl_socket_close (struct mnl_socket *nl);src/libmnl.map +0
-0
src/libmnl.map LIBMNL_1.1 { · line 79
Quoted 6 lines
src/libmnl.map +1
-0@@ -74,5 +74,6 @@ LIBMNL_1.1 { } LIBMNL_1.0; LIBMNL_1.2 { + mnl_socket_open2; mnl_socket_fdopen; } LIBMNL_1.1;
I think this breaks library ABI: you should introduce a new revision instead.
Best regards,
Jozsef
-
E-mail : [email protected], [email protected] PGP key : http://www.kfki.hu/~kadlec/pgp_public_key.txt
Address : Wigner Research Centre for Physics, Hungarian Academy of Sciences
H-1525 Budapest 114, POB. 49, Hungary
Pablo Neira Ayuso
maintainerRe: [PATCH libmnl 1/2] socket: introduce mnl_socket_open2()
Quoted 35 lines · Jozsef Kadlecsik
Hi,
Quoted 31 lines · Guillaume Nault
Define
mnl_socket_open2()so that user can pass a set of SOCK_* flags at socket creation time.Signed-off-by Guillaume Nault <[email protected]>--- include/libmnl/libmnl.h | 3 ++- src/libmnl.map | 1 + src/socket.c | 41 ++++++++++++++++++++++++++++++++--------- 3 files changed, 35 insertions(+), 10 deletions(-)include/libmnl/libmnl.h +2
-1@@ -21,7 +21,8 @@ extern "C" {struct mnl_socket ; -extern struct mnl_socket *mnl_socket_open (int type); +extern struct mnl_socket *mnl_socket_open (int bus); +extern struct mnl_socket *mnl_socket_open2 (int bus,int flags);extern struct mnl_socket *mnl_socket_fdopen (int fd);extern int mnl_socket_bind (struct mnl_socket *nl,unsigned int groups,pid_t pid);extern int mnl_socket_close (struct mnl_socket *nl);src/libmnl.map +0
-0@@ -74,5 +74,6 @@ LIBMNL_1.1 { } LIBMNL_1.0;
Quoted 7 lines
src/libmnl.map LIBMNL_1.1 { · line 79
Quoted 4 lines
src/libmnl.map +1
-0LIBMNL_1.2 { + mnl_socket_open2; mnl_socket_fdopen; } LIBMNL_1.1;I think this breaks library ABI: you should introduce a new revision instead.
This would be part of the new interfaces for the next release:
src/libmnl.map +5 -0
@@ -72,3 +72,8 @@ local: *; LIBMNL_1.1 { mnl_attr_parse_payload; } LIBMNL_1.0; + +LIBMNL_1.2 { + mnl_socket_open2; + mnl_socket_fdopen; +} LIBMNL_1.1;
Re: [PATCH libmnl 1/2] socket: introduce mnl_socket_open2()
Quoted 44 lines · Pablo Neira Ayuso
Quoted 35 lines · Jozsef Kadlecsik
Hi,
Quoted 31 lines · Guillaume Nault
Define
mnl_socket_open2()so that user can pass a set of SOCK_* flags at socket creation time.Signed-off-by Guillaume Nault <[email protected]>--- include/libmnl/libmnl.h | 3 ++- src/libmnl.map | 1 + src/socket.c | 41 ++++++++++++++++++++++++++++++++--------- 3 files changed, 35 insertions(+), 10 deletions(-)include/libmnl/libmnl.h +2
-1@@ -21,7 +21,8 @@ extern "C" {struct mnl_socket ; -extern struct mnl_socket *mnl_socket_open (int type); +extern struct mnl_socket *mnl_socket_open (int bus); +extern struct mnl_socket *mnl_socket_open2 (int bus,int flags);extern struct mnl_socket *mnl_socket_fdopen (int fd);extern int mnl_socket_bind (struct mnl_socket *nl,unsigned int groups,pid_t pid);extern int mnl_socket_close (struct mnl_socket *nl);src/libmnl.map +0
-0@@ -74,5 +74,6 @@ LIBMNL_1.1 { } LIBMNL_1.0;Quoted 7 lines
src/libmnl.map LIBMNL_1.1 { · line 79
Quoted 4 lines
src/libmnl.map +1
-0LIBMNL_1.2 { + mnl_socket_open2; mnl_socket_fdopen; } LIBMNL_1.1;I think this breaks library ABI: you should introduce a new revision instead.
Quoted 1 line
This would be part of the new interfaces for the next release:
That's right then, sorry for the noise :-)
Best regards,
Jozsef
Quoted 15 lines
src/libmnl.map +5
-1@@ -72,3 +72,8 @@ local: *; LIBMNL_1.1 { mnl_attr_parse_payload; } LIBMNL_1.0; + +LIBMNL_1.2 { + mnl_socket_open2; + mnl_socket_fdopen; +} LIBMNL_1.1; --
Quoted 4 lines
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
-
E-mail : [email protected], [email protected] PGP key : http://www.kfki.hu/~kadlec/pgp_public_key.txt
Address : Wigner Research Centre for Physics, Hungarian Academy of Sciences
H-1525 Budapest 114, POB. 49, Hungary
Re: [PATCH libmnl 1/2] socket: introduce mnl_socket_open2()
In reply to Jozsef KadlecsikQuoted 35 lines · Jozsef Kadlecsik
Hi,
Quoted 31 lines · Guillaume Nault
Define
mnl_socket_open2()so that user can pass a set of SOCK_* flags at socket creation time.Signed-off-by Guillaume Nault <[email protected]>--- include/libmnl/libmnl.h | 3 ++- src/libmnl.map | 1 + src/socket.c | 41 ++++++++++++++++++++++++++++++++--------- 3 files changed, 35 insertions(+), 10 deletions(-)include/libmnl/libmnl.h +2
-1@@ -21,7 +21,8 @@ extern "C" {struct mnl_socket ; -extern struct mnl_socket *mnl_socket_open (int type); +extern struct mnl_socket *mnl_socket_open (int bus); +extern struct mnl_socket *mnl_socket_open2 (int bus,int flags);extern struct mnl_socket *mnl_socket_fdopen (int fd);extern int mnl_socket_bind (struct mnl_socket *nl,unsigned int groups,pid_t pid);extern int mnl_socket_close (struct mnl_socket *nl);src/libmnl.map +0
-0@@ -74,5 +74,6 @@ LIBMNL_1.1 { } LIBMNL_1.0;
Quoted 8 lines
src/libmnl.map LIBMNL_1.1 { · line 79
Quoted 4 lines
src/libmnl.map +1
-0LIBMNL_1.2 { + mnl_socket_open2; mnl_socket_fdopen; } LIBMNL_1.1;I think this breaks library ABI: you should introduce a new revision instead.
AFAIK, this revision hasn't been part of any official release yet. That's why I've exported mnl_socket_open2() there. I don't mind incrementing the ABI version, but should we really do that for every commit exporting a new function between two releases?
Re: [PATCH libmnl 1/2] socket: introduce mnl_socket_open2()
Quoted 8 lines · Guillaume Nault
Quoted 4 lines
I think this breaks library ABI: you should introduce a new revision instead.
AFAIK, this revision hasn't been part of any official release yet. That's why I've exported
mnl_socket_open2()there. I don't mind incrementing the ABI version, but should we really do that for every commit exporting a new function between two releases?
Not for every commit, indeed no. That would lead to a needlessy larger (and deeper) symvers DAG, and therefore more to process for dynamic and runtime linkers. Not much, but it would pile up for x->\infty. This is also why the entire DAG should be flattened again when setting -version-info C:R:A back to a new *:0:0.
Re: [PATCH libmnl 1/2] socket: introduce mnl_socket_open2()
In reply to Guillaume NaultQuoted 2 lines · Guillaume Nault
Define
mnl_socket_open2()so that user can pass a set of SOCK_* flags at socket creation time.
Applied, thanks for your patience.
Skipping patch 2/2 though.
PATCH 2/2 examples: use mnl_socket_open2()
In reply to Guillaume NaultOpen netlink sockets with the SOCK_CLOEXEC flag to provide sample usage of the new mnl_socket_open2() function.
--- examples/genl/genl-family-get.c | 4 ++-- examples/genl/genl-group-events.c | 4 ++-- examples/kobject/kobject-event.c | 4 ++-- examples/netfilter/nf-log.c | 4 ++-- examples/netfilter/nf-queue.c | 4 ++-- examples/netfilter/nfct-create-batch.c | 4 ++-- examples/netfilter/nfct-daemon.c | 4 ++-- examples/netfilter/nfct-dump.c | 4 ++-- examples/netfilter/nfct-event.c | 4 ++-- examples/rtnl/rtnl-addr-dump.c | 4 ++-- examples/rtnl/rtnl-link-dump.c | 4 ++-- examples/rtnl/rtnl-link-dump2.c | 4 ++-- examples/rtnl/rtnl-link-dump3.c | 4 ++-- examples/rtnl/rtnl-link-event.c | 4 ++-- examples/rtnl/rtnl-link-set.c | 4 ++-- examples/rtnl/rtnl-route-add.c | 4 ++-- examples/rtnl/rtnl-route-dump.c | 4 ++-- examples/rtnl/rtnl-route-event.c | 4 ++-- 18 files changed, 36 insertions(+), 36 deletions(-)
examples/genl/genl-family-get.c +2 -2
@@ -206,9 +206,9 @@ int main(int argc, char *argv[])else nlh->nlmsg_flags |=NLM_F_DUMP ; - nl =mnl_socket_open (NETLINK_GENERIC ); + nl =mnl_socket_open2 (NETLINK_GENERIC ,SOCK_CLOEXEC );if (nl ==NULL ) { -perror ("mnl_socket_open" ); +perror ("mnl_socket_open2" );exit (EXIT_FAILURE ); }
examples/genl/genl-group-events.c +2 -2
@@ -28,9 +28,9 @@ int main(int argc, char *argv[]) } group =atoi (argv[1 ]); - nl =mnl_socket_open (NETLINK_GENERIC ); + nl =mnl_socket_open2 (NETLINK_GENERIC ,SOCK_CLOEXEC );if (nl ==NULL ) { -perror ("mnl_socket_open" ); +perror ("mnl_socket_open2" );exit (EXIT_FAILURE ); }
examples/kobject/kobject-event.c +2 -2
@@ -13,9 +13,9 @@ int main(int argc, char *argv[])char buf[MNL_SOCKET_BUFFER_SIZE ];int ret; - nl =mnl_socket_open (NETLINK_KOBJECT_UEVENT ); + nl =mnl_socket_open2 (NETLINK_KOBJECT_UEVENT ,SOCK_CLOEXEC );if (nl ==NULL ) { -perror ("mnl_socket_open" ); +perror ("mnl_socket_open2" );exit (EXIT_FAILURE ); }
examples/netfilter/nf-log.c +2 -2
@@ -154,9 +154,9 @@ int main(int argc, char *argv[]) } qnum =atoi (argv[1 ]); - nl =mnl_socket_open (NETLINK_NETFILTER ); + nl =mnl_socket_open2 (NETLINK_NETFILTER ,SOCK_CLOEXEC );if (nl ==NULL ) { -perror ("mnl_socket_open" ); +perror ("mnl_socket_open2" );exit (EXIT_FAILURE ); }
examples/netfilter/nf-queue.c +2 -2
@@ -169,9 +169,9 @@ int main(int argc, char *argv[]) } queue_num =atoi (argv[1 ]); - nl =mnl_socket_open (NETLINK_NETFILTER ); + nl =mnl_socket_open2 (NETLINK_NETFILTER ,SOCK_CLOEXEC );if (nl ==NULL ) { -perror ("mnl_socket_open" ); +perror ("mnl_socket_open2" );exit (EXIT_FAILURE ); }
examples/netfilter/nfct-create-batch.c +2 -2
@@ -139,9 +139,9 @@ int main(void)unsigned int seq, portid;uint16_t i; - nl =mnl_socket_open (NETLINK_NETFILTER ); + nl =mnl_socket_open2 (NETLINK_NETFILTER ,SOCK_CLOEXEC );if (nl ==NULL ) { -perror ("mnl_socket_open" ); +perror ("mnl_socket_open2" );exit (EXIT_FAILURE ); }if (mnl_socket_bind (nl,0 ,MNL_SOCKET_AUTOPID ) <0 ) {
examples/netfilter/nfct-daemon.c +2 -2
@@ -264,9 +264,9 @@ int main(int argc, char *argv[])nice (-20 );/* Open netlink socket to operate with netfilter */ - nl =mnl_socket_open (NETLINK_NETFILTER ); + nl =mnl_socket_open2 (NETLINK_NETFILTER ,SOCK_CLOEXEC );if (nl ==NULL ) { -perror ("mnl_socket_open" ); +perror ("mnl_socket_open2" );exit (EXIT_FAILURE ); }
examples/netfilter/nfct-dump.c +2 -2
@@ -270,9 +270,9 @@ int main(void)uint32_t seq, portid;int ret; - nl =mnl_socket_open (NETLINK_NETFILTER ); + nl =mnl_socket_open2 (NETLINK_NETFILTER ,SOCK_CLOEXEC );if (nl ==NULL ) { -perror ("mnl_socket_open" ); +perror ("mnl_socket_open2" );exit (EXIT_FAILURE ); }
examples/netfilter/nfct-event.c +2 -2
@@ -206,9 +206,9 @@ int main(void)char buf[MNL_SOCKET_BUFFER_SIZE ];int ret; - nl =mnl_socket_open (NETLINK_NETFILTER ); + nl =mnl_socket_open2 (NETLINK_NETFILTER ,SOCK_CLOEXEC );if (nl ==NULL ) { -perror ("mnl_socket_open" ); +perror ("mnl_socket_open2" );exit (EXIT_FAILURE ); }
examples/rtnl/rtnl-addr-dump.c +2 -2
@@ -98,9 +98,9 @@ int main(int argc, char *argv[])else if (strcmp (argv[1 ],"inet6" ) ==0 ) rt->rtgen_family =AF_INET6 ; - nl =mnl_socket_open (NETLINK_ROUTE ); + nl =mnl_socket_open2 (NETLINK_ROUTE ,SOCK_CLOEXEC );if (nl ==NULL ) { -perror ("mnl_socket_open" ); +perror ("mnl_socket_open2" );exit (EXIT_FAILURE ); }
examples/rtnl/rtnl-link-dump.c +2 -2
@@ -95,9 +95,9 @@ int main(void) rt =mnl_nlmsg_put_extra_header (nlh,sizeof (struct rtgenmsg )); rt->rtgen_family =AF_PACKET ; - nl =mnl_socket_open (NETLINK_ROUTE ); + nl =mnl_socket_open2 (NETLINK_ROUTE ,SOCK_CLOEXEC );if (nl ==NULL ) { -perror ("mnl_socket_open" ); +perror ("mnl_socket_open2" );exit (EXIT_FAILURE ); }
examples/rtnl/rtnl-link-dump2.c +2 -2
@@ -68,9 +68,9 @@ int main(void) rt =mnl_nlmsg_put_extra_header (nlh,sizeof (struct rtgenmsg )); rt->rtgen_family =AF_PACKET ; - nl =mnl_socket_open (NETLINK_ROUTE ); + nl =mnl_socket_open2 (NETLINK_ROUTE ,SOCK_CLOEXEC );if (nl ==NULL ) { -perror ("mnl_socket_open" ); +perror ("mnl_socket_open2" );exit (EXIT_FAILURE ); }
examples/rtnl/rtnl-link-dump3.c +2 -2
@@ -68,9 +68,9 @@ int main(void) rt =mnl_nlmsg_put_extra_header (nlh,sizeof (struct rtgenmsg )); rt->rtgen_family =AF_PACKET ; - nl =mnl_socket_open (NETLINK_ROUTE ); + nl =mnl_socket_open2 (NETLINK_ROUTE ,SOCK_CLOEXEC );if (nl ==NULL ) { -perror ("mnl_socket_open" ); +perror ("mnl_socket_open2" );exit (EXIT_FAILURE ); }
examples/rtnl/rtnl-link-event.c +2 -2
@@ -66,9 +66,9 @@ int main(void)char buf[MNL_SOCKET_BUFFER_SIZE ];int ret; - nl =mnl_socket_open (NETLINK_ROUTE ); + nl =mnl_socket_open2 (NETLINK_ROUTE ,SOCK_CLOEXEC );if (nl ==NULL ) { -perror ("mnl_socket_open" ); +perror ("mnl_socket_open2" );exit (EXIT_FAILURE ); }
examples/rtnl/rtnl-link-set.c +2 -2
@@ -46,9 +46,9 @@ int main(int argc, char *argv[])mnl_attr_put_str (nlh,IFLA_IFNAME , argv[1 ]); - nl =mnl_socket_open (NETLINK_ROUTE ); + nl =mnl_socket_open2 (NETLINK_ROUTE ,SOCK_CLOEXEC );if (nl ==NULL ) { -perror ("mnl_socket_open" ); +perror ("mnl_socket_open2" );exit (EXIT_FAILURE ); }
examples/rtnl/rtnl-route-add.c +2 -2
@@ -92,9 +92,9 @@ int main(int argc, char *argv[]) } } - nl =mnl_socket_open (NETLINK_ROUTE ); + nl =mnl_socket_open2 (NETLINK_ROUTE ,SOCK_CLOEXEC );if (nl ==NULL ) { -perror ("mnl_socket_open" ); +perror ("mnl_socket_open2" );exit (EXIT_FAILURE ); }
examples/rtnl/rtnl-route-dump.c +2 -2
@@ -321,9 +321,9 @@ int main(int argc, char *argv[])else if (strcmp (argv[1 ],"inet6" ) ==0 ) rtm->rtm_family =AF_INET6 ; - nl =mnl_socket_open (NETLINK_ROUTE ); + nl =mnl_socket_open2 (NETLINK_ROUTE ,SOCK_CLOEXEC );if (nl ==NULL ) { -perror ("mnl_socket_open" ); +perror ("mnl_socket_open2" );exit (EXIT_FAILURE ); }
examples/rtnl/rtnl-route-event.c +2 -2
@@ -311,9 +311,9 @@ int main(int argc, char *argv[])char buf[MNL_SOCKET_BUFFER_SIZE ];int ret; - nl =mnl_socket_open (NETLINK_ROUTE ); + nl =mnl_socket_open2 (NETLINK_ROUTE ,SOCK_CLOEXEC );if (nl ==NULL ) { -perror ("mnl_socket_open" ); +perror ("mnl_socket_open2" );exit (EXIT_FAILURE ); }
Signature · 1 line
2.6.0