1
0
mirror of https://github.com/systemd/systemd synced 2026-03-14 09:04:47 +01:00

Compare commits

..

2 Commits

Author SHA1 Message Date
Jörg Deckert
dd568427fb
networkd: correct batman-adv setting name (GatewayBandwidth) (#19539)
Co-authored-by: Jörg Deckert <jdeckert@unitas-network.de>
2021-05-08 14:39:32 +02:00
Yu Watanabe
3d56acef7f string-util: explicitly cast character to unsigned
This also adds comment why we cast to unsigned.

Follow-up for 7971f9030ae4bebe0d4a6845ed31584f8ab18103.

Addresses the comment https://github.com/systemd/systemd/pull/19544#discussion_r628472794.
2021-05-08 14:24:51 +02:00
5 changed files with 14 additions and 5 deletions

View File

@ -130,7 +130,12 @@ static inline bool _pure_ in_charset(const char *s, const char* charset) {
}
static inline bool char_is_cc(char p) {
return (uint8_t) p < ' ' || p == 127;
/* char is unsigned on some architectures, e.g. aarch64. So, compiler may warn the condition
* p >= 0 is always true. See #19543. Hence, let's cast to unsigned before the comparison. Note
* that the cast in the right hand side is redundant, as according to the C standard, compilers
* automatically cast a signed value to unsigned when comparing with an unsigned variable. Just
* for safety and readability. */
return (uint8_t) p < (uint8_t) ' ' || p == 127;
}
bool string_has_cc(const char *p, const char *ok) _pure_;

View File

@ -244,6 +244,8 @@ BatmanAdvanced.Fragmentation, config_parse_bool,
BatmanAdvanced.GatewayMode, config_parse_batadv_gateway_mode, 0, offsetof(BatmanAdvanced, gateway_mode)
BatmanAdvanced.GatewayBandwithDown, config_parse_badadv_bandwidth, 0, offsetof(BatmanAdvanced, gateway_bandwidth_down)
BatmanAdvanced.GatewayBandwithUp, config_parse_badadv_bandwidth, 0, offsetof(BatmanAdvanced, gateway_bandwidth_up)
BatmanAdvanced.GatewayBandwidthDown, config_parse_badadv_bandwidth, 0, offsetof(BatmanAdvanced, gateway_bandwidth_down)
BatmanAdvanced.GatewayBandwidthUp, config_parse_badadv_bandwidth, 0, offsetof(BatmanAdvanced, gateway_bandwidth_up)
BatmanAdvanced.HopPenalty, config_parse_uint8, 0, offsetof(BatmanAdvanced, hop_penalty)
BatmanAdvanced.OriginatorIntervalSec, config_parse_sec, 0, offsetof(BatmanAdvanced, originator_interval)
BatmanAdvanced.RoutingAlgorithm, config_parse_batadv_routing_algorithm, 0, offsetof(BatmanAdvanced, routing_algorithm)

View File

@ -11,6 +11,6 @@ DistributedArpTable=1
Fragmentation=1
HopPenalty=10
OriginatorIntervalSec=1
GatewayBandwithDown=100K
GatewayBandwithUp=12K
GatewayBandwidthDown=100K
GatewayBandwidthUp=12K
RoutingAlgorithm=batman-v

View File

@ -234,4 +234,6 @@ HopPenalty=
OriginatorIntervalSec=
GatewayBandwithDown=
GatewayBandwithUp=
GatewayBandwidthDown=
GatewayBandwidthUp=
RoutingAlgorithm=

View File

@ -10,5 +10,5 @@ DistributedArpTable=1
Fragmentation=0
HopPenalty=10
OriginatorIntervalSec=1000ms
GatewayBandwithDown=205M
GatewayBandwithUp=2G
GatewayBandwidthDown=205M
GatewayBandwidthUp=2G