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

scan failure on one backend causes failures on all #559

Closed
rgetz opened this issue Jun 22, 2020 · 5 comments · Fixed by #801
Closed

scan failure on one backend causes failures on all #559

rgetz opened this issue Jun 22, 2020 · 5 comments · Fixed by #801
Assignees

Comments

@rgetz
Copy link
Contributor

rgetz commented Jun 22, 2020

@mhennerich noticed that an ethernet scan failure causes a total scan failure...

I think this is a problem with bad actors on ethernet with a Windows clients.

But will need to check a little bit more...

@rgetz rgetz self-assigned this Jun 22, 2020
@rgetz
Copy link
Contributor Author

rgetz commented Jul 22, 2020

right now, we have iio_scan_context_get_info_list() which returns either:

 * @returns On success, the number of contexts found.
 * @returns On failure, a negative error number.

So, in the case we have a partial failure (usb works, but Ethernet does not), how do we want to return things?

  • on partial success, just return the number of context found, and don't tell anyone Ethernet failed?

@tfcollins
Copy link
Contributor

What is an Ethernet failure? Is that just it didn't find anything?

@commodo
Copy link
Contributor

commodo commented Jul 23, 2020

So, if it's a bad-actor on the network, we can consider it doesn't exist and continue with the rest that do exist?
We can probably identify a few error codes that make sense to ignore in the network iteration code.

Another option is to extend the API a bit, and add a iio_scan_context_allow_partial_results_set(true) [or some other function call that may be made more extensible, like an iio_scan_context_ioctl() or something], to allow for partial results.

This could probably be useful for local contexts as well [later] when stuff gets added/extended to the local context to do more validation in there.
Right now, local_context_scan() does something like:

static int check_device(void *d, const char *path)
{
        *(bool *)d = true;
        return 0;
}

int local_context_scan(struct iio_scan_result *scan_result)
{
        struct iio_context_info **info;
        bool exists = false;
        char *desc, *uri, *machine, buf[2 * BUF_SIZE], names[BUF_SIZE];
        int ret;

        ret = foreach_in_dir(&exists, "/sys/bus/iio", true, check_device);
        if (ret < 0 || !exists)
                return 0;
.........................

So, check_device() looks fine for a prototype code, but I think we can [probably] squeeze more sysfs ABI validation in there.
That could break some backwards compatibility [at first], so this should probably be kept as a backwards compatible behavior.

@rgetz
Copy link
Contributor Author

rgetz commented Jul 23, 2020

What is an Ethernet failure? Is that just it didn't find anything?

It's when something response that they do have a IIO device via dns-sd, but don't actually have iiod running.

This happens if you have an old install with a iio_services file in /etc/avahai/ ... but no iiod running. The Linux side handles this case, but the windows implementation doesn't like it, and returns a failure.

@rgetz
Copy link
Contributor Author

rgetz commented Aug 4, 2020

I think the issue is - the Linux code actually port knocks, and the Windows code does not...

That is the easiest fix.

rgetz added a commit that referenced this issue Feb 23, 2022
Both the Linux and Mac implemations of DNS SD ensures something is there
before passing the host information up the stack. The Windows
implemnation was missing this, so add it.

Fix #559

Signed-off-by: Robin Getz <[email protected]>
rgetz added a commit that referenced this issue Feb 23, 2022
Both the Linux and Mac implemations of DNS SD ensures something is there
before passing the host information up the stack. The Windows
implemnation was missing this, so add it.

Fix #559

Signed-off-by: Robin Getz <[email protected]>
rgetz added a commit that referenced this issue Feb 23, 2022
Both the Linux and Mac implemations of DNS SD ensures something is there
before passing the host information up the stack. The Windows
implemnation was missing this, so add it. Add locking since it's needed
by those functions.

Fix #559

Signed-off-by: Robin Getz <[email protected]>
rgetz added a commit that referenced this issue Feb 27, 2022
Both the Linux and Mac implemations of DNS SD ensures something is there
before passing the host information up the stack. The Windows
implemnation was missing this, so add it. Add locking since it's needed
by those functions.

Fix #559

Signed-off-by: Robin Getz <[email protected]>
rgetz added a commit that referenced this issue Feb 27, 2022
Both the Linux and Mac implemations of DNS SD ensures something is there
before passing the host information up the stack. The Windows
implemnation was missing this, so add it. Add locking since it's needed
by those functions.

Fix #559

Signed-off-by: Robin Getz <[email protected]>
rgetz added a commit that referenced this issue Feb 28, 2022
Both the Linux and Mac implemations of DNS SD ensures something is there
before passing the host information up the stack. The Windows
implemnation was missing this, so add it. Add locking since it's needed
by those functions.

Fix #559

Signed-off-by: Robin Getz <[email protected]>
rgetz added a commit that referenced this issue Mar 1, 2022
Both the Linux and Mac implemations of DNS SD ensures something is there
before passing the host information up the stack. The Windows
implemnation was missing this, so add it. Add locking since it's needed
by those functions.

Fix #559

Signed-off-by: Robin Getz <[email protected]>
rgetz added a commit that referenced this issue Mar 2, 2022
Both the Linux and Mac implemations of DNS SD ensures something is there
before passing the host information up the stack. The Windows
implemnation was missing this, so add it. Add locking since it's needed
by those functions.

Fix #559

Signed-off-by: Robin Getz <[email protected]>
rgetz added a commit that referenced this issue Mar 3, 2022
Both the Linux and Mac implemations of DNS SD ensures something is there
before passing the host information up the stack. The Windows
implemnation was missing this, so add it. Add locking since it's needed
by those functions.

Fix #559

Signed-off-by: Robin Getz <[email protected]>
@rgetz rgetz closed this as completed Mar 3, 2022
pcercuei pushed a commit that referenced this issue Mar 4, 2022
Both the Linux and Mac implemations of DNS SD ensures something is there
before passing the host information up the stack. The Windows
implemnation was missing this, so add it. Add locking since it's needed
by those functions.

Fix #559

Signed-off-by: Robin Getz <[email protected]>
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

Successfully merging a pull request may close this issue.

3 participants