The SRv6 technology with ostinato

43 views
Skip to first unread message

粘英璞

unread,
May 10, 2023, 7:53:33 AM5/10/23
to ostinato
Hello !

Recently I have been researching how to make SRv6 packets with ostinato. Does the author or anyone else have any ideas? for example How do I add SRv6 extension headers ? etc.


Srivats P

unread,
May 11, 2023, 8:10:29 AM5/11/23
to 粘英璞, ostinato
You need to use Ostinato userscript for SRv6.

Create the following protocol stack - 

Mac, Eth, IPv6, Userscript, UDP, Pattern

and use the following SRv6 userscript -

const sids = [

0x00010203, 0x04050607, 0x08090a0b, 0x0c0d0e1f,

0x00010203, 0x04050607, 0x08090a0b, 0x0c0d0e2f,

0x00010203, 0x04050607, 0x08090a0b, 0x0c0d0e4f,

0x00010203, 0x04050607, 0x08090a0b, 0x0c0d0e4f,

0x00010203, 0x04050607, 0x08090a0b, 0x0c0d0e5f

];


protocol.name = "SRv6 SRH"


protocol.protocolFrameSize = function() { return 8 + sids.length*4; }


protocol.protocolId = function(id_type)

{

if (id_type == Protocol.ProtocolIdIp)

return 43;

return 0;

}



protocol.protocolFrameValue = function(index)

{

var segmentsLeft = sids.length/4-1;

var tag = 0xabcd;


var pfv = new Array(protocol.protocolFrameSize());


// next header (8)

pfv[0] = protocol.payloadProtocolId(Protocol.ProtocolIdIp);


// hdr ext len (8)

pfv[1] = sids.length/2; // 2 quad-words per SID


// routing type (8)

pfv[2] = 4;


// segments left (8)

pfv[3] = segmentsLeft;


// last entry (8)

pfv[4] = sids.length/4-1;


// flags (8)

pfv[5] = 0;


// Tag (16)

pfv[6] = (tag >> 8) & 0xFF;

pfv[7] = (tag >> 0) & 0xFF;


// SIDs

for (i = 0; i < sids.length; i++) {

pfv[8+i*4+0] = (sids[i] >> 24) & 0xFF;

pfv[8+i*4+1] = (sids[i] >> 16) & 0xFF;

pfv[8+i*4+2] = (sids[i] >> 8) & 0xFF;

pfv[8+i*4+3] = (sids[i] >> 0) & 0xFF;

}


return pfv;

}


On Wed, May 10, 2023 at 5:23 PM 粘英璞 <niany...@gmail.com> wrote:
Hello !

Recently I have been researching how to make SRv6 packets with ostinato. Does the author or anyone else have any ideas? for example How do I add SRv6 extension headers ? etc.


--
Get Ostinato News and Updates on Twitter - Follow @ostinato (http://twitter.com/ostinato)
---
You received this message because you are subscribed to the Google Groups "ostinato" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ostinato+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ostinato/759b6311-f377-4f32-90aa-19ad66c8dd13n%40googlegroups.com.

Marc

unread,
Jun 18, 2023, 4:34:22 AM6/18/23
to ostinato
Can you teach me step by step how to create the userscript for SRv6? Im trying to send a traffic TCP in a SRv6 explicit path policy. Thanks

Srivats P

unread,
Jun 20, 2023, 3:09:14 AM6/20/23
to Marc, ostinato
You can consult the documentation - https://userguide.ostinato.org/user-script/

Srivats (Founder, Ostinato)

PS - Please note that Ostinato is stateless and hence TCP won't be supported.

Reply all
Reply to author
Forward
0 new messages