]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/libsystemd/sd-netlink/netlink-util.h
networkd: add support to configure IP Rule (#5725)
[thirdparty/systemd.git] / src / libsystemd / sd-netlink / netlink-util.h
CommitLineData
a2cdd907
LP
1#pragma once
2
d8921c6d
TG
3/***
4 This file is part of systemd.
5
6 Copyright (C) 2013 Tom Gundersen <teg@jklm.no>
7
8 systemd is free software; you can redistribute it and/or modify it
9 under the terms of the GNU Lesser General Public License as published by
10 the Free Software Foundation; either version 2.1 of the License, or
11 (at your option) any later version.
12
13 systemd is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
17
18 You should have received a copy of the GNU Lesser General Public License
19 along with systemd; If not, see <http://www.gnu.org/licenses/>.
20***/
21
07630cea 22#include "sd-netlink.h"
d8921c6d 23
a33dece5 24#include "util.h"
d8921c6d 25
1c4baffc
TG
26int rtnl_message_new_synthetic_error(int error, uint32_t serial, sd_netlink_message **ret);
27uint32_t rtnl_message_get_serial(sd_netlink_message *m);
28void rtnl_message_seal(sd_netlink_message *m);
3815f36f 29
cb4d8b2d
SS
30static inline bool rtnl_message_type_is_neigh(uint16_t type) {
31 return IN_SET(type, RTM_NEWNEIGH, RTM_GETNEIGH, RTM_DELNEIGH);
32}
33
34static inline bool rtnl_message_type_is_route(uint16_t type) {
35 return IN_SET(type, RTM_NEWROUTE, RTM_GETROUTE, RTM_DELROUTE);
36}
37
38static inline bool rtnl_message_type_is_link(uint16_t type) {
39 return IN_SET(type, RTM_NEWLINK, RTM_SETLINK, RTM_GETLINK, RTM_DELLINK);
40}
41
42static inline bool rtnl_message_type_is_addr(uint16_t type) {
43 return IN_SET(type, RTM_NEWADDR, RTM_GETADDR, RTM_DELADDR);
44}
3815f36f 45
30746d60
SS
46static inline bool rtnl_message_type_is_addrlabel(uint16_t type) {
47 return IN_SET(type, RTM_NEWADDRLABEL, RTM_DELADDRLABEL, RTM_GETADDRLABEL);
48}
49
bce67bbe
SS
50static inline bool rtnl_message_type_is_routing_policy_rule(uint16_t type) {
51 return IN_SET(type, RTM_NEWRULE, RTM_DELRULE, RTM_GETRULE);
52}
53
1c4baffc
TG
54int rtnl_set_link_name(sd_netlink **rtnl, int ifindex, const char *name);
55int rtnl_set_link_properties(sd_netlink **rtnl, int ifindex, const char *alias, const struct ether_addr *mac, unsigned mtu);
a33dece5 56
ee8c4568
LP
57int rtnl_log_parse_error(int r);
58int rtnl_log_create_error(int r);