Re: [PATCH 1/4] test: process-context-settings: use ip instead of ifconfig/route

2019-07-19 Thread Denis Kenzior

Hi Martin,

On 7/18/19 6:49 AM, Martin Hundebøll wrote:

---
  test/process-context-settings | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)



Patch 1 & 2 applied.

Regards,
-Denis

___
ofono mailing list
ofono@ofono.org
https://lists.ofono.org/mailman/listinfo/ofono


Re: [PATCH 1/4] test: process-context-settings: use ip instead of ifconfig/route

2019-07-18 Thread Martin Hundebøll

On 18/07/2019 18.38, Pavel Machek wrote:

On Thu 2019-07-18 13:49:34, Martin Hundebøll wrote:

---
  test/process-context-settings | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/test/process-context-settings b/test/process-context-settings
index 1d30b30d..a536a771 100755
--- a/test/process-context-settings
+++ b/test/process-context-settings
@@ -41,14 +41,14 @@ for path, properties in modems:
print("IP address is %s" % (address))
print("Gateway is %s" % (gateway))
  
-			cmd = "ifconfig " + interface + " " + address

-   cmd += " netmask 255.255.255.255"
+   cmd = "ip address add dev " + interface + " " + address
+   cmd += "/32"
os.system(cmd);
  
  			for i in settings["DomainNameServers"]:

print("Nameserver is %s" % (i))
  
-cmd = "route add -host " + i

+   cmd = "ip route add  " + i
cmd +=" dev " + interface
os.system(cmd);


So.. you move from one tool to another one, fixing it on some systems
and braking on some.


`ifconfig` and friends have been obsolete for quite some time now. Even 
busybox has been shipping `ip` since 2002...



But I guess better solution would be to use python module, not execing
external programs.

...which certainly should not be executed using os.system(). Network
interface called `> /etc/passwd` would be a lot of phun, right? :-).


I'll leave it up to ofono to choose sane names for interfaces :)

// Martin
___
ofono mailing list
ofono@ofono.org
https://lists.ofono.org/mailman/listinfo/ofono


Re: [PATCH 1/4] test: process-context-settings: use ip instead of ifconfig/route

2019-07-18 Thread Pavel Machek
On Thu 2019-07-18 13:49:34, Martin Hundebøll wrote:
> ---
>  test/process-context-settings | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/test/process-context-settings b/test/process-context-settings
> index 1d30b30d..a536a771 100755
> --- a/test/process-context-settings
> +++ b/test/process-context-settings
> @@ -41,14 +41,14 @@ for path, properties in modems:
>   print("IP address is %s" % (address))
>   print("Gateway is %s" % (gateway))
>  
> - cmd = "ifconfig " + interface + " " + address
> - cmd += " netmask 255.255.255.255"
> + cmd = "ip address add dev " + interface + " " + address
> + cmd += "/32"
>   os.system(cmd);
>  
>   for i in settings["DomainNameServers"]:
>   print("Nameserver is %s" % (i))
>  
> - cmd = "route add -host " + i
> + cmd = "ip route add  " + i
>   cmd +=" dev " + interface
>   os.system(cmd);

So.. you move from one tool to another one, fixing it on some systems
and braking on some.

But I guess better solution would be to use python module, not execing
external programs.

...which certainly should not be executed using os.system(). Network
interface called `> /etc/passwd` would be a lot of phun, right? :-).

Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html


signature.asc
Description: Digital signature
___
ofono mailing list
ofono@ofono.org
https://lists.ofono.org/mailman/listinfo/ofono