X Tutup
Skip to content

Commit 3f7cc08

Browse files
committed
network: coding style fixes
1 parent d40b01e commit 3f7cc08

File tree

4 files changed

+22
-27
lines changed

4 files changed

+22
-27
lines changed

src/network/netdev/bond.c

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -177,22 +177,21 @@ static int netdev_bond_fill_message_create(NetDev *netdev, Link *link, sd_netlin
177177
assert(b);
178178

179179
if (b->mode != _NETDEV_BOND_MODE_INVALID) {
180-
r = sd_netlink_message_append_u8(m, IFLA_BOND_MODE,
181-
bond_mode_to_kernel(b->mode));
180+
r = sd_netlink_message_append_u8(m, IFLA_BOND_MODE, bond_mode_to_kernel(b->mode));
182181
if (r < 0)
183182
return log_netdev_error_errno(netdev, r, "Could not append IFLA_BOND_MODE attribute: %m");
184183
}
185184

186185
if (b->xmit_hash_policy != _NETDEV_BOND_XMIT_HASH_POLICY_INVALID) {
187186
r = sd_netlink_message_append_u8(m, IFLA_BOND_XMIT_HASH_POLICY,
188-
bond_xmit_hash_policy_to_kernel(b->xmit_hash_policy));
187+
bond_xmit_hash_policy_to_kernel(b->xmit_hash_policy));
189188
if (r < 0)
190189
return log_netdev_error_errno(netdev, r, "Could not append IFLA_BOND_XMIT_HASH_POLICY attribute: %m");
191190
}
192191

