mirror of
				https://github.com/asterisk/asterisk.git
				synced 2025-11-03 20:38:59 +00:00 
			
		
		
		
	Simplify endianness and fix for unaligned reads (bug #3867)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5295 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
		
							
								
								
									
										5
									
								
								dns.c
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								dns.c
									
									
									
									
									
								
							@@ -19,12 +19,13 @@
 | 
			
		||||
#include <asterisk/logger.h>
 | 
			
		||||
#include <asterisk/channel.h>
 | 
			
		||||
#include <asterisk/dns.h>
 | 
			
		||||
#include <asterisk/endian.h>
 | 
			
		||||
 | 
			
		||||
#define MAX_SIZE 4096
 | 
			
		||||
 | 
			
		||||
typedef struct {
 | 
			
		||||
	unsigned	id :16;		/* query identification number */
 | 
			
		||||
#if BYTE_ORDER == BIG_ENDIAN
 | 
			
		||||
#if __BYTE_ORDER == __BIG_ENDIAN
 | 
			
		||||
			/* fields in third byte */
 | 
			
		||||
	unsigned	qr: 1;		/* response flag */
 | 
			
		||||
	unsigned	opcode: 4;	/* purpose of message */
 | 
			
		||||
@@ -38,7 +39,7 @@ typedef struct {
 | 
			
		||||
	unsigned	cd: 1;		/* checking disabled by resolver */
 | 
			
		||||
	unsigned	rcode :4;	/* response code */
 | 
			
		||||
#endif
 | 
			
		||||
#if BYTE_ORDER == LITTLE_ENDIAN || BYTE_ORDER == PDP_ENDIAN
 | 
			
		||||
#if __BYTE_ORDER == __LITTLE_ENDIAN || __BYTE_ORDER == __PDP_ENDIAN
 | 
			
		||||
			/* fields in third byte */
 | 
			
		||||
	unsigned	rd :1;		/* recursion desired */
 | 
			
		||||
	unsigned	tc :1;		/* truncated message */
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user