@@ -788,6 +788,11 @@ compose_out_dhcpv6_opts(struct ofpbuf *userdata,
return false;
}
+ if (!iaid) {
+ /* If iaid is None, it means its an DHCPv6 information request.
+ * Don't put IA_NA option in the response. */
+ break;
+ }
/* IA Address option is used to specify IPv6 addresses associated
* with an IA_NA or IA_TA. The IA Address option must be
* encapsulated in the Options field of an IA_NA or IA_TA option.
@@ -896,7 +901,8 @@ pinctrl_handle_put_dhcpv6_opts(
}
uint8_t out_dhcpv6_msg_type;
- switch(*in_dhcpv6_data) {
+ uint8_t in_dhcpv6_msg_type = *in_dhcpv6_data;
+ switch (in_dhcpv6_msg_type) {
case DHCPV6_MSG_TYPE_SOLICIT:
out_dhcpv6_msg_type = DHCPV6_MSG_TYPE_ADVT;
break;
@@ -904,6 +910,7 @@ pinctrl_handle_put_dhcpv6_opts(
case DHCPV6_MSG_TYPE_REQUEST:
case DHCPV6_MSG_TYPE_CONFIRM:
case DHCPV6_MSG_TYPE_DECLINE:
+ case DHCPV6_MSG_TYPE_INFO_REQ:
out_dhcpv6_msg_type = DHCPV6_MSG_TYPE_REPLY;
break;
@@ -916,7 +923,10 @@ pinctrl_handle_put_dhcpv6_opts(
in_dhcpv6_data += 4;
/* We need to extract IAID from the IA-NA option of the client's DHCPv6
* solicit/request/confirm packet and copy the same IAID in the Server's
- * response. */
+ * response.
+ * DHCPv6 information packet (for stateless request will not have IA-NA
+ * option. So we don't need to copy that in the Server's response.
+ * */
ovs_be32 iaid = 0;
struct dhcpv6_opt_header const *in_opt_client_id = NULL;
size_t udp_len = ntohs(in_udp->udp_len);
@@ -950,7 +960,7 @@ pinctrl_handle_put_dhcpv6_opts(
goto exit;
}
- if (!iaid) {
+ if (!iaid && in_dhcpv6_msg_type != DHCPV6_MSG_TYPE_INFO_REQ) {
VLOG_WARN_RL(&rl, "DHCPv6 option - IA NA not present in the "
" DHCPv6 packet");
goto exit;
@@ -151,6 +151,7 @@ struct dhcp_opt6_header {
#define DHCPV6_MSG_TYPE_CONFIRM 4
#define DHCPV6_MSG_TYPE_REPLY 7
#define DHCPV6_MSG_TYPE_DECLINE 9
+#define DHCPV6_MSG_TYPE_INFO_REQ 11
/* DHCPv6 Option codes */
@@ -4615,15 +4615,23 @@ trim_zeros() {
# from the "ovs-ofctl monitor br-int resume"
test_dhcpv6() {
local inport=$1 src_mac=$2 src_lla=$3 msg_code=$4 offer_ip=$5
- local request=ffffffffffff${src_mac}86dd00000000002a1101${src_lla}
+ if test $msg_code != 0b; then
+ req_len=2a
+ else
+ req_len=1a
+ fi
+ local request=ffffffffffff${src_mac}86dd0000000000${req_len}1101${src_lla}
# dst ip ff02::1:2
request=${request}ff020000000000000000000000010002
# udp header and dhcpv6 header
- request=${request}02220223002affff${msg_code}010203
+ request=${request}0222022300${req_len}ffff${msg_code}010203
# Client identifier
request=${request}0001000a00030001${src_mac}
- # IA-NA (Identity Association for Non Temporary Address)
- request=${request}0003000c0102030400000e1000001518
+ # Add IA-NA (Identity Association for Non Temporary Address) if msg_code
+ # is not 11 (information request packet)
+ if test $msg_code != 0b; then
+ request=${request}0003000c0102030400000e1000001518
+ fi
shift; shift; shift; shift; shift;
if test $offer_ip != 0; then
local server_mac=000000100001
@@ -4754,7 +4762,7 @@ cat 4.expected > expout
AT_CHECK([cat 4.packets], [0], [expout])
# Send DHCPv6 packet on ls1-lp3. native DHCPv6 works as stateless mode for this port.
-# The DHCPv6 reply should doesn't contian offer_ip.
+# The DHCPv6 reply shouldn't contain offer_ip.
src_mac=f00000000022
src_lla=fe80000000000000f20000fffe000022
reset_pcap_file hv1-vif5 hv1/vif5
@@ -4768,6 +4776,23 @@ $PYTHON "$top_srcdir/utilities/ovs-pcap.in" hv1/vif5-tx.pcap | trim_zeros > 5.pa
cat 5.expected | cut -c 1-120,125- > expout
AT_CHECK([cat 5.packets | cut -c 1-120,125- ], [0], [expout])
+# Send DHCPv6 information request (code 11) on ls1-lp3. The DHCPv6 reply
+# shouldn't contain offer_ip
+src_mac=f00000000022
+src_lla=fe80000000000000f20000fffe000022
+reset_pcap_file hv1-vif5 hv1/vif5
+rm -f 5.expected
+test_dhcpv6 5 $src_mac $src_lla 0b 1 5
+
+# NXT_RESUMEs should be 4.
+OVS_WAIT_UNTIL([test 4 = `cat ofctl_monitor*.log | grep -c NXT_RESUME`])
+
+$PYTHON "$top_srcdir/utilities/ovs-pcap.in" hv1/vif5-tx.pcap |
+trim_zeros > 5.packets
+# Skipping the UDP checksum
+cat 5.expected | cut -c 1-120,125- > expout
+AT_CHECK([cat 5.packets | cut -c 1-120,125- ], [0], [expout])
+
as hv1
OVS_APP_EXIT_AND_WAIT([ovn-controller])
OVS_APP_EXIT_AND_WAIT([ovs-vswitchd])