Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet6/nd6.c
| Show First 20 Lines • Show All 1,607 Lines • ▼ Show 20 Lines | |||||
| * Updates status of the default router route. | * Updates status of the default router route. | ||||
| */ | */ | ||||
| static void | static void | ||||
| check_release_defrouter(const struct rib_cmd_info *rc, void *_cbdata) | check_release_defrouter(const struct rib_cmd_info *rc, void *_cbdata) | ||||
| { | { | ||||
| struct nd_defrouter *dr; | struct nd_defrouter *dr; | ||||
| struct nhop_object *nh; | struct nhop_object *nh; | ||||
| nh = rc->rc_nh_old; | nh = rc->rc_nh_old; | ||||
bz: The call stack was too deep for me to conclude rc_nh_old would always be non-NULL here? If… | |||||
Done Inline Actionsrib_decompose_notification() also assumes that rc_nh_old is non-NULL (when the command is RTM_DELETE), and that apparently did not cause any problems in the past several years. markj: rib_decompose_notification() also assumes that `rc_nh_old` is non-NULL (when the command is… | |||||
| if (rc->rc_cmd == RTM_DELETE && (nh->nh_flags & NHF_DEFAULT) != 0) { | |||||
| if ((nh != NULL) && (nh->nh_flags & NHF_DEFAULT)) { | |||||
| dr = defrouter_lookup(&nh->gw6_sa.sin6_addr, nh->nh_ifp); | dr = defrouter_lookup(&nh->gw6_sa.sin6_addr, nh->nh_ifp); | ||||
| if (dr != NULL) { | if (dr != NULL) { | ||||
| dr->installed = 0; | dr->installed = 0; | ||||
| defrouter_rele(dr); | defrouter_rele(dr); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| void | void | ||||
| nd6_subscription_cb(struct rib_head *rnh, struct rib_cmd_info *rc, void *arg) | nd6_subscription_cb(struct rib_head *rnh, struct rib_cmd_info *rc, void *arg) | ||||
| { | { | ||||
| #ifdef ROUTE_MPATH | #ifdef ROUTE_MPATH | ||||
| rib_decompose_notification(rc, check_release_defrouter, NULL); | rib_decompose_notification(rc, check_release_defrouter, NULL); | ||||
| if (rc->rc_cmd == RTM_DELETE && !NH_IS_NHGRP(rc->rc_nh_old)) | |||||
| check_release_defrouter(rc, NULL); | |||||
| #else | #else | ||||
| check_release_defrouter(rc, NULL); | check_release_defrouter(rc, NULL); | ||||
| #endif | #endif | ||||
| } | } | ||||
Done Inline ActionsThis should work great for plain nexthop. Shall we check if the rc->rc_nh_old is nexthop group, aka via NH_IS_NHGRP() ? zlei: This should work great for plain nexthop. Shall we check if the `rc->rc_nh_old` is nexthop… | |||||
| int | int | ||||
| nd6_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp) | nd6_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp) | ||||
| { | { | ||||
| struct in6_ndireq *ndi = (struct in6_ndireq *)data; | struct in6_ndireq *ndi = (struct in6_ndireq *)data; | ||||
| struct in6_nbrinfo *nbi = (struct in6_nbrinfo *)data; | struct in6_nbrinfo *nbi = (struct in6_nbrinfo *)data; | ||||
| struct in6_ndifreq *ndif = (struct in6_ndifreq *)data; | struct in6_ndifreq *ndif = (struct in6_ndifreq *)data; | ||||
| struct epoch_tracker et; | struct epoch_tracker et; | ||||
| ▲ Show 20 Lines • Show All 1,093 Lines • Show Last 20 Lines | |||||
The call stack was too deep for me to conclude rc_nh_old would always be non-NULL here? If you keep removing the NULL check below, can we add a KASSERT to document the assumption (here and below)?