Projects
Mega:23.03
dhcp
_service:tar_scm:backport-0004-Support-unicast-...
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:tar_scm:backport-0004-Support-unicast-BOOTP-for-IBM-pSeries-systems-and-ma.patch of Package dhcp
Reference: https://src.fedoraproject.org/rpms/dhcp/blob/rawhide/f/0004-Support-unicast-BOOTP-for-IBM-pSeries-systems-and-ma.patch From 0a640394cb6f4a97fb87e53f049fba23523035c8 Mon Sep 17 00:00:00 2001 From: Pavel Zhukov <pzhukov@redhat.com> Date: Thu, 21 Feb 2019 10:22:41 +0100 Subject: [PATCH 04/28] Support unicast BOOTP for IBM pSeries systems (and maybe others) --- server/bootp.c | 12 +++++++++++- server/dhcp.c | 33 ++++++++++++++++++++++++++------- 2 files changed, 37 insertions(+), 8 deletions(-) diff --git a/server/bootp.c b/server/bootp.c index 919d483..338aac0 100644 --- a/server/bootp.c +++ b/server/bootp.c @@ -52,6 +52,7 @@ void bootp (packet) char msgbuf [1024]; int ignorep; int peer_has_leases = 0; + int norelay = 0; if (packet -> raw -> op != BOOTREQUEST) return; @@ -67,7 +68,7 @@ void bootp (packet) ? inet_ntoa (packet -> raw -> giaddr) : packet -> interface -> name); - if (!locate_network (packet)) { + if ((norelay = locate_network (packet)) == 0) { log_info ("%s: network unknown", msgbuf); return; } @@ -428,6 +429,15 @@ void bootp (packet) goto out; } + } else if (norelay == 2) { + to.sin_addr = raw.ciaddr; + to.sin_port = remote_port; + if (fallback_interface) { + result = send_packet (fallback_interface, NULL, &raw, + outgoing.packet_length, from, + &to, &hto); + goto out; + } /* If it comes from a client that already knows its address and is not requesting a broadcast response, and we can diff --git a/server/dhcp.c b/server/dhcp.c index 0b261c2..ae805a6 100644 --- a/server/dhcp.c +++ b/server/dhcp.c @@ -5332,6 +5332,7 @@ int locate_network (packet) struct data_string data; struct subnet *subnet = (struct subnet *)0; struct option_cache *oc; + int norelay = 0; #if defined(DHCPv6) && defined(DHCP4o6) if (dhcpv4_over_dhcpv6 && (packet->dhcp4o6_response != NULL)) { @@ -5353,12 +5354,24 @@ int locate_network (packet) from the interface, if there is one. If not, fail. */ if (!oc && !packet -> raw -> giaddr.s_addr) { if (packet -> interface -> shared_network) { - shared_network_reference - (&packet -> shared_network, - packet -> interface -> shared_network, MDL); - return 1; + struct in_addr any_addr; + any_addr.s_addr = INADDR_ANY; + + if (!packet -> packet_type && memcmp(&packet -> raw -> ciaddr, &any_addr, 4)) { + struct iaddr cip; + memcpy(cip.iabuf, &packet -> raw -> ciaddr, 4); + cip.len = 4; + if (!find_grouped_subnet(&subnet, packet->interface->shared_network, cip, MDL)) + norelay = 2; + } + + if (!norelay) { + shared_network_reference(&packet -> shared_network, packet -> interface -> shared_network, MDL); + return 1; + } + } else { + return 0; } - return 0; } /* If there's an option indicating link connection, and it's valid, @@ -5384,7 +5397,10 @@ int locate_network (packet) data_string_forget (&data, MDL); } else { ia.len = 4; - memcpy (ia.iabuf, &packet -> raw -> giaddr, 4); + if (norelay) + memcpy (ia.iabuf, &packet->raw->ciaddr, 4); + else + memcpy (ia.iabuf, &packet->raw->giaddr, 4); } /* If we know the subnet on which the IP address lives, use it. */ @@ -5392,7 +5408,10 @@ int locate_network (packet) shared_network_reference (&packet -> shared_network, subnet -> shared_network, MDL); subnet_dereference (&subnet, MDL); - return 1; + if (norelay) + return norelay; + else + return 1; } /* Otherwise, fail. */ -- 2.35.1
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2