Charles M.C. Chan | 93b7fb0 | 2014-12-28 03:59:36 +0800 | [diff] [blame] | 1 | /* |
Charles M.C. Chan | 197a012 | 2015-04-08 18:15:34 +0800 | [diff] [blame] | 2 | * Copyright 2014-2015 Open Networking Laboratory |
Charles M.C. Chan | 93b7fb0 | 2014-12-28 03:59:36 +0800 | [diff] [blame] | 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | |
| 18 | |
| 19 | package org.onlab.packet; |
| 20 | |
Pavlin Radoslavov | c6aef92 | 2015-02-27 10:23:04 -0800 | [diff] [blame] | 21 | import org.onlab.packet.ipv6.IExtensionHeader; |
Charles M.C. Chan | ea5aa47 | 2015-01-03 13:40:39 +0800 | [diff] [blame] | 22 | import org.onlab.packet.ndp.NeighborAdvertisement; |
| 23 | import org.onlab.packet.ndp.NeighborSolicitation; |
| 24 | import org.onlab.packet.ndp.Redirect; |
| 25 | import org.onlab.packet.ndp.RouterAdvertisement; |
| 26 | import org.onlab.packet.ndp.RouterSolicitation; |
Jonathan Hart | 2a65575 | 2015-04-07 16:46:33 -0700 | [diff] [blame] | 27 | |
Charles M.C. Chan | 93b7fb0 | 2014-12-28 03:59:36 +0800 | [diff] [blame] | 28 | import java.nio.ByteBuffer; |
| 29 | import java.util.HashMap; |
| 30 | import java.util.Map; |
| 31 | |
Jonathan Hart | 2a65575 | 2015-04-07 16:46:33 -0700 | [diff] [blame] | 32 | import static org.onlab.packet.PacketUtils.checkInput; |
| 33 | |
Charles M.C. Chan | 93b7fb0 | 2014-12-28 03:59:36 +0800 | [diff] [blame] | 34 | /** |
Charles M.C. Chan | 7fee36a | 2014-12-31 00:19:59 +0800 | [diff] [blame] | 35 | * Implements ICMPv6 packet format. (RFC 4443) |
Charles M.C. Chan | 93b7fb0 | 2014-12-28 03:59:36 +0800 | [diff] [blame] | 36 | */ |
| 37 | public class ICMP6 extends BasePacket { |
| 38 | public static final byte HEADER_LENGTH = 4; // bytes |
| 39 | |
Charles M.C. Chan | 2184de1 | 2015-04-26 02:24:53 +0800 | [diff] [blame] | 40 | // Type |
| 41 | /** Destination Unreachable. */ |
| 42 | public static final byte DEST_UNREACH = (byte) 0x01; |
| 43 | /** Packet Too Big. */ |
| 44 | public static final byte PKT_TOO_BIG = (byte) 0x02; |
| 45 | /** Time Exceeded. */ |
| 46 | public static final byte TIME_EXCEED = (byte) 0x03; |
| 47 | /** Parameter Problem. */ |
| 48 | public static final byte PARAM_ERR = (byte) 0x04; |
| 49 | /** Echo Request. */ |
Charles M.C. Chan | 197a012 | 2015-04-08 18:15:34 +0800 | [diff] [blame] | 50 | public static final byte ECHO_REQUEST = (byte) 0x80; |
Charles M.C. Chan | 2184de1 | 2015-04-26 02:24:53 +0800 | [diff] [blame] | 51 | /** Echo Reply. */ |
Charles M.C. Chan | 197a012 | 2015-04-08 18:15:34 +0800 | [diff] [blame] | 52 | public static final byte ECHO_REPLY = (byte) 0x81; |
Charles M.C. Chan | 2184de1 | 2015-04-26 02:24:53 +0800 | [diff] [blame] | 53 | /** Multicast Listener Query. */ |
| 54 | public static final byte MCAST_QUERY = (byte) 0x82; |
| 55 | /** Multicast Listener Report. */ |
| 56 | public static final byte MCAST_REPORT = (byte) 0x83; |
| 57 | /** Multicast Listener Done. */ |
| 58 | public static final byte MCAST_DONE = (byte) 0x84; |
| 59 | /** Router Solicitation. */ |
Charles M.C. Chan | 93b7fb0 | 2014-12-28 03:59:36 +0800 | [diff] [blame] | 60 | public static final byte ROUTER_SOLICITATION = (byte) 0x85; |
Charles M.C. Chan | 2184de1 | 2015-04-26 02:24:53 +0800 | [diff] [blame] | 61 | /** Router Advertisement. */ |
Charles M.C. Chan | 93b7fb0 | 2014-12-28 03:59:36 +0800 | [diff] [blame] | 62 | public static final byte ROUTER_ADVERTISEMENT = (byte) 0x86; |
Charles M.C. Chan | 2184de1 | 2015-04-26 02:24:53 +0800 | [diff] [blame] | 63 | /** Neighbor Solicitation. */ |
Charles M.C. Chan | 93b7fb0 | 2014-12-28 03:59:36 +0800 | [diff] [blame] | 64 | public static final byte NEIGHBOR_SOLICITATION = (byte) 0x87; |
Charles M.C. Chan | 2184de1 | 2015-04-26 02:24:53 +0800 | [diff] [blame] | 65 | /** Neighbor Advertisement. */ |
Charles M.C. Chan | 93b7fb0 | 2014-12-28 03:59:36 +0800 | [diff] [blame] | 66 | public static final byte NEIGHBOR_ADVERTISEMENT = (byte) 0x88; |
Charles M.C. Chan | 2184de1 | 2015-04-26 02:24:53 +0800 | [diff] [blame] | 67 | /** Redirect Message. */ |
Charles M.C. Chan | ea5aa47 | 2015-01-03 13:40:39 +0800 | [diff] [blame] | 68 | public static final byte REDIRECT = (byte) 0x89; |
Charles M.C. Chan | 2184de1 | 2015-04-26 02:24:53 +0800 | [diff] [blame] | 69 | |
| 70 | // Code for DEST_UNREACH |
| 71 | /** No route to destination. */ |
| 72 | public static final byte NO_ROUTE = (byte) 0x00; |
| 73 | /** Communication with destination administratively prohibited. */ |
| 74 | public static final byte COMM_PROHIBIT = (byte) 0x01; |
| 75 | /** Beyond scope of source address. */ |
| 76 | public static final byte BEYOND_SCOPE = (byte) 0x02; |
| 77 | /** Address unreachable. */ |
| 78 | public static final byte ADDR_UNREACH = (byte) 0x03; |
| 79 | /** Port unreachable. */ |
| 80 | public static final byte PORT_UNREACH = (byte) 0x04; |
| 81 | /** Source address failed ingress/egress policy. */ |
| 82 | public static final byte FAIL_POLICY = (byte) 0x05; |
| 83 | /** Reject route to destination. */ |
| 84 | public static final byte REJECT_ROUTE = (byte) 0x06; |
| 85 | /** Error in Source Routing Header. */ |
| 86 | public static final byte SRC_ROUTING_HEADER_ERR = (byte) 0x07; |
| 87 | |
| 88 | // Code for TIME_EXCEED |
| 89 | /** Hop limit exceeded in transit. */ |
| 90 | public static final byte HOP_LIMIT_EXCEED = (byte) 0x00; |
| 91 | /** Fragment reassembly time exceeded. */ |
| 92 | public static final byte DEFRAG_TIME_EXCEED = (byte) 0x01; |
| 93 | |
| 94 | // Code for PARAM_ERR |
| 95 | /** Erroneous header field encountered. */ |
| 96 | public static final byte HDR_FIELD_ERR = (byte) 0x00; |
| 97 | /** Unrecognized Next Header type encountered. */ |
| 98 | public static final byte NEXT_HEADER_ERR = (byte) 0x01; |
| 99 | /** Unrecognized IPv6 option encountered. */ |
| 100 | public static final byte IPV6_OPT_ERR = (byte) 0x01; |
| 101 | |
Jonathan Hart | 2a65575 | 2015-04-07 16:46:33 -0700 | [diff] [blame] | 102 | public static final Map<Byte, Deserializer<? extends IPacket>> TYPE_DESERIALIZER_MAP = |
Charles M.C. Chan | 93b7fb0 | 2014-12-28 03:59:36 +0800 | [diff] [blame] | 103 | new HashMap<>(); |
| 104 | |
| 105 | static { |
Jonathan Hart | 2a65575 | 2015-04-07 16:46:33 -0700 | [diff] [blame] | 106 | ICMP6.TYPE_DESERIALIZER_MAP.put(ICMP6.ROUTER_SOLICITATION, RouterSolicitation.deserializer()); |
| 107 | ICMP6.TYPE_DESERIALIZER_MAP.put(ICMP6.ROUTER_ADVERTISEMENT, RouterAdvertisement.deserializer()); |
| 108 | ICMP6.TYPE_DESERIALIZER_MAP.put(ICMP6.NEIGHBOR_SOLICITATION, NeighborSolicitation.deserializer()); |
| 109 | ICMP6.TYPE_DESERIALIZER_MAP.put(ICMP6.NEIGHBOR_ADVERTISEMENT, NeighborAdvertisement.deserializer()); |
| 110 | ICMP6.TYPE_DESERIALIZER_MAP.put(ICMP6.REDIRECT, Redirect.deserializer()); |
Charles M.C. Chan | 93b7fb0 | 2014-12-28 03:59:36 +0800 | [diff] [blame] | 111 | } |
| 112 | |
| 113 | protected byte icmpType; |
| 114 | protected byte icmpCode; |
| 115 | protected short checksum; |
| 116 | |
Pavlin Radoslavov | c6aef92 | 2015-02-27 10:23:04 -0800 | [diff] [blame] | 117 | private static final byte[] ZERO_ADDRESS = new byte[Ip6Address.BYTE_LENGTH]; |
| 118 | |
Charles M.C. Chan | 93b7fb0 | 2014-12-28 03:59:36 +0800 | [diff] [blame] | 119 | /** |
Charles M.C. Chan | 7fee36a | 2014-12-31 00:19:59 +0800 | [diff] [blame] | 120 | * Gets ICMP6 type. |
| 121 | * |
| 122 | * @return the ICMP6 type |
Charles M.C. Chan | 93b7fb0 | 2014-12-28 03:59:36 +0800 | [diff] [blame] | 123 | */ |
| 124 | public byte getIcmpType() { |
| 125 | return this.icmpType; |
| 126 | } |
| 127 | |
| 128 | /** |
Charles M.C. Chan | 7fee36a | 2014-12-31 00:19:59 +0800 | [diff] [blame] | 129 | * Sets ICMP6 type. |
| 130 | * |
| 131 | * @param icmpType the ICMP type to set |
Charles M.C. Chan | 93b7fb0 | 2014-12-28 03:59:36 +0800 | [diff] [blame] | 132 | * @return this |
| 133 | */ |
| 134 | public ICMP6 setIcmpType(final byte icmpType) { |
| 135 | this.icmpType = icmpType; |
| 136 | return this; |
| 137 | } |
| 138 | |
| 139 | /** |
Charles M.C. Chan | 7fee36a | 2014-12-31 00:19:59 +0800 | [diff] [blame] | 140 | * Gets ICMP6 code. |
| 141 | * |
| 142 | * @return the ICMP6 code |
Charles M.C. Chan | 93b7fb0 | 2014-12-28 03:59:36 +0800 | [diff] [blame] | 143 | */ |
| 144 | public byte getIcmpCode() { |
| 145 | return this.icmpCode; |
| 146 | } |
| 147 | |
| 148 | /** |
Charles M.C. Chan | 7fee36a | 2014-12-31 00:19:59 +0800 | [diff] [blame] | 149 | * Sets ICMP6 code. |
| 150 | * |
| 151 | * @param icmpCode the ICMP6 code to set |
Charles M.C. Chan | 93b7fb0 | 2014-12-28 03:59:36 +0800 | [diff] [blame] | 152 | * @return this |
| 153 | */ |
| 154 | public ICMP6 setIcmpCode(final byte icmpCode) { |
| 155 | this.icmpCode = icmpCode; |
| 156 | return this; |
| 157 | } |
| 158 | |
| 159 | /** |
Charles M.C. Chan | 7fee36a | 2014-12-31 00:19:59 +0800 | [diff] [blame] | 160 | * Gets checksum. |
| 161 | * |
Charles M.C. Chan | 93b7fb0 | 2014-12-28 03:59:36 +0800 | [diff] [blame] | 162 | * @return the checksum |
| 163 | */ |
| 164 | public short getChecksum() { |
| 165 | return this.checksum; |
| 166 | } |
| 167 | |
| 168 | /** |
Charles M.C. Chan | 7fee36a | 2014-12-31 00:19:59 +0800 | [diff] [blame] | 169 | * Sets checksum. |
| 170 | * |
| 171 | * @param checksum the checksum to set |
Charles M.C. Chan | 93b7fb0 | 2014-12-28 03:59:36 +0800 | [diff] [blame] | 172 | * @return this |
| 173 | */ |
| 174 | public ICMP6 setChecksum(final short checksum) { |
| 175 | this.checksum = checksum; |
| 176 | return this; |
| 177 | } |
| 178 | |
Charles M.C. Chan | 93b7fb0 | 2014-12-28 03:59:36 +0800 | [diff] [blame] | 179 | @Override |
| 180 | public byte[] serialize() { |
| 181 | byte[] payloadData = null; |
| 182 | if (this.payload != null) { |
| 183 | this.payload.setParent(this); |
| 184 | payloadData = this.payload.serialize(); |
| 185 | } |
| 186 | |
Charles M.C. Chan | 5c0b476 | 2015-01-10 18:38:37 +0800 | [diff] [blame] | 187 | int payloadLength = 0; |
| 188 | if (payloadData != null) { |
| 189 | payloadLength = payloadData.length; |
| 190 | } |
Charles M.C. Chan | 93b7fb0 | 2014-12-28 03:59:36 +0800 | [diff] [blame] | 191 | |
| 192 | final byte[] data = new byte[HEADER_LENGTH + payloadLength]; |
Dusan Pajin | 79f515f | 2015-02-11 16:40:34 +0100 | [diff] [blame] | 193 | final ByteBuffer bbData = ByteBuffer.wrap(data); |
Charles M.C. Chan | 93b7fb0 | 2014-12-28 03:59:36 +0800 | [diff] [blame] | 194 | |
Dusan Pajin | 79f515f | 2015-02-11 16:40:34 +0100 | [diff] [blame] | 195 | // Creating ByteBuffer for checksum calculation |
| 196 | final byte[] checksumData = |
| 197 | new byte[IPv6.FIXED_HEADER_LENGTH + HEADER_LENGTH + payloadLength]; |
| 198 | final ByteBuffer bbChecksum = ByteBuffer.wrap(checksumData); |
| 199 | |
| 200 | // |
| 201 | // Creating IPv6 Pseudo Header for checksum calculation according |
| 202 | // to RFC 4443 and RFC 2460 |
| 203 | // |
Pavlin Radoslavov | c6aef92 | 2015-02-27 10:23:04 -0800 | [diff] [blame] | 204 | IPv6 ipv6Parent = null; |
| 205 | for (IPacket p = this.parent; p != null; p = p.getParent()) { |
| 206 | if (p instanceof IPv6) { |
| 207 | ipv6Parent = (IPv6) p; |
| 208 | break; |
| 209 | } |
| 210 | } |
| 211 | if (ipv6Parent != null) { |
Charles M.C. Chan | 197a012 | 2015-04-08 18:15:34 +0800 | [diff] [blame] | 212 | bbChecksum.put(ipv6Parent.getSourceAddress()); |
| 213 | bbChecksum.put(ipv6Parent.getDestinationAddress()); |
Pavlin Radoslavov | c6aef92 | 2015-02-27 10:23:04 -0800 | [diff] [blame] | 214 | } else { |
| 215 | // NOTE: IPv6 source and destination addresses unknown. Use zeroes. |
| 216 | bbChecksum.put(ZERO_ADDRESS); |
| 217 | bbChecksum.put(ZERO_ADDRESS); |
| 218 | } |
Dusan Pajin | 79f515f | 2015-02-11 16:40:34 +0100 | [diff] [blame] | 219 | bbChecksum.putInt(HEADER_LENGTH + payloadLength); |
| 220 | bbChecksum.put((byte) 0); |
| 221 | bbChecksum.put((byte) 0); |
| 222 | bbChecksum.put((byte) 0); |
| 223 | bbChecksum.put(IPv6.PROTOCOL_ICMP6); |
| 224 | bbChecksum.put(this.icmpType); |
| 225 | bbChecksum.put(this.icmpCode); |
| 226 | bbChecksum.put((byte) 0); |
| 227 | bbChecksum.put((byte) 0); |
| 228 | |
| 229 | bbData.put(this.icmpType); |
| 230 | bbData.put(this.icmpCode); |
| 231 | bbData.putShort(this.checksum); |
Charles M.C. Chan | 93b7fb0 | 2014-12-28 03:59:36 +0800 | [diff] [blame] | 232 | if (payloadData != null) { |
Dusan Pajin | 79f515f | 2015-02-11 16:40:34 +0100 | [diff] [blame] | 233 | bbData.put(payloadData); |
| 234 | bbChecksum.put(payloadData); |
Charles M.C. Chan | 93b7fb0 | 2014-12-28 03:59:36 +0800 | [diff] [blame] | 235 | } |
| 236 | |
Pavlin Radoslavov | c6aef92 | 2015-02-27 10:23:04 -0800 | [diff] [blame] | 237 | if (this.parent != null) { |
| 238 | if (this.parent instanceof IPv6) { |
| 239 | ((IPv6) this.parent).setNextHeader(IPv6.PROTOCOL_ICMP6); |
| 240 | } else if (this.parent instanceof IExtensionHeader) { |
| 241 | ((IExtensionHeader) this.parent).setNextHeader(IPv6.PROTOCOL_ICMP6); |
| 242 | } |
Charles M.C. Chan | 93b7fb0 | 2014-12-28 03:59:36 +0800 | [diff] [blame] | 243 | } |
| 244 | |
| 245 | // compute checksum if needed |
| 246 | if (this.checksum == 0) { |
Dusan Pajin | 79f515f | 2015-02-11 16:40:34 +0100 | [diff] [blame] | 247 | bbData.rewind(); |
| 248 | bbChecksum.rewind(); |
Charles M.C. Chan | 93b7fb0 | 2014-12-28 03:59:36 +0800 | [diff] [blame] | 249 | int accumulation = 0; |
| 250 | |
Dusan Pajin | 79f515f | 2015-02-11 16:40:34 +0100 | [diff] [blame] | 251 | for (int i = 0; i < checksumData.length / 2; ++i) { |
| 252 | accumulation += 0xffff & bbChecksum.getShort(); |
Charles M.C. Chan | 93b7fb0 | 2014-12-28 03:59:36 +0800 | [diff] [blame] | 253 | } |
| 254 | // pad to an even number of shorts |
Dusan Pajin | 79f515f | 2015-02-11 16:40:34 +0100 | [diff] [blame] | 255 | if (checksumData.length % 2 > 0) { |
| 256 | accumulation += (bbChecksum.get() & 0xff) << 8; |
Charles M.C. Chan | 93b7fb0 | 2014-12-28 03:59:36 +0800 | [diff] [blame] | 257 | } |
| 258 | |
| 259 | accumulation = (accumulation >> 16 & 0xffff) |
| 260 | + (accumulation & 0xffff); |
| 261 | this.checksum = (short) (~accumulation & 0xffff); |
Dusan Pajin | 79f515f | 2015-02-11 16:40:34 +0100 | [diff] [blame] | 262 | bbData.putShort(2, this.checksum); |
Charles M.C. Chan | 93b7fb0 | 2014-12-28 03:59:36 +0800 | [diff] [blame] | 263 | } |
| 264 | return data; |
| 265 | } |
| 266 | |
Jonathan Hart | 2a65575 | 2015-04-07 16:46:33 -0700 | [diff] [blame] | 267 | @Override |
| 268 | public IPacket deserialize(final byte[] data, final int offset, |
| 269 | final int length) { |
| 270 | final ByteBuffer bb = ByteBuffer.wrap(data, offset, length); |
| 271 | this.icmpType = bb.get(); |
| 272 | this.icmpCode = bb.get(); |
| 273 | this.checksum = bb.getShort(); |
| 274 | |
| 275 | Deserializer<? extends IPacket> deserializer; |
| 276 | if (ICMP6.TYPE_DESERIALIZER_MAP.containsKey(icmpType)) { |
| 277 | deserializer = TYPE_DESERIALIZER_MAP.get(icmpType); |
| 278 | } else { |
| 279 | deserializer = Data.deserializer(); |
| 280 | } |
| 281 | try { |
| 282 | this.payload = deserializer.deserialize(data, bb.position(), |
| 283 | bb.limit() - bb.position()); |
| 284 | this.payload.setParent(this); |
| 285 | } catch (DeserializationException e) { |
| 286 | return this; |
| 287 | } |
| 288 | |
| 289 | return this; |
| 290 | } |
| 291 | |
Charles M.C. Chan | 93b7fb0 | 2014-12-28 03:59:36 +0800 | [diff] [blame] | 292 | /* |
| 293 | * (non-Javadoc) |
| 294 | * |
| 295 | * @see java.lang.Object#hashCode() |
| 296 | */ |
| 297 | @Override |
| 298 | public int hashCode() { |
| 299 | final int prime = 5807; |
| 300 | int result = super.hashCode(); |
| 301 | result = prime * result + this.icmpType; |
| 302 | result = prime * result + this.icmpCode; |
| 303 | result = prime * result + this.checksum; |
| 304 | return result; |
| 305 | } |
| 306 | |
| 307 | /* |
| 308 | * (non-Javadoc) |
| 309 | * |
| 310 | * @see java.lang.Object#equals(java.lang.Object) |
| 311 | */ |
| 312 | @Override |
| 313 | public boolean equals(final Object obj) { |
| 314 | if (this == obj) { |
| 315 | return true; |
| 316 | } |
| 317 | if (!super.equals(obj)) { |
| 318 | return false; |
| 319 | } |
| 320 | if (!(obj instanceof ICMP6)) { |
| 321 | return false; |
| 322 | } |
| 323 | final ICMP6 other = (ICMP6) obj; |
| 324 | if (this.icmpType != other.icmpType) { |
| 325 | return false; |
| 326 | } |
| 327 | if (this.icmpCode != other.icmpCode) { |
| 328 | return false; |
| 329 | } |
| 330 | if (this.checksum != other.checksum) { |
| 331 | return false; |
| 332 | } |
| 333 | return true; |
| 334 | } |
| 335 | |
Jonathan Hart | 2a65575 | 2015-04-07 16:46:33 -0700 | [diff] [blame] | 336 | /** |
| 337 | * Deserializer function for ICMPv6 packets. |
| 338 | * |
| 339 | * @return deserializer function |
| 340 | */ |
| 341 | public static Deserializer<ICMP6> deserializer() { |
| 342 | return (data, offset, length) -> { |
| 343 | checkInput(data, offset, length, HEADER_LENGTH); |
Charles M.C. Chan | 93b7fb0 | 2014-12-28 03:59:36 +0800 | [diff] [blame] | 344 | |
Jonathan Hart | 2a65575 | 2015-04-07 16:46:33 -0700 | [diff] [blame] | 345 | ICMP6 icmp6 = new ICMP6(); |
| 346 | |
| 347 | ByteBuffer bb = ByteBuffer.wrap(data, offset, length); |
| 348 | |
| 349 | icmp6.icmpType = bb.get(); |
| 350 | icmp6.icmpCode = bb.get(); |
| 351 | icmp6.checksum = bb.getShort(); |
| 352 | |
| 353 | Deserializer<? extends IPacket> deserializer; |
| 354 | if (ICMP6.TYPE_DESERIALIZER_MAP.containsKey(icmp6.icmpType)) { |
| 355 | deserializer = TYPE_DESERIALIZER_MAP.get(icmp6.icmpType); |
| 356 | } else { |
| 357 | deserializer = Data.deserializer(); |
Charles M.C. Chan | 93b7fb0 | 2014-12-28 03:59:36 +0800 | [diff] [blame] | 358 | } |
Jonathan Hart | 2a65575 | 2015-04-07 16:46:33 -0700 | [diff] [blame] | 359 | icmp6.payload = deserializer.deserialize(data, bb.position(), |
| 360 | bb.limit() - bb.position()); |
| 361 | icmp6.payload.setParent(icmp6); |
Charles M.C. Chan | 93b7fb0 | 2014-12-28 03:59:36 +0800 | [diff] [blame] | 362 | |
Jonathan Hart | 2a65575 | 2015-04-07 16:46:33 -0700 | [diff] [blame] | 363 | return icmp6; |
| 364 | }; |
Charles M.C. Chan | 93b7fb0 | 2014-12-28 03:59:36 +0800 | [diff] [blame] | 365 | } |
| 366 | } |