View | Details | Raw Unified | Return to bug 226513 | Differences between
and this patch

Collapse All | Expand All

(-)files/0001-Revert-Try-to-fix-problems-with-strict-aliasing.patch (-84 lines)
Removed Link Here
1
This reverts commit c371602f5f499a29d1fb1c43a8d12f21ff56296b.
2
---
3
 src/ifvc.c | 23 ++++++++++-------------
4
 1 file changed, 10 insertions(+), 13 deletions(-)
5
6
diff --git a/src/ifvc.c b/src/ifvc.c
7
index 3a7476d..2d487ed 100644
8
--- a/src/ifvc.c
9
+++ b/src/ifvc.c
10
@@ -34,13 +34,6 @@
11
 
12
 #include "igmpproxy.h"
13
 
14
-/* We need a temporary copy to not break strict aliasing rules */
15
-static inline uint32_t s_addr_from_sockaddr(const struct sockaddr *addr) {
16
-    struct sockaddr_in addr_in;
17
-    memcpy(&addr_in, addr, sizeof(addr_in));
18
-    return addr_in.sin_addr.s_addr;
19
-}
20
-
21
 struct IfDesc IfDescVc[ MAX_IF ], *IfDescEp = IfDescVc;
22
 
23
 /* aimwang: add for detect interface and rebuild IfVc record */
24
@@ -112,15 +105,17 @@ void rebuildIfVc () {
25
         }
26
 
27
         // Get the interface adress...
28
-        Dp->InAdr.s_addr = s_addr_from_sockaddr(&IfPt->ifr_addr);
29
+        Dp->InAdr = ((struct sockaddr_in *)&IfPt->ifr_addr)->sin_addr;
30
         addr = Dp->InAdr.s_addr;
31
 
32
         memcpy( IfReq.ifr_name, Dp->Name, sizeof( IfReq.ifr_name ) );
33
+        IfReq.ifr_addr.sa_family = AF_INET;
34
+        ((struct sockaddr_in *)&IfReq.ifr_addr)->sin_addr.s_addr = addr;
35
 
36
         // Get the subnet mask...
37
         if (ioctl(Sock, SIOCGIFNETMASK, &IfReq ) < 0)
38
             my_log(LOG_ERR, errno, "ioctl SIOCGIFNETMASK for %s", IfReq.ifr_name);
39
-        mask = s_addr_from_sockaddr(&IfReq.ifr_netmask);
40
+        mask = ((struct sockaddr_in *)&IfReq.ifr_addr)->sin_addr.s_addr;
41
         subnet = addr & mask;
42
 
43
         if ( ioctl( Sock, SIOCGIFFLAGS, &IfReq ) < 0 )
