On Fri, 2023-05-05 at 17:27 +0200, Ilya Maximets wrote:
> On 5/5/23 16:23, Ilya Maximets wrote:
> > On 5/5/23 14:26, Stefan Hoffmann wrote:
> > > On Fri, 2023-05-05 at 14:21 +0200, Stefan Hoffmann wrote:
> > > > This tests stream.c and stream.py with ssl connection at
> > > > CHECK_STREAM_OPEN_BLOCK.
> > > > For the tests, ovsdb needs to be build with libssl.
> > > > 
> > > > Signed-off-by: Stefan Hoffmann <stefan.hoffm...@cloudandheat.com>
> > > > ---
> > > >  tests/ovsdb-idl.at   | 41 ++++++++++++++++++++++++++++++++++++-----
> > > >  tests/test-stream.c  | 12 +++++++++++-
> > > >  tests/test-stream.py | 18 ++++++++++++++++++
> > > >  3 files changed, 65 insertions(+), 6 deletions(-)
> > > > 
> > > > diff --git a/tests/ovsdb-idl.at b/tests/ovsdb-idl.at
> > > > index 8b1cdcdf8..a62816636 100644
> > > > --- a/tests/ovsdb-idl.at
> > > > +++ b/tests/ovsdb-idl.at
> > > > @@ -10,9 +10,20 @@ m4_define([OVSDB_START_IDLTEST],
> > > >  [
> > > >    AT_CHECK([ovsdb-tool create db dnl
> > > >      m4_if([$2], [], [$abs_srcdir/idltest.ovsschema], [$2])])
> > > > +  PKIDIR=$abs_top_builddir/tests
> > > > +  SSL_FLAGS=""
> > > > +  REMOTE_STRING="$1"
> > > > +  REMOTE_PROTOCOL="${REMOTE_STRING::4}"
> > > > +  if [[ "$REMOTE_PROTOCOL" == "pssl" ]]; then
> > > > +    SSL_FLAGS="--private-key=$PKIDIR/testpki-privkey2.pem dnl
> > > > +    --certificate=$PKIDIR/testpki-cert2.pem dnl
> > > > +    --ca-cert=$PKIDIR/testpki-cacert.pem"
> > > > +  fi
> > > > +  #m4_if([$REMOTE_PROTOCOL], [pssl], 
> > > > [--private-key=$PKIDIR/testpki-privkey2.pem 
> > > > --certificate=$PKIDIR/testpki-cert2.pem 
> > > > --ca-cert=$PKIDIR/testpki-cacert.pem], []) dnl
> > > 
> > > I didn't found a proper way to build this using m4_if, as I'm not
> > > familiar with it and don't know how to debug here.
> > > I guess (but not sure) it's somehow, that $REMOTE_PROTOCOL comes from
> > > LISTEN_PROTOCOL, which is defined at CHECK_STREAM_OPEN_BLOCK as
> > > "p$PROTOCOL". But also checking $PROTOCOL == ssl doesn't work.
> > > 
> > > Can someone point me to the right direction how to use m4_if here,
> > > please?
> > 
> > m4_if has to be resolvable at "compile time", i.e. the result has
> > to be known when the test is translated from autotest to shell.
> > And your REMOTE_PROTOCOL is a shell variable, not an m4 definition,
> > so it can't be resolved, it's taken as a literal value.
> > 
> > You may try defining REMOTE_PROTOCOL as an m4 macro and use m4_substr
> > to get the protocol value.  Note that $REMOTE_STRING in your case is
> > also a shell variable, while $1 is not.  So, you can use $1 in
> > m4_if or m4_substr, but you can't use $REMOTE_STRING.
> 
> An easier way might be to just pass the protocol and the address
> as two separate arguments.

I tried both ways and would pass one argument REMOTE and use m4_substr
to get the protocol. This way I don't need to touch all places the
function is called.
Also it was hard for me to find proper variable names for the other
way, as REMOTE_ADDRESS would contain port:ip...

> 
> > 
> > Best regards, Ilya Maximets.

new patch is on it's way.

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to