[B.A.T.M.A.N.] Batman gateway lock ups
by Outback Dingo
see pastebin
http://www.pastebin.ca/1194874
pertinent info
dmesg | grep 'batgat loaded'
batgat: [init_module:96] batgat loaded rv1025
uname -a
Linux nightwing 2.6.23.16 #16 Tue Apr 22 20:00:17 ART 2008 mips unknown
root@nightwing:~# batmand -v
WARNING: You are using the unstable batman branch. If you are interested in
*using* batman get the latest stable release !
B.A.T.M.A.N. 0.3-beta (compatibility version 5)
lsmod
Module Size Used by Tainted:
P
sch_htb 14048
2
ath_ahb 103616
0
wlan_xauth 480
0
wlan_wep 4000
0
wlan_tkip 9856
0
wlan_ccmp 5440
2
wlan_acl 1920 0
ath_rate_minstrel 8352 1
ath_hal 136832 3 ath_ahb,ath_rate_minstrel
wlan_scan_sta 8768 1
wlan_scan_ap 6656 0
wlan 152464 10
ath_ahb,wlan_xauth,wlan_wep,wlan_tkip,wlan_ccmp,wlan_acl,ath_rate_minstrel,wlan_scan_sta,wlan_scan_ap
batgat 10944 1
ipt_iprange 672 0
ipt_TOS 832 0
ipt_TTL 928 0
xt_MARK 960 3
ipt_ECN 1472 0
xt_CLASSIFY 640 0
ipt_ttl 704 0
ipt_tos 544 0
ipt_time 1568 0
xt_tcpmss 1088 0
xt_statistic 832 0
xt_mark 672 7
xt_mac 736 3
xt_length 736 0
ipt_ecn 1024 0
xt_DSCP 1056 0
xt_dscp 832 0
imq 2096 0
ipt_IMQ 672 2
xt_string 896 0
xt_layer7 9840 0
ipt_ipp2p 6784 0
ipt_LOG 4640 0
xt_CHAOS 1792 0
xt_DELUDE 2624 1
xt_TARPIT 2816 1
xt_quota 800 0
xt_portscan 2016 0
xt_pkttype 704 0
xt_physdev 1488 0
ipt_owner 800 0
iptable_raw 832 0
xt_NOTRACK 832 0
xt_CONNMARK 1088 0
ipt_recent 4992 0
xt_helper 992 0
xt_conntrack 1312 0
xt_connmark 832 0
xt_connbytes 1312 0
tun 6592 0
13 years, 6 months
[B.A.T.M.A.N.] batman-exp rev.1154 still using 94% CPU load
by Stephan Enderlein (Freifunk Dresden)
Hi,
I have still the problem that batman-exp is hanging on 94% cpu load.
perhaps it has nothing to do with the gateway task. It is possible that
I run more "batmand -c" at same time?
The current batman revision is 1154.
Do you have any idea?
Mem: 15700K used, 14924K free, 0K shrd, 1440K buff, 6600K cached
CPU: 5.8% usr 94.1% sys 0.0% nice 0.0% idle 0.0% io 0.0% irq 0.0% softirq
Load average: 1.62 1.39 0.98
PID PPID USER STAT VSZ %MEM %CPU COMMAND
24256 1843 root R 1264 4.1 94.7 /sbin/batmand -s 10.12.0.1 -a 10.12.10.16/28 -r 1 --t 63
--no-unreachable-rule --no-throw-rules --no-prio-rules --one-way-tunnel 1 --two-way-tunnel 0 eth1
tbb /t 1 /i /A
1156 1 root S 1264 4.1 0.0 /sbin/batmand -s 10.12.0.1 -a 10.12.10.16/28 -r 1 --t 63
--no-unreachable-rule --no-throw-rules --no-prio-rules --one-way-tunnel 1 --two-way-tunnel 0 eth1
tbb /t 1 /i /A
1843 1156 root S 1264 4.1 0.0 /sbin/batmand -s 10.12.0.1 -a 10.12.10.16/28 -r 1 --t 63
--no-unreachable-rule --no-throw-rules --no-prio-rules --one-way-tunnel 1 --two-way-tunnel 0 eth1
tbb /t 1 /i /A
24462 24460 root S 1216 3.9 0.0 batmand -cb -d2
24857 24815 root S 1216 3.9 0.0 batmand -c -b -r 1
---------------------------------------
Dipl.Informatiker(FH) Stephan Enderlein
Freifunk Dresden
14 years
Re: [B.A.T.M.A.N.] Some questions to BATMAN
by John Harris
Hii,
I have fixed my problem... The reason was the HNA announce...After writing 129.211.186.0If/24 in the HNA field, I could make a
traceroute to my server...
Thank you all for the advices...
If anybody has some advices, comments or want to discuss, don't hesistate to contact me...
greetings,
J
> -----Ursprüngliche Nachricht-----
> Von: "John Harris" <JHarris(a)web.de>
> Gesendet: 31.12.08 13:24:46
> An: dondavis(a)reglue.org
> Betreff: Re: [B.A.T.M.A.N.] Some questions to BATMAN
> Hii Don,
>
> my scenario look like as follows...
>
> router 1 <---------------------> router 2 <-----------------------> router 3 (connected to server..IP 129.211.186.46)
> eth1:bat eth1:bat eth1:bat (11.1.1.2) (wired: 129.211.186.12)
>
> The IP Adress of my router 3 is 129.211.186.12 (dhcp-lan), router 3 is connected to my server with the server IP 129.211.186.46.
>
> I can ping the eth1:bat interface of the router among each other. But I couldn't make a trace to the server IP 129.211.186.46 from
> an another router... I get the message:
>
> " *sendto: Network is unreachable
> traceroute: wrote 129.211.186.46 40 chars, ret=-1"
>
> My settings to BATMAN are:
>
> ----------------------------------------
> Management: B.A.T.M.A.N.
>
>
> WLAN as 11.1.1.3/24
> LAN as 129.211.186.12
>
> local internet-bandwidth: This is not a internet-gateway
> common used gateway stable
> Prefered gateway:
> Host&Network Announcement (HNA): 129.211.186.46/24
> Visualisation Server:
> Hello-Interval [ms]:
> ----------------------------------------
>
> The output of the command "batmand -c -d 1" on the router I see:
> Originator Router (#/128): Potential routers... [B.A.T.M.A.N. 0.2 rv502, MainIF/IP: eth1:bat 11.1.1.1, UT: 0d 1h22m]
> 11.1.1.3 11.1.1.3 (119): 11.1.1.3 (119)
> 129.211.186.181 11.1.1.3 (128): 11.1.1.3 (128)
>
> Originator Router (#/128): Potential routers... [B.A.T.M.A.N. 0.2 rv502, MainIF/IP: eth1:bat 11.1.1.3, UT: 0d 0h27m]
> 11.1.1.1 11.1.1.1 (124): 11.1.1.1 (124)
>
>
> I would be very appreciate, if you an the others could give me some advice how to fix my problem...How can make a
> traceroute form a router to the server IP 129.211.186.46.
>
> Thanks in advance...
>
> greetings,
> J
>
>
>
> > -----Ursprüngliche Nachricht-----
> > Von: "John Harris" <JHarris(a)web.de>
> > Gesendet: 29.12.08 21:39:27
> > An: b.a.t.m.a.n@open-mesh.net,dondavis@reglue.org
> > Betreff: Re: [B.A.T.M.A.N.] Some questions to BATMAN
>
> > Hiii Don,
> >
> > thank you very much for your reply, for your help...
> >
> >
> > >
> > >> 1)
> > >> I will build a mesh network.. One of my router is connected to my server
> > >> with the IP 129.211.186.12. I can't make
> > >> a traceroute through my router to this server. If I try to make
> > >> "traceroute 129.211.186.12" from an another router I get the message:
> > >> "PING 129.211.186.12 (129.211.186.12): 56 data bytes
> > >> ping: sendto: Network is unreachable
> > >
> > >
> > > router Server (129.211.186.12)
> > > (batman eth0) <------------------> (batman some wireless device)
> > >
> > > On the router, which firmware are you running with Batman?
> > >
> > >
> > > When you type batmand -c -d 1 on the router /server what do you see?
> > >
> > > What does batmand -v show on the router / server?
> > >
> > >
> >
> > I have some problems with my server at the moment, I will write the output of the other commands as soon as possible...
> >
> >
> > my freifunk firmware is v1.6.29 and the batmand version is :B.A.T.M.A.N. 0.2 rv502 (compability version 3)
> >
> >
> >
> >
> >
> > >> I can send ping requests from my server to the router and from the
> > >> router to the server, but as I said, I can't make a traceroute to the
> > >> server
> > >> from an another router. My question is, how can I do this ?
> > >>
> > >> In OLSR it was not a problem to trace the server through the router.
> > >> Should I change something in HNA messages ?
> > >>
> > >> 2)
> > >> I read the HowTO from Freifunk Leipzig about the configuration of
> > >> BATMAN, look here http://wiki.leipzig.freifunk.net/BATMAN. How is the
> > >> configuration
> > >> If I want to run BATMAN in Ubuntu Intrepid? How can I configure the
> > >> IPTABLES ?
> > >>
> > >
> > > For newer batman and experimental you'll want to open up ports 4305-4307:
> > >
> > > iptables -t filter -I INPUT 2 -p udp --dport 4305 --sport 4305 -j ACCEPT
> > > iptables -t filter -I INPUT 2 -p udp --dport 4306 --sport 4306 -j ACCEPT
> > > iptables -t filter -I INPUT 2 -p udp --dport 4307 --sport 4307 -j ACCEPT
> > > iptables -t filter -I OUTPUT 2 -p udp --dport 4305 --sport 4305 -j ACCEPT
> > > iptables -t filter -I OUTPUT 2 -p udp --dport 4306 --sport 4306 -j ACCEPT
> > > iptables -t filter -I OUTPUT 2 -p udp --dport 4307 --sport 4307 -j ACCEPT
> >
> >
> > You helped me a lot so far,thank you,
> > I will write the output of the commands as soon as possible...
> >
> >
> > greetings,
> > John
> >
> >
> > >
> > >
> > >
> > >
> > > _______________________________________________
> > > B.A.T.M.A.N mailing list
> > > B.A.T.M.A.N(a)open-mesh.net
> > > https://list.open-mesh.net/mm/listinfo/b.a.t.m.a.n
> > >
> >
>
>
> _______________________________________________________________________
> Täglich 1.000.000 Euro gewinnen! Jetzt kostenlos WEB.DE MillionenKlick
> spielen! https://millionenklick.web.de/?mc=mail@footer.mklick@home
>
>
> _______________________________________________
> B.A.T.M.A.N mailing list
> B.A.T.M.A.N(a)open-mesh.net
> https://list.open-mesh.net/mm/listinfo/b.a.t.m.a.n
>
_______________________________________________________________________
Sensationsangebot verlängert: WEB.DE FreeDSL - Telefonanschluss + DSL
für nur 16,37 Euro/mtl.!* http://dsl.web.de/?ac=OM.AD.AD008K15039B7069a
14 years, 1 month
Re: [B.A.T.M.A.N.] Some questions to BATMAN
by John Harris
Hii Don,
my scenario look like as follows...
router 1 <---------------------> router 2 <-----------------------> router 3 (connected to server..IP 129.211.186.46)
eth1:bat eth1:bat eth1:bat (11.1.1.2) (wired: 129.211.186.12)
The IP Adress of my router 3 is 129.211.186.12 (dhcp-lan), router 3 is connected to my server with the server IP 129.211.186.46.
I can ping the eth1:bat interface of the router among each other. But I couldn't make a trace to the server IP 129.211.186.46 from
an another router... I get the message:
" *sendto: Network is unreachable
traceroute: wrote 129.211.186.46 40 chars, ret=-1"
My settings to BATMAN are:
----------------------------------------
Management: B.A.T.M.A.N.
WLAN as 11.1.1.3/24
LAN as 129.211.186.12
local internet-bandwidth: This is not a internet-gateway
common used gateway stable
Prefered gateway:
Host&Network Announcement (HNA): 129.211.186.46/24
Visualisation Server:
Hello-Interval [ms]:
----------------------------------------
The output of the command "batmand -c -d 1" on the router I see:
Originator Router (#/128): Potential routers... [B.A.T.M.A.N. 0.2 rv502, MainIF/IP: eth1:bat 11.1.1.1, UT: 0d 1h22m]
11.1.1.3 11.1.1.3 (119): 11.1.1.3 (119)
129.211.186.181 11.1.1.3 (128): 11.1.1.3 (128)
Originator Router (#/128): Potential routers... [B.A.T.M.A.N. 0.2 rv502, MainIF/IP: eth1:bat 11.1.1.3, UT: 0d 0h27m]
11.1.1.1 11.1.1.1 (124): 11.1.1.1 (124)
I would be very appreciate, if you an the others could give me some advice how to fix my problem...How can make a
traceroute form a router to the server IP 129.211.186.46.
Thanks in advance...
greetings,
J
> -----Ursprüngliche Nachricht-----
> Von: "John Harris" <JHarris(a)web.de>
> Gesendet: 29.12.08 21:39:27
> An: b.a.t.m.a.n@open-mesh.net,dondavis@reglue.org
> Betreff: Re: [B.A.T.M.A.N.] Some questions to BATMAN
> Hiii Don,
>
> thank you very much for your reply, for your help...
>
>
> >
> >> 1)
> >> I will build a mesh network.. One of my router is connected to my server
> >> with the IP 129.211.186.12. I can't make
> >> a traceroute through my router to this server. If I try to make
> >> "traceroute 129.211.186.12" from an another router I get the message:
> >> "PING 129.211.186.12 (129.211.186.12): 56 data bytes
> >> ping: sendto: Network is unreachable
> >
> >
> > router Server (129.211.186.12)
> > (batman eth0) <------------------> (batman some wireless device)
> >
> > On the router, which firmware are you running with Batman?
> >
> >
> > When you type batmand -c -d 1 on the router /server what do you see?
> >
> > What does batmand -v show on the router / server?
> >
> >
>
> I have some problems with my server at the moment, I will write the output of the other commands as soon as possible...
>
>
> my freifunk firmware is v1.6.29 and the batmand version is :B.A.T.M.A.N. 0.2 rv502 (compability version 3)
>
>
>
>
>
> >> I can send ping requests from my server to the router and from the
> >> router to the server, but as I said, I can't make a traceroute to the
> >> server
> >> from an another router. My question is, how can I do this ?
> >>
> >> In OLSR it was not a problem to trace the server through the router.
> >> Should I change something in HNA messages ?
> >>
> >> 2)
> >> I read the HowTO from Freifunk Leipzig about the configuration of
> >> BATMAN, look here http://wiki.leipzig.freifunk.net/BATMAN. How is the
> >> configuration
> >> If I want to run BATMAN in Ubuntu Intrepid? How can I configure the
> >> IPTABLES ?
> >>
> >
> > For newer batman and experimental you'll want to open up ports 4305-4307:
> >
> > iptables -t filter -I INPUT 2 -p udp --dport 4305 --sport 4305 -j ACCEPT
> > iptables -t filter -I INPUT 2 -p udp --dport 4306 --sport 4306 -j ACCEPT
> > iptables -t filter -I INPUT 2 -p udp --dport 4307 --sport 4307 -j ACCEPT
> > iptables -t filter -I OUTPUT 2 -p udp --dport 4305 --sport 4305 -j ACCEPT
> > iptables -t filter -I OUTPUT 2 -p udp --dport 4306 --sport 4306 -j ACCEPT
> > iptables -t filter -I OUTPUT 2 -p udp --dport 4307 --sport 4307 -j ACCEPT
>
>
> You helped me a lot so far,thank you,
> I will write the output of the commands as soon as possible...
>
>
> greetings,
> John
>
>
> >
> >
> >
> >
> > _______________________________________________
> > B.A.T.M.A.N mailing list
> > B.A.T.M.A.N(a)open-mesh.net
> > https://list.open-mesh.net/mm/listinfo/b.a.t.m.a.n
> >
>
_______________________________________________________________________
Täglich 1.000.000 Euro gewinnen! Jetzt kostenlos WEB.DE MillionenKlick
spielen! https://millionenklick.web.de/?mc=mail@footer.mklick@home
14 years, 1 month
Re: [B.A.T.M.A.N.] Some questions to BATMAN
by John Harris
Hiii Don,
thank you very much for your reply, for your help...
>
>> 1)
>> I will build a mesh network.. One of my router is connected to my server
>> with the IP 129.211.186.12. I can't make
>> a traceroute through my router to this server. If I try to make
>> "traceroute 129.211.186.12" from an another router I get the message:
>> "PING 129.211.186.12 (129.211.186.12): 56 data bytes
>> ping: sendto: Network is unreachable
>
>
> router Server (129.211.186.12)
> (batman eth0) <------------------> (batman some wireless device)
>
> On the router, which firmware are you running with Batman?
>
>
> When you type batmand -c -d 1 on the router /server what do you see?
>
> What does batmand -v show on the router / server?
>
>
I have some problems with my server at the moment, I will write the output of the other commands as soon as possible...
my freifunk firmware is v1.6.29 and the batmand version is :B.A.T.M.A.N. 0.2 rv502 (compability version 3)
>> I can send ping requests from my server to the router and from the
>> router to the server, but as I said, I can't make a traceroute to the
>> server
>> from an another router. My question is, how can I do this ?
>>
>> In OLSR it was not a problem to trace the server through the router.
>> Should I change something in HNA messages ?
>>
>> 2)
>> I read the HowTO from Freifunk Leipzig about the configuration of
>> BATMAN, look here http://wiki.leipzig.freifunk.net/BATMAN. How is the
>> configuration
>> If I want to run BATMAN in Ubuntu Intrepid? How can I configure the
>> IPTABLES ?
>>
>
> For newer batman and experimental you'll want to open up ports 4305-4307:
>
> iptables -t filter -I INPUT 2 -p udp --dport 4305 --sport 4305 -j ACCEPT
> iptables -t filter -I INPUT 2 -p udp --dport 4306 --sport 4306 -j ACCEPT
> iptables -t filter -I INPUT 2 -p udp --dport 4307 --sport 4307 -j ACCEPT
> iptables -t filter -I OUTPUT 2 -p udp --dport 4305 --sport 4305 -j ACCEPT
> iptables -t filter -I OUTPUT 2 -p udp --dport 4306 --sport 4306 -j ACCEPT
> iptables -t filter -I OUTPUT 2 -p udp --dport 4307 --sport 4307 -j ACCEPT
You helped me a lot so far,thank you,
I will write the output of the commands as soon as possible...
greetings,
John
>
>
>
>
> _______________________________________________
> B.A.T.M.A.N mailing list
> B.A.T.M.A.N(a)open-mesh.net
> https://list.open-mesh.net/mm/listinfo/b.a.t.m.a.n
>
_______________________________________________________________________
Sensationsangebot verlängert: WEB.DE FreeDSL - Telefonanschluss + DSL
für nur 16,37 Euro/mtl.!* http://dsl.web.de/?ac=OM.AD.AD008K15039B7069a
14 years, 1 month
[B.A.T.M.A.N.] Some questions to BATMAN
by John Harris
Hiii,
I have some question about BATMAN routing protocol...
I would be appreciate if anybody could help me...
1)
I will build a mesh network.. One of my router is connected to my server with the IP 129.211.186.12. I can't make
a traceroute through my router to this server. If I try to make "traceroute 129.211.186.12" from an another router I get the message:
"PING 129.211.186.12 (129.211.186.12): 56 data bytes
ping: sendto: Network is unreachable
"
I can send ping requests from my server to the router and from the router to the server, but as I said, I can't make a traceroute to the server
from an another router. My question is, how can I do this ?
In OLSR it was not a problem to trace the server through the router. Should I change something in HNA messages ?
2)
I read the HowTO from Freifunk Leipzig about the configuration of BATMAN, look here http://wiki.leipzig.freifunk.net/BATMAN. How is the configuration
If I want to run BATMAN in Ubuntu Intrepid? How can I configure the IPTABLES ?
greetings,
John
_______________________________________________________________________
Sensationsangebot verlängert: WEB.DE FreeDSL - Telefonanschluss + DSL
für nur 16,37 Euro/mtl.!* http://dsl.web.de/?ac=OM.AD.AD008K15039B7069a
14 years, 1 month
[B.A.T.M.A.N.] Some questions to BATMAN
by John Harris
Hiii,
I wrote some questions a few day ago ? Could nobody help me regarding this questions ???
Sorry people, the questions are maybe very simple, but as I said I'm a beginner.
_______________________________________________________________________
Sensationsangebot verlängert: WEB.DE FreeDSL - Telefonanschluss + DSL
für nur 16,37 Euro/mtl.!* http://dsl.web.de/?ac=OM.AD.AD008K15039B7069a
14 years, 1 month
[B.A.T.M.A.N.] batman advanced 0.1 release
by Marek Lindner
Hi,
today, after a 6 months stabilization and debugging phase we release the first
milestone towards a stable version: batman advanced 0.1.
As this implementation resides in the kernel land only we wanted to make sure
its stability before releasing it to the public.
This batman implemention is marked with the label "advanced" to outline the
fact that it operates on layer 2 (mac layer) as opposed to batman which
operates on layer 3. To gain optimal performance it resides in the kernel as a
module and can be enabled/disabled/configured via the /proc/net/batman-adv/
interface.
Unfortunately, we can not offer precompiled packages for your kernel as the
module sources need to be linked against your very own kernel headers. If you
are using debian you will find packages that you can install via apt-get.
OpenWRT also has the package included. If you intend to use the module on your
own system, simply download the sources, build and load the module.
You can find the sources here:
http://downloads.open-mesh.net/batman/stable/sources/
Special thanks to Sven Eckelmann and Scott Raynel who spent a considerable
amount of time testing, debugging and patching the sources. We included all
their patches which allow us to release today.
The biggest changes since the beta release are:
- support latest kernel version (2.6.20 - 2.6.28)
- LOTS of cleanup: locking, stack usage, memory leaks
- Change Ethertype from 0x0842 to 0x4305
unregistered at IEEE, if you want to sponsor an official Ethertype ($2500)
please contact us
We welcome any feedback/patches/ideas,
The B.A.T.M.A.N. developer team
14 years, 1 month
[B.A.T.M.A.N.] [PATCH] Split SOURCE_VERSION in RELEASE- AND EXTRA_VERSION
by Sven Eckelmann
RELEASE_VERSION and EXTRA_VERSION can be concatenate to a single
SOURCE_VERSION string. This makes it possible to detect unstable
versions during compile time instead of removing the unstable warning
in a seperate commit (or forget this change).
Before releasing the a new stable version the release manager must set
EXTRA_VERSION to "", check INSTALL, THANKS and README and then create
the tag in the repository.
Afterwards the development branch should change the RELEASE_VERSION to
the upcoming version number and the EXTRA_VERSION to a string which
informs the user that it is "unstable" and in development. This could be
for example "-dev", "-pre-alpha", "-beta" or "-rc1".
Signed-off-by: Sven Eckelmann <sven.eckelmann(a)gmx.de>
---
batman/batman.h | 5 ++++-
batman/posix/init.c | 3 ++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/batman/batman.h b/batman/batman.h
index 6af9136..6d1c16a 100644
--- a/batman/batman.h
+++ b/batman/batman.h
@@ -39,7 +39,8 @@
-#define SOURCE_VERSION "0.3.1" /* put exactly one distinct word inside the string like "0.3-pre-alpha" or "0.3-rc1" or "0.3" */
+#define RELEASE_VERSION "0.3.1" /* put exactly one distinct word inside the string like "0.3" or "0.3.1" */
+#define EXTRA_VERSION "" /* put one or less distinct words inside the string like "-pre-alpha" or "-rc1" or "" */
#define COMPAT_VERSION 5
#define PORT 4305
#define GW_PORT 4306
@@ -66,6 +67,8 @@
#define REVISION_VERSION "0"
#endif
+#define SOURCE_VERSION RELEASE_VERSION""EXTRA_VERSION
+
/*
diff --git a/batman/posix/init.c b/batman/posix/init.c
index c79c010..b850b61 100644
--- a/batman/posix/init.c
+++ b/batman/posix/init.c
@@ -249,7 +249,8 @@ void apply_init_args( int argc, char *argv[] ) {
stop = 0;
prog_name = argv[0];
-/* printf( "WARNING: You are using the unstable batman branch. If you are interested in *using* batman get the latest stable release !\n" );*/
+ if (strlen(EXTRA_VERSION) > 0)
+ printf( "WARNING: You are using the unstable batman branch. If you are interested in *using* batman get the latest stable release !\n" );
while ( ( optchar = getopt_long( argc, argv, "a:A:bcd:hHio:g:p:r:s:vV", long_options, &option_index ) ) != -1 ) {
--
1.6.0.6
14 years, 1 month
[B.A.T.M.A.N.] [PATCH] Make batman timer functions thread safe
by Sven Eckelmann
The calculation inside of update_internal_clock aren't atomic and can lead to
bogus time informations when many threads calling get_time_msec64 or
get_time_msec.
Signed-off-by: Sven Eckelmann <sven.eckelmann(a)gmx.de>
---
batman/posix/posix.c | 17 +++++++++++++++--
1 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/batman/posix/posix.c b/batman/posix/posix.c
index dd24a65..042a2b9 100644
--- a/batman/posix/posix.c
+++ b/batman/posix/posix.c
@@ -49,6 +49,7 @@ static float system_tick;
uint8_t tunnel_running = 0;
+static pthread_mutex_t batman_clock_mutex = PTHREAD_MUTEX_INITIALIZER;
void update_internal_clock()
{
@@ -61,14 +62,26 @@ void update_internal_clock()
uint32_t get_time_msec()
{
+ uint32_t time;
+
+ pthread_mutex_lock(&batman_clock_mutex);
update_internal_clock();
- return (uint32_t)(((float)(batman_clock_ticks) * 1000) / system_tick);
+ time = (uint32_t)(((float)(batman_clock_ticks) * 1000) / system_tick);
+ pthread_mutex_unlock(&batman_clock_mutex);
+
+ return time;
}
uint64_t get_time_msec64()
{
+ uint64_t time;
+
+ pthread_mutex_lock(&batman_clock_mutex);
update_internal_clock();
- return (uint64_t)(((float)(batman_clock_ticks) * 1000) / system_tick);
+ time = (uint64_t)(((float)(batman_clock_ticks) * 1000) / system_tick);
+ pthread_mutex_unlock(&batman_clock_mutex);
+
+ return time;
}
/* batman animation */
--
1.6.0.1
14 years, 1 month