Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 
0003 #include <sys/socket.h>
0004 #include <bpf/bpf_helpers.h>
0005 
0006 int get_set_sk_priority(void *ctx)
0007 {
0008     int prio;
0009 
0010     /* Verify that context allows calling bpf_getsockopt and
0011      * bpf_setsockopt by reading and writing back socket
0012      * priority.
0013      */
0014 
0015     if (bpf_getsockopt(ctx, SOL_SOCKET, SO_PRIORITY, &prio, sizeof(prio)))
0016         return 0;
0017     if (bpf_setsockopt(ctx, SOL_SOCKET, SO_PRIORITY, &prio, sizeof(prio)))
0018         return 0;
0019 
0020     return 1;
0021 }