@@ -161,142 +161,6 @@ static int netdev_bridge_post_create(NetDev *netdev, Link *link, sd_netlink_mess
161161 return r ;
162162}
163163
164- static int link_set_bridge_handler (sd_netlink * rtnl , sd_netlink_message * m , Link * link ) {
165- int r ;
166-
167- assert (m );
168- assert (link );
169- assert (link -> ifname );
170-
171- if (IN_SET (link -> state , LINK_STATE_FAILED , LINK_STATE_LINGER ))
172- return 1 ;
173-
174- r = sd_netlink_message_get_errno (m );
175- if (r < 0 ) {
176- log_link_warning_errno (link , r , "Could not set bridge interface: %m" );
177- return 1 ;
178- }
179-
180- return 1 ;
181- }
182-
183- int link_set_bridge (Link * link ) {
184- _cleanup_ (sd_netlink_message_unrefp ) sd_netlink_message * req = NULL ;
185- int r ;
186-
187- assert (link );
188- assert (link -> network );
189-
190- r = sd_rtnl_message_new_link (link -> manager -> rtnl , & req , RTM_SETLINK , link -> ifindex );
191- if (r < 0 )
192- return log_link_error_errno (link , r , "Could not allocate RTM_SETLINK message: %m" );
193-
194- r = sd_rtnl_message_link_set_family (req , AF_BRIDGE );
195- if (r < 0 )
196- return log_link_error_errno (link , r , "Could not set message family: %m" );
197-
198- r = sd_netlink_message_open_container (req , IFLA_PROTINFO );
199- if (r < 0 )
200- return log_link_error_errno (link , r , "Could not append IFLA_PROTINFO attribute: %m" );
201-
202- if (link -> network -> use_bpdu >= 0 ) {
203- r = sd_netlink_message_append_u8 (req , IFLA_BRPORT_GUARD , link -> network -> use_bpdu );
204- if (r < 0 )
205- return log_link_error_errno (link , r , "Could not append IFLA_BRPORT_GUARD attribute: %m" );
206- }
207-
208- if (link -> network -> hairpin >= 0 ) {
209- r = sd_netlink_message_append_u8 (req , IFLA_BRPORT_MODE , link -> network -> hairpin );
210- if (r < 0 )
211- return log_link_error_errno (link , r , "Could not append IFLA_BRPORT_MODE attribute: %m" );
212- }
213-
214- if (link -> network -> fast_leave >= 0 ) {
215- r = sd_netlink_message_append_u8 (req , IFLA_BRPORT_FAST_LEAVE , link -> network -> fast_leave );
216- if (r < 0 )
217- return log_link_error_errno (link , r , "Could not append IFLA_BRPORT_FAST_LEAVE attribute: %m" );
218- }
219-
220- if (link -> network -> allow_port_to_be_root >= 0 ) {
221- r = sd_netlink_message_append_u8 (req , IFLA_BRPORT_PROTECT , link -> network -> allow_port_to_be_root );
222- if (r < 0 )
223- return log_link_error_errno (link , r , "Could not append IFLA_BRPORT_PROTECT attribute: %m" );
224- }
225-
226- if (link -> network -> unicast_flood >= 0 ) {
227- r = sd_netlink_message_append_u8 (req , IFLA_BRPORT_UNICAST_FLOOD , link -> network -> unicast_flood );
228- if (r < 0 )
229- return log_link_error_errno (link , r , "Could not append IFLA_BRPORT_UNICAST_FLOOD attribute: %m" );
230- }
231-
232- if (link -> network -> multicast_flood >= 0 ) {
233- r = sd_netlink_message_append_u8 (req , IFLA_BRPORT_MCAST_FLOOD , link -> network -> multicast_flood );
234- if (r < 0 )
235- return log_link_error_errno (link , r , "Could not append IFLA_BRPORT_MCAST_FLOOD attribute: %m" );
236- }
237-
238- if (link -> network -> multicast_to_unicast >= 0 ) {
239- r = sd_netlink_message_append_u8 (req , IFLA_BRPORT_MCAST_TO_UCAST , link -> network -> multicast_to_unicast );
240- if (r < 0 )
241- return log_link_error_errno (link , r , "Could not append IFLA_BRPORT_MCAST_TO_UCAST attribute: %m" );
242- }
243-
244- if (link -> network -> neighbor_suppression >= 0 ) {
245- r = sd_netlink_message_append_u8 (req , IFLA_BRPORT_NEIGH_SUPPRESS , link -> network -> neighbor_suppression );
246- if (r < 0 )
247- return log_link_error_errno (link , r , "Could not append IFLA_BRPORT_NEIGH_SUPPRESS attribute: %m" );
248- }
249-
250- if (link -> network -> learning >= 0 ) {
251- r = sd_netlink_message_append_u8 (req , IFLA_BRPORT_LEARNING , link -> network -> learning );
252- if (r < 0 )
253- return log_link_error_errno (link , r , "Could not append IFLA_BRPORT_LEARNING attribute: %m" );
254- }
255-
256- if (link -> network -> bridge_proxy_arp >= 0 ) {
257- r = sd_netlink_message_append_u8 (req , IFLA_BRPORT_PROXYARP , link -> network -> bridge_proxy_arp );
258- if (r < 0 )
259- return log_link_error_errno (link , r , "Could not append IFLA_BRPORT_PROXYARP attribute: %m" );
260- }
261-
262- if (link -> network -> bridge_proxy_arp_wifi >= 0 ) {
263- r = sd_netlink_message_append_u8 (req , IFLA_BRPORT_PROXYARP_WIFI , link -> network -> bridge_proxy_arp_wifi );
264- if (r < 0 )
265- return log_link_error_errno (link , r , "Could not append IFLA_BRPORT_PROXYARP_WIFI attribute: %m" );
266- }
267-
268- if (link -> network -> cost != 0 ) {
269- r = sd_netlink_message_append_u32 (req , IFLA_BRPORT_COST , link -> network -> cost );
270- if (r < 0 )
271- return log_link_error_errno (link , r , "Could not append IFLA_BRPORT_COST attribute: %m" );
272- }
273-
274- if (link -> network -> priority != LINK_BRIDGE_PORT_PRIORITY_INVALID ) {
275- r = sd_netlink_message_append_u16 (req , IFLA_BRPORT_PRIORITY , link -> network -> priority );
276- if (r < 0 )
277- return log_link_error_errno (link , r , "Could not append IFLA_BRPORT_PRIORITY attribute: %m" );
278- }
279-
280- if (link -> network -> multicast_router != _MULTICAST_ROUTER_INVALID ) {
281- r = sd_netlink_message_append_u8 (req , IFLA_BRPORT_MULTICAST_ROUTER , link -> network -> multicast_router );
282- if (r < 0 )
283- return log_link_error_errno (link , r , "Could not append IFLA_BRPORT_MULTICAST_ROUTER attribute: %m" );
284- }
285-
286- r = sd_netlink_message_close_container (req );
287- if (r < 0 )
288- return log_link_error_errno (link , r , "Could not append IFLA_LINKINFO attribute: %m" );
289-
290- r = netlink_call_async (link -> manager -> rtnl , NULL , req , link_set_bridge_handler ,
291- link_netlink_destroy_callback , link );
292- if (r < 0 )
293- return log_link_error_errno (link , r , "Could not send rtnetlink message: %m" );
294-
295- link_ref (link );
296-
297- return r ;
298- }
299-
300164int config_parse_bridge_igmp_version (
301165 const char * unit ,
302166 const char * filename ,
0 commit comments