nitefood / asn

ASN / RPKI validity / BGP stats / IPv4v6 / Prefix / URL / ASPath / Organization / IP reputation / IP geolocation / IP fingerprinting / Network recon / lookup API server / Web traceroute server
MIT License
1.31k stars 159 forks source link

ipcalc bad argument #37

Closed jluthman closed 1 year ago

jluthman commented 1 year ago

Possibly related to issue 34 - https://github.com/nitefood/asn/issues/34

asn dns.inxfiber.com

ipcalc: bad argument -v: unknown option Usage: ipcalc [OPTION...] -c, --check Validate IP address for specified address family -4, --ipv4 IPv4 address family (default) -6, --ipv6 IPv6 address family -b, --broadcast Display calculated broadcast address -h, --hostname Show hostname determined via DNS -m, --netmask Display default netmask for IP (class A, B, or C) -n, --network Display network address -p, --prefix Display network prefix -s, --silent Don't ever display error messages

Help options: -?, --help Show this help message --usage Display brief usage message

yum whatprovides ipcalc

Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile

  • base: ohioix.mm.fcix.net
  • epel: mirrors.wcupa.edu
  • extras: mirrors.sonic.net
  • updates: repos.lax.layerhost.com initscripts-9.49.53-1.el7.x86_64 : The inittab file and the /etc/init.d scripts

Repo : base Matched from: Filename : /usr/bin/ipcalc

nitefood commented 1 year ago

Hi @jluthman!

Yes, these issues are definitely related. It appears that you're using an older CentOS/RHEL version, at least I assume so given your initscripts version (reminds me of this).

In such case, if you can't update your system, you may get lucky by manually installing a newer version of ipcalc. Maybe @robert-scheck could help chiming in once again in case he knows of a better option.

Let me know how it works out.

Thanks for the feedback!

robert-scheck commented 1 year ago

Yes, ipcalc as shipped by RHEL/CentOS 7 is simply too old. The earliest version that seems to work properly with asn is part of CentOS/RHEL/Rocky Linux 9. Replacing it is not easily possible in an update-safe way. Just replacing /usr/bin/ipcalc might be overriden with the next initscripts RPM package update, thus an alternative ipcalc would actually have to live e.g. in /usr/local/bin/ipcalc (or somewhere else on $PATH before /usr/bin to be called first). But that's nothing an RPM package from EPEL could ship, given EPEL is not allowed to replace base (CentOS/RHEL/Rocky Linux) RPM packages. So, yes, building it yourself is most likely the way to go. If it helps somehow, I could ship a "bad" RPM package within a Fedora COPR repository (outside of the regular distribution) to provide what's needed for asn…let me know, if there is interest.

robert-scheck commented 1 year ago

If it helps somehow, I could ship a "bad" RPM package within a Fedora COPR repository (outside of the regular distribution) to provide what's needed for asn

…there you go: https://copr.fedorainfracloud.org/coprs/robert/ipcalc/

jluthman commented 1 year ago

Robert's solution/repo is perfect. Simply run the dnf commands and it works.

ipcalc -v

ipcalc 1.0.1

which ipcalc

/usr/local/bin/ipcalc