Commit f4685fa6d0427c3948a5120a9658fad7ae81facd

Authored by Tomas Hozza
Committed by Greg Kroah-Hartman
1 parent 77d6a52893

tools: hv: daemon setsockopt should use options macros

HyperV daemon should use macros for option values when calling setsockopt.
Using specific numeric values instead of macros is confusing.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
Acked-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Showing 1 changed file with 7 additions and 3 deletions Side-by-side Diff

tools/hv/hv_kvp_daemon.c
... ... @@ -102,6 +102,10 @@
102 102 #define MAX_FILE_NAME 100
103 103 #define ENTRIES_PER_BLOCK 50
104 104  
  105 +#ifndef SOL_NETLINK
  106 +#define SOL_NETLINK 270
  107 +#endif
  108 +
105 109 struct kvp_record {
106 110 char key[HV_KVP_EXCHANGE_MAX_KEY_SIZE];
107 111 char value[HV_KVP_EXCHANGE_MAX_VALUE_SIZE];
... ... @@ -1407,7 +1411,7 @@
1407 1411  
1408 1412 int main(void)
1409 1413 {
1410   - int fd, len, sock_opt;
  1414 + int fd, len, nl_group;
1411 1415 int error;
1412 1416 struct cn_msg *message;
1413 1417 struct pollfd pfd;
... ... @@ -1452,8 +1456,8 @@
1452 1456 close(fd);
1453 1457 exit(EXIT_FAILURE);
1454 1458 }
1455   - sock_opt = CN_KVP_IDX;
1456   - setsockopt(fd, 270, 1, &sock_opt, sizeof(sock_opt));
  1459 + nl_group = CN_KVP_IDX;
  1460 + setsockopt(fd, SOL_NETLINK, NETLINK_ADD_MEMBERSHIP, &nl_group, sizeof(nl_group));
1457 1461 /*
1458 1462 * Register ourselves with the kernel.
1459 1463 */