[asterisk-commits] kpfleming: branch kpfleming/aligner2 r128766 - /team/kpfleming/aligner2/chann...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Jul 7 16:26:06 CDT 2008
Author: kpfleming
Date: Mon Jul 7 16:26:05 2008
New Revision: 128766
URL: http://svn.digium.com/view/asterisk?view=rev&rev=128766
Log:
fix for part of issue 11485 here too; it was already fixed in trunk, but not in 1.4
Modified:
team/kpfleming/aligner2/channels/chan_sip.c
Modified: team/kpfleming/aligner2/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/kpfleming/aligner2/channels/chan_sip.c?view=diff&rev=128766&r1=128765&r2=128766
==============================================================================
--- team/kpfleming/aligner2/channels/chan_sip.c (original)
+++ team/kpfleming/aligner2/channels/chan_sip.c Mon Jul 7 16:26:05 2008
@@ -2656,11 +2656,19 @@
/*! \brief Support routine for find_peer */
static int sip_addrcmp(char *name, struct sockaddr_in *sin)
{
- /* We know name is the first field, so we can cast */
- struct sip_peer *p = (struct sip_peer *) name;
- return !(!inaddrcmp(&p->addr, sin) ||
- (ast_test_flag(&p->flags[0], SIP_INSECURE_PORT) &&
- (p->addr.sin_addr.s_addr == sin->sin_addr.s_addr)));
+ /* Force the cast from 'char *' to 'struct sip_peer *',
+ since we know the alignment of the pointer we received
+ is proper for a 'struct sip_peer *' (since that is what
+ it really is).
+ */
+ union {
+ char *name;
+ struct sip_peer *p;
+ } hack = { .name = name };
+
+ return !(!inaddrcmp(&hack.p->addr, sin) ||
+ (ast_test_flag(&hack.p->flags[0], SIP_INSECURE_PORT) &&
+ (hack.p->addr.sin_addr.s_addr == sin->sin_addr.s_addr)));
}
/*! \brief Locate peer by name or ip address
More information about the asterisk-commits
mailing list