44
@@ -131,7 +126,7 @@ void rebuildIfVc () {
45
         {
46
             if ( ioctl( Sock, SIOCGIFDSTADDR, &IfReq ) < 0 )
47
                 my_log(LOG_ERR, errno, "ioctl SIOCGIFDSTADDR for %s", IfReq.ifr_name);
48
-            addr = s_addr_from_sockaddr(&IfReq.ifr_dstaddr);
49
+            addr = ((struct sockaddr_in *)&IfReq.ifr_dstaddr)->sin_addr.s_addr;
50
             subnet = addr & mask;
51
         }
52
 
53
@@ -263,15 +258,17 @@ void buildIfVc(void) {
54
             }
55
 
56
             // Get the interface adress...
57
-            IfDescEp->InAdr.s_addr = s_addr_from_sockaddr(&IfPt->ifr_addr);
58
+            IfDescEp->InAdr = ((struct sockaddr_in *)&IfPt->ifr_addr)->sin_addr;
59
             addr = IfDescEp->InAdr.s_addr;
60
 
61
             memcpy( IfReq.ifr_name, IfDescEp->Name, sizeof( IfReq.ifr_name ) );
62
+            IfReq.ifr_addr.sa_family = AF_INET;
63
+            ((struct sockaddr_in *)&IfReq.ifr_addr)->sin_addr.s_addr = addr;
64
 
65
             // Get the subnet mask...
66
             if (ioctl(Sock, SIOCGIFNETMASK, &IfReq ) < 0)
67
                 my_log(LOG_ERR, errno, "ioctl SIOCGIFNETMASK for %s", IfReq.ifr_name);
68
-            mask = s_addr_from_sockaddr(&IfReq.ifr_netmask);
69
+            mask = ((struct sockaddr_in *)&IfReq.ifr_addr)->sin_addr.s_addr;
70
             subnet = addr & mask;
71
 
72
             /* get if flags
73
@@ -293,7 +290,7 @@ void buildIfVc(void) {
74
             {
75
                 if ( ioctl( Sock, SIOCGIFDSTADDR, &IfReq ) < 0 )
76
                     my_log(LOG_ERR, errno, "ioctl SIOCGIFDSTADDR for %s", IfReq.ifr_name);
77
-                addr = s_addr_from_sockaddr(&IfReq.ifr_dstaddr);
78
+                addr = ((struct sockaddr_in *)&IfReq.ifr_dstaddr)->sin_addr.s_addr;
79
                 subnet = addr & mask;
80
             }
81
 
82
-- 
83
2.15.1
84
(-)files/0002-Revert-Include-config.h-before-any-other-files-to-ma.patch (-32 lines)
Removed Link Here
1
This reverts commit 7fcb7900b757b64cf58e6b2d1d473de289945e8d.
2
---
3
 src/igmpproxy.h | 6 +++---
4
 1 file changed, 3 insertions(+), 3 deletions(-)
5
6
diff --git a/src/igmpproxy.h b/src/igmpproxy.h
7
index ad1063b..6980e35 100644
8
--- a/src/igmpproxy.h
9
+++ b/src/igmpproxy.h
10
@@ -35,9 +35,6 @@
11
 *   igmpproxy.h - Header file for common includes.
12
 */
13
 
14
-#include "config.h"
15
-#include "os.h"
16
-
17
 #include <errno.h>
18
 #include <stdarg.h>
19
 #include <stdio.h>
20
@@ -60,6 +57,9 @@
21
 #include <netinet/in.h>
22
 #include <arpa/inet.h>
23
 
24
+#include "os.h"
25
+#include "config.h"
26
+
27
 /*
28
  * Limit on length of route data
29
  */
30
-- 
31
2.15.1
32
(-)files/patch-src_igmpproxy.h (+22 lines)
Added Link Here
1
--- src/igmpproxy.h.orig	2018-02-13 19:17:30 UTC
2
+++ src/igmpproxy.h
3
@@ -35,9 +35,6 @@
4
 *   igmpproxy.h - Header file for common includes.
5
 */
6
 
7
-#include "config.h"
8
-#include "os.h"
9
-
10
 #include <errno.h>
11
 #include <stdarg.h>
12
 #include <stdio.h>
13
@@ -60,6 +57,9 @@
14
 #include <netinet/in.h>
15
 #include <arpa/inet.h>
16
 
17
+#include "os.h"
18
+#include "config.h"
19
+
20
 /*
21
  * Limit on length of route data
22
  */
(-)Makefile (-4 / +1 lines)
Lines 2-8 Link Here
2
# $FreeBSD$
2
# $FreeBSD$
3
3
4
PORTNAME=	igmpproxy
4
PORTNAME=	igmpproxy
5
PORTVERSION=	0.2
5
PORTVERSION=	0.2.1
6
PORTEPOCH=	1
6
PORTEPOCH=	1
7
CATEGORIES=	net
7
CATEGORIES=	net
8
8
Lines 19-27 Link Here
19
USES=		autoreconf
19
USES=		autoreconf
20
GNU_CONFIGURE=	yes
20
GNU_CONFIGURE=	yes
21
21
22
EXTRA_PATCHES+=	${FILESDIR}/0001-Revert-Try-to-fix-problems-with-strict-aliasing.patch:-p1
23
EXTRA_PATCHES+= ${FILESDIR}/0002-Revert-Include-config.h-before-any-other-files-to-ma.patch:-p1
24
25
post-install:
22
post-install:
26
	${INSTALL_DATA} ${WRKSRC}/igmpproxy.conf \
23
	${INSTALL_DATA} ${WRKSRC}/igmpproxy.conf \
27
	    ${STAGEDIR}${PREFIX}/etc/igmpproxy.conf.sample
24
	    ${STAGEDIR}${PREFIX}/etc/igmpproxy.conf.sample
(-)distinfo (-3 / +3 lines)
Lines 1-3 Link Here
1
TIMESTAMP = 1513975936
1
TIMESTAMP = 1520662869
2
SHA256 (pali-igmpproxy-0.2_GH0.tar.gz) = 48fdaaa698c2ebe1c674b9ba4f9cb1369453bc97295434b608c9d5dab18c9293
2
SHA256 (pali-igmpproxy-0.2.1_GH0.tar.gz) = 6faa1f42ba323f60a9eb4958550e25b2e7e9c645da32c52ba12db0c9bdfce1ba
3
SIZE (pali-igmpproxy-0.2_GH0.tar.gz) = 41732
3
SIZE (pali-igmpproxy-0.2.1_GH0.tar.gz) = 42201

Return to bug 226513