Ethereal-dev: [ethereal-dev] Mismatch in "port" integer size

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Gilbert Ramirez <gram@xxxxxxxxxx>
Date: Wed, 5 Jan 2000 13:46:17 -0600
I came across this error while compiling Ethereal on MSVC 6.0 (guess what I'm
working on :-):

packet-afs.c 
             M:/build/ethereal/src/packet-afs.c(759) : warning C4761: integral size mismatch in argument; conversion supplied 
             M:/build/ethereal/src/packet-afs.c(759) : warning C4761: integral size mismatch in argument; conversion supplied 
             M:/build/ethereal/src/packet-afs.c(763) : warning C4761: integral size mismatch in argument; conversion supplied 
             M:/build/ethereal/src/packet-afs.c(763) : warning C4761: integral size mismatch in argument; conversion supplied 

The type for srcport and dest packet_info is guint32.

packet.h:

typedef struct _packet_info {
  int     len;
  int     captured_len;
  address dl_src;		/* link-layer source address */
  address dl_dst;		/* link-layer destination address */
  address net_src;		/* network-layer source address */
  address net_dst;		/* network-layer destination address */
  address src;			/* source address (net if present, DL otherwise )*/
  address dst;			/* destination address (net if present, DL otherwise )*/
  guint32 ipproto;
  port_type ptype;		/* type of the following two port numbers */
  guint32 srcport;		/* source port */
  guint32 destport;		/* destination port */
  guint32 match_port;
  int     iplen;
  int     iphdrlen;
} packet_info;


But in conversation.h, guint16's are used for ports:

extern void conversation_init(void);
conversation_t *conversation_new(address *src, address *dst, port_type ptype,
    guint16 src_port, guint16 dst_port, void *data);
conversation_t *find_conversation(address *src, address *dst, port_type ptype,
    guint16 src_port, guint16 dst_port);


So, does packet_info use guint32 to support non-tcp/udp "ports"? If so, no code
uses it yet. I plan to convert IPX over to using the conversation code and all
that, but it's "ports" are also guint16.

I'm in favor of changing the packet_info struct to use guint16 for srcport,
destport, and match_port, if no one has a good reason as to why not.

--gilbert