iscsid: don't round up when modifying padding len

Bug found from Wyllys Ingersoll:

in iscsi_copy_operational_params, the conn->max_recv_dlength is set to
_padding (conn_conf->MaxRecvDataSegmentLength);

initiator_common.c:153 ::  conn->max_recv_dlength =
__padding(conn_conf->MaxRecvDataSegmentLength);

This (_padding) rounds up the value. If the configured
MaxRecvDataSegmentLength is set to the actual maximum (2^24 -1 :
16777215), the _padding function changes it to 16777216, causing the
comparison to fail since it is above the maximum and it resets the
value to the default minimum (262144).  This is probably not the
intended result.

The actual maximum is really 16777212 since 16777212 & 0x03 == 0,
which will cause it to pass thru the _padding function with no change.

The _padding issue probably affects other parameters as well, thats
the one where I first noticed the problem.
Fix build warnings for unused variables

Signed-off-by: Andy Grover <agrover@redhat.com>
Fix warning about possibly-uninitialized variable

Signed-off-by: Andy Grover <agrover@redhat.com>
Fix bad sizeof in memset

Signed-off-by: Andy Grover <agrover@redhat.com>
Fix missing header

Signed-off-by: Andy Grover <agrover@redhat.com>
iscsiuio: Fix warning about non-matching types

Signed-off-by: Andy Grover <agrover@redhat.com>
iscsiuio: Fix strict-aliasing warning with struct mac_address

Resolve strict aliasing issues by defining a union inside struct
mac_address. This lets dhcpv6 code directly get at the last 4 bytes of the
mac address to use for a transaction id.

Natural alignment would leave a gap between the struct members. Use
attribute (packed) to avoid this and keep the overall struct 6 bytes.

Signed-off-by: Andy Grover <agrover@redhat.com>
iscsiuio: Resolve strict aliasing issue in iscsiuio/src/unix/nic.c

Break up the expression and use a local variable.

Signed-off-by: Andy Grover <agrover@redhat.com>
iscsiuio: Fix aliasing issue with IPV6_IS_ADDR_UNSPECIFIED

There already is a union to reference the memory as an array of uints, so
just use it for IS_ADDR_UNSPECIFIED.

Also, all the other #defines aren't used anywhere so we can remove them.

Signed-off-by: Andy Grover <agrover@redhat.com>
iscsiuio: Use attribute(unused) for variables that are unused but needed

These variables need to exist even if they're not used. In order to prevent
gcc from issuing a warning about set but unused variables, annotate them
with __attribute__((__unused__)).

Signed-off-by: Andy Grover <agrover@redhat.com>
iscsiuio: Use attribute(unused) for *icmpv6_hdr

I think this variable serves a documentation and completeness purpose
even though it is not used in the function's computation. In order to
prevent gcc from issuing a warning about set but unused variables,
annotate it with __attribute__((__unused__)).

Signed-off-by: Andy Grover <agrover@redhat.com>
iscsiuio: Change nic_disable to return void

No callers are checking its retval, and it's not clear what they'd do if
it returned an error.

Instead, log any errors, some which should really never happen.

Signed-off-by: Andy Grover <agrover@redhat.com>
iscsiuio: Remove set but unused variables

Signed-off-by: Andy Grover <agrover@redhat.com>
iscsiuio: Check return value from nic_queue_tx_packet

and log an error if it fails.

Signed-off-by: Andy Grover <agrover@redhat.com>