On 17 April 2017 at 08:13, <[email protected]> wrote: > From: Numan Siddique <[email protected]> > > This patch adds a new OVN action 'dns_lookup' to support native DNS. > ovn-controller parses this action and adds a NXT_PACKET_IN2 > OF flow with 'pause' flag set. > > A new table 'DNS' is added in the SB DB to look up and resolve > the DNS queries. When a valid DNS packet is received by > ovn-controller, it looks up the DNS name in the 'DNS' table > and if successful, it frames a DNS reply, resumes the packet > and stores 1 in the 1-bit subfield. If the packet is invalid > or cannot be resolved, it resumes the packet without any > modifications and stores 0 in the 1-bit subfield. > > reg0[4] = dns_lookup(); next; > > An upcoming patch will use this action and adds logical flows. > > Signed-off-by: Numan Siddique <[email protected]> >
Acked-by: Gurucharan Shetty <[email protected]> This needs a rebase as it does not apply on the tip of master. One comment inline. > > > + <table name="DNS" title="Native DNS resolution"> > + <p> > + Each row in this table stores the DNS records. The OVN action > + <code>dns_lookup</code> uses this table for DNS resolution. > + </p> > + > + <column name="records"> > + Key-value pair of DNS records with <code>hostname</code> as the key > + and a string of IP address(es) separated by comma or space as the > + value. > "hostname" feels like a misnomer as even LB VIPs can be programmed in the DNS table. A better option is to use "DNS name"? > + > + <p><b>Example: </b> "vm1.ovn.org" = "10.0.0.4 aef0::4"</p> > + </column> > + > + <column name="datapaths"> > + The DNS records defined in the column <ref column="records"/> will > be > + applied only to the DNS queries originating from the datapaths > defined > + in this column. > + </column> > + > + <group title="Common Columns"> > + <column name="external_ids"> > + See <em>External IDs</em> at the beginning of this document. > + </column> > + </group> > + </table> > </database> > diff --git a/ovn/utilities/ovn-sbctl.c b/ovn/utilities/ovn-sbctl.c > index ffa931a..79a51e9 100644 > --- a/ovn/utilities/ovn-sbctl.c > +++ b/ovn/utilities/ovn-sbctl.c > @@ -1056,6 +1056,9 @@ static const struct ctl_table_class > tables[SBREC_N_TABLES] = { > > [SBREC_TABLE_SSL].row_ids[0] = > {&sbrec_table_sb_global, NULL, &sbrec_sb_global_col_ssl}, > + > + [SBREC_TABLE_DNS].row_ids[0] = > + {&sbrec_table_dns, NULL, &sbrec_dns_col_records}, > }; > > > diff --git a/ovn/utilities/ovn-trace.c b/ovn/utilities/ovn-trace.c > index 66844b1..b141203 100644 > --- a/ovn/utilities/ovn-trace.c > +++ b/ovn/utilities/ovn-trace.c > @@ -1428,6 +1428,18 @@ execute_next(const struct ovnact_next *next, > trace__(dp, uflow, next->ltable, next->pipeline, super); > } > > + > +static void > +execute_dns_lookup(const struct ovnact_dns_lookup *dl, struct flow *uflow, > + struct ovs_list *super) > +{ > + struct mf_subfield sf = expr_resolve_field(&dl->dst); > + union mf_subvalue sv = { .u8_val = 0 }; > + mf_write_subfield_flow(&sf, &sv, uflow); > + ovntrace_node_append(super, OVNTRACE_NODE_ERROR, > + "*** dns_lookup action not implemented"); > +} > + > static void > trace_actions(const struct ovnact *ovnacts, size_t ovnacts_len, > const struct ovntrace_datapath *dp, struct flow *uflow, > @@ -1542,6 +1554,10 @@ trace_actions(const struct ovnact *ovnacts, size_t > ovnacts_len, > * though, it would be easy enough to track the queue > information > * by adjusting uflow->skb_priority. */ > break; > + > + case OVNACT_DNS_LOOKUP: > + execute_dns_lookup(ovnact_get_DNS_LOOKUP(a), uflow, super); > + break; > } > > } > diff --git a/tests/ovn.at b/tests/ovn.at > index af77c19..53a2dd5 100644 > --- a/tests/ovn.at > +++ b/tests/ovn.at > @@ -1027,6 +1027,13 @@ set_queue(61440); > set_queue(65535); > Queue ID 65535 for set_queue is not in valid range 0 to 61440. > > +# dns_lookup > +reg1[0] = dns_lookup(); > + encodes as controller(userdata=00.00.00. > 06.00.00.00.00.00.01.de.10.00.00.00.40,pause) > + has prereqs udp > +reg1[0] = dns_lookup("hostname"); > + dns_lookup doesn't take any parameters > + > # Contradictionary prerequisites (allowed but not useful): > ip4.src = ip6.src[0..31]; > encodes as move:NXM_NX_IPV6_SRC[0..31]->NXM_OF_IP_SRC[] > -- > 2.9.3 > > _______________________________________________ > dev mailing list > [email protected] > https://mail.openvswitch.org/mailman/listinfo/ovs-dev > _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
