mirror of
https://github.com/systemd/systemd.git
synced 2025-08-29 01:49:55 +03:00
Merge pull request #30694 from yuwata/sd-netlink-move-macro-and-introduce-tos-getter
sd-netlink: two cleanups
This commit is contained in:
@ -92,6 +92,20 @@ int sd_rtnl_message_route_set_src_prefixlen(sd_netlink_message *m, unsigned char
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sd_rtnl_message_route_set_tos(sd_netlink_message *m, unsigned char tos) {
|
||||
struct rtmsg *rtm;
|
||||
|
||||
assert_return(m, -EINVAL);
|
||||
assert_return(m->hdr, -EINVAL);
|
||||
assert_return(rtnl_message_type_is_route(m->hdr->nlmsg_type), -EINVAL);
|
||||
|
||||
rtm = NLMSG_DATA(m->hdr);
|
||||
|
||||
rtm->rtm_tos = tos;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sd_rtnl_message_route_set_scope(sd_netlink_message *m, unsigned char scope) {
|
||||
struct rtmsg *rtm;
|
||||
|
||||
|
@ -17,9 +17,6 @@
|
||||
|
||||
#define GET_CONTAINER(m, i) ((struct rtattr*)((uint8_t*)(m)->hdr + (m)->containers[i].offset))
|
||||
|
||||
#define RTA_TYPE(rta) ((rta)->rta_type & NLA_TYPE_MASK)
|
||||
#define RTA_FLAGS(rta) ((rta)->rta_type & ~NLA_TYPE_MASK)
|
||||
|
||||
int message_new_empty(sd_netlink *nl, sd_netlink_message **ret) {
|
||||
sd_netlink_message *m;
|
||||
|
||||
|
@ -10,6 +10,9 @@
|
||||
#include "ordered-set.h"
|
||||
#include "socket-util.h"
|
||||
|
||||
#define RTA_FLAGS(rta) ((rta)->rta_type & ~NLA_TYPE_MASK)
|
||||
#define RTA_TYPE(rta) ((rta)->rta_type & NLA_TYPE_MASK)
|
||||
|
||||
/* See struct rtvia in rtnetlink.h */
|
||||
typedef struct RouteVia {
|
||||
uint16_t family;
|
||||
|
@ -267,8 +267,6 @@ int bridge_vlan_set_message(Link *link, sd_netlink_message *m, bool is_set) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define RTA_TYPE(rta) ((rta)->rta_type & NLA_TYPE_MASK)
|
||||
|
||||
int link_update_bridge_vlan(Link *link, sd_netlink_message *m) {
|
||||
_cleanup_free_ void *data = NULL;
|
||||
size_t len;
|
||||
|
@ -162,6 +162,7 @@ int sd_rtnl_message_link_get_type(sd_netlink_message *m, unsigned short *type);
|
||||
int sd_rtnl_message_new_route(sd_netlink *nl, sd_netlink_message **ret, uint16_t nlmsg_type, int rtm_family, unsigned char rtm_protocol);
|
||||
int sd_rtnl_message_route_set_dst_prefixlen(sd_netlink_message *m, unsigned char prefixlen);
|
||||
int sd_rtnl_message_route_set_src_prefixlen(sd_netlink_message *m, unsigned char prefixlen);
|
||||
int sd_rtnl_message_route_set_tos(sd_netlink_message *m, unsigned char tos);
|
||||
int sd_rtnl_message_route_set_scope(sd_netlink_message *m, unsigned char scope);
|
||||
int sd_rtnl_message_route_set_flags(sd_netlink_message *m, unsigned flags);
|
||||
int sd_rtnl_message_route_set_table(sd_netlink_message *m, unsigned char table);
|
||||
|
Reference in New Issue
Block a user