Ruby linux tproxy and routing bgp\ospf\others

two questions:
i was wondering if there is a way in ruby to handle linux netfilter
tproxy sockets?
read them… create a client tproxy scket?
(as used in squid and haproxy)

another issue is linux routing manipulating from ruby.
i want to manipulate linux routing tables as a “bgp” daemon.
bird and quagga do exist but i was wondering if there is a option from
ruby to manipulate the routing tables?
i can run iproute or ip commands but i want to identify the change for
as came from bgp daemon.
i know that exists somewhere in linux “NETLINK_ROUTE” so is there any
way to do something with it from ruby?

Thanks,
Eliezer

Eliezer C. wrote in post #1067234:

i know that exists somewhere in linux “NETLINK_ROUTE” so is there any
way to do something with it from ruby?

I wrote a ruby netlink library for a client last year. They expressed an
interest in open-sourcing it at some point, but I don’t think they have
done so yet.

So I know that it’s possible, but you may have to get down to some very
low-level programming to achieve it.

Some useful sources of info:

On 7/4/2012 10:48 PM, Brian C. wrote:

Some useful sources of info:

thanks.
i have seen this:
https://github.com/mpage/netlink
but as i have no knowledge about netlink i have no way to know a thing
about it.
i will read some more but if you can say something about it i will be
happy to hear.

Thanks,
Eliezer

On 7/6/2012 11:01 AM, Brian C. wrote:

happy to hear.

Sorry, you’ll need to read the links I gave before (including the ‘ip’
source code), to build the appropriate message structures. For example,
adding a new route is message code RTM_NEWROUTE with flags
NLM_F_CREATE|NLM_F_EXCL

It will probably be easier to spawn out to the ‘ip’ command for now. If
you want to mark the route as coming from BGP, then look at the
‘protocol’ option and /etc/iproute2/rt_protos

well i will see what is going on…
i dont want to use the ip command because it will then not be my
“daemon” but using “ip” command.

for couple tasks it will be fine to use ip but as for higher levels it
wont be good.

probably i will read it somewhere in the near future.

Thanks

Eliezer C. wrote in post #1067585:

i have seen this:
https://github.com/mpage/netlink

Ah, that’s not the one I wrote, which included high-level functions for
manipulating the interface and routing tables.

but as i have no knowledge about netlink i have no way to know a thing
about it.
i will read some more but if you can say something about it i will be
happy to hear.

Sorry, you’ll need to read the links I gave before (including the ‘ip’
source code), to build the appropriate message structures. For example,
adding a new route is message code RTM_NEWROUTE with flags
NLM_F_CREATE|NLM_F_EXCL

It will probably be easier to spawn out to the ‘ip’ command for now. If
you want to mark the route as coming from BGP, then look at the
‘protocol’ option and /etc/iproute2/rt_protos