LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > CentOS
User Name
Password
CentOS This forum is for the discussion of CentOS Linux. Note: This forum does not have any official participation.

Notices


Reply
  Search this Thread
Old 09-22-2017, 02:05 AM   #1
vikramb
LQ Newbie
 
Registered: Sep 2017
Posts: 2

Rep: Reputation: Disabled
netlink on ClearOS 7.3 issue


I am trying following simple program on ClearOS 7.3, 64 bit

Code:
#include <sys/socket.h>
#include <linux/netlink.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <errno.h>

int main()
{
    int flags =0;
    int bus = NETLINK_NETFILTER;

    int sock_fd = socket(AF_NETLINK, SOCK_RAW | flags, bus);
    if(sock_fd<0)
    {
        printf("\nsocket failed with error no = %d and error msg = %s\n",
                                errno, strerror(errno));

        return -1;
    }

    printf("\nOP completed successfully..!\n");
    return 0;
}
I am getting following error:

socket failed with error no = 93 and error msg = Protocol not supported

My OS details are:

ClearOS release 7.3.0 (Final)
Linux 3.10.0-514.26.2.v7.x86_64 #1 SMP Wed Jul 5 10:37:54 MDT 2017 x86_64 x86_64 x86_64 GNU/Linux

Please help.
 
Old 09-28-2017, 01:17 PM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,782

Rep: Reputation: 7999Reputation: 7999Reputation: 7999Reputation: 7999Reputation: 7999Reputation: 7999Reputation: 7999Reputation: 7999Reputation: 7999Reputation: 7999Reputation: 7999
Quote:
Originally Posted by vikramb View Post
I am trying following simple program on ClearOS 7.3, 64 bit
Code:
#include <sys/socket.h>
#include <linux/netlink.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <errno.h>

int main()
{
    int flags =0;
    int bus = NETLINK_NETFILTER;
    int sock_fd = socket(AF_NETLINK, SOCK_RAW | flags, bus);
    if(sock_fd<0)
    {
        printf("\nsocket failed with error no = %d and error msg = %s\n",
                                errno, strerror(errno));
        return -1;
    }
    printf("\nOP completed successfully..!\n");
    return 0;
}
I am getting following error: socket failed with error no = 93 and error msg = Protocol not supported My OS details are:
ClearOS release 7.3.0 (Final)
Linux 3.10.0-514.26.2.v7.x86_64 #1 SMP Wed Jul 5 10:37:54 MDT 2017 x86_64 x86_64 x86_64 GNU/Linux
Are you running this as root? Where did you get the program? How are you running it, with what arguments?
 
Old 10-03-2017, 01:07 AM   #3
vikramb
LQ Newbie
 
Registered: Sep 2017
Posts: 2

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by TB0ne View Post
Are you running this as root? Where did you get the program? How are you running it, with what arguments?
Yes. I have tried using root. same results.

Arguments are

int flags =0;
int bus = NETLINK_NETFILTER;

The program is small snippet taken from libmnl source, NOT as is, but a simplified version.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ClearOS... gor0 Red Hat 1 11-28-2014 02:37 AM
clearos help ratzim Linux - Newbie 2 01-25-2011 11:21 AM
Netlink socket issue? nandac Linux - Enterprise 1 01-12-2007 06:03 PM
Netlink socket issue? nandac Programming 0 01-04-2007 08:37 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > CentOS

All times are GMT -5. The time now is 10:20 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration