]> git.pld-linux.org Git - packages/dhcp.git/blame - dhcp-unicast-bootp.patch
- updated to 4.4.3-P1
[packages/dhcp.git] / dhcp-unicast-bootp.patch
CommitLineData
15c1a831
MK
1From 0a640394cb6f4a97fb87e53f049fba23523035c8 Mon Sep 17 00:00:00 2001
2From: Pavel Zhukov <pzhukov@redhat.com>
3Date: Thu, 21 Feb 2019 10:22:41 +0100
4Subject: [PATCH 04/28] Support unicast BOOTP for IBM pSeries systems (and
5 maybe others)
6
7---
8 server/bootp.c | 12 +++++++++++-
9 server/dhcp.c | 33 ++++++++++++++++++++++++++-------
10 2 files changed, 37 insertions(+), 8 deletions(-)
11
12diff --git a/server/bootp.c b/server/bootp.c
13index 919d483..338aac0 100644
14--- a/server/bootp.c
15+++ b/server/bootp.c
19507c9d 16@@ -52,6 +52,7 @@ void bootp (packet)
8c878a4c
ER
17 char msgbuf [1024];
18 int ignorep;
19 int peer_has_leases = 0;
20+ int norelay = 0;
21
22 if (packet -> raw -> op != BOOTREQUEST)
23 return;
19507c9d 24@@ -67,7 +68,7 @@ void bootp (packet)
8c878a4c
ER
25 ? inet_ntoa (packet -> raw -> giaddr)
26 : packet -> interface -> name);
27
28- if (!locate_network (packet)) {
29+ if ((norelay = locate_network (packet)) == 0) {
30 log_info ("%s: network unknown", msgbuf);
31 return;
32 }
19507c9d
AM
33@@ -428,6 +429,15 @@ void bootp (packet)
34
8c878a4c
ER
35 goto out;
36 }
37+ } else if (norelay == 2) {
38+ to.sin_addr = raw.ciaddr;
39+ to.sin_port = remote_port;
40+ if (fallback_interface) {
19507c9d
AM
41+ result = send_packet (fallback_interface, NULL, &raw,
42+ outgoing.packet_length, from,
43+ &to, &hto);
8c878a4c
ER
44+ goto out;
45+ }
46
47 /* If it comes from a client that already knows its address
48 and is not requesting a broadcast response, and we can
15c1a831
MK
49diff --git a/server/dhcp.c b/server/dhcp.c
50index 0b261c2..ae805a6 100644
51--- a/server/dhcp.c
52+++ b/server/dhcp.c
53@@ -5332,6 +5332,7 @@ int locate_network (packet)
8c878a4c
ER
54 struct data_string data;
55 struct subnet *subnet = (struct subnet *)0;
56 struct option_cache *oc;
57+ int norelay = 0;
58
19507c9d
AM
59 #if defined(DHCPv6) && defined(DHCP4o6)
60 if (dhcpv4_over_dhcpv6 && (packet->dhcp4o6_response != NULL)) {
15c1a831 61@@ -5353,12 +5354,24 @@ int locate_network (packet)
8c878a4c
ER
62 from the interface, if there is one. If not, fail. */
63 if (!oc && !packet -> raw -> giaddr.s_addr) {
64 if (packet -> interface -> shared_network) {
65- shared_network_reference
66- (&packet -> shared_network,
67- packet -> interface -> shared_network, MDL);
68- return 1;
69+ struct in_addr any_addr;
70+ any_addr.s_addr = INADDR_ANY;
71+
72+ if (!packet -> packet_type && memcmp(&packet -> raw -> ciaddr, &any_addr, 4)) {
73+ struct iaddr cip;
74+ memcpy(cip.iabuf, &packet -> raw -> ciaddr, 4);
75+ cip.len = 4;
76+ if (!find_grouped_subnet(&subnet, packet->interface->shared_network, cip, MDL))
77+ norelay = 2;
78+ }
79+
80+ if (!norelay) {
81+ shared_network_reference(&packet -> shared_network, packet -> interface -> shared_network, MDL);
82+ return 1;
83+ }
84+ } else {
85+ return 0;
86 }
87- return 0;
88 }
89
19507c9d 90 /* If there's an option indicating link connection, and it's valid,
15c1a831 91@@ -5384,7 +5397,10 @@ int locate_network (packet)
8c878a4c
ER
92 data_string_forget (&data, MDL);
93 } else {
94 ia.len = 4;
95- memcpy (ia.iabuf, &packet -> raw -> giaddr, 4);
96+ if (norelay)
97+ memcpy (ia.iabuf, &packet->raw->ciaddr, 4);
98+ else
99+ memcpy (ia.iabuf, &packet->raw->giaddr, 4);
100 }
101
102 /* If we know the subnet on which the IP address lives, use it. */
15c1a831 103@@ -5392,7 +5408,10 @@ int locate_network (packet)
8c878a4c
ER
104 shared_network_reference (&packet -> shared_network,
105 subnet -> shared_network, MDL);
106 subnet_dereference (&subnet, MDL);
107- return 1;
108+ if (norelay)
109+ return norelay;
110+ else
111+ return 1;
112 }
113
114 /* Otherwise, fail. */
15c1a831
MK
115--
1162.35.1
117
This page took 0.152112 seconds and 4 git commands to generate.