From 8257add51ea24df688d9cf2d053bd008211a0cf2 Mon Sep 17 00:00:00 2001 From: Ing-Dom Date: Mon, 20 Jan 2025 19:21:40 +0100 Subject: [PATCH] fix searchResponseExtended DHCP, prints, length --- src/knx/ip_data_link_layer.cpp | 6 +++--- src/knx/knx_ip_search_response_extended.cpp | 16 ++++++++-------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/knx/ip_data_link_layer.cpp b/src/knx/ip_data_link_layer.cpp index cdbce9e..d48ed72 100644 --- a/src/knx/ip_data_link_layer.cpp +++ b/src/knx/ip_data_link_layer.cpp @@ -460,7 +460,7 @@ void IpDataLinkLayer::loopHandleSearchRequestExtended(uint8_t* buffer, uint16_t if(searchRequest.srpRequestDIBs) { - println("srpRequestDIBs"); + //println("srpRequestDIBs"); if(searchRequest.requestedDIB(IP_CONFIG)) dibLength += LEN_IP_CONFIG_DIB; //16 @@ -510,9 +510,9 @@ void IpDataLinkLayer::loopHandleSearchRequestExtended(uint8_t* buffer, uint16_t searchResponse.setTunnelingInfo(_ipParameters, _deviceObject, tunnels); } - if(searchResponse.totalLength() > 150) + if(searchResponse.totalLength() > 500) { - println("skipped response cause length is not plausible"); + printf("skipped response length > 500. Length: %d bytes\n", searchResponse.totalLength()); return; } diff --git a/src/knx/knx_ip_search_response_extended.cpp b/src/knx/knx_ip_search_response_extended.cpp index eae2182..8722910 100644 --- a/src/knx/knx_ip_search_response_extended.cpp +++ b/src/knx/knx_ip_search_response_extended.cpp @@ -34,7 +34,7 @@ KnxIpSearchResponseExtended::KnxIpSearchResponseExtended(IpParameterObject& para void KnxIpSearchResponseExtended::setDeviceInfo(IpParameterObject& parameters, DeviceObject& deviceObject) { - println("setDeviceInfo"); + //setDeviceInfo"); KnxIpDeviceInformationDIB _deviceInfo(_data + currentPos); _deviceInfo.length(LEN_DEVICE_INFORMATION_DIB); _deviceInfo.code(DEVICE_INFO); @@ -65,7 +65,7 @@ void KnxIpSearchResponseExtended::setDeviceInfo(IpParameterObject& parameters, D void KnxIpSearchResponseExtended::setSupportedServices() { - println("setSupportedServices"); + //println("setSupportedServices"); KnxIpSupportedServiceDIB _supportedServices(_data + currentPos); _supportedServices.length(LEN_SERVICE_DIB); _supportedServices.code(SUPP_SVC_FAMILIES); @@ -82,7 +82,7 @@ void KnxIpSearchResponseExtended::setSupportedServices() void KnxIpSearchResponseExtended::setIpConfig(IpParameterObject& parameters) { - println("setIpConfig"); + //println("setIpConfig"); KnxIpConfigDIB _ipConfig(_data + currentPos); _ipConfig.length(LEN_IP_CONFIG_DIB); _ipConfig.code(IP_CONFIG); @@ -97,14 +97,14 @@ void KnxIpSearchResponseExtended::setIpConfig(IpParameterObject& parameters) void KnxIpSearchResponseExtended::setIpCurrentConfig(IpParameterObject& parameters) { - println("setIpCurrentConfig"); + //println("setIpCurrentConfig"); KnxIpConfigDIB _ipCurConfig(_data + currentPos, true); _ipCurConfig.length(LEN_IP_CURRENT_CONFIG_DIB); _ipCurConfig.code(IP_CUR_CONFIG); _ipCurConfig.address(parameters.propertyValue(PID_CURRENT_IP_ADDRESS)); _ipCurConfig.subnet(parameters.propertyValue(PID_CURRENT_SUBNET_MASK)); _ipCurConfig.gateway(parameters.propertyValue(PID_CURRENT_DEFAULT_GATEWAY)); - _ipCurConfig.dhcp(parameters.propertyValue(PID_DHCP_BOOTP_SERVER)); + _ipCurConfig.dhcp(0); _ipCurConfig.info1(parameters.propertyValue(PID_CURRENT_IP_ASSIGNMENT_METHOD)); _ipCurConfig.info2(0x00); //Reserved @@ -113,7 +113,7 @@ void KnxIpSearchResponseExtended::setIpCurrentConfig(IpParameterObject& paramete void KnxIpSearchResponseExtended::setKnxAddresses(IpParameterObject& parameters, DeviceObject& deviceObject) { - println("setKnxAddresses"); + //println("setKnxAddresses"); KnxIpKnxAddressesDIB _knxAddresses(_data + currentPos); _knxAddresses.length(4); //minimum _knxAddresses.code(KNX_ADDRESSES); @@ -136,7 +136,7 @@ void KnxIpSearchResponseExtended::setKnxAddresses(IpParameterObject& parameters, void KnxIpSearchResponseExtended::setTunnelingInfo(IpParameterObject& parameters, DeviceObject& deviceObject, KnxIpTunnelConnection tunnels[]) { - println("setTunnelingInfo"); + //println("setTunnelingInfo"); KnxIpTunnelingInfoDIB _tunnelInfo(_data + currentPos); _tunnelInfo.length(4); //minlength _tunnelInfo.code(TUNNELING_INFO); @@ -196,7 +196,7 @@ void KnxIpSearchResponseExtended::setTunnelingInfo(IpParameterObject& parameters void KnxIpSearchResponseExtended::setExtendedDeviceInfo() { - println("setExtendedDeviceInfo"); + //println("setExtendedDeviceInfo"); KnxIpExtendedDeviceInformationDIB _extended(_data + currentPos); _extended.length(LEN_EXTENDED_DEVICE_INFORMATION_DIB); _extended.code(EXTENDED_DEVICE_INFO);