Lines Matching refs:rtm

211 			struct rt_msghdr *rtm, struct rib_cmd_info *rc);
215 static void send_rtm_reply(struct socket *so, struct rt_msghdr *rtm,
644 * Fills in @info based on userland-provided @rtm message.
649 fill_addrinfo(struct rt_msghdr *rtm, int len, struct linear_buffer *lb, u_int fibnum,
654 rtm->rtm_pid = curproc->p_pid;
655 info->rti_addrs = rtm->rtm_addrs;
657 info->rti_mflags = rtm->rtm_inits;
658 info->rti_rmx = &rtm->rtm_rmx;
665 if (rt_xaddrs((caddr_t)(rtm + 1), len + (caddr_t)rtm, info))
668 info->rti_flags = rtm->rtm_flags;
676 if (rtm->rtm_type != RTM_GET) {
743 struct rt_msghdr *rtm, struct rib_cmd_info *rc)
765 if ((rtm->rtm_addrs & RTA_NETMASK) == 0) {
795 if (rtm->rtm_flags & RTF_ANNOUNCE) {
898 struct rt_msghdr *rtm, *orig_rtm = NULL;
902 rtm = *prtm;
904 rtsock_msg_buffer(rtm->rtm_type, info, NULL, &len);
911 bcopy(rtm, tmp_rtm, rtm->rtm_msglen);
912 orig_rtm = rtm;
913 rtm = tmp_rtm;
917 * Delay freeing original rtm as info contains
922 w.w_tmem = (caddr_t)rtm;
924 rtsock_msg_buffer(rtm->rtm_type, info, &w, &len);
925 rtm->rtm_addrs = info->rti_addrs;
929 *prtm = rtm;
936 * rtm can be reallocated.
939 * rtm.
947 struct rt_msghdr *rtm;
951 rtm = *prtm;
962 if (rtm->rtm_addrs & (RTA_IFP | RTA_IFA)) {
973 rtm->rtm_index = ifp->if_index;
979 rtm->rtm_index = ifp->if_index;
984 rtm = *prtm;
985 rtm->rtm_flags = rc->rc_rt->rte_flags | nhop_get_rtflags(nh);
986 if (rtm->rtm_flags & RTF_GWFLAG_COMPAT)
987 rtm->rtm_flags = RTF_GATEWAY |
988 (rtm->rtm_flags & ~RTF_GWFLAG_COMPAT);
989 rt_getmetrics(rc->rc_rt, nh, &rtm->rtm_rmx);
990 rtm->rtm_rmx.rmx_weight = rc->rc_nh_weight;
1032 struct rt_msghdr *rtm = NULL;
1061 if (len < sizeof(*rtm) ||
1072 if ((rtm = malloc(total_len, M_TEMP, M_NOWAIT)) == NULL)
1075 m_copydata(m, 0, len, (caddr_t)rtm);
1079 .base = (char *)rtm + alloc_len,
1083 if (rtm->rtm_version != RTM_VERSION) {
1085 free(rtm, M_TEMP);
1086 rtm = NULL;
1096 if ((error = fill_addrinfo(rtm, len, &lb, fibnum, &info)) != 0) {
1107 if (rtm->rtm_flags & RTF_LLDATA) {
1108 error = lla_rt_output(rtm, &info);
1113 int blackhole_flags = rtm->rtm_flags & (RTF_BLACKHOLE|RTF_REJECT);
1125 switch (rtm->rtm_type) {
1128 if (rtm->rtm_type == RTM_ADD) {
1134 error = rib_action(fibnum, rtm->rtm_type, &info, &rc);
1149 rtm->rtm_index = nh->nh_ifp->if_index;
1150 rtm->rtm_flags = rc.rc_rt->rte_flags | nhop_get_rtflags(nh);
1173 error = handle_rtm_get(&info, fibnum, rtm, &rc);
1187 error = update_rtm_from_rc(&info, &rtm, alloc_len, &rc, nh);
1190 * point to memory outsize @rtm. Some may be pointing
1197 * writing updated rtm in rtsock_msg_buffer().
1209 if (rtm != NULL) {
1211 /* sin6_scope_id is recovered before sending rtm. */
1223 if (update_rtm_from_info(&info, &rtm, alloc_len) != 0) {
1230 send_rtm_reply(so, rtm, m, saf, fibnum, error);
1236 * Sends the prepared reply message in @rtm to all rtsock clients.
1237 * Frees @m and @rtm.
1241 send_rtm_reply(struct socket *so, struct rt_msghdr *rtm, struct mbuf *m,
1251 if (rtm != NULL)
1252 free(rtm, M_TEMP);
1260 if (rtm != NULL) {
1262 rtm->rtm_errno = rtm_errno;
1264 rtm->rtm_flags |= RTF_DONE;
1266 m_copyback(m, 0, rtm->rtm_msglen, (caddr_t)rtm);
1267 if (m->m_pkthdr.len < rtm->rtm_msglen) {
1270 } else if (m->m_pkthdr.len > rtm->rtm_msglen)
1271 m_adj(m, rtm->rtm_msglen - m->m_pkthdr.len);
1273 free(rtm, M_TEMP);
1680 struct rt_msghdr *rtm;
1723 rtm = mtod(m, struct rt_msghdr *);
1724 bzero((caddr_t)rtm, len);
1749 rtm->rtm_msglen = len;
1750 rtm->rtm_version = RTM_VERSION;
1751 rtm->rtm_type = type;
1770 struct rt_msghdr *rtm = NULL;
1819 rtm = (struct rt_msghdr *)w->w_tmem;
1877 rtm->rtm_version = RTM_VERSION;
1878 rtm->rtm_type = type;
1879 rtm->rtm_msglen = len;
1900 struct rt_msghdr *rtm;
1917 rtm = mtod(m, struct rt_msghdr *);
1918 rtm->rtm_flags = RTF_DONE | flags;
1919 rtm->rtm_errno = error;
1920 rtm->rtm_addrs = rtinfo->rti_addrs;
2037 struct rt_msghdr *rtm;
2058 rtm = mtod(m, struct rt_msghdr *);
2059 rtm->rtm_addrs = info->rti_addrs;
2061 rtm->rtm_index = info->rti_ifp->if_index;
2067 rtm->rtm_flags = info->rti_flags;
2267 struct rt_msghdr *rtm = (struct rt_msghdr *)w->w_tmem;
2269 bzero(&rtm->rtm_index,
2270 sizeof(*rtm) - offsetof(struct rt_msghdr, rtm_index));
2277 rtm->rtm_flags = rtflags | RTF_UP;
2278 if (rtm->rtm_flags & RTF_GWFLAG_COMPAT)
2279 rtm->rtm_flags = RTF_GATEWAY |
2280 (rtm->rtm_flags & ~RTF_GWFLAG_COMPAT);
2281 rt_getmetrics(rt, nh, &rtm->rtm_rmx);
2282 rtm->rtm_rmx.rmx_weight = weight;
2283 rtm->rtm_index = nh->nh_ifp->if_index;
2284 rtm->rtm_addrs = info.rti_addrs;
2285 error = SYSCTL_OUT(w->w_req, (caddr_t)rtm, size);