0
0
mirror of https://github.com/ecki/net-tools.git synced 2025-04-12 08:23:35 +00:00

9 Commits

Author SHA1 Message Date
aebd88ef8d standardize --help/usage handling
When displaying usage output in response to the user requesting it
(e.g. using -h/--help), make sure we write the output to stdout and
we exit(0).  When displaying output in response to an error (e.g.
an invalid option or argument), make sure we write the output to
stdout and exit non-zero.  This brings us in line with standard
utilities out there.

URL: https://bugs.gentoo.org/655942
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2018-06-26 03:30:13 -04:00
5c9e1e7615 use sockaddr_storage everywhere
Not all sockaddr structs have the same alignment.  Instead, it depends
on the fields contained in it.  The way net-tools has written things
though, it accepts sockaddr* everywhere which has 16bit alignment, even
though it will cast it to other sockaddr types that have higher alignment.
For example, `route` can crash on alpha because it declares sockaddr on
the stack, but then casts it up to sockaddr_in6 (which has 32bits).

It's also bad storage wise as we might try to cast the sockaddr to a type
that is larger than sockaddr which means clobbering the stack.

Instead, lets rewrite all the APIs to take a sockaddr_storage.  This is
guaranteed to have both the maximum alignment and size requirements for
all other sockaddr types.  Now we can safely cast that pointer to any
other sockaddr type and not worry about it.  It also has the nice effect
of deleting a lot of casts in a lot of places when we only need the type
of family.

The vast majority of changes here are mechanical.  There are a few places
where we have to memcpy between a dedicated sockaddr_storage and a smaller
struct because we're using an external embedded type (like arpreq).

URL: https://bugs.gentoo.org/558436
2015-11-24 09:34:47 -05:00
d621c2e820 [Bug#22] Return non-zero exit code if route arguments fail verification (CEM@sf.net) 2014-10-04 18:08:54 +00:00
d1381f908a trim trailing whitespace
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-05-12 22:31:19 -04:00
3d31cea261 Use safe_strncpy wherever possible
to avoid string overflow and to make sure the string
is terminated.

- link mii-tool and nameif against lib/
- remove xmalloc() from nameif because it's defined also in util.c
2013-02-19 10:28:11 +01:00
23e60909a2 X25 code compiles with 2.4 and 2.6 kernel headers (Debian Bug#271678) 2005-09-04 04:23:13 +00:00
5ce213869c make it compile with 2.4 and 2.6 kernel headers (Debian Bug ) 2005-05-16 10:07:48 +00:00
a859bcb3f5 merged debian patch to make it compile with new headers 2004-06-03 22:41:53 +00:00
481de747db Add X.25 support.
Patch from "J.H.M. Dassen (Ray)" <jdassen@cistron.nl>
2000-05-20 13:38:10 +00:00