10 #ifndef MPTCPD_COMMANDS_H
11 #define MPTCPD_COMMANDS_H
14 # include <mptcpd/private/config.h>
20 #include <sys/socket.h>
21 #include <netinet/in.h>
22 #include <linux/netlink.h>
29 #define MPTCPD_NLA_ALIGN(v) (NLA_HDRLEN + NLA_ALIGN(sizeof(v)))
40 #define MPTCPD_NLA_ALIGN_OPT(v) ((v) == 0 ? 0 : (MPTCPD_NLA_ALIGN(v)))
52 #define MPTCPD_NLA_ALIGN_ADDR(v) \
53 (NLA_HDRLEN + NLA_ALIGN(mptcpd_get_addr_size(v)))
70 static inline bool mptcpd_is_inet_family(
struct sockaddr
const *addr)
72 return addr->sa_family == AF_INET || addr->sa_family == AF_INET6;
83 static inline size_t mptcpd_get_addr_size(
struct sockaddr
const *addr)
85 assert(mptcpd_is_inet_family(addr));
87 return addr->sa_family == AF_INET
88 ?
sizeof(
struct in_addr)
89 : sizeof(struct in6_addr);
103 static inline uint16_t mptcpd_get_addr_family(struct sockaddr const *addr)
105 sa_family_t
const family = (addr == NULL ? 0 : addr->sa_family);
struct mptcpd_pm_cmd_ops const * mptcpd_get_mptcp_org_cmd_ops(void)
Get multipath-tcp.org kernel MPTCP generic netlink command operations.
struct mptcpd_pm_cmd_ops const * mptcpd_get_upstream_cmd_ops(void)
Get upstream kernel MPTCP generic netlink command operations.
uint16_t mptcpd_get_port_number(struct sockaddr const *addr)
Get IP port number (host byte order).
Definition: commands.c:29
bool mptcpd_check_genl_error(struct l_genl_msg *msg, char const *fname)
Check for genl operation failure.
Definition: commands.c:52
void mptcpd_family_send_callback(struct l_genl_msg *msg, void *user_data)
Generic error reporting callback.
Definition: commands.c:85
MPTCP path management generic netlink command functions.
Definition: path_manager.h:123