Skip to content

Commit 7b914e7

Browse files
authored
Fix IPv6 nasl builtin function (#2045)
* Fix: add function alias for forge_ip_v6_packet() * fix nasl example * add more function aliases
1 parent fe34055 commit 7b914e7

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

rust/examples/forge_tcp_v6.nasl

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,9 @@ dport = 63322;
2626

2727
filter = string("tcp and src ", src, " and dst ", dst);
2828

29-
ip6 = forge_ip_v6_packet( ip6_v: 6, # IP6_v,
30-
ip6_p: 6, #IP6_P,
31-
ip6_plen:40,
32-
ip6_hlim:IP6_HLIM,
29+
ip6 = forge_ip_v6_packet( ip6_p: 6, #IP6_P,
30+
ip6_hlim: 64, #IP6_HLIM,
31+
ip6_v: 6, # IP6_v,
3332
ip6_src: src,
3433
ip6_dst: dst);
3534

@@ -44,10 +43,7 @@ tcp = forge_tcp_v6_packet(ip6 : ip6,
4443
th_off : 5,
4544
th_win : 1024,
4645
th_urp : 0,
47-
tcp_opt : 3,
48-
tcp_opt_val : 7,
4946
data: "123456",
50-
update_ip_len: TRUE
5147
);
5248

5349
dump_tcp_v6_packet(tcp);

rust/src/nasl/builtin/raw_ip/packet_forgery.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2451,7 +2451,6 @@ fn dump_ip_v6_packet(positional: CheckedPositionals<Ipv6Packet>) {
24512451
/// - th_win: is the TCP window size. NASL will convert it into network order if necessary. 0 by default.
24522452
/// - th_sum: is the TCP checksum. By default, the right value is computed.
24532453
/// - th_urp: is the urgent pointer. 0 by default.
2454-
/// - update_ip_len: is a flag (TRUE by default). If set, NASL will recompute the size field of the IP datagram.
24552454
///
24562455
/// The modified IP datagram or NULL on error.
24572456
#[nasl_function(named(
@@ -3317,10 +3316,16 @@ function_set! {
33173316
(nasl_send_capture, "send_capture"),
33183317

33193318
//IPv6
3319+
3320+
(forge_ip_v6_packet, "forge_ipv6_packet"), // this alias is deprecated.
33203321
forge_ip_v6_packet,
3322+
(get_ip_v6_element, "get_ipv6_element"),
33213323
get_ip_v6_element,
3324+
(set_ip_v6_elements,"set_ipv6_elements"),
33223325
set_ip_v6_elements,
3326+
(insert_ip_v6_options, "insert_ipv6_options"),
33233327
insert_ip_v6_options,
3328+
(dump_ip_v6_packet,"dump_ipv6_packet"),
33243329
dump_ip_v6_packet,
33253330
forge_tcp_v6_packet,
33263331
(get_tcp_element, "get_tcp_v6_element"),

0 commit comments

Comments
 (0)