Re: [ovs-dev] [PATCH ovn] Add DNSSL support to OVN

2019-10-23 Thread Lorenzo Bianconi
> On Mon, Oct 21, 2019 at 10:49 PM Lorenzo Bianconi <
> lorenzo.bianc...@redhat.com> wrote:
> 
> > Introduce the possibility to specify a DNSSL option to Router
> > Advertisement packets. DNS Search list can be specified using
> > 'dnssl' tag in the ipv6_ra_configs column of logical router
> > port table
> >
> > Signed-off-by: Lorenzo Bianconi 
> >
> 
> Hi Lorenzo,

Hi Numan,

> 
> Can you please rebase. The patch has some conflicts.
> 
> Or this patch needs to be applied on top of the RDNSS patch ?

Yes, it need to applied ontop of RDNSS one. I will send a v2. Thx.

Regards,
Lorenzo

> 
> If so, can you please send it as a series addressing the compilation warning
> in the rdnss patch.
> 
> Thanks
> Numan
> 
> 
> > ---
> >  controller/pinctrl.c | 62 +++-
> >  northd/ovn-northd.c  |  4 +++
> >  ovn-nb.xml   |  4 +++
> >  tests/ovn.at | 30 ++---
> >  4 files changed, 89 insertions(+), 11 deletions(-)
> >
> > diff --git a/controller/pinctrl.c b/controller/pinctrl.c
> > index 5bc4b35e7..b522e3359 100644
> > --- a/controller/pinctrl.c
> > +++ b/controller/pinctrl.c
> > @@ -2194,6 +2194,7 @@ struct ipv6_ra_config {
> >  struct lport_addresses prefixes;
> >  struct in6_addr rdnss;
> >  bool has_rdnss;
> > +struct ds dnssl;
> >  };
> >
> >  struct ipv6_ra_state {
> > @@ -2214,6 +2215,17 @@ struct nd_rdnss_opt {
> >  const ovs_be128 dns[0];
> >  };
> >
> > +/* DNSSL option RFC 6106 */
> > +#define ND_OPT_DNSSL31
> > +#define ND_DNSSL_OPT_LEN8
> > +struct ovs_nd_dnssl {
> > +u_int8_t type;  /* ND_OPT_DNSSL */
> > +u_int8_t len;   /* >= 2 */
> > +ovs_be16 reserved;
> > +ovs_be32 lifetime;
> > +char dnssl[0];
> > +};
> > +
> >  static void
> >  init_ipv6_ras(void)
> >  {
> > @@ -2225,6 +2237,7 @@ ipv6_ra_config_delete(struct ipv6_ra_config *config)
> >  {
> >  if (config) {
> >  destroy_lport_addresses(>prefixes);
> > +ds_destroy(>dnssl);
> >  free(config);
> >  }
> >  }
> > @@ -2263,6 +2276,7 @@ ipv6_ra_update_config(const struct
> > sbrec_port_binding *pb)
> >  nd_ra_min_interval_default(config->max_interval));
> >  config->mtu = smap_get_int(>options, "ipv6_ra_mtu",
> > ND_MTU_DEFAULT);
> >  config->la_flags = IPV6_ND_RA_OPT_PREFIX_ON_LINK;
> > +ds_init(>dnssl);
> >
> >  const char *address_mode = smap_get(>options,
> > "ipv6_ra_address_mode");
> >  if (!address_mode) {
> > @@ -2308,6 +2322,11 @@ ipv6_ra_update_config(const struct
> > sbrec_port_binding *pb)
> >  }
> >  config->has_rdnss = !!rdnss;
> >
> > +const char *dnssl = smap_get(>options, "ipv6_ra_dnssl");
> > +if (dnssl) {
> > +ds_put_buffer(>dnssl, dnssl, strlen(dnssl));
> > +}
> > +
> >  return config;
> >
> >  fail:
> > @@ -2366,6 +2385,44 @@ packet_put_ra_rdnss_opt(struct dp_packet *b,
> > uint8_t num,
> >prev_l4_size +
> > size));
> >  }
> >
> > +static void
> > +packet_put_ra_dnssl_opt(struct dp_packet *b, ovs_be32 lifetime,
> > +char *dnssl_list)
> > +{
> > +char *t0, *r0 = dnssl_list, dnssl[255] = {};
> > +size_t prev_l4_size = dp_packet_l4_size(b);
> > +struct ip6_hdr *nh = dp_packet_l3(b);
> > +size_t size = 8;
> > +int i = 0;
> > +
> > +while ((t0 = strtok_r(r0, ",", ))) {
> > +char *t1, *r1 = t0;
> > +
> > +size += strlen(t0) + 2;
> > +while ((t1 = strtok_r(r1, ".", ))) {
> > +dnssl[i++] = strlen(t1);
> > +memcpy([i], t1, strlen(t1));
> > +i += strlen(t1);
> > +}
> > +dnssl[i++] = 0;
> > +}
> > +size = ROUND_UP(size, 8);
> > +nh->ip6_plen = htons(prev_l4_size + size);
> > +
> > +struct ovs_nd_dnssl *nd_dnssl = dp_packet_put_uninit(b, size);
> > +nd_dnssl->type = ND_OPT_DNSSL;
> > +nd_dnssl->len = size / 8;
> > +nd_dnssl->reserved = 0;
> > +nd_dnssl->lifetime = lifetime;
> > +memcpy(_dnssl->dnssl[0], dnssl, size);
> > +
> > +struct ovs_ra_msg *ra = dp_packet_l4(b);
> > +ra->icmph.icmp6_cksum = 0;
> > +uint32_t icmp_csum = packet_csum_pseudoheader6(dp_packet_l3(b));
> > +ra->icmph.icmp6_cksum = csum_finish(csum_continue(icmp_csum, ra,
> > +  prev_l4_size +
> > size));
> > +}
> > +
> >  /* Called with in the pinctrl_handler thread context. */
> >  static long long int
> >  ipv6_ra_send(struct rconn *swconn, struct ipv6_ra_state *ra)
> > @@ -2374,7 +2431,7 @@ ipv6_ra_send(struct rconn *swconn, struct
> > ipv6_ra_state *ra)
> >  return ra->next_announce;
> >  }
> >
> > -uint64_t packet_stub[128 / 8];
> > +uint64_t packet_stub[512 / 8];
> >  struct dp_packet packet;
> >  dp_packet_use_stub(, packet_stub, sizeof packet_stub);
> >  compose_nd_ra(, ra->config->eth_src, ra->config->eth_dst,
> > @@ -2393,6 +2450,9 @@ 

Re: [ovs-dev] [PATCH ovn] Add DNSSL support to OVN

2019-10-23 Thread Numan Siddique
On Mon, Oct 21, 2019 at 10:49 PM Lorenzo Bianconi <
lorenzo.bianc...@redhat.com> wrote:

> Introduce the possibility to specify a DNSSL option to Router
> Advertisement packets. DNS Search list can be specified using
> 'dnssl' tag in the ipv6_ra_configs column of logical router
> port table
>
> Signed-off-by: Lorenzo Bianconi 
>

Hi Lorenzo,

Can you please rebase. The patch has some conflicts.

Or this patch needs to be applied on top of the RDNSS patch ?

If so, can you please send it as a series addressing the compilation warning
in the rdnss patch.

Thanks
Numan


> ---
>  controller/pinctrl.c | 62 +++-
>  northd/ovn-northd.c  |  4 +++
>  ovn-nb.xml   |  4 +++
>  tests/ovn.at | 30 ++---
>  4 files changed, 89 insertions(+), 11 deletions(-)
>
> diff --git a/controller/pinctrl.c b/controller/pinctrl.c
> index 5bc4b35e7..b522e3359 100644
> --- a/controller/pinctrl.c
> +++ b/controller/pinctrl.c
> @@ -2194,6 +2194,7 @@ struct ipv6_ra_config {
>  struct lport_addresses prefixes;
>  struct in6_addr rdnss;
>  bool has_rdnss;
> +struct ds dnssl;
>  };
>
>  struct ipv6_ra_state {
> @@ -2214,6 +2215,17 @@ struct nd_rdnss_opt {
>  const ovs_be128 dns[0];
>  };
>
> +/* DNSSL option RFC 6106 */
> +#define ND_OPT_DNSSL31
> +#define ND_DNSSL_OPT_LEN8
> +struct ovs_nd_dnssl {
> +u_int8_t type;  /* ND_OPT_DNSSL */
> +u_int8_t len;   /* >= 2 */
> +ovs_be16 reserved;
> +ovs_be32 lifetime;
> +char dnssl[0];
> +};
> +
>  static void
>  init_ipv6_ras(void)
>  {
> @@ -2225,6 +2237,7 @@ ipv6_ra_config_delete(struct ipv6_ra_config *config)
>  {
>  if (config) {
>  destroy_lport_addresses(>prefixes);
> +ds_destroy(>dnssl);
>  free(config);
>  }
>  }
> @@ -2263,6 +2276,7 @@ ipv6_ra_update_config(const struct
> sbrec_port_binding *pb)
>  nd_ra_min_interval_default(config->max_interval));
>  config->mtu = smap_get_int(>options, "ipv6_ra_mtu",
> ND_MTU_DEFAULT);
>  config->la_flags = IPV6_ND_RA_OPT_PREFIX_ON_LINK;
> +ds_init(>dnssl);
>
>  const char *address_mode = smap_get(>options,
> "ipv6_ra_address_mode");
>  if (!address_mode) {
> @@ -2308,6 +2322,11 @@ ipv6_ra_update_config(const struct
> sbrec_port_binding *pb)
>  }
>  config->has_rdnss = !!rdnss;
>
> +const char *dnssl = smap_get(>options, "ipv6_ra_dnssl");
> +if (dnssl) {
> +ds_put_buffer(>dnssl, dnssl, strlen(dnssl));
> +}
> +
>  return config;
>
>  fail:
> @@ -2366,6 +2385,44 @@ packet_put_ra_rdnss_opt(struct dp_packet *b,
> uint8_t num,
>prev_l4_size +
> size));
>  }
>
> +static void
> +packet_put_ra_dnssl_opt(struct dp_packet *b, ovs_be32 lifetime,
> +char *dnssl_list)
> +{
> +char *t0, *r0 = dnssl_list, dnssl[255] = {};
> +size_t prev_l4_size = dp_packet_l4_size(b);
> +struct ip6_hdr *nh = dp_packet_l3(b);
> +size_t size = 8;
> +int i = 0;
> +
> +while ((t0 = strtok_r(r0, ",", ))) {
> +char *t1, *r1 = t0;
> +
> +size += strlen(t0) + 2;
> +while ((t1 = strtok_r(r1, ".", ))) {
> +dnssl[i++] = strlen(t1);
> +memcpy([i], t1, strlen(t1));
> +i += strlen(t1);
> +}
> +dnssl[i++] = 0;
> +}
> +size = ROUND_UP(size, 8);
> +nh->ip6_plen = htons(prev_l4_size + size);
> +
> +struct ovs_nd_dnssl *nd_dnssl = dp_packet_put_uninit(b, size);
> +nd_dnssl->type = ND_OPT_DNSSL;
> +nd_dnssl->len = size / 8;
> +nd_dnssl->reserved = 0;
> +nd_dnssl->lifetime = lifetime;
> +memcpy(_dnssl->dnssl[0], dnssl, size);
> +
> +struct ovs_ra_msg *ra = dp_packet_l4(b);
> +ra->icmph.icmp6_cksum = 0;
> +uint32_t icmp_csum = packet_csum_pseudoheader6(dp_packet_l3(b));
> +ra->icmph.icmp6_cksum = csum_finish(csum_continue(icmp_csum, ra,
> +  prev_l4_size +
> size));
> +}
> +
>  /* Called with in the pinctrl_handler thread context. */
>  static long long int
>  ipv6_ra_send(struct rconn *swconn, struct ipv6_ra_state *ra)
> @@ -2374,7 +2431,7 @@ ipv6_ra_send(struct rconn *swconn, struct
> ipv6_ra_state *ra)
>  return ra->next_announce;
>  }
>
> -uint64_t packet_stub[128 / 8];
> +uint64_t packet_stub[512 / 8];
>  struct dp_packet packet;
>  dp_packet_use_stub(, packet_stub, sizeof packet_stub);
>  compose_nd_ra(, ra->config->eth_src, ra->config->eth_dst,
> @@ -2393,6 +2450,9 @@ ipv6_ra_send(struct rconn *swconn, struct
> ipv6_ra_state *ra)
>  if (ra->config->has_rdnss) {
>  packet_put_ra_rdnss_opt(, 1, 0x,
> >config->rdnss);
>  }
> +if (ra->config->dnssl.length) {
> +packet_put_ra_dnssl_opt(, 0x,
> ra->config->dnssl.string);
> +}
>
>  uint64_t ofpacts_stub[4096 / 8];
>  struct ofpbuf ofpacts = 

Re: [ovs-dev] [PATCH ovn] Add DNSSL support to OVN

2019-10-21 Thread 0-day Robot
Bleep bloop.  Greetings Lorenzo Bianconi, I am a robot and I have tried out 
your patch.
Thanks for your contribution.

I encountered some error that I wasn't expecting.  See the details below.


git-am:
Failed to merge in the changes.
Patch failed at 0001 Add DNSSL support to OVN
The copy of the patch that failed is found in:
   
/var/lib/jenkins/jobs/upstream_build_from_pw/workspace/OVN/.git/rebase-apply/patch
When you have resolved this problem, run "git am --resolved".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".


Please check this out.  If you feel there has been an error, please email 
acon...@redhat.com

Thanks,
0-day Robot
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH ovn] Add DNSSL support to OVN

2019-10-21 Thread Lorenzo Bianconi
Introduce the possibility to specify a DNSSL option to Router
Advertisement packets. DNS Search list can be specified using
'dnssl' tag in the ipv6_ra_configs column of logical router
port table

Signed-off-by: Lorenzo Bianconi 
---
 controller/pinctrl.c | 62 +++-
 northd/ovn-northd.c  |  4 +++
 ovn-nb.xml   |  4 +++
 tests/ovn.at | 30 ++---
 4 files changed, 89 insertions(+), 11 deletions(-)

diff --git a/controller/pinctrl.c b/controller/pinctrl.c
index 5bc4b35e7..b522e3359 100644
--- a/controller/pinctrl.c
+++ b/controller/pinctrl.c
@@ -2194,6 +2194,7 @@ struct ipv6_ra_config {
 struct lport_addresses prefixes;
 struct in6_addr rdnss;
 bool has_rdnss;
+struct ds dnssl;
 };
 
 struct ipv6_ra_state {
@@ -2214,6 +2215,17 @@ struct nd_rdnss_opt {
 const ovs_be128 dns[0];
 };
 
+/* DNSSL option RFC 6106 */
+#define ND_OPT_DNSSL31
+#define ND_DNSSL_OPT_LEN8
+struct ovs_nd_dnssl {
+u_int8_t type;  /* ND_OPT_DNSSL */
+u_int8_t len;   /* >= 2 */
+ovs_be16 reserved;
+ovs_be32 lifetime;
+char dnssl[0];
+};
+
 static void
 init_ipv6_ras(void)
 {
@@ -2225,6 +2237,7 @@ ipv6_ra_config_delete(struct ipv6_ra_config *config)
 {
 if (config) {
 destroy_lport_addresses(>prefixes);
+ds_destroy(>dnssl);
 free(config);
 }
 }
@@ -2263,6 +2276,7 @@ ipv6_ra_update_config(const struct sbrec_port_binding *pb)
 nd_ra_min_interval_default(config->max_interval));
 config->mtu = smap_get_int(>options, "ipv6_ra_mtu", ND_MTU_DEFAULT);
 config->la_flags = IPV6_ND_RA_OPT_PREFIX_ON_LINK;
+ds_init(>dnssl);
 
 const char *address_mode = smap_get(>options, "ipv6_ra_address_mode");
 if (!address_mode) {
@@ -2308,6 +2322,11 @@ ipv6_ra_update_config(const struct sbrec_port_binding 
*pb)
 }
 config->has_rdnss = !!rdnss;
 
+const char *dnssl = smap_get(>options, "ipv6_ra_dnssl");
+if (dnssl) {
+ds_put_buffer(>dnssl, dnssl, strlen(dnssl));
+}
+
 return config;
 
 fail:
@@ -2366,6 +2385,44 @@ packet_put_ra_rdnss_opt(struct dp_packet *b, uint8_t num,
   prev_l4_size + size));
 }
 
+static void
+packet_put_ra_dnssl_opt(struct dp_packet *b, ovs_be32 lifetime,
+char *dnssl_list)
+{
+char *t0, *r0 = dnssl_list, dnssl[255] = {};
+size_t prev_l4_size = dp_packet_l4_size(b);
+struct ip6_hdr *nh = dp_packet_l3(b);
+size_t size = 8;
+int i = 0;
+
+while ((t0 = strtok_r(r0, ",", ))) {
+char *t1, *r1 = t0;
+
+size += strlen(t0) + 2;
+while ((t1 = strtok_r(r1, ".", ))) {
+dnssl[i++] = strlen(t1);
+memcpy([i], t1, strlen(t1));
+i += strlen(t1);
+}
+dnssl[i++] = 0;
+}
+size = ROUND_UP(size, 8);
+nh->ip6_plen = htons(prev_l4_size + size);
+
+struct ovs_nd_dnssl *nd_dnssl = dp_packet_put_uninit(b, size);
+nd_dnssl->type = ND_OPT_DNSSL;
+nd_dnssl->len = size / 8;
+nd_dnssl->reserved = 0;
+nd_dnssl->lifetime = lifetime;
+memcpy(_dnssl->dnssl[0], dnssl, size);
+
+struct ovs_ra_msg *ra = dp_packet_l4(b);
+ra->icmph.icmp6_cksum = 0;
+uint32_t icmp_csum = packet_csum_pseudoheader6(dp_packet_l3(b));
+ra->icmph.icmp6_cksum = csum_finish(csum_continue(icmp_csum, ra,
+  prev_l4_size + size));
+}
+
 /* Called with in the pinctrl_handler thread context. */
 static long long int
 ipv6_ra_send(struct rconn *swconn, struct ipv6_ra_state *ra)
@@ -2374,7 +2431,7 @@ ipv6_ra_send(struct rconn *swconn, struct ipv6_ra_state 
*ra)
 return ra->next_announce;
 }
 
-uint64_t packet_stub[128 / 8];
+uint64_t packet_stub[512 / 8];
 struct dp_packet packet;
 dp_packet_use_stub(, packet_stub, sizeof packet_stub);
 compose_nd_ra(, ra->config->eth_src, ra->config->eth_dst,
@@ -2393,6 +2450,9 @@ ipv6_ra_send(struct rconn *swconn, struct ipv6_ra_state 
*ra)
 if (ra->config->has_rdnss) {
 packet_put_ra_rdnss_opt(, 1, 0x, >config->rdnss);
 }
+if (ra->config->dnssl.length) {
+packet_put_ra_dnssl_opt(, 0x, ra->config->dnssl.string);
+}
 
 uint64_t ofpacts_stub[4096 / 8];
 struct ofpbuf ofpacts = OFPBUF_STUB_INITIALIZER(ofpacts_stub);
diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c
index d1de36e08..dbb279052 100644
--- a/northd/ovn-northd.c
+++ b/northd/ovn-northd.c
@@ -6489,6 +6489,10 @@ copy_ra_to_sb(struct ovn_port *op, const char 
*address_mode)
 if (rdnss) {
 smap_add(, "ipv6_ra_rdnss", rdnss);
 }
+const char *dnssl = smap_get(>nbrp->ipv6_ra_configs, "dnssl");
+if (dnssl) {
+smap_add(, "ipv6_ra_dnssl", dnssl);
+}
 
 smap_add(, "ipv6_ra_src_eth", op->lrp_networks.ea_s);
 
diff --git a/ovn-nb.xml b/ovn-nb.xml
index f1f9b969e..6f2e7dc72 100644
--- a/ovn-nb.xml
+++ b/ovn-nb.xml