if_addr.h 1.4 KB

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