route_netlink.c (9ee6278b78859e8a9e303ec4a037b4e76d6ed89a) | route_netlink.c (656a39c1a062411dca09d1566a7a0709c30f3bc7) |
---|---|
1/*- 2 * SPDX-License-Identifier: BSD-3-Clause 3 * 4 * Copyright (c) 1983, 1988, 1993 5 * The Regents of the University of California. All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 223 unchanged lines hidden (view full) --- 232{ 233 234 struct snl_parsed_route rt = {}; 235 if (!snl_parse_nlmsg(ss, hdr, &snl_rtm_route_parser, &rt)) 236 return; 237 if (rt.rtax_weight == 0) 238 rt.rtax_weight = rt_default_weight; 239 | 1/*- 2 * SPDX-License-Identifier: BSD-3-Clause 3 * 4 * Copyright (c) 1983, 1988, 1993 5 * The Regents of the University of California. All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 223 unchanged lines hidden (view full) --- 232{ 233 234 struct snl_parsed_route rt = {}; 235 if (!snl_parse_nlmsg(ss, hdr, &snl_rtm_route_parser, &rt)) 236 return; 237 if (rt.rtax_weight == 0) 238 rt.rtax_weight = rt_default_weight; 239 |
240 if (rt.rta_multipath != NULL) { | 240 if (rt.rta_multipath.num_nhops != 0) { |
241 uint32_t orig_rtflags = rt.rta_rtflags; 242 uint32_t orig_mtu = rt.rtax_mtu; | 241 uint32_t orig_rtflags = rt.rta_rtflags; 242 uint32_t orig_mtu = rt.rtax_mtu; |
243 for (int i = 0; i < rt.rta_multipath->num_nhops; i++) { 244 struct rta_mpath_nh *nhop = &rt.rta_multipath->nhops[i]; | 243 for (uint32_t i = 0; i < rt.rta_multipath.num_nhops; i++) { 244 struct rta_mpath_nh *nhop = rt.rta_multipath.nhops[i]; |
245 246 rt.rta_gw = nhop->gw; 247 rt.rta_oif = nhop->ifindex; 248 rt.rtax_weight = nhop->rtnh_weight; 249 rt.rta_rtflags = nhop->rta_rtflags ? nhop->rta_rtflags : orig_rtflags; 250 rt.rtax_mtu = nhop->rtax_mtu ? nhop->rtax_mtu : orig_mtu; 251 252 xo_open_instance(name); --- 92 unchanged lines hidden --- | 245 246 rt.rta_gw = nhop->gw; 247 rt.rta_oif = nhop->ifindex; 248 rt.rtax_weight = nhop->rtnh_weight; 249 rt.rta_rtflags = nhop->rta_rtflags ? nhop->rta_rtflags : orig_rtflags; 250 rt.rtax_mtu = nhop->rtax_mtu ? nhop->rtax_mtu : orig_mtu; 251 252 xo_open_instance(name); --- 92 unchanged lines hidden --- |