Re: IP4Config and routes

On Wed, 2009-12-16 at 12:40 +0000, Daniel Drake wrote:
> Hi,
> Ad-hoc networking is broken in Sugar because no route is created for
> multicast packets - this means the collaboration features do not work.
> I can see that I can specify routes in the IP4Config object (hence we
> could modify Sugar to fix this) but the only documentation I can find
> is:
> 	Routes - aau - (read)
> 	Tuples of IPv4 route/prefix/next-hop/metric.

which leads you to:

"Array of IPv4 route structures. Each IPv4 route structure is composed
of 4 32-bit values; the first being the destination IPv4 network or
address (network byte order), the second the destination network or
address prefix (1 - 32), the third being the next-hop (network byte
order) if any, and the fourth being the route metric. For the 'auto'
method, given IP routes are appended to those returned by automatic
configuration. Routes cannot be used with the 'shared' or 'link-local'
methods as there is no upstream network."

If I need to expand on that, please let me know and I'll update the

> I'm not too knowledgeable about routing tables and the language I speak
> is the one that "route -n" returns, basically I want a route of:
> 	destination=
> 	gateway=
> 	genmask=
> 	flags=U
> 	metric=0
> I guess next-hop is gateway, and metric is metric, but I'm a bit stuck
> on "route" and "prefix"

route == destination
prefix = "Genmask" from /sbin/route but as a CIDR prefix, not a subnet

> Can anyone help me convert those values into ones that NM understands,
> or point me at some existing code which uses this functionality?

Lot of the internal NM code does this; internally NM uses

GSList *nm_utils_ip4_routes_from_gvalue (const GValue *value);
void nm_utils_ip4_routes_to_gvalue (GSList *list, GValue *value);

to get translate the 'routes' key into something it can use.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]