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

Splitting with a long URL and a pipe #377

Open
Bundy01 opened this issue Jan 22, 2025 · 4 comments · May be fixed by #378
Open

Splitting with a long URL and a pipe #377

Bundy01 opened this issue Jan 22, 2025 · 4 comments · May be fixed by #378
Assignees
Labels

Comments

@Bundy01
Copy link

Bundy01 commented Jan 22, 2025

Hi,

I've seen this problem with long addresses.

With a pipe

echo gejgeigjegjegjergjegjebjbeeorigthjrzpogiêprjyhrr.rhrh.vfvfocus.uho.com.twear.com.twelderlysd.comdrhearing.comhkhearingspeech.comepaper.ntuh.govphonak.com.hkodcb.org.hkhearingaids.com.hkweb2.ctsh.hcc.edu.tw.stu98erdo.ccdharmazen.orgpubu.com.twzh.wikipedia.org.wiki.facebook.co|fping   
gejgeigjegjegjergjegjebjbeeorigthjrzpogiêprjyhrr.rhrh.vfvfocus.uho.com.twear.com.twelderlysd.comdrhearing.comhkhearingspeech.comep: Name or service not known
aper.ntuh.govphonak.com.hkodcb.org.hkhearingaids.com.hkweb2.ctsh.hcc.edu.tw.stu98erdo.ccdharmazen.orgpubu.com.twzh.wikipedia.org.wi: Name or service not known
ki.facebook.co is alive

Without a pipe, it's OK

fping gejgeigjegjegjergjegjebjbeeorigthjrzpogiêprjyhrr.rhrh.vfvfocus.uho.com.twear.com.twelderlysd.comdrhearing.comhkhearingspeech.comepaper.ntuh.govphonak.com.hkodcb.org.hkhearingaids.com.hkweb2.ctsh.hcc.edu.tw.stu98erdo.ccdharmazen.orgpubu.com.twzh.wikipedia.org.wiki.facebook.co                                 
gejgeigjegjegjergjegjebjbeeorigthjrzpogiêprjyhrr.rhrh.vfvfocus.uho.com.twear.com.twelderlysd.comdrhearing.comhkhearingspeech.comepaper.ntuh.govphonak.com.hkodcb.org.hkhearingaids.com.hkweb2.ctsh.hcc.edu.tw.stu98erdo.ccdharmazen.orgpubu.com.twzh.wikipedia.org.wiki.facebook.co: Name or service not known

I modified the valid URL by adding random letters at the beginning to display the message Name or service not known because I'm using it in a script.
Because of this bug I can't test all the addresses I want (I limit to 132 max characters).

Regards.

@auerswal
Copy link
Collaborator

Thanks for the report!

You should be able to work around this issue by using xargs:

$ echo gejgeigjegjegjergjegjebjbeeorigthjrzpogiêprjyhrr.rhrh.vfvfocus.uho.com.twear.com.twelderlysd.comdrhearing.comhkhearingspeech.comepaper.ntuh.govphonak.com.hkodcb.org.hkhearingaids.com.hkweb2.ctsh.hcc.edu.tw.stu98erdo.ccdharmazen.orgpubu.com.twzh.wikipedia.org.wiki.facebook.co | xargs fping
gejgeigjegjegjergjegjebjbeeorigthjrzpogiêprjyhrr.rhrh.vfvfocus.uho.com.twear.com.twelderlysd.comdrhearing.comhkhearingspeech.comepaper.ntuh.govphonak.com.hkodcb.org.hkhearingaids.com.hkweb2.ctsh.hcc.edu.tw.stu98erdo.ccdharmazen.orgpubu.com.twzh.wikipedia.org.wiki.facebook.co: Name or service not known

This name is too long for DNS anyway. I am not convinced that fping needs to accept names longer than permissible for DNS on standard input or from a file, I'd say it suffices for fping to accept names acceptable for DNS. I am considering to increase the respective size limit in fping.

That fping splits this long name into three parts and adds every one as a target seems to be a bug. I intend to look into diagnosing and rejecting too long input lines instead.

@Bundy01
Copy link
Author

Bundy01 commented Jan 24, 2025

It has nothing to do with this bug, but I'd like to know about messages other than is a live.

I counted 4 of them:

  1. Name or service not known
  2. No address associated...
  3. Temporary failure...
  4. is unreachable

Can you tell me if there are others and what the difference is between these different states?

@auerswal auerswal added the bug label Jan 26, 2025
@auerswal auerswal self-assigned this Jan 26, 2025
@auerswal
Copy link
Collaborator

I am working on a fix for the line-splitting bug and made some progress, but I am not yet sure it works as intended. At least I need more time for testing.

@Bundy01, regarding your question:

Items 1, 2, and 3 on your list are returned by gai_strerror() after getaddrinfo() has failed. They all describe reasons why the name could not be resolved into at least one IP address. These descriptions come from the C Library (e.g., the GNU C Library on GNU/Linux), not fping. See line 2686 in fping.c:

fping/src/fping.c

Line 2686 in cb83286

print_warning("%s: %s\n", name, gai_strerror(ret_ga));

Item 4 on your list means that the target name could be resolved to at least one IP address, at least one ICMP request was sent to to that IP address, but fping did not receive any reply. This is normal fping output.

@Bundy01
Copy link
Author

Bundy01 commented Jan 26, 2025

@auerswal: thanks 👍

auerswal added a commit to auerswal/fping that referenced this issue Feb 1, 2025
This addresses GitHub isse schweikert#377.

Before, input lines longer than the static buffer used to read
data would be handled as if each buffer part were one line.
This could result in splitting input target names into multiple
different target names.

Since the static buffer was significantly smaller then the maximum
length of DNS names (just short of 255 one octet characters),
valid long DNS names could not be read as targets via file.

This commit fixes the splitting of long lines, and also increases
the maximum length of target names to 255 one octet characters.

The additional line parsing code is kept similar to the existing
code and attempts to keep all intended and/or useful features to
minimize the risk of regressions.
@auerswal auerswal linked a pull request Feb 1, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants