Question about event handling with IPRoute API #877
Replies: 4 comments 4 replies
-
I get |
Beta Was this translation helpful? Give feedback.
-
Hello Eugene, but isn't that pretty much functionally equivalent to just doing this?
I'm asking because this doesn't work for me. While running this, |
Beta Was this translation helpful? Give feedback.
-
OK, so maybe I should've read the documentation more carefully. This works for me:
EDIT: |
Beta Was this translation helpful? Give feedback.
-
Long story short: no, you will not interfere tl;dr
PS: converted the issue to a discussion |
Beta Was this translation helpful? Give feedback.
-
Hello,
first of all I apologize for using the bugtracker as a means to get information. Didn't want to mail Peter directly, because maybe someone else might have a good hint for me.
Anyway, I'm trying to use v0.5.18 of pyroute2 to set routing rules (in the policy based routing sense) when the configuration of an interface changes. By change I mean adding of an IP address, update, remove, etc.
I'm pretty sure that the IPRoute API/class provides everything that is necessary to set the routing rules, but I'm unsure about how to implement the monitoring loop. I checked the examples, and
ip_monitor.py
looks like the kind of thing I want. OK, there's no looping here, but I guess that would be trivial. However the example uses a IPRSocket object, and as far as I understand, if I'm using that one, that I have to do pretty much everything myself.So basically what I'm looking for is something like:
So ipr actually has a
get()
method, but apparantly it doesn't do what I want. Also there'sregister_callback()
, which could be potentially be interesting. But I don't get my registered callback function to fire.I guess I'm pretty much lost here. I'm grateful for any kind of pointers. Maybe there's an example of a one of the tests that is closer to what I want to achieve.
Thanks in advance!
With best wishes,
Tobias
Beta Was this translation helpful? Give feedback.
All reactions