aboutsummaryrefslogtreecommitdiff
path: root/relay/dhcrelay.c
diff options
context:
space:
mode:
Diffstat (limited to 'relay/dhcrelay.c')
-rw-r--r--relay/dhcrelay.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/relay/dhcrelay.c b/relay/dhcrelay.c
index f00aa2f..b37dc9e 100644
--- a/relay/dhcrelay.c
+++ b/relay/dhcrelay.c
@@ -156,7 +156,7 @@ static const char url[] =
" -e <enterprisenumber>\n"\
" -l lower0 [ ... -l lowerN]\n" \
" -u upper0 [ ... -u upperN]\n" \
-" lower (client link): [address%%]interface[#index][!remoteid]\n" \
+" lower (client link): [address%%]interface[#index][!remoteid][&subscriberid]\n" \
" upper (server link): [address%%]interface"
#else
#define DHCRELAY_USAGE \
@@ -1147,13 +1147,13 @@ add_relay_agent_options(struct interface_info *ip, struct dhcp_packet *packet,
#ifdef DHCPv6
/*
- * Parse a downstream argument: [address%]interface[#index][!remoteid].
+ * Parse a downstream argument: [address%]interface[#index][!remoteid][&subscriberid].
*/
static struct stream_list *
parse_downstream(char *arg) {
struct stream_list *dp, *up;
struct interface_info *ifp = NULL;
- char *ifname, *addr, *iid, *rid;
+ char *ifname, *addr, *iid, *rid, *sid;
isc_result_t status;
if (!supports_multiple_interfaces(ifp) &&
@@ -1169,6 +1169,10 @@ parse_downstream(char *arg) {
*ifname++ = '\0';
addr = arg;
}
+ sid = strchr(ifname, '&');
+ if (sid != NULL) {
+ *sid++ = '\0';
+ }
rid = strchr(ifname, '!');
if (rid != NULL) {
*rid++ = '\0';
@@ -1231,6 +1235,11 @@ parse_downstream(char *arg) {
dp->ifp->remote_id = (u_int8_t *) remote_id;
dp->ifp->remote_id_len = sizeof(int) + strlen(rid);
}
+ /* we're overloading the circuit_id option */
+ if (sid != NULL) {
+ ifp->circuit_id = (u_int8_t *) sid;
+ ifp->circuit_id_len = strlen(sid);
+ }
/* !addr case handled by setup. */
if (!rfc6221_ldra && /* silently ignore any addr for LDRA */
addr && (inet_pton(AF_INET6, addr, &dp->link.sin6_addr) <= 0))
@@ -1370,6 +1379,7 @@ setup_streams(void) {
static const int required_forw_opts[] = {
D6O_INTERFACE_ID,
D6O_REMOTE_ID,
+ D6O_SUBSCRIBER_ID,
D6O_RELAY_MSG,
0
};
@@ -1481,6 +1491,14 @@ opt_error:
D6O_REMOTE_ID, 0))
goto opt_error;
+ /* add subscriber id */
+ if (dp->ifp->circuit_id &&
+ !save_option_buffer(&dhcpv6_universe, opts,
+ NULL, dp->ifp->circuit_id,
+ dp->ifp->circuit_id_len,
+ D6O_SUBSCRIBER_ID, 0))
+ goto opt_error;
+
/* Add the relay-msg carrying the packet. */
if (!save_option_buffer(&dhcpv6_universe, opts,
NULL, (unsigned char *) packet->raw,