Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gluon-mesh-batman-adv: get IPv6-addresses via netlink #1616

Merged
merged 1 commit into from
Feb 17, 2019

Conversation

blocktrron
Copy link
Member

@blocktrron blocktrron commented Jan 10, 2019

Previously the content of "/proc/net/if_inet6" was parsed to acquire the
nodes IPv6 addresses. With this commit, IPv6 addresses are acquired
using getifaddrs() as proposed by neoraider in #1615.

Fixes #1615

Copy link
Member

@neocturne neocturne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you already test if this change has any effect on the duplicate address issue?

package/gluon-mesh-batman-adv/src/respondd.c Outdated Show resolved Hide resolved
package/gluon-mesh-batman-adv/src/respondd.c Outdated Show resolved Hide resolved
@blocktrron
Copy link
Member Author

@NeoRaider Testing if it has an affect on the duplicate IP issue is hard as i can't even reproduce it reliably. Maybe @mweinelt is with me testing these cahnges on the experimental nodes of Freifunk Darmstadt?

The cahnges itself are tested as in we have all 3 (Global, ULA, LL) IP-addresses in the respondd response.

Copy link
Member

@neocturne neocturne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found one more issue, and a whitespace nitpick.

package/gluon-mesh-batman-adv/src/respondd.c Show resolved Hide resolved
package/gluon-mesh-batman-adv/src/respondd.c Outdated Show resolved Hide resolved
@rotanid rotanid added 0. type: enhancement The changeset is an enhancement refactoring labels Jan 10, 2019
@cmarxmeier
Copy link

@blocktrron blocktrron force-pushed the pr-getifaddrs branch 5 times, most recently from f1331f6 to 71eb8ba Compare January 13, 2019 23:45
@blocktrron blocktrron changed the title gluon-mesh-batman-adv: use getifaddrs gluon-mesh-batman-adv: get IPv6-addresses via netlink Jan 13, 2019
@blocktrron
Copy link
Member Author

Updated to use netlink. Now looks for the tentative and deprecated flags

@rotanid rotanid requested a review from neocturne January 14, 2019 22:40
@blocktrron
Copy link
Member Author

We've rolled out an image containing 71eb8ba. We have now 17 nodes running with this patch. The double-address issue occurred on 3 of them without the patch, with the patch no node sends duplicate IP-Addresses (Filter for FIrmware 1.3~20190115 on our map)

@neocturne
Copy link
Member

I think it would make sense to use libnl-tiny or libmnl for the message parsing; that way we could also deal with replies spread over multiple recv calls and wouldn't need such a huge receive buffer. libnl-tiny is already included in our firmware (although I hope to switch most users over to libmnl eventually, as it has a nicer API, is maintained more actively, and is even smaller)

@blocktrron
Copy link
Member Author

@NeoRaider So is it libnl-tiny or libmnl? I would like to overhaul it just once more.

@mweinelt
Copy link
Contributor

mweinelt commented Feb 5, 2019

Alot more stuff upstream also depends on libnl-tiny so I don't see it going anywhere without some huge effort. Meanwhile libmnl is nowhere to be found on our routers today.

root@64289-rocket-cloud:~# opkg whatdepends libnl-tiny
Root set:
  libnl-tiny
What depends on root set
	iw 4.14-1	depends on libnl-tiny
	gluon-mesh-batman-adv-15 1	depends on libnl-tiny
	swconfig 11	depends on libnl-tiny
	libiwinfo 2018-07-31-65b8333f-1	depends on libnl-tiny
	wpa-supplicant-mesh-wolfssl 2018-05-21-62566bc2-5	depends on libnl-tiny
	gluon-status-page 3	depends on libiwinfo
	netifd 2018-11-19-4b83102d-2	depends on libnl-tiny
	gluon-radv-filterd 1-1	depends on libnl-tiny
	libbatadv 1	depends on libnl-tiny
	gluon-ebtables-source-filter 1-1	depends on gluon-mesh-batman-adv
	respondd-module-airtime 1-2	depends on libnl-tiny
	simple-tc 1	depends on libnl-tiny
	gluon-ebtables-limit-arp 1-1	depends on gluon-mesh-batman-adv
	gluon-mesh-vpn-core 1	depends on simple-tc
	gluon-status-page-mesh-batman-adv 1	depends on gluon-status-page
	hostapd-wolfssl 2018-05-21-62566bc2-5	depends on libnl-tiny
	gluon-ebtables-filter-ra-dhcp 1-1	depends on gluon-mesh-batman-adv
	batctl 2018.1-1	depends on libnl-tiny
	gluon-ebtables-filter-multicast 1-1	depends on gluon-mesh-batman-adv
	kmod-cfg80211 4.14.95+2017-11-01-9	depends on iw
	gluon-config-mode-mesh-vpn 2	depends on gluon-mesh-vpn-core

@blocktrron blocktrron force-pushed the pr-getifaddrs branch 2 times, most recently from cf36b77 to dfce723 Compare February 15, 2019 00:10
@blocktrron
Copy link
Member Author

Updated the PR to use libnl-tiny. Tested on one device (AVM 4020). Works flawlessly.

@blocktrron blocktrron force-pushed the pr-getifaddrs branch 2 times, most recently from 5a1c09d to 53a1360 Compare February 15, 2019 12:33
Copy link
Member

@neocturne neocturne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, looking much better now! I've found two issues I'd like to see fixed.

FILE *f = fopen("/proc/net/if_inet6", "r");
if (!f)
return NULL;
int br_client_ifindex = if_nametoindex("br-client");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if_nametoindex should only be called once and passed into the callback (by making arg a struct containing the ifindex and the JSON array).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, will implement this.

package/gluon-mesh-batman-adv/src/respondd.c Outdated Show resolved Hide resolved
@neocturne
Copy link
Member

respondd.c: In function 'get_addresses':
respondd.c:125:14: error: invalid type argument of '->' (have 'struct ip_address_information')
   return info->addresses;
              ^~
respondd.c:146:13: error: invalid type argument of '->' (have 'struct ip_address_information')
  return info->addresses;
             ^~
respondd.c:147:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
make[5]: *** [Makefile:35: respondd.so] Error 1

@blocktrron
Copy link
Member Author

@NeoRaider yes i hope it's fixed now. will let you know when i run tested my latest change.

@blocktrron
Copy link
Member Author

@NeoRaider should be fixed now- This node is running the patch: https://meshviewer.darmstadt.freifunk.net/#/en/map/5c49793001b4

@neocturne neocturne merged commit f52bd99 into freifunk-gluon:master Feb 17, 2019
@blocktrron blocktrron deleted the pr-getifaddrs branch December 3, 2019 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0. type: enhancement The changeset is an enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants