<html>
    <head>
      <base href="https://bugzilla.netfilter.org/">
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - mapping IPv4 interval to IPv4 interval works for anonymous maps, but not for named maps"
   href="https://bugzilla.netfilter.org/show_bug.cgi?id=1764#c1">Comment # 1</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - mapping IPv4 interval to IPv4 interval works for anonymous maps, but not for named maps"
   href="https://bugzilla.netfilter.org/show_bug.cgi?id=1764">bug 1764</a>
              from <span class="vcard"><a class="email" href="mailto:pablo@netfilter.org" title="Pablo Neira Ayuso <pablo@netfilter.org>"> <span class="fn">Pablo Neira Ayuso</span></a>
</span></b>
        <pre>TLDR; Try this:

table ip t {                                                                    
        map m {                                                                 
                type ipv4_addr : interval ipv4_addr                             
                flags interval                                                  
                elements = { 192.0.2.0 : 198.51.100.0/24 }                      
        }                                                                       

        chain c {                                                               
                type nat hook postrouting priority srcnat; policy accept;       
                snat to ip saddr map @m persistent                              
        }                                                                       
}

I can post a patch to improve error reporting, to provide a hint.

===

Now looking further at this issue... Maybe this syntax can be revisited while
retaining backwards compatibility, I can propose this instead:

table ip t {                                                                    
        map m {                                                                 
                type ipv4_addr : ipv4_addr                              
                flags interval : interval                                       
                elements = { 192.0.2.0/24 : 198.51.100.0/24 }                   
        }                                                                       

        chain c {                                                               
                type nat hook postrouting priority srcnat; policy accept;       
                snat to ip saddr map @m persistent                              
        }                                                                       
}

however, if lhs is singleton, then I will need syntatic sugar like this
'singleton' keyword (which does not exist):

table ip t {                                                                    
        map m {                                                                 
                type ipv4_addr : ipv4_addr                              
                flags singleton : interval                                      
                elements = { 192.0.2.0 : 198.51.100.0/24 }                      
        }                                                                       

        chain c {                                                               
                type nat hook postrouting priority srcnat; policy accept;       
                snat to ip saddr map @m persistent                              
        }                                                                       
}

otherwise this would need to print:

        flags : interval

because no flags in the left hand side (ie. singleton values only)

Another possibility is to push both interval flags to the type

                type interval lipv4_addr : interval ipv4_addr

thanks.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are watching all bug changes.</li>
      </ul>
    </body>
</html>