|
5 | 5 | #include "conf-parser.h" |
6 | 6 | #include "macvlan.h" |
7 | 7 | #include "macvlan-util.h" |
| 8 | +#include "parse-util.h" |
8 | 9 |
|
9 | 10 | DEFINE_CONFIG_PARSE_ENUM(config_parse_macvlan_mode, macvlan_mode, MacVlanMode, "Failed to parse macvlan mode"); |
10 | 11 |
|
@@ -51,6 +52,57 @@ static int netdev_macvlan_fill_message_create(NetDev *netdev, Link *link, sd_net |
51 | 52 | return log_netdev_error_errno(netdev, r, "Could not append IFLA_MACVLAN_MODE attribute: %m"); |
52 | 53 | } |
53 | 54 |
|
| 55 | + if (m->bc_queue_length != UINT32_MAX) { |
| 56 | + r = sd_netlink_message_append_u32(req, IFLA_MACVLAN_BC_QUEUE_LEN, m->bc_queue_length); |
| 57 | + if (r < 0) |
| 58 | + return log_netdev_error_errno(netdev, r, "Could not append IFLA_MACVLAN_BC_QUEUE_LEN attribute: %m"); |
| 59 | + } |
| 60 | + |
| 61 | + return 0; |
| 62 | +} |
| 63 | + |
| 64 | +int config_parse_macvlan_broadcast_queue_size( |
| 65 | + const char *unit, |
| 66 | + const char *filename, |
| 67 | + unsigned line, |
| 68 | + const char *section, |
| 69 | + unsigned section_line, |
| 70 | + const char *lvalue, |
| 71 | + int ltype, |
| 72 | + const char *rvalue, |
| 73 | + void *data, |
| 74 | + void *userdata) { |
| 75 | + |
| 76 | + MacVlan *m = userdata; |
| 77 | + uint32_t v; |
| 78 | + int r; |
| 79 | + |
| 80 | + assert(filename); |
| 81 | + assert(section); |
| 82 | + assert(lvalue); |
| 83 | + assert(rvalue); |
| 84 | + assert(data); |
| 85 | + assert(userdata); |
| 86 | + |
| 87 | + if (isempty(rvalue)) { |
| 88 | + m->bc_queue_length = UINT32_MAX; |
| 89 | + return 0; |
| 90 | + } |
| 91 | + |
| 92 | + r = safe_atou32(rvalue, &v); |
| 93 | + if (r < 0) { |
| 94 | + log_syntax(unit, LOG_WARNING, filename, line, r, |
| 95 | + "Failed to parse BroadcastMulticastQueueLength=%s, ignoring assignment: %m", rvalue); |
| 96 | + return 0; |
| 97 | + } |
| 98 | + |
| 99 | + if (v == UINT32_MAX) { |
| 100 | + log_syntax(unit, LOG_WARNING, filename, line, 0, |
| 101 | + "Invalid BroadcastMulticastQueueLength=%s, ignoring assignment: %m", rvalue); |
| 102 | + return 0; |
| 103 | + } |
| 104 | + |
| 105 | + m->bc_queue_length = v; |
54 | 106 | return 0; |
55 | 107 | } |
56 | 108 |
|
@@ -82,6 +134,7 @@ static void macvlan_init(NetDev *n) { |
82 | 134 | assert(m); |
83 | 135 |
|
84 | 136 | m->mode = _NETDEV_MACVLAN_MODE_INVALID; |
| 137 | + m->bc_queue_length = UINT32_MAX; |
85 | 138 | } |
86 | 139 |
|
87 | 140 | const NetDevVTable macvtap_vtable = { |
|
0 commit comments