Giter VIP home page Giter VIP logo

Comments (6)

alfredh avatar alfredh commented on May 18, 2024

Hi,

the default network interface is "guessed" based on the routing table. The algorithm
is quite simple. It does not take network cost (Wifi or Mobile) into the equation.

could you please provide output of the "netstat" command and routing table?

NOTE: I think this issue belongs in the baresip project.

/Alfred

from re.

perwx3 avatar perwx3 commented on May 18, 2024

Hi Alfred,

Ok, thanks for clearing that up. I was uncertain if this was supposted work with network cost 'out-of-the-box'.

I am unsure on how to provide output of netstat and routing table.. How do I do that? Note also that I have no jailbreaked iPhone if that is needed for output.

Br,
Per

from re.

alfredh avatar alfredh commented on May 18, 2024

Start baresip and type the /netstat command. Sample output below:

/netstat
--- Network debug ---
 Preferred AF:  AF_INET
 Local IPv4:    enp2s0 - 10.0.0.2
 Local IPv6:        lo - ::
 Domain: getinternet.no
net interfaces:
         lo:  127.0.0.1
     enp2s0:  10.0.0.2
         lo:  ::1
     enp2s0:  fe80::d63d:7eff:fef1:3048
net routes:
 Destination                                 Next Hop                                 Iface           Type
 0.0.0.0/0                                   10.0.0.1                                 enp2s0          
 10.0.0.0/24                                 ?                                        enp2s0          
 ::1/128                                     ?                                        lo              
 fe80::/64                                   ?                                        enp2s0           LINKLOCAL
 DNS Servers from System: (2)
   0: 84.208.20.110:53
   1: 84.208.20.111:53

or use the functions from your code:

net_if_debug()
net_rt_debug()

from re.

perwx3 avatar perwx3 commented on May 18, 2024

Hi,

Sorry for the delay but here's the output from netstat:

--- Network debug ---
Preferred AF: AF_INET
Local IPv4: - 83.182.162.26
Local IPv6: - 2a00:801:212:55e6:10c3:207:28ac:9372
Domain: wx3.local
net interfaces:
lo0: 127.0.0.1
lo0: ::1
lo0: fe80::1
pdp_ip0: 83.182.162.26
pdp_ip0: fe80::ce:4236:4f3d:5446
pdp_ip0: 2a00:801:212:55e6:10c3:207:28ac:9372
pdp_ip0: 2a00:801:212:55e6:75a6:1a23:88b8:2b65
en0: fe80::fc:9b02:e93d:89d6
en0: 192.168.1.129
en2: fe80::1cfc:c93d:cfbf:6dae
en2: 169.254.253.137
awdl0: fe80::6c43:b4ff:fea6:fc99
utun0: fe80::a980:8f0c:957b:c4ec
net routes:
Destination Next Hop Iface Type
DNS Servers from System: (2)
0: 192.168.1.30:53
1: 192.168.1.1:53

--

At this point I have mobile carrier network and WiFi both running and I would like to have 192.168.1.129, the WiFi address as the preferred interface.

I see no net routes. Is that normal?

Br,
Per

from re.

alfredh avatar alfredh commented on May 18, 2024

check if HAVE_SYS_SYSCTL_H and HAVE_NET_ROUTE_H is defined,
and that net/bsd/brt.c is being compiled.

the logic for detecting this is in src/net/mod.mk:

ifneq ($(HAVE_SYS_SYSCTL_H),)
ifneq ($(HAVE_NET_ROUTE_H),)
SRCS	+= net/bsd/brt.c
CFLAGS  += -DHAVE_ROUTE_LIST
endif
endif

oh.. looks like net/route.h is not available for iOS.
you might have to copy that file from another OS, and then rebuild libre
with those flags forced on.

But, I think to solve the problem properly you have to use some iOS specific
functions to retrieve the "default" interface/address.

from re.

perwx3 avatar perwx3 commented on May 18, 2024

Hi.

Yes, I noticed also that net/route.h is missing in the iPhone SDK. I does however exist in the MacOSX SDK so I just made a copy of it:

sudo cp /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/net/route.h /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk/usr/include/net/
and recompiled everything.

And it seems to be working! Netstat command now shows lots of routes and baresip defaults to WiFi just like I would like it to.

I will continue running some more tests but this seems to be a close enough solution.

Thank you for all your help!

from re.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.