N
N
nerik2015-07-10 12:55:01
MySQL
nerik, 2015-07-10 12:55:01

How to organize nat before ipsec tunnel?

I have a server on freebsd that establishes an ipsec tunnel to a remote host on the internet. Behind the server there is a grid with gray ip, the server will natit them to the Internet using pf. ipsec tunnel works on racoon Rule in pf
nat pass from 192.168.1.5/32 to xxxx/32 -> yyyy It looks like the spdadd rules are fired before translation. I found a similar topic dadv.livejournal.com/202710.html But it seems that pf cannot have this.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
vman, 2018-11-09
@vman

For MySQL version 5.6, 5.7 you can do this

CREATE DATABASE test;
use test;

CREATE TABLE t (a varchar(255), b varchar(255));

-- повесим триггер на INSERT 
-- триггер будет брать значение из "...." и вставлять его в поле 'b'

CREATE TRIGGER before_insert_test_t
BEFORE INSERT ON test.t 
FOR EACH ROW 
  SET new.b = SUBSTRING_INDEX(SUBSTRING_INDEX(new.a, '"', 2), '"', -1);

INSERT INTO t (a) VALUES('text text "QWERTY" text text');
SELECT * FROM t;

+------------------------------+--------+
| a                            | b      |
+------------------------------+--------+
| text text "QWERTY" text text | QWERTY |
+------------------------------+--------+

in MySQL version 8, you can do this
CREATE TABLE t 
(
  a varchar(255), 
  b varchar(255) default (SUBSTRING_INDEX(SUBSTRING_INDEX(a, '"', 2), '"', -1);)
);

but I did not check it, I do not have the 8th version.

I
Iossarian, 2018-11-09
@Iossarian

I correctly understood that in the example you indicated a specific number of the occurrence of the separator, but what if this code can be located in a random place in the text, and even in several places?

A
athacker, 2015-07-10
@athacker

There, in the comments to this post, the author writes that pf most likely also needs a similar patch.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question