mirror of
https://github.com/moparisthebest/socat
synced 2024-12-21 14:38:48 -05:00
added struct sockaddr_ll to union sockaddr_union to avoid "strict aliasing"
This commit is contained in:
parent
30a3ec3baa
commit
a8a8626c2f
4
CHANGES
4
CHANGES
@ -1,4 +1,8 @@
|
|||||||
|
|
||||||
|
corrections:
|
||||||
|
added struct sockaddr_ll to union sockaddr_union to avoid "strict
|
||||||
|
aliasing" warnings (problem reported by Paul Wouters)
|
||||||
|
|
||||||
####################### V 1.7.1.1:
|
####################### V 1.7.1.1:
|
||||||
|
|
||||||
corrections:
|
corrections:
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* source: sysutils.h */
|
/* source: sysutils.h */
|
||||||
/* Copyright Gerhard Rieger 2001-2008 */
|
/* Copyright Gerhard Rieger 2001-2010 */
|
||||||
/* Published under the GNU General Public License V.2, see file COPYING */
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
#ifndef __sysutils_h_included
|
#ifndef __sysutils_h_included
|
||||||
@ -27,6 +27,9 @@ union sockaddr_union {
|
|||||||
#if WITH_IP6
|
#if WITH_IP6
|
||||||
struct sockaddr_in6 ip6;
|
struct sockaddr_in6 ip6;
|
||||||
#endif /* WITH_IP6 */
|
#endif /* WITH_IP6 */
|
||||||
|
#if WITH_INTERFACE
|
||||||
|
struct sockaddr_ll ll;
|
||||||
|
#endif
|
||||||
} ;
|
} ;
|
||||||
#endif /* _WITH_SOCKET */
|
#endif /* _WITH_SOCKET */
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* source: xio-interface.c */
|
/* source: xio-interface.c */
|
||||||
/* Copyright Gerhard Rieger 2008 */
|
/* Copyright Gerhard Rieger 2010 */
|
||||||
/* Published under the GNU General Public License V.2, see file COPYING */
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
/* this file contains the source for opening addresses of raw socket type */
|
/* this file contains the source for opening addresses of raw socket type */
|
||||||
@ -60,9 +60,9 @@ int _xioopen_interface(const char *ifname,
|
|||||||
needbind = true;
|
needbind = true;
|
||||||
}
|
}
|
||||||
/*!!! parse by ':' */
|
/*!!! parse by ':' */
|
||||||
((struct sockaddr_ll *)&us)->sll_family = pf;
|
us.ll.sll_family = pf;
|
||||||
((struct sockaddr_ll *)&us)->sll_protocol = htons(ETH_P_ALL);
|
us.ll.sll_protocol = htons(ETH_P_ALL);
|
||||||
((struct sockaddr_ll *)&us)->sll_ifindex = ifidx;
|
us.ll.sll_ifindex = ifidx;
|
||||||
uslen = sizeof(sall);
|
uslen = sizeof(sall);
|
||||||
needbind = true;
|
needbind = true;
|
||||||
xfd->peersa = (union sockaddr_union)us;
|
xfd->peersa = (union sockaddr_union)us;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* source: xioread.c */
|
/* source: xioread.c */
|
||||||
/* Copyright Gerhard Rieger 2001-2009 */
|
/* Copyright Gerhard Rieger 2001-2010 */
|
||||||
/* Published under the GNU General Public License V.2, see file COPYING */
|
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||||
|
|
||||||
/* this is the source of the extended read function */
|
/* this is the source of the extended read function */
|
||||||
@ -148,7 +148,7 @@ ssize_t xioread(xiofile_t *file, void *buff, size_t bufsiz) {
|
|||||||
*/
|
*/
|
||||||
#if defined(PF_PACKET) && defined(PACKET_OUTGOING)
|
#if defined(PF_PACKET) && defined(PACKET_OUTGOING)
|
||||||
if (from.soa.sa_family == PF_PACKET) {
|
if (from.soa.sa_family == PF_PACKET) {
|
||||||
if ((((struct sockaddr_ll *)&from.soa)->sll_pkttype & PACKET_OUTGOING)
|
if ((from.ll.sll_pkttype & PACKET_OUTGOING)
|
||||||
== 0) {
|
== 0) {
|
||||||
errno = EAGAIN; return -1;
|
errno = EAGAIN; return -1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user