- Parameters
-
req | Requested match. |
flags | additional netlink message flags |
Builds a new netlink message requesting a change of link attributes. The netlink message header isn't fully equipped with all relevant fields and must be sent out via nl_send_auto_complete() or supplemented as needed. old must point to a link currently configured in the kernel and tmpl must contain the attributes to be changed set via rtnl_link_set_*
functions.
- Returns
- New netlink message
- Note
- Not all attributes can be changed, see Changeable Attributes for more details.
Definition at line 212 of file lookup.c.
References nl_addr_get_binary_addr(), nlmsg_alloc_simple(), nlmsg_append(), and nlmsg_free().
Referenced by flnl_lookup().
215 struct nl_addr *addr;
217 int tos, scope, table;
218 struct fib_result_nl fr = {0};
220 fwmark = flnl_request_get_fwmark(req);
221 tos = flnl_request_get_tos(req);
222 scope = flnl_request_get_scope(req);
223 table = flnl_request_get_table(req);
225 fr.fl_fwmark = fwmark != UINT_LEAST64_MAX ? fwmark : 0;
226 fr.fl_tos = tos >= 0 ? tos : 0;
227 fr.fl_scope = scope >= 0 ? scope : RT_SCOPE_UNIVERSE;
228 fr.tb_id_in = table >= 0 ? table : RT_TABLE_UNSPEC;
230 addr = flnl_request_get_addr(req);
232 nl_error(EINVAL,
"Request must specify the address");
242 if (
nlmsg_append(msg, &fr,
sizeof(fr), NLMSG_ALIGNTO) < 0)