diff options
author | Patrick Wildt <patrick@cvs.openbsd.org> | 2017-06-26 09:17:56 +0000 |
---|---|---|
committer | Patrick Wildt <patrick@cvs.openbsd.org> | 2017-06-26 09:17:56 +0000 |
commit | e250babd8a463fb200b5e80b9bfe3be2e9008824 (patch) | |
tree | 673c945b9cc2345bb1ce93f1f9604c7980009d81 /sys/net/pfkeyv2.c | |
parent | 1ffde3db16c6afb2ad0be51440d7b74f19b4374a (diff) |
Allow updating the destination address of an existing TDB. Since the
destination address is used as an index when looking for a TDB, we need
to supply the new destination address in a different member. For this,
re-use the proxy address, that so far no one else has been using. It
would make sense to rename this member in the future.
ok claudio@
Diffstat (limited to 'sys/net/pfkeyv2.c')
-rw-r--r-- | sys/net/pfkeyv2.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/sys/net/pfkeyv2.c b/sys/net/pfkeyv2.c index 5acb747f9f3..469a852d21e 100644 --- a/sys/net/pfkeyv2.c +++ b/sys/net/pfkeyv2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pfkeyv2.c,v 1.160 2017/05/29 20:31:12 claudio Exp $ */ +/* $OpenBSD: pfkeyv2.c,v 1.161 2017/06/26 09:17:55 patrick Exp $ */ /* * @(#)COPYRIGHT 1.1 (NRL) 17 January 1995 @@ -1214,6 +1214,15 @@ pfkeyv2_send(struct socket *socket, void *message, int len) import_tag(sa2, headers[SADB_X_EXT_TAG]); import_tap(sa2, headers[SADB_X_EXT_TAP]); #endif + if (headers[SADB_EXT_ADDRESS_SRC] || + headers[SADB_EXT_ADDRESS_PROXY]) { + tdb_unlink(sa2); + import_address((struct sockaddr *)&sa2->tdb_src, + headers[SADB_EXT_ADDRESS_SRC]); + import_address((struct sockaddr *)&sa2->tdb_dst, + headers[SADB_EXT_ADDRESS_PROXY]); + puttdb(sa2); + } } break; |