Skip to content

Conversation

@jpinsonneau
Copy link
Contributor

@jpinsonneau jpinsonneau commented Oct 23, 2025

Description

Parse truncated DNS QNAME using per-CPU buffer and append it to the flows when available

Dependencies

n/a

Checklist

If you are not familiar with our processes or don't know what to answer in the list below, let us know in a comment: the maintainers will take care of that.

  • Will this change affect NetObserv / Network Observability operator? If not, you can ignore the rest of this checklist.
  • Is this PR backed with a JIRA ticket? If so, make sure it is written as a title prefix (in general, PRs affecting the NetObserv/Network Observability product should be backed with a JIRA ticket - especially if they bring user facing changes).
  • Does this PR require product documentation?
    • If so, make sure the JIRA epic is labelled with "documentation" and provides a description relevant for doc writers, such as use cases or scenarios. Any required step to activate or configure the feature should be documented there, such as new CRD knobs.
  • Does this PR require a product release notes entry?
    • If so, fill in "Release Note Text" in the JIRA.
  • Is there anything else the QE team should know before testing? E.g: configuration changes, environment setup, etc.
    • If so, make sure it is described in the JIRA ticket.
  • QE requirements (check 1 from the list):
    • Standard QE validation, with pre-merge tests unless stated otherwise.
    • Regression tests only (e.g. refactoring with no user-facing change).
    • No QE (e.g. trivial change with high reviewer's confidence, or per agreement with the QE team).

To run a perfscale test, comment with: /test ebpf-node-density-heavy-25nodes

@openshift-ci
Copy link

openshift-ci bot commented Oct 23, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign msherif1234 for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@jpinsonneau jpinsonneau marked this pull request as draft October 23, 2025 16:10
@jpinsonneau jpinsonneau changed the title Get DNS names NETOBSERV-2455 - Get DNS names Oct 24, 2025
@jpinsonneau
Copy link
Contributor Author

jpinsonneau commented Oct 24, 2025

Tested on OCP 4.19 with CLI by adding the following column in the config:

  - id: DNSName
    group: DNS
    name: DNS Name
    tooltip: DNS query name.
    field: DnsName
    filter: dns_name
    default: false
    width: 15
    feature: dnsTracking
image image image

@jpinsonneau jpinsonneau added the ok-to-test To set manually when a PR is safe to test. Triggers image build on PR. label Oct 24, 2025
@github-actions
Copy link

New images:
quay.io/netobserv/ebpf-bytecode:34362e6
quay.io/netobserv/netobserv-ebpf-agent:34362e6

These will expire after two weeks.

To deploy this build, run from the operator repo, assuming the operator is running:

USER=netobserv VERSION=34362e6 make set-agent-image

@jpinsonneau jpinsonneau marked this pull request as ready for review October 24, 2025 11:03
__uint(max_entries, 1);
__type(key, u32);
__type(value, struct dns_parse_buffer);
} dns_parse_buffer_map SEC(".maps");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't need this additional map, u can directly read dns name from dns record and added to metric

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rebased to remove the map: e7fe3e5

if (buf) {
// Copy raw QNAME bytes (label-encoded) and let userspace decode to dotted form
__builtin_memset(buf->name, 0, DNS_NAME_MAX_LEN);
u32 qname_off = dns_offset + sizeof(struct dns_header);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pls make sure this math aligns for both DNS over UDP and DNS over TCP , IIRC the headers are of different format

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Seems to work on both 🤔
I'll investigate more on that one

type Protobuf struct {
}

// dnsRawNameToDotted parses a label-encoded DNS QNAME (raw bytes copied from kernel)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a good candidate for unit-test as it looks so convoluted

break
}
// Stop on compression pointer (0xC0xx) since we didn't follow it in kernel
if (l & 0xC0) == 0xC0 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is this 0xC0 magic number ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a skip when a DNS messageg use compression to reduce its size (repeated domain name parts are using pointers).

l is the length byte of a DNS label.
0xC0 in binary is 11000000.
The bitwise AND l & 0xC0 isolates the top two bits of l.
If the result equals 0xC0, it indicates a compression pointer.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pls add comments with all the above details

uint8(mac),
}
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

another UT is needed for this

@github-actions github-actions bot removed the ok-to-test To set manually when a PR is safe to test. Triggers image build on PR. label Oct 24, 2025
@openshift-ci
Copy link

openshift-ci bot commented Oct 24, 2025

@jpinsonneau: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/netobserv-cli-tests e7fe3e5 link false /test netobserv-cli-tests
ci/prow/qe-e2e-tests e7fe3e5 link false /test qe-e2e-tests

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

"additional_flow_metrics":"per_cpu_hash",
"packet_record":"ringbuf",
"dns_flows":"hash",
"dns_parse_buffer_map":"percpu_array",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not needed anymore

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.

2 participants