I'm trying to direct non-broadcast arps to my controller.
Basically I wanted to do something like this:
sudo ovs-ofctl add-flow br0 dl_type=0x0806,dl_dst!=ff:ff:ff:ff:ff:ff,priority=101,action=CONTROLLER:65535
However there is no such thing as != for the dl_dst
I'd also like to create another flow that floods all broadcast arps to every port (except the one it was sent on)
Thank you in advance for your help!
Related
My cross-platform C program takes an IPv6 address and port number, and tries to connect to the remote server they designate. The address may or may not have a scope suffix.
I use getifaddrs() and iterate through the results using a pointer struct ifaddr * pAdapter, ignoring the entries where pAdapter->ifa_addr->sa_family != AF_INET6.
If the user supplied a numeric scope suffix, I only look at entries where the scope ID (sockaddr_in6 *)(pAdapter->ifa_addr)->sin6_scope_id matches it, and if they supplied a non-numeric suffix, I only look at the entries where pAdapter->ifa_name matches it. But if the scope suffix was empty, I simply try all of the entries in turn, and the user has to live with the first successful one whichever it is. (This iteration seems unnecessary on Windows 10—from what I can tell, winsock2 seems to actually do its own similar cascade of attempts under the hood if you leave the scope ID and flow-control fields zeroed.)
On each attempt, I take a copy of *(sockaddr_in6 *)(pAdapter->ifa_addr), fill in the desired sin6_addr and sin6_port, and try to connect() my socket. On my Ubuntu box, this works. On Windows 10, it also works, though it's probably redundant as I mentioned. But on MacBooks running system 10.13.6 and 11.2.3, I have a problem: for some reason there are two IPv6 interfaces both called "lo0", one with scope ID 0 and one with scope ID 1, and connect() hangs when trying through the latter.
For example, I might be trying to connect to fe80::dead:beef%en0 (scope ID 5) and I only supply fe80::dead:beef. The fe80::dead:beef%0 attempt fails with "No route to host" and we move on, but the fe80::dead:beef%1 attempt hangs indefinitely and we never get as far as scope 5.
Why the duplication, why does it hang, and what should I do? Merely adding a timeout to the attempt would make the whole thing prohibitively slow. Is there any other way I determine that scope 1 is not a viable option, and move on?
I am no longer "new" to Python, but am now moving into unchartered territory.
Recently I was dissecting some logic circuit code found here. I learned a lot about the practical use of inheritance from this code. Good stuff.
Not much happens in this code until one changes the inputs on a gate, so the interpreter must be used to manipulate the inputs. I got tired of using the interpreter, and so I investigated ways to create a continuous loop that would not rerun the initial code.
I found that Tkinter uses a continuous loop that I could then interrupt with the "after" method to update some of the parameters of the code currently running.
That works well, however I am curious as to whether there is another and/or better way. Anyone know of one or the other?
Some of the code:
tk_TkGUI = Tk()
f_AndTest() ## Initialize the 'And' gate
tk_TkGUI.after(1000, f_ChangeAnInput) ## Invokes Tk 'after' method to update an input
tk_TkGUI.mainloop() ## Must be used in Windows with Tkinter
def f_ChangeAnInput():
A1.B.set(0) ## Change A1.B from 1 to 0
If you want a window, using Tkinter in this way is perfectly fine.
By the way, after doesn't interrupt the loop as you described it. The main loop simply loops over a queue of events and processes them in order. When it reaches the end it waits for more events. Much like when you press a key or move the mouse, after merely puts something in the queue to be processed later. It really is as simple as that.
you could use threading.
import thread
def blaH:
#All your code that isn't related to your tkinter stuffs in here
thread.start_new_thread(blaH,())
the only thing is that you need new ways of both threads to talk to each other, such as global variables.
Basically I need to play about 20-30+ sounds in the game from one AmbientSound node in the game
So I figured I'll make an array of sounds and then loop through it as required and invoke PlaySound. But so far it has not worked for me.
For example I am not sure how to initialize the sounds. It seems that I can add AmbientSound to the EventGraph and then I need to invoke SetSound to initialize it, but I can only set one sound to AmbientSound node.
So the question is, how do I dynamically SetSound on one AmbientSound node?
Naturally I wanted to add a bunch of sounds to the array and then loop through it calling play sound as required, but I am not that this is possible.
Found the solution:
I just made a an array of SoundWave objects and everytime on the event I need I just set the AmbientSound node to the object at the index array and then play. Works like a dream.
Here is my part of the network that does it:
this is my program:
Program before
and I want it to look like this:
Program after
is this possible to add letters at some specific points in the ValueAxis?
I'm afraid that your links are not working, you may get a better responce using Imager and adding some example code or a Short, Self Contained, Correct Example.
In the meantime is this what you are trying to do
I use libevent like this,
client->m_event = event_new(listener->m_server->m_server_base, client->m_sockfd, EV_PERSIST, Client::ClientEventCallback, client);
event_add(client->m_event, NULL);
But I don't know how to modify the event of m_event, there seems to be no interface to operate in official manual, i tried to do it like this, but it make a core dump.
short event = event_get_events(m_event);
event_del(m_event);
event_assign(m_event, m_server->m_server_base, m_sockfd, event | EV_WRITE, Client::ClientEventCallback, this);
event_add(m_event, NULL);
core dump ocurs at event_assign, please help me ... how to modify the registed event of the struct event ?
I don't see anything in your code that should make you core dump, but I might inquire as to why you're event_assign'ing again anyways just to add in the EV_WRITE flag. Correct me if i'm wrong, but since your event_new is only specifying EV_PERSIST, I don't think it'll ever fire (so why event_add it at that point?) It seems like you should just be doing
client->m_event = event_new(listener->m_server->m_server_base, client->m_sockfd, EV_PERSIST | EV_WRITE, Client::ClientEventCallback, client);
up top, then when you are ready to write just do
event_add(m_event, NULL);
and when you're done writing
event_del(m_event);
Anyways, like I said I wouldn't think what you're doing should be a problem per-say, but if there is some funky behavior that happens when you add an event with only EV_PERSIST as the event type and then later del/assign it, the above may solve it. (And it'll be less code / more effecient anyways, so might as well :))