if_addr.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #ifndef __LINUX_IF_ADDR_H
  2. #define __LINUX_IF_ADDR_H
  3. #include <linux/netlink.h>
  4. struct ifaddrmsg
  5. {
  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. {
  21. IFA_UNSPEC,
  22. IFA_ADDRESS,
  23. IFA_LOCAL,
  24. IFA_LABEL,
  25. IFA_BROADCAST,
  26. IFA_ANYCAST,
  27. IFA_CACHEINFO,
  28. IFA_MULTICAST,
  29. __IFA_MAX,
  30. };
  31. #define IFA_MAX (__IFA_MAX - 1)
  32. /* ifa_flags */
  33. #define IFA_F_SECONDARY 0x01
  34. #define IFA_F_TEMPORARY IFA_F_SECONDARY
  35. #define IFA_F_NODAD 0x02
  36. #define IFA_F_HOMEADDRESS 0x10
  37. #define IFA_F_DEPRECATED 0x20
  38. #define IFA_F_TENTATIVE 0x40
  39. #define IFA_F_PERMANENT 0x80
  40. struct ifa_cacheinfo
  41. {
  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