lists.open-mesh.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2023
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
List overview
Download
commits
July 2015
----- 2023 -----
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
commits@lists.open-mesh.org
1 participants
42 discussions
Start a n
N
ew thread
[batman-adv] master: batman-adv: Fix gw_bandwidth calculation on 32 bit systems (ca6b86f)
by postmaster@open-mesh.org
Repository : ssh://git@open-mesh.org/batman-adv On branch : master >--------------------------------------------------------------- commit ca6b86fa4f897ce0e7ed22ce7fd2eed0dc1b5165 Author: Sven Eckelmann <sven(a)narfation.org> Date: Sun Jun 21 14:42:52 2015 +0200 batman-adv: Fix gw_bandwidth calculation on 32 bit systems The TVLV for the gw_bandwidth stores everything as u32. But the gw_bandwidth reads the signed long which limits the maximum value to (2 ** 31 - 1) on systems with 4 byte long. Also the input value is always converted from either Mibit/s or Kibit/s to 100Kibit/s. This reduces the values even further when the user sets it via the default unit Kibit/s. It may even cause an integer overflow and end up with a value the user never intended. Instead read the values as u64, check for possible overflows, do the unit adjustments and then reduce the size to u32. Signed-off-by: Sven Eckelmann <sven(a)narfation.org> Signed-off-by: Marek Lindner <mareklindner(a)neomailbox.ch> >--------------------------------------------------------------- ca6b86fa4f897ce0e7ed22ce7fd2eed0dc1b5165 net/batman-adv/gateway_common.c | 49 +++++++++++++++++++++++++++++++++------ 1 file changed, 42 insertions(+), 7 deletions(-) diff --git a/net/batman-adv/gateway_common.c b/net/batman-adv/gateway_common.c index 6b930a6..058b957 100644 --- a/net/batman-adv/gateway_common.c +++ b/net/batman-adv/gateway_common.c @@ -18,6 +18,7 @@ #include "gateway_common.h" #include "main.h" +#include <asm/div64.h> #include <linux/atomic.h> #include <linux/errno.h> #include <linux/byteorder/generic.h> @@ -44,7 +45,7 @@ static bool batadv_parse_gw_bandwidth(struct net_device *net_dev, char *buff, { enum batadv_bandwidth_units bw_unit_type = BATADV_BW_UNIT_KBIT; char *slash_ptr, *tmp_ptr; - long ldown, lup; + u64 ldown, lup; int ret; slash_ptr = strchr(buff, '/'); @@ -62,7 +63,7 @@ static bool batadv_parse_gw_bandwidth(struct net_device *net_dev, char *buff, *tmp_ptr = '\0'; } - ret = kstrtol(buff, 10, &ldown); + ret = kstrtou64(buff, 10, &ldown); if (ret) { batadv_err(net_dev, "Download speed of gateway mode invalid: %s\n", @@ -72,14 +73,31 @@ static bool batadv_parse_gw_bandwidth(struct net_device *net_dev, char *buff, switch (bw_unit_type) { case BATADV_BW_UNIT_MBIT: - *down = ldown * 10; + /* prevent overflow */ + if (U64_MAX / 10 < ldown) { + batadv_err(net_dev, + "Download speed of gateway mode too large: %s\n", + buff); + return false; + } + + ldown *= 10; break; case BATADV_BW_UNIT_KBIT: default: - *down = ldown / 100; + do_div(ldown, 100); break; } + if (U32_MAX < ldown) { + batadv_err(net_dev, + "Download speed of gateway mode too large: %s\n", + buff); + return false; + } + + *down = ldown; + /* we also got some upload info */ if (slash_ptr) { bw_unit_type = BATADV_BW_UNIT_KBIT; @@ -95,7 +113,7 @@ static bool batadv_parse_gw_bandwidth(struct net_device *net_dev, char *buff, *tmp_ptr = '\0'; } - ret = kstrtol(slash_ptr + 1, 10, &lup); + ret = kstrtou64(slash_ptr + 1, 10, &lup); if (ret) { batadv_err(net_dev, "Upload speed of gateway mode invalid: %s\n", @@ -105,13 +123,30 @@ static bool batadv_parse_gw_bandwidth(struct net_device *net_dev, char *buff, switch (bw_unit_type) { case BATADV_BW_UNIT_MBIT: - *up = lup * 10; + /* prevent overflow */ + if (U64_MAX / 10 < lup) { + batadv_err(net_dev, + "Upload speed of gateway mode too large: %s\n", + slash_ptr + 1); + return false; + } + + lup *= 10; break; case BATADV_BW_UNIT_KBIT: default: - *up = lup / 100; + do_div(lup, 100); break; } + + if (U32_MAX < lup) { + batadv_err(net_dev, + "Upload speed of gateway mode too large: %s\n", + slash_ptr + 1); + return false; + } + + *up = lup; } return true;
7 years, 8 months
1
0
0
0
[batman-adv] master: batman-adv: Define (u|s)(8|16|32|64) limits for Linux < 3.14 (557adc4)
by postmaster@open-mesh.org
Repository : ssh://git@open-mesh.org/batman-adv On branch : master >--------------------------------------------------------------- commit 557adc412fb47d44d77ae62d06067450c1c8fa6a Author: Sven Eckelmann <sven(a)narfation.org> Date: Sun Jun 21 14:42:51 2015 +0200 batman-adv: Define (u|s)(8|16|32|64) limits for Linux < 3.14 Signed-off-by: Sven Eckelmann <sven(a)narfation.org> Signed-off-by: Marek Lindner <mareklindner(a)neomailbox.ch> >--------------------------------------------------------------- 557adc412fb47d44d77ae62d06067450c1c8fa6a compat-include/linux/kernel.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/compat-include/linux/kernel.h b/compat-include/linux/kernel.h index 663f9e9..c39cbe8 100644 --- a/compat-include/linux/kernel.h +++ b/compat-include/linux/kernel.h @@ -53,4 +53,21 @@ #endif /* < KERNEL_VERSION(2, 6, 39) */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0) + +#define U8_MAX ((u8)~0U) +#define S8_MAX ((s8)(U8_MAX >> 1)) +#define S8_MIN ((s8)(-S8_MAX - 1)) +#define U16_MAX ((u16)~0U) +#define S16_MAX ((s16)(U16_MAX >> 1)) +#define S16_MIN ((s16)(-S16_MAX - 1)) +#define U32_MAX ((u32)~0U) +#define S32_MAX ((s32)(U32_MAX >> 1)) +#define S32_MIN ((s32)(-S32_MAX - 1)) +#define U64_MAX ((u64)~0ULL) +#define S64_MAX ((s64)(U64_MAX >> 1)) +#define S64_MIN ((s64)(-S64_MAX - 1)) + +#endif /* < KERNEL_VERSION(3, 14, 0) */ + #endif /* _NET_BATMAN_ADV_COMPAT_LINUX_KERNEL_H_ */
7 years, 8 months
1
0
0
0
[batman-adv] master: batman-adv: Backport kstrtou64 for Linux < 2.6.39 (194b581)
by postmaster@open-mesh.org
Repository : ssh://git@open-mesh.org/batman-adv On branch : master >--------------------------------------------------------------- commit 194b581c677d267ce71b9bcd86fa1642a5e9e3d1 Author: Sven Eckelmann <sven(a)narfation.org> Date: Sun Jun 21 14:42:50 2015 +0200 batman-adv: Backport kstrtou64 for Linux < 2.6.39 Signed-off-by: Sven Eckelmann <sven(a)narfation.org> Signed-off-by: Marek Lindner <mareklindner(a)neomailbox.ch> >--------------------------------------------------------------- 194b581c677d267ce71b9bcd86fa1642a5e9e3d1 compat-include/linux/kernel.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/compat-include/linux/kernel.h b/compat-include/linux/kernel.h index 2015f7f..663f9e9 100644 --- a/compat-include/linux/kernel.h +++ b/compat-include/linux/kernel.h @@ -36,6 +36,18 @@ _r = -ERANGE;\ _r;\ }) + +#define kstrtou64(cp, base, v)\ +({\ + unsigned long long _v;\ + int _r;\ + _r = strict_strtoull(cp, base, &_v);\ + *(v) = (uint64_t)_v;\ + if ((unsigned long long)*(v) != _v)\ + _r = -ERANGE;\ + _r;\ +}) + #define kstrtoul strict_strtoul #define kstrtol strict_strtol
7 years, 8 months
1
0
0
0
[batman-adv] master's head updated: Merge branch 'next' (f1b48f2)
by postmaster@open-mesh.org
Repository : ssh://git@open-mesh.org/batman-adv Branch 'master' now includes: de46667 batman-adv: Fix broken DAT capability check dfb27e7 batman-adv: Fix broken NC capability check a4824ff batman-adv: Fix broken TT capability check 1798ad3 batman-adv: Fix broken MCAST capability check cc063e9 Merge branch 'maint' into next f1b48f2 Merge branch 'next'
7 years, 8 months
1
0
0
0
[batman-adv] master: Merge branch 'next' (f1b48f2)
by postmaster@open-mesh.org
Repository : ssh://git@open-mesh.org/batman-adv On branch : master >--------------------------------------------------------------- commit f1b48f24cd055f03c3006f0be76b217493380a93 Merge: aa203f7 cc063e9 Author: Marek Lindner <mareklindner(a)neomailbox.ch> Date: Tue Jul 7 16:49:13 2015 +0800 Merge branch 'next' >--------------------------------------------------------------- f1b48f24cd055f03c3006f0be76b217493380a93 net/batman-adv/distributed-arp-table.c | 2 +- net/batman-adv/multicast.c | 11 ++++++----- net/batman-adv/network-coding.c | 2 +- net/batman-adv/translation-table.c | 3 ++- net/batman-adv/types.h | 8 ++++---- 5 files changed, 14 insertions(+), 12 deletions(-) diff --cc net/batman-adv/multicast.c index c64d9b1,deb51ad..8fa9af2 --- a/net/batman-adv/multicast.c +++ b/net/batman-adv/multicast.c @@@ -731,10 -729,11 +731,11 @@@ static void batadv_mcast_tvlv_ogm_handl if (orig_mcast_enabled && tvlv_value && (tvlv_value_len >= sizeof(mcast_flags))) - mcast_flags = *(uint8_t *)tvlv_value; + mcast_flags = *(u8 *)tvlv_value; spin_lock_bh(&orig->mcast_handler_lock); - orig_initialized = orig->capa_initialized & BATADV_ORIG_CAPA_HAS_MCAST; + orig_initialized = test_bit(BATADV_ORIG_CAPA_HAS_MCAST, + &orig->capa_initialized); /* If mcast support is turned on decrease the disabled mcast node * counter only if we had increased it for this node before. If this
7 years, 8 months
1
0
0
0
[batman-adv] next's head updated: Merge branch 'maint' into next (cc063e9)
by postmaster@open-mesh.org
Repository : ssh://git@open-mesh.org/batman-adv Branch 'next' now includes: de46667 batman-adv: Fix broken DAT capability check dfb27e7 batman-adv: Fix broken NC capability check a4824ff batman-adv: Fix broken TT capability check 1798ad3 batman-adv: Fix broken MCAST capability check cc063e9 Merge branch 'maint' into next
7 years, 8 months
1
0
0
0
[batman-adv] next: Merge branch 'maint' into next (cc063e9)
by postmaster@open-mesh.org
Repository : ssh://git@open-mesh.org/batman-adv On branch : next >--------------------------------------------------------------- commit cc063e98e6d8de9f17fe2d6a196aea1734cbadf9 Merge: 2fc460e 1798ad3 Author: Marek Lindner <mareklindner(a)neomailbox.ch> Date: Tue Jul 7 16:48:35 2015 +0800 Merge branch 'maint' into next >--------------------------------------------------------------- cc063e98e6d8de9f17fe2d6a196aea1734cbadf9 net/batman-adv/distributed-arp-table.c | 2 +- net/batman-adv/multicast.c | 11 ++++++----- net/batman-adv/network-coding.c | 2 +- net/batman-adv/translation-table.c | 3 ++- net/batman-adv/types.h | 8 ++++---- 5 files changed, 14 insertions(+), 12 deletions(-)
7 years, 8 months
1
0
0
0
[batman-adv] maint: batman-adv: Fix broken MCAST capability check (1798ad3)
by postmaster@open-mesh.org
Repository : ssh://git@open-mesh.org/batman-adv On branch : maint >--------------------------------------------------------------- commit 1798ad3fb6ba72f8c6f96024b27ad27193648787 Author: Linus Lüssing <linus.luessing(a)c0d3.blue> Date: Fri Jul 3 18:29:59 2015 +0200 batman-adv: Fix broken MCAST capability check The introduction of set_bit() and clear_bit() calls in batman-adv wrongly passed bitmasks and not the bit numbers to these functions. This leads to broken capability checks. Fixing this by making the capability enum a non-bitmasked one and by that passing non-masked values to set_bit()/clear_bit(). Fixes: 201a54ba710a ("batman-adv: Make MCAST capability changes atomic") Reported-by: Def <def(a)laposte.net> Signed-off-by: Linus Lüssing <linus.luessing(a)c0d3.blue> Signed-off-by: Marek Lindner <mareklindner(a)neomailbox.ch> >--------------------------------------------------------------- 1798ad3fb6ba72f8c6f96024b27ad27193648787 multicast.c | 11 ++++++----- types.h | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/multicast.c b/multicast.c index b75bcc3..ee8317f 100644 --- a/multicast.c +++ b/multicast.c @@ -709,14 +709,15 @@ static void batadv_mcast_tvlv_ogm_handler_v1(struct batadv_priv *bat_priv, mcast_flags = *(uint8_t *)tvlv_value; spin_lock_bh(&orig->mcast_handler_lock); - orig_initialized = orig->capa_initialized & BATADV_ORIG_CAPA_HAS_MCAST; + orig_initialized = test_bit(BATADV_ORIG_CAPA_HAS_MCAST, + &orig->capa_initialized); /* If mcast support is turned on decrease the disabled mcast node * counter only if we had increased it for this node before. If this * is a completely new orig_node no need to decrease the counter. */ if (orig_mcast_enabled && - !(orig->capabilities & BATADV_ORIG_CAPA_HAS_MCAST)) { + !(test_bit(BATADV_ORIG_CAPA_HAS_MCAST, &orig->capabilities))) { if (orig_initialized) atomic_dec(&bat_priv->mcast.num_disabled); set_bit(BATADV_ORIG_CAPA_HAS_MCAST, &orig->capabilities); @@ -725,7 +726,7 @@ static void batadv_mcast_tvlv_ogm_handler_v1(struct batadv_priv *bat_priv, * node counter. */ } else if (!orig_mcast_enabled && - (orig->capabilities & BATADV_ORIG_CAPA_HAS_MCAST || + (test_bit(BATADV_ORIG_CAPA_HAS_MCAST, &orig->capabilities) || !orig_initialized)) { atomic_inc(&bat_priv->mcast.num_disabled); clear_bit(BATADV_ORIG_CAPA_HAS_MCAST, &orig->capabilities); @@ -774,8 +775,8 @@ void batadv_mcast_purge_orig(struct batadv_orig_node *orig) spin_lock_bh(&orig->mcast_handler_lock); - if (!(orig->capabilities & BATADV_ORIG_CAPA_HAS_MCAST) && - orig->capa_initialized & BATADV_ORIG_CAPA_HAS_MCAST) + if (!(test_bit(BATADV_ORIG_CAPA_HAS_MCAST, &orig->capabilities)) && + test_bit(BATADV_ORIG_CAPA_HAS_MCAST, &orig->capa_initialized)) atomic_dec(&bat_priv->mcast.num_disabled); batadv_mcast_want_unsnoop_update(bat_priv, orig, BATADV_NO_FLAGS); diff --git a/types.h b/types.h index 6f4486c..3baf595 100644 --- a/types.h +++ b/types.h @@ -302,7 +302,7 @@ enum batadv_orig_capabilities { BATADV_ORIG_CAPA_HAS_DAT, BATADV_ORIG_CAPA_HAS_NC, BATADV_ORIG_CAPA_HAS_TT, - BATADV_ORIG_CAPA_HAS_MCAST = BIT(3), + BATADV_ORIG_CAPA_HAS_MCAST, }; /**
7 years, 8 months
1
0
0
0
[batman-adv] maint: batman-adv: Fix broken TT capability check (a4824ff)
by postmaster@open-mesh.org
Repository : ssh://git@open-mesh.org/batman-adv On branch : maint >--------------------------------------------------------------- commit a4824ffaa200050a0b3e68101ebe074a7c45b7d5 Author: Linus Lüssing <linus.luessing(a)c0d3.blue> Date: Fri Jul 3 18:29:58 2015 +0200 batman-adv: Fix broken TT capability check The introduction of set_bit() and clear_bit() calls in batman-adv wrongly passed bitmasks and not the bit numbers to these functions. This leads to broken capability checks. Fixing this by making the capability enum a non-bitmasked one and by that passing non-masked values to set_bit()/clear_bit(). Fixes: a51fa16ecf3f ("batman-adv: Make TT capability changes atomic") Reported-by: Def <def(a)laposte.net> Signed-off-by: Linus Lüssing <linus.luessing(a)c0d3.blue> Signed-off-by: Marek Lindner <mareklindner(a)neomailbox.ch> >--------------------------------------------------------------- a4824ffaa200050a0b3e68101ebe074a7c45b7d5 translation-table.c | 3 ++- types.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/translation-table.c b/translation-table.c index b6c0f52..d73b103 100644 --- a/translation-table.c +++ b/translation-table.c @@ -3323,7 +3323,8 @@ static void batadv_tt_update_orig(struct batadv_priv *bat_priv, bool has_tt_init; tt_vlan = (struct batadv_tvlv_tt_vlan_data *)tt_buff; - has_tt_init = orig_node->capa_initialized & BATADV_ORIG_CAPA_HAS_TT; + has_tt_init = test_bit(BATADV_ORIG_CAPA_HAS_TT, + &orig_node->capa_initialized); /* orig table not initialised AND first diff is in the OGM OR the ttvn * increased by one -> we can apply the attached changes diff --git a/types.h b/types.h index cb7ccb1..6f4486c 100644 --- a/types.h +++ b/types.h @@ -301,7 +301,7 @@ struct batadv_orig_node { enum batadv_orig_capabilities { BATADV_ORIG_CAPA_HAS_DAT, BATADV_ORIG_CAPA_HAS_NC, - BATADV_ORIG_CAPA_HAS_TT = BIT(2), + BATADV_ORIG_CAPA_HAS_TT, BATADV_ORIG_CAPA_HAS_MCAST = BIT(3), };
7 years, 8 months
1
0
0
0
[batman-adv] maint: batman-adv: Fix broken NC capability check (dfb27e7)
by postmaster@open-mesh.org
Repository : ssh://git@open-mesh.org/batman-adv On branch : maint >--------------------------------------------------------------- commit dfb27e75b5586e356e88b9d827d772a6cbdf3cc1 Author: Linus Lüssing <linus.luessing(a)c0d3.blue> Date: Fri Jul 3 18:29:57 2015 +0200 batman-adv: Fix broken NC capability check The introduction of set_bit() and clear_bit() calls in batman-adv wrongly passed bitmasks and not the bit numbers to these functions. This leads to broken capability checks. Fixing this by making the capability enum a non-bitmasked one and by that passing non-masked values to set_bit()/clear_bit(). Fixes: 586df9e2537b ("batman-adv: Make NC capability changes atomic") Reported-by: Def <def(a)laposte.net> Signed-off-by: Linus Lüssing <linus.luessing(a)c0d3.blue> Signed-off-by: Marek Lindner <mareklindner(a)neomailbox.ch> >--------------------------------------------------------------- dfb27e75b5586e356e88b9d827d772a6cbdf3cc1 network-coding.c | 2 +- types.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/network-coding.c b/network-coding.c index 3ce493e..0309c2c 100644 --- a/network-coding.c +++ b/network-coding.c @@ -871,7 +871,7 @@ void batadv_nc_update_nc_node(struct batadv_priv *bat_priv, goto out; /* check if orig node is network coding enabled */ - if (!(orig_node->capabilities & BATADV_ORIG_CAPA_HAS_NC)) + if (!(test_bit(BATADV_ORIG_CAPA_HAS_NC, &orig_node->capabilities))) goto out; /* accept ogms from 'good' neighbors and single hop neighbors */ diff --git a/types.h b/types.h index 08a6343..cb7ccb1 100644 --- a/types.h +++ b/types.h @@ -300,7 +300,7 @@ struct batadv_orig_node { */ enum batadv_orig_capabilities { BATADV_ORIG_CAPA_HAS_DAT, - BATADV_ORIG_CAPA_HAS_NC = BIT(1), + BATADV_ORIG_CAPA_HAS_NC, BATADV_ORIG_CAPA_HAS_TT = BIT(2), BATADV_ORIG_CAPA_HAS_MCAST = BIT(3), };
7 years, 8 months
1
0
0
0
← Newer
1
2
3
4
5
Older →
Jump to page:
1
2
3
4
5
Results per page:
10
25
50
100
200