netlink: provide a fallback definition of NETLINK_SOCK_DIAG

Add a fallback definition of NETLINK_SOCK_DIAG to netlink.h
instead of adding these fallback definitions to every file.

* netlink.h: Provide a fallback definition of NETLINK_SOCK_DIAG.
* socketutils.c: Include "netlink.h" instead of <linux/netlink.h>,
remove fallback definition of NETLINK_SOCK_DIAG.
This commit is contained in:
Дмитрий Левин 2017-06-24 22:25:28 +00:00
parent 4ec744efce
commit fd68eabd59
2 changed files with 5 additions and 5 deletions

View File

@ -32,6 +32,10 @@
#include <sys/socket.h>
#include <linux/netlink.h>
#ifndef NETLINK_SOCK_DIAG
# define NETLINK_SOCK_DIAG 4
#endif
#undef NLMSG_HDRLEN
#define NLMSG_HDRLEN ((unsigned int) NLMSG_ALIGN(sizeof(struct nlmsghdr)))

View File

@ -31,7 +31,7 @@
#include <netinet/in.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <linux/netlink.h>
#include "netlink.h"
#include <linux/sock_diag.h>
#include <linux/inet_diag.h>
#include <linux/unix_diag.h>
@ -46,10 +46,6 @@
# define UNIX_PATH_MAX sizeof(((struct sockaddr_un *) 0)->sun_path)
#endif
#ifndef NETLINK_SOCK_DIAG
# define NETLINK_SOCK_DIAG 4
#endif
typedef struct {
unsigned long inode;
char *details;