0
0
mirror of https://github.com/ecki/net-tools.git synced 2025-05-02 01:33:59 +00:00

12 Commits

Author SHA1 Message Date
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
4d721ae0a7 fix up signed/unsigned warnings
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-11-20 19:46:38 -05:00
46cd57a736 fix up unused variable warnings
Some of these are unused, so drop them.  Others are only used in debug
code, so refactor those so things are always compiled.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-11-20 19:46:38 -05:00
97b31ceedc clean up const/unsigned pointers with aftype/hwtype structs
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-11-20 19:46:38 -05:00
0daeffdcff ethernet mac in lower case hex digits 2002-07-30 05:17:29 +00:00
dbc1e63ecc Remove `sprint' member from struct hwtype. As far as I can see
it served no useful purpose.  Please check I didn't break your
favourite hardware type in the process.
Add derisory support for Ash protocols.
1999-09-27 11:00:42 +00:00
e1396f4419 Include util.h where needed 1998-11-19 13:01:47 +00:00
8e30424705 - Allow device probing again (this should fix the problem Arnaldo de Melo
reported)

- Various cleanups and bug fixes.

- Better error message for ENODEV.

- Proper exit codes for interface printing

- Add safe_strncpy and use it everywhere: this fixes quite a lot of
strncpy bugs (strncpy doesn't add a '\0' when the source string is too
long!)
1998-11-17 15:16:09 +00:00
49d6a0009c Yow. This is net-tools completely reindented.
Some other cleanups:
- lib/net-string.c removed because it was not used and had a copyright notice
that conflicted with the GPL.
- Minor cleanups.
- Fix an potential buffer overflow in ax25.
- Switch to CVS $Id$ for versioning consistently
1998-11-15 20:07:31 +00:00
9791447022 Replace outdated NLS support with GNU gettext (patch from
Arnaldo Carvalho de Melo <acme@conectiva.com.br>).  This
touches virtually every file but the changes are fairly
superficial.

Please check I haven't broken your favourite AF/hardware
type during the conversion.
1998-08-10 20:48:01 +00:00
4077f846d0 Be robust, allow to skip leading zero as RH4.2 does. 1998-05-28 18:31:12 +00:00
1ef3bd3bd1 Initial revision 1998-01-08 09:54:43 +00:00