Skip to content

Conversation

@vijayragavalu
Copy link
Contributor

Reason for change: 1) Translate all the RDKB IPtables rules to nftables
2) write into /tmp/.nft and /tmp/.nft_v6 files and apply into netfilter
3) all the nftables rules are added under firewall_nft dir

Test Procedure: RDKB Firewall functionality
Risks: Medium

Signed-off-by: Vijayaragavalu S vijayaragavalu.s@infosys.com

Reason for change: 1) Translate all the RDKB IPtables rules to nftables
2) write into /tmp/.nft and /tmp/.nft_v6 files and apply into netfilter
3) all the nftables rules are added under firewall_nft dir

Test Procedure: RDKB Firewall functionality
Risks: Medium

Signed-off-by: Vijayaragavalu S vijayaragavalu.s@infosys.com
@rdkcmf-jenkins
Copy link
Contributor

b'## Blackduck scan failure details

Summary: 0 violations, 0 files pending approval, 8 files pending identification.

  • Protex Server Path: /home/blackduck/github/utopia/104/rdkb/components/opensource/ccsp/Utopia

  • Commit: 86adb10

Report detail: gist'

Reason for change: 1) Resolved build errors
2)Bug fixes wrt iptables to nftables rules conversion for few cases

Test Procedure: RDKB Firewall functionality
Risks: Medium

Signed-off-by: Vijayaragavalu S vijayaragavalu.s@infosys.com
@rdkcmf-jenkins
Copy link
Contributor

b'## Blackduck scan failure details

Summary: 0 violations, 0 files pending approval, 8 files pending identification.

  • Protex Server Path: /home/blackduck/github/utopia/104/rdkb/components/opensource/ccsp/Utopia

  • Commit: 4d70f6c

Report detail: gist'

Reason for change: iptables to nftables rules conversion for extender ,
emta , nfq handler rules files

Test Procedure: RDKB Firewall functionality
Risks: Medium

Signed-off-by: Vijayaragavalu S vijayaragavalu.s@infosys.com
@rdkcmf-jenkins
Copy link
Contributor

b'## Blackduck scan failure details

Summary: 0 violations, 0 files pending approval, 8 files pending identification.

  • Protex Server Path: /home/blackduck/github/utopia/104/rdkb/components/opensource/ccsp/Utopia

  • Commit: 0e9532f

Report detail: gist'

Reason for change: adapt these 2 newly added function in
firewall nft ext file also
get_ip_and_netmask_addr
calculate_network_address

Test Procedure: RDKB Firewall functionality
Risks: Medium

Signed-off-by: Vijayaragavalu S vijayaragavalu.s@infosys.com
@rdkcmf-jenkins
Copy link
Contributor

b'## Blackduck scan failure details

Summary: 0 violations, 0 files pending approval, 8 files pending identification.

  • Protex Server Path: /home/blackduck/github/utopia/104/rdkb/components/opensource/ccsp/Utopia

  • Commit: 4bb69cf

Report detail: gist'

@rdkcmf-jenkins
Copy link
Contributor

b'## Blackduck scan failure details

Summary: 0 violations, 0 files pending approval, 8 files pending identification.

  • Protex Server Path: /home/blackduck/github/utopia/104/rdkb/components/opensource/ccsp/Utopia

  • Commit: 4bb69cf

Report detail: gist'

@rdkcmf-jenkins
Copy link
Contributor

b'## WARNING: A Blackduck scan failure has been waived

A prior failure has been upvoted

  • Upvote reason: OK

  • Commit: 4bb69cf
    '

@vijayragavalu vijayragavalu marked this pull request as ready for review October 22, 2025 08:30
@vijayragavalu vijayragavalu requested review from a team as code owners October 22, 2025 08:30
Reason for change: 1) build support for IPV6 nft file
2) Run time issues resolved for ipv4 and ipv6 nft

Test Procedure: RDKB Firewall functionality
Risks: Medium

