if_addr.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #ifndef __LINUX_IF_ADDR_H
  2. #define __LINUX_IF_ADDR_H
  3. #include <linux/types.h>
  4. #include <linux/netlink.h>
  5. struct ifaddrmsg {
  6. __u8 ifa_family;
  7. __u8 ifa_prefixlen; /* The prefix length */
  8. __u8 ifa_flags; /* Flags */
  9. __u8 ifa_scope; /* Address scope */
  10. __u32 ifa_index; /* Link index */
  11. };
  12. /*
  13. * Important comment:
  14. * IFA_ADDRESS is prefix address, rather than local interface address.
  15. * It makes no difference for normally configured broadcast interfaces,
  16. * but for point-to-point IFA_ADDRESS is DESTINATION address,
  17. * local address is supplied in IFA_LOCAL attribute.
  18. */
  19. enum {
  20. IFA_UNSPEC,
  21. IFA_ADDRESS,
  22. IFA_LOCAL,
  23. IFA_LABEL,
  24. IFA_BROADCAST,
  25. IFA_ANYCAST,
  26. IFA_CACHEINFO,
  27. IFA_MULTICAST,
  28. __IFA_MAX,
  29. };
  30. #define IFA_MAX (__IFA_MAX - 1)
  31. /* ifa_flags */
  32. #define IFA_F_SECONDARY 0x01
  33. #define IFA_F_TEMPORARY IFA_F_SECONDARY
  34. #define IFA_F_NODAD 0x02
  35. #define IFA_F_OPTIMISTIC 0x04
  36. #define IFA_F_DADFAILED 0x08
  37. #define IFA_F_HOMEADDRESS 0x10
  38. #define IFA_F_DEPRECATED 0x20
  39. #define IFA_F_TENTATIVE 0x40
  40. #define IFA_F_PERMANENT 0x80
  41. struct ifa_cacheinfo {
  42. __u32 ifa_prefered;
  43. __u32 ifa_valid;
  44. __u32 cstamp; /* created timestamp, hundredths of seconds */
  45. __u32 tstamp; /* updated timestamp, hundredths of seconds */
  46. };
  47. /* backwards compatibility for userspace */
  48. #ifndef __KERNEL__
  49. #define IFA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct ifaddrmsg))))
  50. #define IFA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct ifaddrmsg))
  51. #endif
  52. #endif