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

Function change_nhop

freebsd/net/route/route_ctl.c:922–960  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

920}
921
922static int
923change_nhop(struct rib_head *rnh, struct rt_addrinfo *info,
924 struct nhop_object *nh_orig, struct nhop_object **nh_new)
925{
926 int free_ifa = 0;
927 int error;
928
929 /*
930 * New gateway could require new ifaddr, ifp;
931 * flags may also be different; ifp may be specified
932 * by ll sockaddr when protocol address is ambiguous
933 */
934 if (((nh_orig->nh_flags & NHF_GATEWAY) &&
935 info->rti_info[RTAX_GATEWAY] != NULL) ||
936 info->rti_info[RTAX_IFP] != NULL ||
937 (info->rti_info[RTAX_IFA] != NULL &&
938 !sa_equal(info->rti_info[RTAX_IFA], nh_orig->nh_ifa->ifa_addr))) {
939 error = rt_getifa_fib(info, rnh->rib_fibnum);
940 if (info->rti_ifa != NULL)
941 free_ifa = 1;
942
943 if (error != 0) {
944 if (free_ifa) {
945 ifa_free(info->rti_ifa);
946 info->rti_ifa = NULL;
947 }
948
949 return (error);
950 }
951 }
952
953 error = nhop_create_from_nhop(rnh, nh_orig, info, nh_new);
954 if (free_ifa) {
955 ifa_free(info->rti_ifa);
956 info->rti_ifa = NULL;
957 }
958
959 return (error);
960}
961
962#ifdef ROUTE_MPATH
963static int

Callers 2

change_mpath_routeFunction · 0.85
change_routeFunction · 0.85

Calls 3

rt_getifa_fibFunction · 0.85
ifa_freeFunction · 0.85
nhop_create_from_nhopFunction · 0.85

Tested by

no test coverage detected