Signed-off-by: Vijayaragavalu S <vijayaragavalu.s@infosys.com>
Reason for change: 1) Resolve bridge mode issue and managed site
Test Procedure: RDKB Firewall functionality
Risks: Medium
Signed-off-by: Vijayaragavalu S <vijayaragavalu.s@infosys.com>
vsai1990 and others added 4 commits December 10, 2025 14:49
… iptables (#147)

Testing: RDKB Firewall functionality
1. Bootup device and check iptables -S.
2. Do syscfg set nft_enable 1 ; syscfg commit; reboot
3. Check nft list ruleset. (Testing is for utopia component only and to
check core funtionality of iptables and nftables)
… iptables (#149)

Testing: RDKB Firewall functionality
1. Bootup device and check iptables -S.
2. Do syscfg set nft_enable 1 ; syscfg commit; reboot
3. Check nft list ruleset. (Testing is for utopia component only and to
check core funtionality of iptables and nftables)

Co-authored-by: vijayragavalu <154231347+vijayragavalu@users.noreply.github.com>
#157)

… iptables(part 3)

Added additional check whether firewall_ipt and firewall_nft is present.
to.sin_family = AF_INET;
to.sin_addr.s_addr = inet_addr(dstIp); // you can also use inet_aton()
to.sin_port = htons(dstPort);
memset(to.sin_zero, '\0', sizeof(to.sin_zero));

Check failure

Code scanning / CodeQL

Call to `memset` may be deleted High

Call to memset may be deleted by the compiler.

Copilot Autofix

AI 12 days ago

To fix this issue, replace the use of memset with a function guaranteed not to be optimized away by compilers. If the target platform/compiler supports C11, use memset_s. If not, use a secure zeroing function like explicit_bzero (on some platforms) or a fallback implementation if neither is available. Because you can only edit the region shown, the best approach in the given context is to use memset_s if available, falling back to memset otherwise. This involves:

  • Including a feature test for memset_s at the top of the file.
  • Replacing memset at line 140 with memset_s and adding a fallback in case of non-support (as per the C11 standard: memset_s returns nonzero if unsupported).
  • If you can only edit the code as shown, you can directly replace memset with memset_s and ensure the required header is present.

Suggested changeset 1
source/firewall_nft/raw_socket_send.c

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/source/firewall_nft/raw_socket_send.c b/source/firewall_nft/raw_socket_send.c
--- a/source/firewall_nft/raw_socket_send.c
+++ b/source/firewall_nft/raw_socket_send.c
@@ -137,7 +137,12 @@
     to.sin_family = AF_INET;
     to.sin_addr.s_addr = inet_addr(dstIp); // you can also use inet_aton()
     to.sin_port = htons(dstPort);
-    memset(to.sin_zero, '\0', sizeof(to.sin_zero));
+    // Use memset_s if available to ensure zeroing is not optimized out
+#if defined(__STDC_LIB_EXT1__)
+    memset_s(to.sin_zero, sizeof(to.sin_zero), 0, sizeof(to.sin_zero));
+#else
+    memset(to.sin_zero, 0, sizeof(to.sin_zero)); // Fallback if memset_s not available
+#endif
 
     if((sent = write(rawsock, pkt, pkt_len)) != pkt_len)
     {
EOF
@@ -137,7 +137,12 @@
to.sin_family = AF_INET;
to.sin_addr.s_addr = inet_addr(dstIp); // you can also use inet_aton()
to.sin_port = htons(dstPort);
memset(to.sin_zero, '\0', sizeof(to.sin_zero));
// Use memset_s if available to ensure zeroing is not optimized out
#if defined(__STDC_LIB_EXT1__)
memset_s(to.sin_zero, sizeof(to.sin_zero), 0, sizeof(to.sin_zero));
#else
memset(to.sin_zero, 0, sizeof(to.sin_zero)); // Fallback if memset_s not available
#endif

if((sent = write(rawsock, pkt, pkt_len)) != pkt_len)
{
Copilot is powered by AI and may make mistakes. Always verify output.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants