All of lore.kernel.org
 help / color / mirror / Atom feed
* howto setup a route by netlink socket
@ 2008-05-30  1:37 C.J
  2008-05-30  3:36 ` James Cameron
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: C.J @ 2008-05-30  1:37 UTC (permalink / raw)
  To: linux-ppp

Hi list,

I want to set a route by netlink socket but I've no idea how to do it clearly.

Here I've make up a virtual interface that is ppp0 by ioctl, we want to it could communicate with peer side.
We need just a route, right?  Netlink can do this. As there are many attributes , we need tell kernel what's our route.
But I'm not sure what we should build as attributes that we will send to kernel.

Now I get a simple talk, it contains 2 attrs follow 'rtmsg' structure. 
 RTA_DST, 192.168.1.1 -- the peer IP
 RTA_SRC, 192.168.1.2 -- our local IP
And it cannot work, kernel return [No such Device] error.
I think there are something I lost, pls help me and point out the errors.

Reg


--
c.j
  




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: howto setup a route by netlink socket
  2008-05-30  1:37 howto setup a route by netlink socket C.J
@ 2008-05-30  3:36 ` James Cameron
  2008-05-30  8:13 ` James Chapman
  2008-05-31 13:26 ` C.J
  2 siblings, 0 replies; 4+ messages in thread
From: James Cameron @ 2008-05-30  3:36 UTC (permalink / raw)
  To: linux-ppp

You could look at the ip(8) command source to find out how it is done,
/sbin/ip or /bin/ip is part of the iproute package on Red Hat and Debian
based Linux distributions.

Latest version of pptp has a hack that uses system(3) to execute ip(8).
If you can figure a way to do this without using system(3) then I'm
quite interested.

-- 
James Cameron                         http://quozl.netrek.org/
HP Open Source, Volunteer             http://opensource.hp.com/
PPTP Client Project, Release Engineer http://pptpclient.sourceforge.net/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: howto setup a route by netlink socket
  2008-05-30  1:37 howto setup a route by netlink socket C.J
  2008-05-30  3:36 ` James Cameron
@ 2008-05-30  8:13 ` James Chapman
  2008-05-31 13:26 ` C.J
  2 siblings, 0 replies; 4+ messages in thread
From: James Chapman @ 2008-05-30  8:13 UTC (permalink / raw)
  To: linux-ppp

James Cameron wrote:
> You could look at the ip(8) command source to find out how it is done,
> /sbin/ip or /bin/ip is part of the iproute package on Red Hat and Debian
> based Linux distributions.

The ip command uses libnetlink, but there's a new netlink library that 
is much easier to use. It's called libnl, at 
http://people.suug.ch/~tgr/libnl/. It includes simple apps that do 
common things like add routes. Binary packages are available for modern 
distros.

> Latest version of pptp has a hack that uses system(3) to execute ip(8).
> If you can figure a way to do this without using system(3) then I'm
> quite interested.


-- 
James Chapman
Katalix Systems Ltd
http://www.katalix.com
Catalysts for your Embedded Linux software development


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Re: howto setup a route by netlink socket
  2008-05-30  1:37 howto setup a route by netlink socket C.J
  2008-05-30  3:36 ` James Cameron
  2008-05-30  8:13 ` James Chapman
@ 2008-05-31 13:26 ` C.J
  2 siblings, 0 replies; 4+ messages in thread
From: C.J @ 2008-05-31 13:26 UTC (permalink / raw)
  To: linux-ppp

Hi James Chapman

>>
>James Cameron wrote:
>> You could look at the ip(8) command source to find out how it is done,
>> /sbin/ip or /bin/ip is part of the iproute package on Red Hat and Debian
>> based Linux distributions.

>The ip command uses libnetlink, but there's a new netlink library that 
>is much easier to use. It's called libnl, at 
>http://people.suug.ch/~tgr/libnl/. It includes simple apps that do 
>common things like add routes. Binary packages are available for modern 
>distros.

>> Latest version of pptp has a hack that uses system(3) to execute ip(8).
>> If you can figure a way to do this without using system(3) then I'm
>> quite interested.

Thanks a lot, I'll try.

Reg

--
c.j


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-05-31 13:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-30  1:37 howto setup a route by netlink socket C.J
2008-05-30  3:36 ` James Cameron
2008-05-30  8:13 ` James Chapman
2008-05-31 13:26 ` C.J

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.