Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP3:GA
lio-utils
0026-iscsiMib.c-fixes-for-strict-aliasing.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0026-iscsiMib.c-fixes-for-strict-aliasing.patch of Package lio-utils
From da77229050bb604c916ffd567b58e0fed236748b Mon Sep 17 00:00:00 2001 From: Hannes Reinecke <hare@suse.de> Date: Thu, 17 Apr 2014 12:03:50 +0200 Subject: iscsiMib.c: fixes for strict aliasing gcc is becoming more and more picky about how valid C-code should look like, so fixup iscsiMib.c to eliminate the strict aliasing warnings. Signed-off-by: Hannes Reinecke <hare@suse.de> --- mib-modules/iscsiMib.c | 46 ++++++++++++++++++++-------------------------- 1 file changed, 20 insertions(+), 26 deletions(-) diff --git a/mib-modules/iscsiMib.c b/mib-modules/iscsiMib.c index e2e1ed4..5e5ba51 100644 --- a/mib-modules/iscsiMib.c +++ b/mib-modules/iscsiMib.c @@ -809,8 +809,7 @@ iscsiPortalAttributes_load(netsnmp_cache *cache, void *vmagic) while (line == fgets(line, sizeof(line), fp)) { memset(&tmp, 0, sizeof(tmp)); if (sscanf(line, ISCSI_PORTAL_ATTR_LINE, &tmp.iscsiInstIndex, - &tmp.iscsiPortalIndex, roles, addrType, - (u_int *)tmp.iscsiPortalAddr, proto, + &tmp.iscsiPortalIndex, roles, addrType, &addr, proto, &tmp.iscsiPortalMaxRecvDataSegLength, hdrDigest, dataDigest, rcvMarker) != 10) continue; @@ -819,8 +818,7 @@ iscsiPortalAttributes_load(netsnmp_cache *cache, void *vmagic) tmp.iscsiPortalRoles = NODE_ROLE_TARGET; if (!strcmp(addrType, "ipv4")) { tmp.iscsiPortalAddrType = INET_ADDR_TYPE_IPV4; - addr = htonl(*(uint32_t *)&tmp.iscsiPortalAddr); - *(uint32_t *)tmp.iscsiPortalAddr = addr; + *tmp.iscsiPortalAddr = htonl(addr); } if (!strcmp(proto, "TCP")) @@ -1733,42 +1731,41 @@ iscsiTargetAttributes_load(unsigned int clientreg, void *clientarg) //snmp_log(LOG_DEBUG, "snmpd: cannot open %s\n", PROC_TARGET_ATTR); return; } - + while (line == fgets(line, sizeof(line), fp)) { memset(&tmp, 0, sizeof(tmp)); if (sscanf(line, ISCSI_TARGET_ATTR_LINE, &tmp.iscsiInstIndex, &tmp.iscsiNodeIndex, &tmp.iscsiTgtLoginFailures, &tmp.iscsiTgtLastFailureTime, &failType, tmp.iscsiTgtLastIntrFailureName, addrType, - (u_int *)tmp.iscsiTgtLastIntrFailureAddr) != 8) + &addr) != 8) continue; memcpy(tmp.iscsiTgtLastFailureType, iscsiTgtLoginStats_oid, - sizeof(iscsiTgtLoginStats_oid)); - tmp.iscsiTgtLastFailureType[OID_LENGTH(iscsiTgtLoginStats_oid)] = - failType; + sizeof(iscsiTgtLoginStats_oid)); + tmp.iscsiTgtLastFailureType[OID_LENGTH(iscsiTgtLoginStats_oid)] = + failType; tmp.iscsiTgtLastFailureType_len = OID_LENGTH(iscsiTgtLoginStats_oid)+1; if (!strcmp(addrType, "ipv4")) { tmp.iscsiTgtLastIntrFailureAddrType = INET_ADDR_TYPE_IPV4; - addr = htonl(*(uint32_t *)tmp.iscsiTgtLastIntrFailureAddr); - *(uint32_t *)tmp.iscsiTgtLastIntrFailureAddr = addr; + *tmp.iscsiTgtLastIntrFailureAddr = htonl(addr); } /* Send a trap on failures */ - if ((tmp.iscsiInstIndex <= ISCSI_NUM_INSTANCES) && + if ((tmp.iscsiInstIndex <= ISCSI_NUM_INSTANCES) && (tmp.iscsiNodeIndex <= ISCSI_NUM_NODES) && - (tmp.iscsiTgtLoginFailures > - numFailures[tmp.iscsiInstIndex][tmp.iscsiNodeIndex])) { + (tmp.iscsiTgtLoginFailures > + numFailures[tmp.iscsiInstIndex][tmp.iscsiNodeIndex])) { if ((clientreg) && ((failType == ISCSI_LOGIN_FAIL_AUTHORIZE) || (failType == ISCSI_LOGIN_FAIL_AUTHENTICATE) || - (failType == ISCSI_LOGIN_FAIL_NEGOTIATE))) + (failType == ISCSI_LOGIN_FAIL_NEGOTIATE))) send_iscsiTgtLoginFailure_trap(&tmp); } /* Update the counter to the current value from the stack */ - if (numFailures[tmp.iscsiInstIndex][tmp.iscsiNodeIndex] != + if (numFailures[tmp.iscsiInstIndex][tmp.iscsiNodeIndex] != tmp.iscsiTgtLoginFailures) - numFailures[tmp.iscsiInstIndex][tmp.iscsiNodeIndex] = + numFailures[tmp.iscsiInstIndex][tmp.iscsiNodeIndex] = tmp.iscsiTgtLoginFailures; entry = SNMP_MALLOC_TYPEDEF(struct iscsiTargetAttributes_entry); @@ -3572,7 +3569,7 @@ iscsiCxnAttributes_load(netsnmp_cache *cache, void *vmagic) char dataDgst[16]; char rcvMarker[4]; char sendMarker[4]; - uint32_t addr; + uint32_t local_addr, remote_addr; struct iscsiCxnAttributes_entry tmp, *entry; if (iscsiCxnAttributes_head) @@ -3582,14 +3579,14 @@ iscsiCxnAttributes_load(netsnmp_cache *cache, void *vmagic) //snmp_log(LOG_DEBUG, "snmpd: cannot open %s\n", PROC_CXN_ATTR); return -1; } - + while (line == fgets(line, sizeof(line), fp)) { memset(&tmp, 0, sizeof(tmp)); if (sscanf(line, ISCSI_CXN_ATTR_LINE, &tmp.iscsiInstIndex, &tmp.iscsiSsnNodeIndex, &tmp.iscsiSsnIndex, &tmp.iscsiCxnIndex, &tmp.iscsiCxnCid, cxnState, addrType, - (u_int *)tmp.iscsiCxnLocalAddr, proto, - &tmp.iscsiCxnLocalPort, (u_int *)tmp.iscsiCxnRemoteAddr, + &local_addr, proto, + &tmp.iscsiCxnLocalPort, &remote_addr, &tmp.iscsiCxnRemotePort, &tmp.iscsiCxnMaxRecvDataSegLength, &tmp.iscsiCxnMaxXmitDataSegLength, hdrDgst, dataDgst, rcvMarker, sendMarker, &tmp.iscsiCxnVersionActive) != 19) @@ -3605,11 +3602,8 @@ iscsiCxnAttributes_load(netsnmp_cache *cache, void *vmagic) if (!strcmp(addrType, "ipv4")) { tmp.iscsiCxnAddrType = INET_ADDR_TYPE_IPV4; - addr = htonl(*(uint32_t *)tmp.iscsiCxnLocalAddr); - *(uint32_t *)tmp.iscsiCxnLocalAddr = addr; - - addr = htonl(*(uint32_t *)tmp.iscsiCxnRemoteAddr); - *(uint32_t *)tmp.iscsiCxnRemoteAddr = addr; + *tmp.iscsiCxnLocalAddr = htonl(local_addr); + *tmp.iscsiCxnRemoteAddr = htonl(remote_addr); } if (!strcmp(proto, "TCP")) -- 1.8.1.4
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor