Decode AF_SMC netlink messages unconditionally
As smc_diag.h is bundled, there is little sense to build AF_SMC support conditionally. * netlink_smc_diag.c [!AF_SMC]: Include xlat/addrfams.h under XLAT_MACROS_ONLY, enable the rest of file. * netlink_sock_diag.c: Include xlat/addrfams.h under XLAT_MACROS_ONLY. (diag_decoders): Remove "ifdef AF_SMC" condition for [AF_SMC], reorder in accordance with address family values. * tests/nlattr_smc_diag_msg.c [!AF_SMC]: Define AF_SMC to 43, enable the rest of test.
This commit is contained in:
parent
14ae61f37b
commit
9d2848e517
@ -29,20 +29,24 @@
|
||||
#include "defs.h"
|
||||
#include <sys/socket.h>
|
||||
|
||||
#ifdef AF_SMC
|
||||
#ifndef AF_SMC
|
||||
# define XLAT_MACROS_ONLY
|
||||
# include "xlat/addrfams.h"
|
||||
# undef XLAT_MACROS_ONLY
|
||||
#endif
|
||||
|
||||
# include "netlink.h"
|
||||
# include "netlink_sock_diag.h"
|
||||
# include "nlattr.h"
|
||||
# include "print_fields.h"
|
||||
#include "netlink.h"
|
||||
#include "netlink_sock_diag.h"
|
||||
#include "nlattr.h"
|
||||
#include "print_fields.h"
|
||||
|
||||
# include <arpa/inet.h>
|
||||
# include <linux/smc_diag.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <linux/smc_diag.h>
|
||||
|
||||
# include "xlat/smc_diag_attrs.h"
|
||||
# include "xlat/smc_diag_extended_flags.h"
|
||||
# include "xlat/smc_link_group_roles.h"
|
||||
# include "xlat/smc_states.h"
|
||||
#include "xlat/smc_diag_attrs.h"
|
||||
#include "xlat/smc_diag_extended_flags.h"
|
||||
#include "xlat/smc_link_group_roles.h"
|
||||
#include "xlat/smc_states.h"
|
||||
|
||||
DECL_NETLINK_DIAG_DECODER(decode_smc_diag_req)
|
||||
{
|
||||
@ -186,5 +190,3 @@ DECL_NETLINK_DIAG_DECODER(decode_smc_diag_msg)
|
||||
ARRAY_SIZE(smc_diag_msg_nla_decoders), NULL);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* AF_SMC */
|
||||
|
@ -31,6 +31,10 @@
|
||||
#include "netlink.h"
|
||||
#include "netlink_sock_diag.h"
|
||||
|
||||
#define XLAT_MACROS_ONLY
|
||||
#include "xlat/addrfams.h"
|
||||
#undef XLAT_MACROS_ONLY
|
||||
|
||||
static void
|
||||
decode_family(struct tcb *const tcp, const uint8_t family,
|
||||
const kernel_ulong_t addr, const unsigned int len)
|
||||
@ -50,14 +54,12 @@ typedef DECL_NETLINK_DIAG_DECODER((*netlink_diag_decoder_t));
|
||||
static const struct {
|
||||
const netlink_diag_decoder_t request, response;
|
||||
} diag_decoders[] = {
|
||||
[AF_UNIX] = { decode_unix_diag_req, decode_unix_diag_msg },
|
||||
[AF_INET] = { decode_inet_diag_req, decode_inet_diag_msg },
|
||||
[AF_INET6] = { decode_inet_diag_req, decode_inet_diag_msg },
|
||||
[AF_NETLINK] = { decode_netlink_diag_req, decode_netlink_diag_msg },
|
||||
[AF_PACKET] = { decode_packet_diag_req, decode_packet_diag_msg },
|
||||
#ifdef AF_SMC
|
||||
[AF_SMC] = { decode_smc_diag_req, decode_smc_diag_msg },
|
||||
#endif
|
||||
[AF_UNIX] = { decode_unix_diag_req, decode_unix_diag_msg }
|
||||
};
|
||||
|
||||
bool
|
||||
|
@ -29,23 +29,25 @@
|
||||
#include "tests.h"
|
||||
#include <sys/socket.h>
|
||||
|
||||
#ifdef AF_SMC
|
||||
#ifndef AF_SMC
|
||||
# define AF_SMC 43
|
||||
#endif
|
||||
|
||||
# include <stdio.h>
|
||||
# include <string.h>
|
||||
# include <stdint.h>
|
||||
# include <arpa/inet.h>
|
||||
# include "test_nlattr.h"
|
||||
# include <linux/rtnetlink.h>
|
||||
# include <linux/smc_diag.h>
|
||||
# include <linux/sock_diag.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include <arpa/inet.h>
|
||||
#include "test_nlattr.h"
|
||||
#include <linux/rtnetlink.h>
|
||||
#include <linux/smc_diag.h>
|
||||
#include <linux/sock_diag.h>
|
||||
|
||||
# ifndef SMC_CLNT
|
||||
# define SMC_CLNT 0
|
||||
# endif
|
||||
# ifndef SMC_ACTIVE
|
||||
# define SMC_ACTIVE 1
|
||||
# endif
|
||||
#ifndef SMC_CLNT
|
||||
# define SMC_CLNT 0
|
||||
#endif
|
||||
#ifndef SMC_ACTIVE
|
||||
# define SMC_ACTIVE 1
|
||||
#endif
|
||||
|
||||
static const char address[] = "12.34.56.78";
|
||||
|
||||
@ -195,9 +197,3 @@ int main(void)
|
||||
printf("+++ exited with 0 +++\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
SKIP_MAIN_UNDEFINED("AF_SMC")
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user