History

ipv6: add ip6_del_rt_reason()

Add RTA_DEL_REASON and enum rt_del_reason to the rtnetlink uAPI, and add ip6_del_rt_reason(), which takes the reason a route is being deleted. It has no skip_notify argument: a caller that records a deletion reason wants the notification that carries it. The reason is unused for now. Subsequent patches propagate it to the deletion path and report it on RTM_DELROUTE.

Yuyang Huang committed 3 months ago

Commit cc17e381 parent f6057f03 files · +35 −0Browse files

Showing the changes to include/uapi (1 of 3 files). Show all

Unified · Split

include/uapi/linux/rtnetlink.h+25−0
@@ -399,6 +399,7 @@ enum rtattr_type_t { · 398 unmodified lines
399 RTA_DPORT,399 RTA_DPORT,
400 RTA_NH_ID,400 RTA_NH_ID,
401 RTA_FLOWLABEL,401 RTA_FLOWLABEL,
402 RTA_DEL_REASON,
402 __RTA_MAX403 __RTA_MAX
403};404};
404 405
@@ -407,6 +408,30 @@ enum rtattr_type_t { · 2 unmodified lines
407#define RTM_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct rtmsg))))408#define RTM_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct rtmsg))))
408#define RTM_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct rtmsg))409#define RTM_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct rtmsg))
409 410
411/* RTA_DEL_REASON: why the kernel deleted the route. u32.
412 * Emitted only on RTM_DELROUTE notifications, and only when the deletion
413 * path records a cause. Absence means either an older kernel or a
414 * deletion path that does not (yet) record its cause - consumers must
415 * treat "absent" and "unspec" identically. New causes may be appended.
416 * Currently only IPv6 deletion paths record a cause.
417 *
418 * The attribute is notification-only: the kernel rejects it in
419 * requests, so a notification must not be echoed back verbatim.
420 *
421 * The value space is family-agnostic: a value must never be
422 * reinterpreted per address family. A cause that only one family can
423 * produce still gets its own value rather than reusing another
424 * family's.
425 */
426enum rt_del_reason {
427 RT_DEL_REASON_UNSPEC, /* cause not recorded */
428 RT_DEL_REASON_EXPIRED, /* RTF_EXPIRES lifetime ran out (GC) */
429 RT_DEL_REASON_RA_WITHDRAWN, /* zero-lifetime RA / PIO / RIO */
430 __RT_DEL_REASON_MAX
431};
432
433#define RT_DEL_REASON_MAX (__RT_DEL_REASON_MAX - 1)
434
410/* RTM_MULTIPATH --- array of struct rtnexthop.435/* RTM_MULTIPATH --- array of struct rtnexthop.
411 *436 *
412 * "struct rtnexthop" describes all necessary nexthop information,437 * "struct rtnexthop" describes all necessary nexthop information,