@@ -4,11 +4,11 @@ Date: Thu, 25 Apr 2019 22:07:20 +0000
4
4
Subject: [PATCH] Customizable Option 82 circuit ID and remote ID fields
5
5
6
6
---
7
- relay/dhcrelay.c | 171 ++++++++++++++++++++++++++++++++++++++++ -------
8
- 1 file changed, 147 insertions(+), 24 deletions(-)
7
+ relay/dhcrelay.c | 178 +++++++++++++++++++++++++++++++++++++++- -------
8
+ 1 file changed, 150 insertions(+), 28 deletions(-)
9
9
10
10
diff --git a/relay/dhcrelay.c b/relay/dhcrelay.c
11
- index 0cb2ef6..418b943 100644
11
+ index 3b9c71b..19843f7 100644
12
12
--- a/relay/dhcrelay.c
13
13
+++ b/relay/dhcrelay.c
14
14
@@ -75,6 +75,8 @@ int bad_circuit_id = 0; /* Circuit ID option in matching RAI option
@@ -20,7 +20,7 @@ index 0cb2ef6..418b943 100644
20
20
int max_hop_count = 10; /* Maximum hop count */
21
21
22
22
int no_daemon = 0;
23
- @@ -151 ,10 +153 ,20 @@ static const char url[] =
23
+ @@ -160 ,10 +162 ,20 @@ static const char url[] =
24
24
25
25
char *progname;
26
26
@@ -42,7 +42,7 @@ index 0cb2ef6..418b943 100644
42
42
" [-A <length>] [-c <hops>]\n" \
43
43
" [-p <port> | -rp <relay-port>]\n" \
44
44
" [-pf <pid-file>] [--no-pid]\n"\
45
- @@ -171 ,11 +183 ,11 @@ char *progname;
45
+ @@ -180 ,11 +192 ,11 @@ char *progname;
46
46
" -l lower0 [ ... -l lowerN]\n" \
47
47
" -u upper0 [ ... -u upperN]\n" \
48
48
" lower (client link): [address%%]interface[#index]\n" \
@@ -56,7 +56,7 @@ index 0cb2ef6..418b943 100644
56
56
" [-A <length>] [-c <hops>] [-p <port>]\n" \
57
57
" [-pf <pid-file>] [--no-pid]\n"\
58
58
" [-m append|replace|forward|discard]\n" \
59
- @@ -190 ,13 +202 ,13 @@ char *progname;
59
+ @@ -199 ,13 +211 ,13 @@ char *progname;
60
60
" -l lower0 [ ... -l lowerN]\n" \
61
61
" -u upper0 [ ... -u upperN]\n" \
62
62
" lower (client link): [address%%]interface[#index]\n" \
@@ -72,10 +72,10 @@ index 0cb2ef6..418b943 100644
72
72
" [-p <port> | -rp <relay-port>]\n" \
73
73
" [-pf <pid-file>] [--no-pid]\n" \
74
74
" [-m append|replace|forward|discard]\n" \
75
- @@ -204 ,18 +216 ,18 @@ char *progname;
75
+ @@ -213 ,18 +225 ,18 @@ char *progname;
76
76
" [-iu interface0 [ ... -iu interfaceN]\n" \
77
77
" [-id interface0 [ ... -id interfaceN]\n" \
78
- " [-U interface]\n" \
78
+ " [-U interface] [-g <ip-address>] \n" \
79
79
- " server0 [ ... serverN]\n\n" \
80
80
+ " server0 [ ... serverN]\n\n" DHCRELAY_OPTION82_USAGE \
81
81
" %s {--version|--help|-h}"
@@ -88,13 +88,13 @@ index 0cb2ef6..418b943 100644
88
88
" [-i interface0 [ ... -i interfaceN]\n" \
89
89
" [-iu interface0 [ ... -iu interfaceN]\n" \
90
90
" [-id interface0 [ ... -id interfaceN]\n" \
91
- " [-U interface]\n" \
91
+ " [-U interface] [-g <ip-address>] \n" \
92
92
- " server0 [ ... serverN]\n\n" \
93
93
+ " server0 [ ... serverN]\n\n" DHCRELAY_OPTION82_USAGE \
94
94
" %s {--version|--help|-h}"
95
95
#endif
96
96
#endif
97
- @@ -471 ,6 +483 ,15 @@ main(int argc, char **argv) {
97
+ @@ -480 ,6 +492 ,15 @@ main(int argc, char **argv) {
98
98
local_family_set = 1;
99
99
local_family = AF_INET;
100
100
#endif
@@ -110,7 +110,7 @@ index 0cb2ef6..418b943 100644
110
110
add_agent_options = 1;
111
111
} else if (!strcmp(argv[i], "-A")) {
112
112
#ifdef DHCPv6
113
- @@ -1171 ,6 +1192 ,81 @@ find_interface_by_agent_option(struct dhcp_packet *packet,
113
+ @@ -1207 ,6 +1228 ,81 @@ find_interface_by_agent_option(struct dhcp_packet *packet,
114
114
return (-1);
115
115
}
116
116
@@ -192,7 +192,7 @@ index 0cb2ef6..418b943 100644
192
192
/*
193
193
* Examine a packet to see if it's a candidate to have a Relay
194
194
* Agent Information option tacked onto its tail. If it is, tack
195
- @@ -1180 ,9 +1276 ,12 @@ static int
195
+ @@ -1216 ,9 +1312 ,12 @@ int
196
196
add_relay_agent_options(struct interface_info *ip, struct dhcp_packet *packet,
197
197
unsigned length, struct in_addr giaddr) {
198
198
int is_dhcp = 0, mms;
@@ -206,7 +206,7 @@ index 0cb2ef6..418b943 100644
206
206
207
207
/* If we're not adding agent options to packets, we can skip
208
208
this. */
209
- @@ -1316 ,17 +1415 ,40 @@ add_relay_agent_options(struct interface_info *ip, struct dhcp_packet *packet,
209
+ @@ -1357 ,17 +1456 ,40 @@ add_relay_agent_options(struct interface_info *ip, struct dhcp_packet *packet,
210
210
op = sp;
211
211
#endif
212
212
@@ -258,7 +258,7 @@ index 0cb2ef6..418b943 100644
258
258
}
259
259
260
260
if (adding_link_select) {
261
- @@ -1351 ,7 +1473 ,7 @@ add_relay_agent_options(struct interface_info *ip, struct dhcp_packet *packet,
261
+ @@ -1392 ,7 +1514 ,7 @@ add_relay_agent_options(struct interface_info *ip, struct dhcp_packet *packet,
262
262
* If not, forward without adding the option.
263
263
*/
264
264
if (max - sp >= optlen + 3) {
@@ -267,7 +267,7 @@ index 0cb2ef6..418b943 100644
267
267
268
268
/* Okay, cons up *our* Relay Agent Information option. */
269
269
*sp++ = DHO_DHCP_AGENT_OPTIONS;
270
- @@ -1359 ,16 +1481 ,16 @@ add_relay_agent_options(struct interface_info *ip, struct dhcp_packet *packet,
270
+ @@ -1400 ,16 +1522 ,16 @@ add_relay_agent_options(struct interface_info *ip, struct dhcp_packet *packet,
271
271
272
272
/* Copy in the circuit id... */
273
273
*sp++ = RAI_CIRCUIT_ID;
@@ -292,5 +292,5 @@ index 0cb2ef6..418b943 100644
292
292
293
293
/* RFC3527: Use the inbound packet's interface address in
294
294
- -
295
- 2.17 .1
295
+ 2.25 .1
296
296
0 commit comments