class PacketGen::Header::OSPFv3::LSUpdate

This class handles {OSPFv3 OSPFv3} Link State Update packets payload. The LSU payload has the following format:

 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                            # LSAs                             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                                                               |
+-                                                            +-+
|                             LSAs                              |
+-                                                            +-+
|                              ...                              |

This paylod is implemented with two fields:

Create a LSUpdate payload

# standalone
lsu = PacketGen::Header::OSPFv3::LSUpdate.new
# in a packet
pkt = PacketGen.gen('IPv6', src: source_ip).add('OSPFv3').add('OSPFv3::LSUpdate')
# make IPv6 header correct for OSPF
pkt.ospfize
# access to LSUpdate payload
lsu = pkt.ospfv3_lsupdate    # => PacketGen::Header::OSPFv3::LSUpdate

Add LSAs to a LSUpdate payload

Adding LSAs with {ArrayOfLSA#<< ArrayOfLSA#<<} automagically update {#lsas_count}. To not update it, use {ArrayOfLSA#push ArrayOfLSA#push}.

lsu.lsas << { type: 'Router', age: 40, link_state_id: '0.0.0.1', advertising_router: '1.1.1.1', sequence_number: 42 }
lsu.lsas_count     #=> 1
# add a link to Router LSA
lsu.lsas.first.links << { type: 1, metric: 10, interface_id: 1, neighbor_interface_id: 2, neighbor_router_id: '2.2.2.2'}

@author Sylvain Daubert

Public Instance Methods

calc_checksum() click to toggle source

Calculate checksums of all LSAs @return [void]

# File lib/packetgen/header/ospfv3/ls_update.rb, line 59
def calc_checksum
  lsas.each(&:calc_checksum)
end
calc_length() click to toggle source

Calculate length of all LSAs

# File lib/packetgen/header/ospfv3/ls_update.rb, line 64
def calc_length
  lsas.each(&:calc_length)
end