193192
if (b->lacp_rate != _NETDEV_BOND_LACP_RATE_INVALID &&
194193
b->mode == NETDEV_BOND_MODE_802_3AD) {
195-
r = sd_netlink_message_append_u8(m, IFLA_BOND_AD_LACP_RATE, b->lacp_rate );
194+
r = sd_netlink_message_append_u8(m, IFLA_BOND_AD_LACP_RATE, b->lacp_rate);
196195
if (r < 0)
197196
return log_netdev_error_errno(netdev, r, "Could not append IFLA_BOND_AD_LACP_RATE attribute: %m");
198197
}
@@ -220,8 +219,8 @@ static int netdev_bond_fill_message_create(NetDev *netdev, Link *link, sd_netlin
220219
if (r < 0)
221220
return log_netdev_error_errno(netdev, r, "Could not append IFLA_BOND_ARP_INTERVAL attribute: %m");
222221

223-
if ((b->lp_interval >= LEARNING_PACKETS_INTERVAL_MIN_SEC) &&
224-
(b->lp_interval <= LEARNING_PACKETS_INTERVAL_MAX_SEC)) {
222+
if (b->lp_interval >= LEARNING_PACKETS_INTERVAL_MIN_SEC &&
223+
b->lp_interval <= LEARNING_PACKETS_INTERVAL_MAX_SEC) {
225224
r = sd_netlink_message_append_u32(m, IFLA_BOND_LP_INTERVAL, b->lp_interval / USEC_PER_SEC);
226225
if (r < 0)
227226
return log_netdev_error_errno(netdev, r, "Could not append IFLA_BOND_LP_INTERVAL attribute: %m");
@@ -313,23 +312,20 @@ static int netdev_bond_fill_message_create(NetDev *netdev, Link *link, sd_netlin
313312
return log_netdev_error_errno(netdev, r, "Could not append IFLA_BOND_TLB_DYNAMIC_LB attribute: %m");
314313
}
315314

316-
if (b->arp_interval > 0) {
317-
if (b->n_arp_ip_targets > 0) {
318-
319-
r = sd_netlink_message_open_container(m, IFLA_BOND_ARP_IP_TARGET);
320-
if (r < 0)
321-
return log_netdev_error_errno(netdev, r, "Could not open contaniner IFLA_BOND_ARP_IP_TARGET : %m");
322-
323-
LIST_FOREACH(arp_ip_target, target, b->arp_ip_targets) {
324-
r = sd_netlink_message_append_u32(m, i++, target->ip.in.s_addr);
325-
if (r < 0)
326-
return log_netdev_error_errno(netdev, r, "Could not append IFLA_BOND_ARP_ALL_TARGETS attribute: %m");
327-
}
315+
if (b->arp_interval > 0 && b->n_arp_ip_targets > 0) {
316+
r = sd_netlink_message_open_container(m, IFLA_BOND_ARP_IP_TARGET);
317+
if (r < 0)
318+
return log_netdev_error_errno(netdev, r, "Could not open contaniner IFLA_BOND_ARP_IP_TARGET : %m");
328319

329-
r = sd_netlink_message_close_container(m);
320+
LIST_FOREACH(arp_ip_target, target, b->arp_ip_targets) {
321+
r = sd_netlink_message_append_u32(m, i++, target->ip.in.s_addr);
330322
if (r < 0)
331-
return log_netdev_error_errno(netdev, r, "Could not close contaniner IFLA_BOND_ARP_IP_TARGET : %m");
323+
return log_netdev_error_errno(netdev, r, "Could not append IFLA_BOND_ARP_ALL_TARGETS attribute: %m");
332324
}
325+
326+
r = sd_netlink_message_close_container(m);
327+
if (r < 0)
328+
return log_netdev_error_errno(netdev, r, "Could not close contaniner IFLA_BOND_ARP_IP_TARGET : %m");
333329
}
334330

335331
return 0;

src/network/netdev/geneve.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ static int netdev_geneve_create(NetDev *netdev) {
9292
return log_netdev_error_errno(netdev, r, "Could not append IFLA_GENEVE_GROUP attribute: %m");
9393
}
9494

95-
if (v->ttl) {
95+
if (v->ttl > 0) {
9696
r = sd_netlink_message_append_u8(m, IFLA_GENEVE_TTL, v->ttl);
9797
if (r < 0)
9898
return log_netdev_error_errno(netdev, r, "Could not append IFLA_GENEVE_TTL attribute: %m");

src/network/netdev/tunnel.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ static int netdev_ipip_fill_message_create(NetDev *netdev, Link *link, sd_netlin
6666
return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_PMTUDISC attribute: %m");
6767

6868
if (t->fou_tunnel) {
69-
7069
r = sd_netlink_message_append_u16(m, IFLA_IPTUN_ENCAP_TYPE, t->fou_encap_type);
7170
if (r < 0)
7271
return log_netdev_error_errno(netdev, r, "Could not append IFLA_IPTUN_ENCAP_TYPE attribute: %m");
@@ -430,7 +429,7 @@ static int netdev_ip6tnl_fill_message_create(NetDev *netdev, Link *link, sd_netl
430429
if (t->copy_dscp)
431430
t->flags |= IP6_TNL_F_RCV_DSCP_COPY;
432431

433-
if (t->allow_localremote != -1)
432+
if (t->allow_localremote >= 0)
434433
SET_FLAG(t->flags, IP6_TNL_F_ALLOW_LOCAL_REMOTE, t->allow_localremote);
435434

436435
if (t->encap_limit != IPV6_DEFAULT_TNL_ENCAP_LIMIT) {

src/network/networkd-link.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -881,9 +881,9 @@ void link_check_ready(Link *link) {
881881

882882
if (!link->network->bridge) {
883883

884-
if (link_ipv6ll_enabled(link))
885-
if (in_addr_is_null(AF_INET6, (const union in_addr_union*) &link->ipv6ll_address) > 0)
886-
return;
884+
if (link_ipv6ll_enabled(link) &&
885+
in_addr_is_null(AF_INET6, (const union in_addr_union*) &link->ipv6ll_address))
886+
return;
887887

888888
if ((link_dhcp4_enabled(link) && !link_dhcp6_enabled(link) &&
889889
!link->dhcp4_configured) ||
@@ -1734,7 +1734,7 @@ static int link_acquire_conf(Link *link) {
17341734
if (r < 0)
17351735
return r;
17361736

1737-
if (in_addr_is_null(AF_INET6, (const union in_addr_union*) &link->ipv6ll_address) == 0) {
1737+
if (!in_addr_is_null(AF_INET6, (const union in_addr_union*) &link->ipv6ll_address)) {
17381738
r = link_acquire_ipv6_conf(link);
17391739
if (r < 0)
17401740
return r;

0 commit comments

Comments
 (0)
X Tutup