Lines Matching defs:rt
624 rtm_report(struct rtentry *rt, u_char type, int seq, int tableid)
637 info.rti_info[RTAX_DST] = rt_key(rt);
638 info.rti_info[RTAX_GATEWAY] = rt->rt_gateway;
639 info.rti_info[RTAX_NETMASK] = rt_plen2mask(rt, &sa_mask);
640 info.rti_info[RTAX_LABEL] = rtlabel_id2sa(rt->rt_labelid, &sa_rl);
642 if (rt->rt_flags & RTF_BFD) {
644 info.rti_info[RTAX_BFD] = bfd2sa(rt, &sa_bfd);
649 if (rt->rt_flags & RTF_MPLS) {
656 rt->rt_llinfo)->mpls_label;
659 rt->rt_llinfo)->mpls_operation;
662 ifp = if_get(rt->rt_ifidx);
668 info.rti_info[RTAX_IFA] = rt->rt_ifa->ifa_addr;
670 info.rti_info[RTAX_BRD] = rt->rt_ifa->ifa_dstaddr;
681 rtm->rtm_index = rt->rt_ifidx;
683 rtm->rtm_priority = rt->rt_priority & RTP_MASK;
684 rtm->rtm_flags = rt->rt_flags;
687 rtm_getmetrics(rt, &rtm->rtm_rmx);
699 struct rtentry *rt = NULL;
878 error = rtm_output(rtm, &rt, &info, prio, tableid);
884 rtm = rtm_report(rt, type, seq, tableid);
890 rtfree(rt);
930 struct rtentry *rt = *prt;
941 rt = rtable_match(tableid, info->rti_info[RTAX_DST], NULL);
942 if ((error = route_arp_conflict(rt, info))) {
943 rtfree(rt);
944 rt = NULL;
953 if ((rt != NULL) && ISSET(rt->rt_flags, RTF_CACHED)) {
954 ifp = if_get(rt->rt_ifidx);
956 rtfree(rt);
957 rt = NULL;
965 rtfree(rt);
966 rt = NULL;
973 error = rtrequest(RTM_ADD, info, prio, &rt, tableid);
977 &rt->rt_rmx);
980 rt = rtable_lookup(tableid, info->rti_info[RTAX_DST],
983 if (rt == NULL) {
992 if (ISSET(rt->rt_flags, RTF_MPATH) &&
998 ifp = if_get(rt->rt_ifidx);
1000 rtfree(rt);
1001 rt = NULL;
1011 if ((ISSET(rt->rt_flags, RTF_CACHED))) {
1013 ifp->if_rtrequest(ifp, RTM_INVALIDATE, rt);
1015 rtable_walk(tableid, rt_key(rt)->sa_family, NULL,
1016 route_cleargateway, rt);
1025 if (ISSET(rt->rt_flags, RTF_LOCAL|RTF_BROADCAST)) {
1030 rtfree(rt);
1031 rt = NULL;
1034 error = rtrequest_delete(info, prio, ifp, &rt, tableid);
1038 rt = rtable_lookup(tableid, info->rti_info[RTAX_DST],
1045 if ((rt != NULL) && ISSET(rt->rt_flags, RTF_MPATH) &&
1047 rtfree(rt);
1048 rt = NULL;
1055 if ((rt == NULL) && (info->rti_info[RTAX_GATEWAY] != NULL)) {
1056 rt = rtable_lookup(tableid, info->rti_info[RTAX_DST],
1059 if ((rt != NULL) && ISSET(rt->rt_flags, RTF_MPATH)) {
1060 rtfree(rt);
1061 rt = NULL;
1065 if (rt == NULL) {
1074 if (ISSET(rt->rt_flags, RTF_LOCAL|RTF_BROADCAST)) {
1079 ifp = if_get(rt->rt_ifidx);
1081 rtfree(rt);
1082 rt = NULL;
1092 if (rt_plen(rt) != plen) {
1098 if (rt->rt_gateway == NULL ||
1099 bcmp(rt->rt_gateway,
1120 if (rt->rt_ifa != ifa) {
1121 ifp->if_rtrequest(ifp, RTM_DELETE, rt);
1122 ifafree(rt->rt_ifa);
1124 rt->rt_ifa = ifaref(ifa);
1125 rt->rt_ifidx = ifa->ifa_ifp->if_index;
1127 rt_if_linkstate_change(rt, ifa->ifa_ifp,
1135 if (!newgate && rt->rt_gateway->sa_family !=
1142 error = rt_setgate(rt,
1151 error = rt_mpls_set(rt,
1159 rt_mpls_clear(rt);
1167 error = bfdset(rt);
1174 bfdclear(rt);
1185 rt->rt_flags =
1186 (rt->rt_flags & ~rtm->rtm_fmask) |
1189 rtm_setmetrics(rtm->rtm_inits, &rtm->rtm_rmx, &rt->rt_rmx);
1191 ifp->if_rtrequest(ifp, RTM_ADD, rt);
1196 rtlabel_unref(rt->rt_labelid);
1197 rt->rt_labelid = rtlabel_name2id(rtlabel);
1201 rt->rt_locks &= ~(rtm->rtm_inits);
1202 rt->rt_locks |= (rtm->rtm_inits & rtm->rtm_rmx.rmx_locks);
1206 rt = rtable_lookup(tableid, info->rti_info[RTAX_DST],
1209 if (rt == NULL)
1215 *prt = rt;
1257 struct rtentry *rt;
1259 rt = rtalloc(gateway, RT_RESOLVE, rtable_l2(rtableid));
1260 if (rt != NULL)
1261 ifa = rt->rt_ifa;
1262 rtfree(rt);
1342 route_cleargateway(struct rtentry *rt, void *arg, unsigned int rtableid)
1346 if (ISSET(rt->rt_flags, RTF_GATEWAY) && rt->rt_gwroute == nhrt &&
1347 !ISSET(rt->rt_locks, RTV_MTU))
1348 atomic_store_int(&rt->rt_mtu, 0);
1361 route_arp_conflict(struct rtentry *rt, struct rt_addrinfo *info)
1369 if (rt == NULL || !ISSET(rt->rt_flags, RTF_LLINFO))
1373 if (ISSET(rt->rt_flags, RTF_CACHED))
1380 if ((ISSET(rt->rt_flags, RTF_ANNOUNCE) == proxy) ||
1381 ISSET(rt->rt_flags, RTF_MPATH))
1409 rtm_getmetrics(const struct rtentry *rt, struct rt_metrics *out)
1411 const struct rt_kmetrics *in = &rt->rt_rmx;
1416 expire = rt_timer_get_expire(rt);
1734 rtm_send(struct rtentry *rt, int cmd, int error, unsigned int rtableid)
1742 info.rti_info[RTAX_DST] = rt_key(rt);
1743 info.rti_info[RTAX_GATEWAY] = rt->rt_gateway;
1744 if (!ISSET(rt->rt_flags, RTF_HOST))
1745 info.rti_info[RTAX_NETMASK] = rt_plen2mask(rt, &sa_mask);
1746 info.rti_info[RTAX_LABEL] = rtlabel_id2sa(rt->rt_labelid, &sa_rl);
1747 ifp = if_get(rt->rt_ifidx);
1753 info.rti_info[RTAX_IFA] = rt->rt_ifa->ifa_addr;
1756 rtm_miss(cmd, &info, rt->rt_flags, rt->rt_priority, rt->rt_ifidx, error,
1961 sysctl_dumpentry(struct rtentry *rt, void *v, unsigned int id)
1973 if (w->w_op == NET_RT_FLAGS && !(rt->rt_flags & w->w_arg))
1980 if (prio == (rt->rt_priority & RTP_MASK))
1983 if (prio != (rt->rt_priority & RTP_MASK) &&
1989 info.rti_info[RTAX_DST] = rt_key(rt);
1990 info.rti_info[RTAX_GATEWAY] = rt->rt_gateway;
1991 info.rti_info[RTAX_NETMASK] = rt_plen2mask(rt, &sa_mask);
1992 ifp = if_get(rt->rt_ifidx);
1998 info.rti_info[RTAX_IFA] = rt->rt_ifa->ifa_addr;
2000 info.rti_info[RTAX_BRD] = rt->rt_ifa->ifa_dstaddr;
2003 info.rti_info[RTAX_LABEL] = rtlabel_id2sa(rt->rt_labelid, &sa_rl);
2005 if (rt->rt_flags & RTF_BFD) {
2007 info.rti_info[RTAX_BFD] = bfd2sa(rt, &sa_bfd);
2011 if (rt->rt_flags & RTF_MPLS) {
2018 rt->rt_llinfo)->mpls_label;
2021 rt->rt_llinfo)->mpls_operation;
2030 rtm->rtm_flags = RTF_DONE | rt->rt_flags;
2031 rtm->rtm_priority = rt->rt_priority & RTP_MASK;
2032 rtm_getmetrics(rt, &rtm->rtm_rmx);
2034 rtm->rtm_rmx.rmx_refcnt = refcnt_read(&rt->rt_refcnt) - 1;
2035 rtm->rtm_index = rt->rt_ifidx;