Commit 2ae99d73 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov

net: Define named constant for nlmsg_seq

For better readability.
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
parent 25d048c0
...@@ -59,6 +59,8 @@ struct rtattr { ...@@ -59,6 +59,8 @@ struct rtattr {
#define NLMSG_MIN_TYPE 0x10 /* < 0x10: reserved control messages */ #define NLMSG_MIN_TYPE 0x10 /* < 0x10: reserved control messages */
#define CR_NLMSG_SEQ 24680 /* arbitrary chosen */
extern int parse_rtattr(struct rtattr *tb[], int max, struct rtattr *rta, int len); extern int parse_rtattr(struct rtattr *tb[], int max, struct rtattr *rta, int len);
extern int nlmsg_receive(char *buf, int len, int (*cb)(struct nlmsghdr *)); extern int nlmsg_receive(char *buf, int len, int (*cb)(struct nlmsghdr *));
......
...@@ -23,7 +23,7 @@ int nlmsg_receive(char *buf, int len, int (*cb)(struct nlmsghdr *)) ...@@ -23,7 +23,7 @@ int nlmsg_receive(char *buf, int len, int (*cb)(struct nlmsghdr *))
struct nlmsghdr *hdr; struct nlmsghdr *hdr;
for (hdr = (struct nlmsghdr *)buf; NLMSG_OK(hdr, len); hdr = NLMSG_NEXT(hdr, len)) { for (hdr = (struct nlmsghdr *)buf; NLMSG_OK(hdr, len); hdr = NLMSG_NEXT(hdr, len)) {
if (hdr->nlmsg_seq != 24680) if (hdr->nlmsg_seq != CR_NLMSG_SEQ)
continue; continue;
if (hdr->nlmsg_type == NLMSG_DONE) if (hdr->nlmsg_type == NLMSG_DONE)
return 0; return 0;
......
...@@ -333,7 +333,7 @@ static int collect_unix_sockets(int nl) ...@@ -333,7 +333,7 @@ static int collect_unix_sockets(int nl)
req.hdr.nlmsg_len = sizeof(req); req.hdr.nlmsg_len = sizeof(req);
req.hdr.nlmsg_type = SOCK_DIAG_BY_FAMILY; req.hdr.nlmsg_type = SOCK_DIAG_BY_FAMILY;
req.hdr.nlmsg_flags = NLM_F_ROOT|NLM_F_MATCH|NLM_F_REQUEST; req.hdr.nlmsg_flags = NLM_F_ROOT|NLM_F_MATCH|NLM_F_REQUEST;
req.hdr.nlmsg_seq = 24680; req.hdr.nlmsg_seq = CR_NLMSG_SEQ;
req.r.sdiag_family = AF_UNIX; req.r.sdiag_family = AF_UNIX;
req.r.udiag_states = -1; /* All */ req.r.udiag_states = -1; /* All */
req.r.udiag_show = UDIAG_SHOW_NAME | UDIAG_SHOW_VFS | UDIAG_SHOW_PEER | UDIAG_SHOW_ICONS | UDIAG_SHOW_RQLEN; req.r.udiag_show = UDIAG_SHOW_NAME | UDIAG_SHOW_VFS | UDIAG_SHOW_PEER | UDIAG_SHOW_ICONS | UDIAG_SHOW_RQLEN;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment