mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2024-11-26 17:28:29 -05:00
90a545ccba
This makes the RTM_NEWLINK, RTM_DELLINK, and operstate debug messages easier to understand. Signed-hostap: Jouni Malinen <j@w1.fi>
109 lines
2.8 KiB
C
109 lines
2.8 KiB
C
/*
|
|
* wpa_supplicant - Private copy of Linux netlink/rtnetlink definitions.
|
|
* Copyright (c) 2003-2005, Jouni Malinen <j@w1.fi>
|
|
*
|
|
* This software may be distributed under the terms of the BSD license.
|
|
* See README for more details.
|
|
*/
|
|
|
|
#ifndef PRIV_NETLINK_H
|
|
#define PRIV_NETLINK_H
|
|
|
|
/*
|
|
* This should be replaced with user space header once one is available with C
|
|
* library, etc..
|
|
*/
|
|
|
|
#ifndef IFF_LOWER_UP
|
|
#define IFF_LOWER_UP 0x10000 /* driver signals L1 up */
|
|
#endif
|
|
#ifndef IFF_DORMANT
|
|
#define IFF_DORMANT 0x20000 /* driver signals dormant */
|
|
#endif
|
|
|
|
#ifndef IFLA_IFNAME
|
|
#define IFLA_IFNAME 3
|
|
#endif
|
|
#ifndef IFLA_WIRELESS
|
|
#define IFLA_WIRELESS 11
|
|
#endif
|
|
#ifndef IFLA_OPERSTATE
|
|
#define IFLA_OPERSTATE 16
|
|
#endif
|
|
#ifndef IFLA_LINKMODE
|
|
#define IFLA_LINKMODE 17
|
|
#define IF_OPER_DORMANT 5
|
|
#define IF_OPER_UP 6
|
|
#endif
|
|
|
|
#define NLM_F_REQUEST 1
|
|
|
|
#define NETLINK_ROUTE 0
|
|
#define RTMGRP_LINK 1
|
|
#define RTM_BASE 0x10
|
|
#define RTM_NEWLINK (RTM_BASE + 0)
|
|
#define RTM_DELLINK (RTM_BASE + 1)
|
|
#define RTM_SETLINK (RTM_BASE + 3)
|
|
|
|
#define NLMSG_ALIGNTO 4
|
|
#define NLMSG_ALIGN(len) (((len) + NLMSG_ALIGNTO - 1) & ~(NLMSG_ALIGNTO - 1))
|
|
#define NLMSG_HDRLEN ((int) NLMSG_ALIGN(sizeof(struct nlmsghdr)))
|
|
#define NLMSG_LENGTH(len) ((len) + NLMSG_ALIGN(sizeof(struct nlmsghdr)))
|
|
#define NLMSG_SPACE(len) NLMSG_ALIGN(NLMSG_LENGTH(len))
|
|
#define NLMSG_DATA(nlh) ((void*) (((char*) nlh) + NLMSG_LENGTH(0)))
|
|
#define NLMSG_NEXT(nlh,len) ((len) -= NLMSG_ALIGN((nlh)->nlmsg_len), \
|
|
(struct nlmsghdr *) \
|
|
(((char *)(nlh)) + NLMSG_ALIGN((nlh)->nlmsg_len)))
|
|
#define NLMSG_OK(nlh,len) ((len) >= (int) sizeof(struct nlmsghdr) && \
|
|
(nlh)->nlmsg_len >= sizeof(struct nlmsghdr) && \
|
|
(int) (nlh)->nlmsg_len <= (len))
|
|
#define NLMSG_PAYLOAD(nlh,len) ((nlh)->nlmsg_len - NLMSG_SPACE((len)))
|
|
|
|
#define RTA_ALIGNTO 4
|
|
#define RTA_ALIGN(len) (((len) + RTA_ALIGNTO - 1) & ~(RTA_ALIGNTO - 1))
|
|
#define RTA_OK(rta,len) \
|
|
((len) > 0 && (rta)->rta_len >= sizeof(struct rtattr) && \
|
|
(rta)->rta_len <= (len))
|
|
#define RTA_NEXT(rta,attrlen) \
|
|
((attrlen) -= RTA_ALIGN((rta)->rta_len), \
|
|
(struct rtattr *) (((char *)(rta)) + RTA_ALIGN((rta)->rta_len)))
|
|
#define RTA_LENGTH(len) (RTA_ALIGN(sizeof(struct rtattr)) + (len))
|
|
#define RTA_DATA(rta) ((void *) (((char *) (rta)) + RTA_LENGTH(0)))
|
|
#define RTA_PAYLOAD(rta) ((int) ((rta)->rta_len) - RTA_LENGTH(0))
|
|
|
|
|
|
struct sockaddr_nl
|
|
{
|
|
sa_family_t nl_family;
|
|
unsigned short nl_pad;
|
|
u32 nl_pid;
|
|
u32 nl_groups;
|
|
};
|
|
|
|
struct nlmsghdr
|
|
{
|
|
u32 nlmsg_len;
|
|
u16 nlmsg_type;
|
|
u16 nlmsg_flags;
|
|
u32 nlmsg_seq;
|
|
u32 nlmsg_pid;
|
|
};
|
|
|
|
struct ifinfomsg
|
|
{
|
|
unsigned char ifi_family;
|
|
unsigned char __ifi_pad;
|
|
unsigned short ifi_type;
|
|
int ifi_index;
|
|
unsigned ifi_flags;
|
|
unsigned ifi_change;
|
|
};
|
|
|
|
struct rtattr
|
|
{
|
|
unsigned short rta_len;
|
|
unsigned short rta_type;
|
|
};
|
|
|
|
#endif /* PRIV_NETLINK_H */
|