kohler / click

The Click modular router: fast modular packet processing and analysis
Other
734 stars 324 forks source link

ipv6 and ipv4 router example and ipv6 config errors #483

Open deshmukhrajvardhan opened 3 years ago

deshmukhrajvardhan commented 3 years ago

Hi,

I have been working on a element that handles both ipv4 and ipv6. It have it working fine with ipv4 but the click config for ipv6 gives errors. I would appreciate an example click config file for it.

I have looked at the following examples: https://github.com/kohler/click/blob/6fa978f0188bd0b8a266f65cd0e79d81838b7963/conf/ip601.click https://github.com/kohler/click/blob/6fa978f0188bd0b8a266f65cd0e79d81838b7963/conf/ip64-nat4.click

Errors:

conf/mfw-ipv6-quic-vm.click:77: While configuring ‘CheckIP6Header@34 :: CheckIP6Header’:
  BADADDRS: parse error
conf/mfw-ipv6-quic-vm.click:79: While configuring ‘rtip6 :: LookupIP6Route’:
  argument 1 should be DADDR/MASK [GW] OUTPUT
  argument 2 should be DADDR/MASK [GW] OUTPUT
conf/mfw-ipv6-quic-vm.click:84: While configuring ‘nda :: IP6NDAdvertiser’:
  argument 1 should be `IP6/MASK ETHADDR'
  argument 1 had no IP6 address and masks
conf/mfw-ipv6-quic-vm.click:95: While configuring ‘c3 :: Classifier’:
  pattern 1: expected a digit
  pattern 2: expected a digit
Router could not be initialized!

Specifications:

Want to route all ipv6 traffic to interface with ipv6 address: fe80::29e7:d96d:843a:f07 mac address: 00:50:56:A2:7C:42 routes:

nda :: IP6NDAdvertiser(
        2607:f8b0:4005:5::9/128 00:50:56:A2:7C:42,
        2600:1700:4ca0:85c0:2c06:53b8:196f:3e20/128 00:50:56:A2:7C:42,
        fe80::29e7:d96d:843a:f07/128 00:50:56:A2:7C:42);

config:

// Generated by make-ip-conf-minifw.pl   Thu Mar 11 13:33:27 EST 2021

// Startup a control port
cs::ControlSocket(TCP, 7777);

// ens224 10.10.4.254 00:50:56:a2:8c:18
// ens160 10.10.11.254 00:50:56:a2:81:19
// ens192 10.10.12.254 00:50:56:a2:7c:42

// Shared IP input path and routing table
ip :: Strip(14)
    -> CheckIPHeader(INTERFACES 10.10.4.254/255.255.255.0 10.10.11.254/255.255.255.0 10.10.12.254/255.255.255.0)
    -> rt :: StaticIPLookup(
    10.10.4.254/32 0,
    10.10.4.255/32 0,
    10.10.4.0/32 0,
    10.10.11.254/32 0,
    10.10.11.255/32 0,
    10.10.11.0/32 0,
    10.10.12.254/32 0,
    10.10.12.255/32 0,
    10.10.12.0/32 0,
    10.10.4.0/255.255.255.0 1,
    10.10.11.0/255.255.255.0 2,
    10.10.12.0/255.255.255.0 3,
    255.255.255.255/32 0.0.0.0 0,
    0.0.0.0/32 0,
    16.0.0.0/255.0.0.0 10.10.11.25 2,
    48.0.0.0/255.0.0.0 10.10.12.25 3,
    192.168.0.0/255.255.0.0 10.10.12.25 3,
    172.19.0.0/255.255.0.0 10.10.12.25 3,
    172.217.0.0/255.255.0.0 10.10.12.25 3);

// ARP responses are copied to each ARPQuerier and the host.
arpt :: Tee(4);

// Input and output paths for ens224
c0 :: Classifier(12/0806 20/0001, 12/0806 20/0002, 12/0800, -);
FromDevice(ens224) -> c0;
out0 :: Queue(200) -> todevice0 :: ToDevice(ens224);
c0[0] -> ar0 :: ARPResponder(10.10.4.254 00:50:56:a2:8c:18) -> out0;
arpq0 :: ARPQuerier(10.10.4.254, 00:50:56:a2:8c:18) -> out0;
c0[1] -> arpt;
arpt[0] -> [1]arpq0;
c0[2] -> Paint(1) -> ip;
c0[3] -> Print("ens224 non-IP") -> Discard;

// Input and output paths for ens160
c1 :: Classifier(12/0806 20/0001, 12/0806 20/0002, 12/0800, -);
FromDevice(ens160) -> c1;
out1 :: Queue(200) -> todevice1 :: ToDevice(ens160);
c1[0] -> ar1 :: ARPResponder(10.10.11.254 00:50:56:a2:81:19) -> out1;
arpq1 :: ARPQuerier(10.10.11.254, 00:50:56:a2:81:19) -> out1;
c1[1] -> arpt;
arpt[1] -> [1]arpq1;
c1[2] -> Paint(2) -> ip;
c1[3] -> Print("ens160 non-IP") -> Discard;

// Input and output paths for ens192
c2 :: Classifier(12/0806 20/0001, 12/0806 20/0002, 12/0800, -);
FromDevice(ens192) -> c2;
out2 :: Queue(200) -> todevice2 :: ToDevice(ens192);
c2[0] -> ar2 :: ARPResponder(10.10.12.254 00:50:56:a2:7c:42) -> out2;
arpq2 :: ARPQuerier(10.10.12.254, 00:50:56:a2:7c:42) -> out2;
c2[1] -> arpt;
arpt[2] -> [1]arpq2;
c2[2] -> Paint(3) -> ip;
c2[3] -> Print("ens192 non-IP") -> Discard;

 //       fe80::b90a:63e2:63b:ffff/80 ::0 0,
 //       fe80::b90a:63e2:63b:ffff/80 ::0 1,
 //       fe80::9253:de96:f534:ffff/80 ::0 2,

ip6 :: Strip(14)
    -> CheckIP6Header(2607:f8b0:4005:5::ffff 2600:1700:4ca0:85c0:2c06:53b8:ffff)
    -> GetIP6Address(24)
    -> rtip6 :: LookupIP6Route(
        2607:f8b0:4005:5::/80 fe80::29e7:d96d:843a:f07 3,
        2600:1700:4ca0:85c0:2c06:53b8:196f::/80 fe80::29e7:d96d:843a:f07 3);

nda :: IP6NDAdvertiser(
        2607:f8b0:4005:5::9/128 00:50:56:A2:7C:42,
        2600:1700:4ca0:85c0:2c06:53b8:196f:3e20/128 00:50:56:A2:7C:42,
        fe80::29e7:d96d:843a:f07/128 00:50:56:A2:7C:42);

nds :: IP6NDSolicitor(
        fe80::29e7:d96d:843a:f07, 00:50:56:A2:7C:42);

c3 :: Classifier(12/86dd 20/3aff 54/87,
                 12/86dd 20/3aff 54/88,
                 12/86dd,
                  -);
FromDevice(ens192) -> c3;
//out2 :: Queue(200) -> todevice2 :: ToDevice(ens192);
c3[0] -> nda -> out2;
//arpq2 :: ARPQuerier(10.10.12.254, 00:50:56:a2:7c:42) -> out2;
c3[1] -> [1]nds;
//arpt[2] -> [1]arpq2;
c3[2] -> Paint(3) -> ip6;
c3[3] -> Print("ens192 non-IP or IPv6") -> Discard;

// Local delivery
toh :: Print(toh) -> Discard;
arpt[3] -> toh;
rt[0] -> IPReassembler -> ping_ipc :: IPClassifier(icmp type echo, -);
ping_ipc[0] -> ICMPPingResponder -> [0]rt;
ping_ipc[1] -> EtherEncap(0x0800, 1:1:1:1:1:1, 2:2:2:2:2:2) -> toh;

// Forwarding path for ens224
rt[1] -> DropBroadcasts
    -> Unstrip(14)
    -> mfw0 :: MiniFW(1, ens224, headqtr/uperf)
    -> Strip(14)
    -> cp0 :: PaintTee(1)
    -> gio0 :: IPGWOptions(10.10.4.254)
    -> FixIPSrc(10.10.4.254)
    -> dt0 :: DecIPTTL
    -> fr0 :: IPFragmenter(1500)
    -> [0]arpq0;
dt0[1] -> ICMPError(10.10.4.254, timeexceeded) -> rt;
fr0[1] -> ICMPError(10.10.4.254, unreachable, needfrag) -> rt;
gio0[1] -> ICMPError(10.10.4.254, parameterproblem) -> rt;
cp0[1] -> ICMPError(10.10.4.254, redirect, host) -> rt;

// Forwarding path for ens160
rt[2] -> DropBroadcasts
    -> Unstrip(14)
    -> mfw1 :: MiniFW(2, ens160, localsite/trex)
    -> Strip(14)
    -> cp1 :: PaintTee(2)
    -> gio1 :: IPGWOptions(10.10.11.254)
    -> FixIPSrc(10.10.11.254)
    -> dt1 :: DecIPTTL
    -> fr1 :: IPFragmenter(1500)
    -> [0]arpq1;
dt1[1] -> ICMPError(10.10.11.254, timeexceeded) -> rt;
fr1[1] -> ICMPError(10.10.11.254, unreachable, needfrag) -> rt;
gio1[1] -> ICMPError(10.10.11.254, parameterproblem) -> rt;
cp1[1] -> ICMPError(10.10.11.254, redirect, host) -> rt;

// Forwarding path for ens192
rt[3] -> DropBroadcasts
    -> Unstrip(14)
    -> mfw2 :: MiniFW(3, ens192, truck/mfwtrex)
    -> Strip(14)
    -> cp2 :: PaintTee(3)
    -> gio2 :: IPGWOptions(10.10.12.254)
    -> FixIPSrc(10.10.12.254)
    -> dt2 :: DecIPTTL
    -> fr2 :: IPFragmenter(1500)
    -> [0]arpq2;
dt2[1] -> ICMPError(10.10.12.254, timeexceeded) -> rt;
fr2[1] -> ICMPError(10.10.12.254, unreachable, needfrag) -> rt;
gio2[1] -> ICMPError(10.10.12.254, parameterproblem) -> rt;
cp2[1] -> ICMPError(10.10.12.254, redirect, host) -> rt;

rtip6[0] -> Print(rtiip60,200) -> Discard;
rtip6[1] -> Print(rtiip61,200) -> Discard;
rtip6[2] -> Print(rtiip62,200) -> Discard;
// Forwarding path for ipv6
rtip6[3] -> DropBroadcasts
         -> Unstrip(14)
         -> mfw3 :: MiniFW(3, ens192, truck/mfwtrex/ipv6)
         -> Strip(14)
         ->[0]nds;

nds[0]->out2;