% DHCP4_DHCP4O6_BAD_PACKET received malformed DHCPv4o6 packet: %1
A malformed DHCPv4o6 packet was received.
-% DHCP4_DHCP4O6_PACKET_SEND %1: trying to send packet %2 (type %3) to %4 on interface %5 encapsulating %6: %7 (type %8)
+% DHCP4_DHCP4O6_PACKET_SEND %1: trying to send packet %2 (type %3) to %4 port %5 on interface %6 encapsulating %7: %8 (type %9)
The arguments specify the client identification information (HW address
and client identifier), DHCPv6 message name and type, source IPv6
-address and interface name, DHCPv4 client identification, message
-name and type.
+address and port, and interface name, DHCPv4 client identification,
+message name and type.
% DHCP4_DHCP4O6_PACKET_SEND_FAIL %1: failed to send DHCPv4o6 packet: %2
This error is output if the IPv4 DHCP server fails to send an
The argument includes the client and the transaction identification
information.
-% DHCP6_DHCP4O6_PACKET_RECEIVED received DHCPv4o6 packet from DHCPv6 server (type %1) for %2 on interface %3
+% DHCP6_DHCP4O6_PACKET_RECEIVED received DHCPv4o6 packet from DHCPv6 server (type %1) for %2 port %3 on interface %4
This debug message is printed when the server is receiving a DHCPv4o6
from the DHCPv6 server over inter-process communication.
if (!query6->relay_info_.empty()) {
resp6->copyRelayInfo(query6);
}
- // Copy interface and remote address
+ // Copy interface, and remote address and port
resp6->setIface(query6->getIface());
resp6->setIndex(query6->getIndex());
resp6->setRemoteAddr(query6->getRemoteAddr());
+ resp6->setRemotePort(query6->getRemotePort());
resp_.reset(new Pkt4o6(resp_, resp6));
}
LOG_DEBUG(packet4_logger, DBG_DHCP4_BASIC, DHCP6_DHCP4O6_PACKET_RECEIVED)
.arg(static_cast<int>(pkt->getType()))
.arg(pkt->getRemoteAddr().toText())
+ .arg(pkt->getRemotePort())
.arg(pkt->getIface());
}
} catch (const std::exception& e) {
.arg(rsp6->getName())
.arg(static_cast<int>(rsp6->getType()))
.arg(rsp6->getRemoteAddr())
+ .arg(rsp6->getRemotePort())
.arg(rsp6->getIface())
.arg(rsp->getLabel())
.arg(rsp->getName())
address that is being declined. Specific information will be printed in a
separate message.
-% DHCP6_DHCP4O6_PACKET_RECEIVED received DHCPv4o6 packet from DHCPv4 server (type %1) for %2 on interface %3
+% DHCP6_DHCP4O6_PACKET_RECEIVED received DHCPv4o6 packet from DHCPv4 server (type %1) for %2 port %3 on interface %4
This debug message is printed when the server is receiving a DHCPv4o6
from the DHCPv4 server over inter-process communication.
LOG_DEBUG(packet6_logger, DBG_DHCP6_BASIC, DHCP6_DHCP4O6_PACKET_RECEIVED)
.arg(static_cast<int>(pkt->getType()))
.arg(pkt->getRemoteAddr().toText())
+ .arg(pkt->getRemotePort())
.arg(pkt->getIface());
}
} catch (const std::exception& e) {
// Should we check it is a DHCPV6_DHCPV4_RESPONSE?
+ // Handle relay port
+ uint16_t relay_port = Dhcpv6Srv::testRelaySourcePort(pkt);
+
// The received message has been unpacked by the receive() function. This
// method could have modified the message so it's better to pack() it
// again because we'll be forwarding it to a client.
// getType() always returns the type of internal message.
uint8_t msg_type = buf[0];
if ((msg_type == DHCPV6_RELAY_FORW) || (msg_type == DHCPV6_RELAY_REPL)) {
- uint16_t relay_port = Dhcpv6Srv::testRelaySourcePort(pkt);
pkt->setRemotePort(relay_port ? relay_port : DHCP6_SERVER_PORT);
} else {
pkt->setRemotePort(DHCP6_CLIENT_PORT);
}
// Get the option holding source port.
- OptionPtr sport = option_vendor->getOption(ISC_V6_4O6_SRC_PORT);
- if (!sport || (sport->len() - sport->getHeaderLen() != 2)) {
+ OptionUint16Ptr sport = boost::dynamic_pointer_cast<
+ OptionUint16>(option_vendor->getOption(ISC_V6_4O6_SRC_PORT));
+ if (!sport) {
LOG_WARN(dhcpsrv_logger, DHCPSRV_DHCP4O6_RECEIVED_BAD_PACKET)
.arg("no source port suboption");
isc_throw(Dhcp4o6IpcError,
"malformed packet (source port suboption missing "
- "or has incorrect length)");
+ "or has incorrect type)");
}
- const OptionBuffer& sport_buf = sport->getData();
- uint16_t sport_value = static_cast<uint16_t>(sport_buf[0]) << 8;
- sport_value |= static_cast<uint16_t>(sport_buf[1]);
// Update the packet.
pkt->setRemoteAddr(srcs->readAddress());
- pkt->setRemotePort(sport_value);
+ pkt->setRemotePort(sport->getValue());
pkt->setIface(iface->getName());
pkt->setIndex(iface->getIndex());