0

I have this code:

    execl("/bin/ip", "address", "add", 
        "dev", ob->tun_name,  
        "local", ob->local_ip,
        "peer", ob->remote_ip,
        NULL
    );

But I get the error:

Object "dress" is unknown, try "ip help".

If I use this:

    execl("/bin/ip", "  address", "add", 
        "dev", ob->tun_name,  
        "local", ob->local_ip,
        "peer", ob->remote_ip,
        NULL
    );

It works.

I've tried execlp("ip", ... but it has the same problem.

What am I doing wrong - why do I need to throw away two characters in front of "address"?

fadedbee
  • 42,671
  • 44
  • 178
  • 308

1 Answers1

0

This works, I needed to add the name of the executable back in.

    execl("/bin/ip", "/bin/ip", "address", "add", 
        "dev", ob->tun_name,  
        "local", ob->local_ip,
        "peer", ob->remote_ip,
        NULL
    );
fadedbee
  • 42,671
  • 44
  • 178
  • 308