1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00
Commit Graph

18 Commits

Author SHA1 Message Date
Stefan Metzmacher
d39636acea lib/socket: autodetect RSS using ETHTOOL_GRXRINGS
This is also used as part of 'ethtool -n rdma14' and
'ethtool -x rdma14'.

;#> ethtool -n rdma14
8 RX rings available
rxclass: Cannot get RX class rule count: Operation not supported
RX classification rule retrieval failed

;#> ethtool -x rdma14
RX flow hash indirection table for rdma14 with 8 RX ring(s):
    0:      0     1     2     3     4     5     6     7
    8:      0     1     2     3     4     5     6     7
RSS hash key:
Operation not supported
RSS hash function:
    toeplitz: on
    xor: off
    crc32: off

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-05-07 14:44:40 +00:00
Stefan Metzmacher
4ccb581609 lib/socket: let query_iface_speed_from_name() initialize memory passed to syscalls
I'm not sure if struct initializers would take care of padding,
so I use ZERO_STRUCT().

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-05-07 14:44:39 +00:00
David Mulder
5391e21dea lib:socket: If returning early, set ifaces
Prevents a segfault in load_interfaces() when total interfaces == 1.
Fixes regression caused by da68a1b2f4.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13665

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Ralph Böhme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Sun Oct 28 00:35:35 CEST 2018 on sn-devel-144
2018-10-28 00:35:34 +02:00
Andreas Schneider
da68a1b2f4 lib:socket: Return early if we have only one interface
This fixes compilation with -Wstrict-overflow=2

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-03-20 23:16:16 +01:00
Andreas Schneider
383530c164 libsocket: Make sure ifr.ifr_name is null-terminated
Found by Coverity

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sat Dec  3 03:40:53 CET 2016 on sn-devel-144
2016-12-03 03:40:53 +01:00
Günther Deschner
2e2f81134c lib/socket/interfaces: Fix some uninitialied bytes.
Valgrind reports the following:

==26599== Syscall param ioctl(SIOCETHTOOL) points to uninitialised byte(s)
==26599==    at 0x7014707: ioctl (in /usr/lib64/libc-2.22.so)
==26599==    by 0x79D1585: query_iface_speed_from_name (interfaces.c:152)
==26599==    by 0x79D1BBA: _get_interfaces (interfaces.c:277)
==26599==    by 0x79D1E80: get_interfaces (interfaces.c:368)
==26599==    by 0x508A7E3: load_interfaces (interface.c:612)
==26599==    by 0x150B30: main (net.c:963)
==26599==  Address 0xffefff0d8 is on thread 1's stack
==26599==  in frame #1, created by query_iface_speed_from_name
(interfaces.c:130)
==26599==
==26599== Syscall param ioctl(SIOCETHTOOL) points to uninitialised byte(s)
==26599==    at 0x7014707: ioctl (in /usr/lib64/libc-2.22.so)
==26599==    by 0x79D15CC: query_iface_speed_from_name (interfaces.c:164)
==26599==    by 0x79D1BBA: _get_interfaces (interfaces.c:277)
==26599==    by 0x79D1E80: get_interfaces (interfaces.c:368)
==26599==    by 0x508A7E3: load_interfaces (interface.c:612)
==26599==    by 0x150B30: main (net.c:963)
==26599==  Address 0xffefff0d8 is on thread 1's stack
==26599==  in frame #1, created by query_iface_speed_from_name
(interfaces.c:130)

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-03-12 06:24:24 +01:00
Anoop C S
9fb98e3e05 lib/socket: Fix improper use of default interface speed
_get_interfaces() function from interfaces.c uses if_speed
variable to store interface speed and is initialized with a
default value at start. But if_speed populated via one
iteration for a specific IP address will be treated as the
default value for next iteration which is wrong. Therefore
change is to move the initialization cum declaration of
if_speed inside iteration of IP addresses loop.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=11734

Signed-off-by: Anoop C S <anoopcs@redhat.com>
Reviewed-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>

Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Sat Feb 13 16:22:22 CET 2016 on sn-devel-144
2016-02-13 16:22:22 +01:00
Michael Adam
8b36428b19 lib:socket: fix CID 1350009 - illegal memory accesses (BUFFER_SIZE_WARNING)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11735

Pair-Programmed-With: Guenther Deschner <gd@samba.org>

Signed-off-by: Michael Adam <obnox@samba.org>
Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
2016-02-13 13:14:13 +01:00
Michael Adam
498383afef lib:socket: fix CID 1350010 - integer OVERFLOW_BEFORE_WIDEN
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Thu Feb  4 00:35:11 CET 2016 on sn-devel-144
2016-02-04 00:35:10 +01:00
Anoop C S
549a9abc7e lib:socket: detect link speed with ethtool ioctl in get_interfaces (on linux)
Pair-Programmed-With: Michael Adam <obnox@samba.org>

Signed-off-by: Anoop C S <anoopcs@redhat.com>
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2016-01-26 07:33:16 +01:00
Michael Adam
64be8e73ff lib:socket: set defaults for linkspeed and capability in get_interfaces()
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2016-01-26 07:33:16 +01:00
Michael Adam
235f37baa7 lib:socket: get interface index from kernel
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2016-01-26 07:33:16 +01:00
Timur Bakeyev
8ac431a22e Fix bug # 9666 - Broken filtering of link-local addresses.
This patch should address the problem with Link Local addresses
on FreeBSD and Linux.

Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Richard Sharpe <rsharpe@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Feb 28 20:56:57 CET 2013 on sn-devel-104
2013-02-28 20:56:57 +01:00
Jeremy Allison
5df1c11539 Start to add truncate checks on all uses of strlcpy(). Reading lwn
has it's uses :-).

Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Thu Mar 29 20:48:15 CEST 2012 on sn-devel-104
2012-03-29 20:48:15 +02:00
Jeremy Allison
744dd6bcbe Fix const warnings. 2011-10-14 13:48:53 -07:00
Matthieu Patou
abe5afc580 Fix bug with Samba not recognising an 6to4 IPv6 interface.
"The 6to4 interface has the flags IFF_POINTTOPOINT interface but no
ifa_dstaddr as it's not at the IPv6 level a point to point interface
(at least from my understanding), as we don't have a IFF_BROADCAST
flag set (I have the impression that this flag is only set on a
interface that has also an IPv4 address) the first test is not valid
also, which result in a skipped interface."
2011-10-14 13:45:48 -07:00
Andrew Bartlett
8a07ec7bab lib/socket: Remove outdated comment
The autoconf and waf tests for interfaces logic are in libreplace now.
2011-05-08 12:57:04 +02:00
Andrew Bartlett
f346a73785 lib/socket move interfaces code to the top level 2011-05-08 12:57:04 +02:00