Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add bind support #493

Merged
merged 8 commits into from
Mar 28, 2023
Merged

Add bind support #493

merged 8 commits into from
Mar 28, 2023

Conversation

sanyangji
Copy link
Collaborator

Description

Support syscall bind: set the socket address to FdInfo.
Reuse dip and dport to store server's listening ip and port.

Motivation and Context

The main motivation is that syscall bind will bind the address to type SCAP_FD_IPV4_SERVSOCK, which has not support yet.

How Has This Been Tested?

Trigger bind syscall and part of test log as:

{
    "Source": 0,
    "Timestamp": 1676428443056764376,
    "Name": "bind",
    "Category": 3,
    "ParamsNumber": 2,
    "Latency": 7118,
    "Ctx": {
        ...
        "FdInfo": {
            "Num": 3,
            "TypeFd": 5,
            "Filename": "",
            "Directory": "",
            "Protocol": 1,
            "Role": true,
            "Sip": [
                0,
                0,
                0,
                0
            ],
            "Dip": [
                845482506, # result
                0,
                0,
                0
            ],
            "Sport": 0,
            "Dport": 8000, # result
            "Source": 0,
            "Destination": 0
        }
    }
}

Signed-off-by: sanyangji <songyujie@zju.edu.cn>
Signed-off-by: sanyangji <songyujie@zju.edu.cn>
Signed-off-by: sanyangji <songyujie@zju.edu.cn>
Signed-off-by: sanyangji <songyujie@zju.edu.cn>
dxsup

This comment was marked as outdated.

Comment on lines 320 to 321
case SCAP_FD_IPV6_SERVSOCK:
p_kindling_event->context.fdInfo.role = fdInfo->is_role_server();
Copy link
Member

Choose a reason for hiding this comment

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

Why don't set p_kindling_event->context.fdInfo.protocol = get_protocol(fdInfo->get_l4proto());

Signed-off-by: sanyangji <songyujie@zju.edu.cn>
@dxsup dxsup merged commit f310bd6 into KindlingProject:main Mar 28, 2023
@sanyangji sanyangji deleted the support-bind branch March 28, 2023 06:33
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