]> git.pld-linux.org Git - packages/dhcp.git/blob - dhcp-unicast-bootp.patch
- introduced -client-dirs subpackage that provides:
[packages/dhcp.git] / dhcp-unicast-bootp.patch
1 --- dhcp-3.0.5/server/bootp.c.unicast   2005-05-18 15:54:17.000000000 -0400
2 +++ dhcp-3.0.5/server/bootp.c   2007-03-30 16:16:00.000000000 -0400
3 @@ -62,6 +62,7 @@
4         char msgbuf [1024];
5         int ignorep;
6         int peer_has_leases = 0;
7 +       int norelay = 0;
8  
9         if (packet -> raw -> op != BOOTREQUEST)
10                 return;
11 @@ -77,7 +78,7 @@
12                  ? inet_ntoa (packet -> raw -> giaddr)
13                  : packet -> interface -> name);
14  
15 -       if (!locate_network (packet)) {
16 +       if ((norelay = locate_network (packet)) == 0) {
17                 log_info ("%s: network unknown", msgbuf);
18                 return;
19         }
20 @@ -357,6 +358,13 @@
21                                               from, &to, &hto);
22                         goto out;
23                 }
24 +       } else if (norelay == 2) {
25 +               to.sin_addr = raw.ciaddr;
26 +               to.sin_port = remote_port;
27 +               if (fallback_interface) {
28 +                       result = send_packet (fallback_interface, (struct packet *)0, &raw, outgoing.packet_length, from, &to, &hto);
29 +                       goto out;
30 +               }
31  
32         /* If it comes from a client that already knows its address
33            and is not requesting a broadcast response, and we can
34 --- dhcp-3.0.5/server/dhcp.c.unicast    2007-03-30 16:13:36.000000000 -0400
35 +++ dhcp-3.0.5/server/dhcp.c    2007-03-30 16:19:35.000000000 -0400
36 @@ -3817,6 +3817,7 @@
37         struct data_string data;
38         struct subnet *subnet = (struct subnet *)0;
39         struct option_cache *oc;
40 +       int norelay = 0;
41  
42         /* See if there's a subnet selection option. */
43         oc = lookup_option (&dhcp_universe, packet -> options,
44 @@ -3826,12 +3827,24 @@
45            from the interface, if there is one.   If not, fail. */
46         if (!oc && !packet -> raw -> giaddr.s_addr) {
47                 if (packet -> interface -> shared_network) {
48 -                       shared_network_reference
49 -                               (&packet -> shared_network,
50 -                                packet -> interface -> shared_network, MDL);
51 -                       return 1;
52 +                       struct in_addr any_addr;
53 +                       any_addr.s_addr = INADDR_ANY;
54 +
55 +                       if (!packet -> packet_type && memcmp(&packet -> raw -> ciaddr, &any_addr, 4)) {
56 +                               struct iaddr cip;
57 +                               memcpy(cip.iabuf, &packet -> raw -> ciaddr, 4);
58 +                               cip.len = 4;
59 +                               if (!find_grouped_subnet(&subnet, packet->interface->shared_network, cip, MDL))
60 +                                       norelay = 2;
61 +                       }
62 +
63 +                       if (!norelay) {
64 +                               shared_network_reference(&packet -> shared_network, packet -> interface -> shared_network, MDL);
65 +                               return 1;
66 +                       }
67 +               } else {
68 +                       return 0;
69                 }
70 -               return 0;
71         }
72  
73         /* If there's an SSO, and it's valid, use it to figure out the
74 @@ -3853,7 +3866,10 @@
75                 data_string_forget (&data, MDL);
76         } else {
77                 ia.len = 4;
78 -               memcpy (ia.iabuf, &packet -> raw -> giaddr, 4);
79 +               if (norelay)
80 +                       memcpy (ia.iabuf, &packet->raw->ciaddr, 4);
81 +               else
82 +                       memcpy (ia.iabuf, &packet->raw->giaddr, 4);
83         }
84  
85         /* If we know the subnet on which the IP address lives, use it. */
86 @@ -3861,7 +3877,10 @@
87                 shared_network_reference (&packet -> shared_network,
88                                           subnet -> shared_network, MDL);
89                 subnet_dereference (&subnet, MDL);
90 -               return 1;
91 +               if (norelay)
92 +                       return norelay;
93 +               else
94 +                       return 1;
95         }
96  
97         /* Otherwise, fail. */
This page took 0.029997 seconds and 3 git commands to generate.