diff options
author | Pablo Mazzini <pmazzini@gmail.com> | 2018-07-14 01:49:02 +0200 |
---|---|---|
committer | Pablo Mazzini <pmazzini@gmail.com> | 2018-07-14 01:49:02 +0200 |
commit | 4fe609e1066744c0f049bdbe0c284859ee1ae230 (patch) | |
tree | 81e88e57e6baef50255b9bf79348e2357a0a7781 /dhcpv6/dhcpv6relay.go | |
parent | 6ebda8509292d4f9091c36cdcf169a322bc173da (diff) |
extend DecapsulateRelay
Diffstat (limited to 'dhcpv6/dhcpv6relay.go')
-rw-r--r-- | dhcpv6/dhcpv6relay.go | 30 |
1 files changed, 2 insertions, 28 deletions
diff --git a/dhcpv6/dhcpv6relay.go b/dhcpv6/dhcpv6relay.go index 2387212..eaebfc2 100644 --- a/dhcpv6/dhcpv6relay.go +++ b/dhcpv6/dhcpv6relay.go @@ -151,39 +151,13 @@ func (d *DHCPv6Relay) GetInnerMessage() (DHCPv6, error) { if !p.IsRelay() { return p, nil } - p, err = DecapsulateRelay(p) + p, err = DecapsulateRelay(p, 0) if err != nil { return nil, err } } } -// GetInnerRelay recurses into a relay message and extract and return the inner -// DHCPv6Relay. Return nil if none found (e.g. not a relay message). -func (r *DHCPv6Relay) GetInnerRelay() (DHCPv6, error) { - p := r - for { - d, err := DecapsulateRelay(p) - if err != nil { - return nil, err - } - if !d.IsRelay() { - return p, nil - } - p = d.(*DHCPv6Relay) - } -} - -// GetInnerPeerAddr returns the peer address in the inner most relay info -// header, this is typically the IP address of the client making the request. -func (r *DHCPv6Relay) GetInnerPeerAddr() (net.IP, error) { - p, err := r.GetInnerRelay() - if err != nil { - return nil, err - } - return p.(*DHCPv6Relay).PeerAddr(), nil -} - // NewRelayReplFromRelayForw creates a RELAY_REPL packet based on a RELAY_FORW // packet and replaces the inner message with the passed DHCPv6 message. func NewRelayReplFromRelayForw(relayForw, msg DHCPv6) (DHCPv6, error) { @@ -212,7 +186,7 @@ func NewRelayReplFromRelayForw(relayForw, msg DHCPv6) (DHCPv6, error) { linkAddr = append(linkAddr, relay.LinkAddr()) peerAddr = append(peerAddr, relay.PeerAddr()) optiids = append(optiids, relay.GetOneOption(OPTION_INTERFACE_ID)) - decap, err := DecapsulateRelay(relay) + decap, err := DecapsulateRelay(relay, 0) if err != nil { return nil, err } |