LCOV - code coverage report
Current view: top level - plugins/wireguard - wireguard_send.h (source / functions) Hit Total Coverage
Test: coverage-filtered.info Lines: 8 8 100.0 %
Date: 2023-07-05 22:20:52 Functions: 1 1 100.0 %

          Line data    Source code
       1             : /*
       2             :  * Copyright (c) 2020 Doc.ai and/or its affiliates.
       3             :  * Copyright (c) 2020 Cisco and/or its affiliates.
       4             :  * Licensed under the Apache License, Version 2.0 (the "License");
       5             :  * you may not use this file except in compliance with the License.
       6             :  * You may obtain a copy of the License at:
       7             :  *
       8             :  *     http://www.apache.org/licenses/LICENSE-2.0
       9             :  *
      10             :  * Unless required by applicable law or agreed to in writing, software
      11             :  * distributed under the License is distributed on an "AS IS" BASIS,
      12             :  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      13             :  * See the License for the specific language governing permissions and
      14             :  * limitations under the License.
      15             :  */
      16             : 
      17             : #ifndef __included_wg_send_h__
      18             : #define __included_wg_send_h__
      19             : 
      20             : #include <wireguard/wireguard_peer.h>
      21             : 
      22             : u8 *wg_build_rewrite (ip46_address_t *src_addr, u16 src_port,
      23             :                       ip46_address_t *dst_addr, u16 dst_port, u8 is_ip4);
      24             : bool wg_send_keepalive (vlib_main_t * vm, wg_peer_t * peer);
      25             : bool wg_send_handshake (vlib_main_t * vm, wg_peer_t * peer, bool is_retry);
      26             : void wg_send_handshake_from_mt (u32 peer_index, bool is_retry);
      27             : bool wg_send_handshake_response (vlib_main_t * vm, wg_peer_t * peer);
      28             : bool wg_send_handshake_cookie (vlib_main_t *vm, u32 sender_index,
      29             :                                cookie_checker_t *cookie_checker,
      30             :                                message_macs_t *macs,
      31             :                                ip46_address_t *wg_if_addr, u16 wg_if_port,
      32             :                                ip46_address_t *remote_addr, u16 remote_port);
      33             : 
      34             : always_inline void
      35        2520 : ip4_header_set_len_w_chksum (ip4_header_t * ip4, u16 len)
      36             : {
      37        2520 :   ip_csum_t sum = ip4->checksum;
      38        2520 :   u16 old = ip4->length;
      39        2520 :   u16 new = len;
      40             : 
      41        2520 :   sum = ip_csum_update (sum, old, new, ip4_header_t, length);
      42        2520 :   ip4->checksum = ip_csum_fold (sum);
      43        2520 :   ip4->length = new;
      44        2520 : }
      45             : 
      46             : #endif /* __included_wg_send_h__ */
      47             : 
      48             : /*
      49             :  * fd.io coding-style-patch-verification: ON
      50             :  *
      51             :  * Local Variables:
      52             :  * eval: (c-set-style "gnu")
      53             :  * End:
      54             :  */

Generated by: LCOV version 1.14