Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

packet rocognition #4

Open
sl1200mk2 opened this issue Apr 21, 2014 · 9 comments
Open

packet rocognition #4

sl1200mk2 opened this issue Apr 21, 2014 · 9 comments

Comments

@sl1200mk2
Copy link
Contributor

in artnet_net_recv() this check is make:
if (cliAddr.sin_addr.s_addr == n->state.ip_addr.s_addr ||
ntohl(cliAddr.sin_addr.s_addr) == LOOPBACK_IP) {
p->length = 0;
return ARTNET_EOK;
}

this prevent to use a node that is bound on the 0.0.0.0:6454 address:port...
in your opinion what check can be done to avoid returning at this stage....

@sl1200mk2
Copy link
Contributor Author

this one i sa stopper too...
can't we check for p->data.ar.longname != n->state.long_name or something else?
++

@nomis52
Copy link
Member

nomis52 commented Apr 23, 2014

Try removing the check.

@sl1200mk2
Copy link
Contributor Author

if I remove the check I got my own node address (e.g the libartnet server)...

@nomis52
Copy link
Member

nomis52 commented Apr 23, 2014

I'm not clear what you're asking for. Can you please clearly describe the problem and what you'd like to see.

@sl1200mk2
Copy link
Contributor Author

I'm trying to make D::Light and Capture Polar working on the same computer....
I register an ArtNet node in DL as a server with artnet_new(), artnet_init(), and so...
I set the long Name, etc...
when I send an ArtPoll, I don't want to see the node I've created to be listed...
this can be done by:
if (((cliAddr.sin_addr.s_addr == n->state.ip_addr.s_addr) && !memcmp(p->data.ar.longname, n->state.long_name, ARTNET_LONG_NAME_LENGTH * sizeof(uint8_t))) ||
ntohl(cliAddr.sin_addr.s_addr) == LOOPBACK_IP) {
p->length = 0;
return ARTNET_EOK;
}

but I would like to know for a more elegant way....
in case of DL and Capture Polar on the same computer, cliAddr.sin_addr.s_addr == n->state.ip_addr.s_addr

best regards,
++

@nomis52
Copy link
Member

nomis52 commented Jun 13, 2014

Let me make sure I understand:
You want to respond to messages send from the same machine, except you also don't want the local node to show up when you try to discover devices?

To do the former you'll need to introduce a new function to control this behavior since we don't want to break existing clients. Something like

artnet_allow_loopback(artnet_node, bool);

There is no good way to filter Polls / PoolReplies from the same node. Comparing the node name is a bit of a hack, esp. since it could be set from the hostname. At a minimum I'd compare the manufacturer ID and the name

@sl1200mk2
Copy link
Contributor Author

Simon,
thank you for taking time to answer me!

2014-06-13 4:42 GMT+02:00 Simon Newton [email protected]:

Let me make sure I understand:
You want to respond to messages send from the same machine, except you
also don't want the local node to show up when you try to discover devices?

that is exactly it!
DL and the 3D visualizer runs on the same host, and when I send a poll, I
don't want DL to be listed

To do the former you'll need to introduce a new function to control this
behavior since we don't want to break existing clients. Something like

artnet_allow_loopback(artnet_node, bool);

There is no good way to filter Polls / PoolReplies from the same node.
Comparing the node name is a bit of a hack, esp. since it could be set from
the hostname. At a minimum I'd compare the manufacturer ID and the name

do you mean something like that?:
if (((cliAddr.sin_addr.s_addr == n->state.ip_addr.s_addr) &&
!artnet_allow_loopback(artnet_node, bool))||
ntohl(cliAddr.sin_addr.s_addr) == LOOPBACK_IP) {
p->length = 0;
return ARTNET_EOK;
}

++
Nico


Reply to this email directly or view it on GitHub
#4 (comment)
.

@nomis52
Copy link
Member

nomis52 commented Jun 13, 2014

Here are the steps:

i) add a new bool to the node_state_t struct to track if loopback is enabled / disabled. It should default to disabled.
ii) add a artnet_allow_loopback function to toggle this state
iii) In artnet_net_recv, if loopback is disabled, and (cliAddr.sin_addr.s_addr == n->state.ip_addr.s_addr || ntohl(cliAddr.sin_addr.s_addr) == LOOPBACK_IP ) the packet should be skipped
iv) In handle_reply if the node name and the manufacturer match our name and the packet was send from this machine the poll reply is discarded.

@sl1200mk2
Copy link
Contributor Author

thanx,
will be on my todo list.

++

2014-06-13 17:29 GMT+02:00 Simon Newton [email protected]:

Here are the steps:

i) add a new bool to the node_state_t struct to track if loopback is
enabled / disabled. It should default to disabled.
ii) add a artnet_allow_loopback function to toggle this state
iii) In artnet_net_recv, if loopback is disabled, and
(cliAddr.sin_addr.s_addr == n->state.ip_addr.s_addr ||
ntohl(cliAddr.sin_addr.s_addr) == LOOPBACK_IP ) the packet should be skipped
iv) In handle_reply if the node name and the manufacturer match our name
and the packet was send from this machine the poll reply is discarded.


Reply to this email directly or view it on GitHub
#4 (comment)
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants