MCPcopy Create free account
hub / github.com/F-Stack/f-stack / rib_del_route

Function rib_del_route

freebsd/net/route/route_ctl.c:729–760  ·  view source on GitHub ↗

* Removes route defined by @info from the kernel table specified by @fibnum and * sa_family in @info->rti_info[RTAX_DST]. * * Returns 0 on success and fills in operation metadata into @rc. */

Source from the content-addressed store, hash-verified

727 * Returns 0 on success and fills in operation metadata into @rc.
728 */
729int
730rib_del_route(uint32_t fibnum, struct rt_addrinfo *info, struct rib_cmd_info *rc)
731{
732 struct rib_head *rnh;
733 struct sockaddr *dst_orig, *netmask;
734 struct sockaddr_storage mdst;
735 int error;
736
737 NET_EPOCH_ASSERT();
738
739 rnh = get_rnh(fibnum, info);
740 if (rnh == NULL)
741 return (EAFNOSUPPORT);
742
743 bzero(rc, sizeof(struct rib_cmd_info));
744 rc->rc_cmd = RTM_DELETE;
745
746 dst_orig = info->rti_info[RTAX_DST];
747 netmask = info->rti_info[RTAX_NETMASK];
748
749 if (netmask != NULL) {
750 /* Ensure @dst is always properly masked */
751 if (dst_orig->sa_len > sizeof(mdst))
752 return (EINVAL);
753 rt_maskedcopy(dst_orig, (struct sockaddr *)&mdst, netmask);
754 info->rti_info[RTAX_DST] = (struct sockaddr *)&mdst;
755 }
756 error = del_route(rnh, info, rc);
757 info->rti_info[RTAX_DST] = dst_orig;
758
759 return (error);
760}
761
762/*
763 * Conditionally unlinks rtentry matching data inside @info from @rnh.

Callers 1

rib_actionFunction · 0.85

Calls 4

get_rnhFunction · 0.85
bzeroFunction · 0.85
rt_maskedcopyFunction · 0.85
del_routeFunction · 0.85

Tested by

no test coverage detected