netlink

Sending Netlink Taskstats message using libnl-3

时光怂恿深爱的人放手 提交于 2020-01-11 06:40:09
问题 I want to read out linux kernel statistics of a single thread using netlink socket and taskstats. I could get taskstats to work using a python wrapper (https://github.com/facebook/gnlpy) but I want to do a C implementation. After setting up the socket, the message parameters and sending, the receiving nl_recvmsgs_default(sock) always returns an error code -7 ("Invalid input data or parameter") or -12 ("Object not found") depending on how I create the message to send. I checked all method

How are netlink sockets in the Linux kernel different from polling from userland?

孤街醉人 提交于 2020-01-04 03:52:17
问题 I have doubt about the functioning of netlink socket in kernel-application interaction context. As I have read that netlink socket is used for event based notification from kernel to application. The benefit of this is Application is not required to poll. But as in case of netlink socket also, it will also be polling finally to check whether some data has been sent from kernel. So my question is, how this functioning of netlink socket is different from Polling of file decriptor? I refered

RTNETLINK answers: No such file or directory

冷暖自知 提交于 2020-01-01 08:42:54
问题 When I run this cmd: tc qdisc add dev eth0 root red limit 51200000 min 128000 max 512000 avpkt 1024 burst 200 ecn probability 0.5 i get RTNETLINK answers: No such file or directory I have configured the kernel for netfilters , and all the networking options in menuconfig . I don't understand why this error occurs. I'm using iproute2-2.6.23 and Fedora 8. This was working fine on my laptop, but not on my Desktop PC? 回答1: On my system your command autoloads the sch_red module. The question is

【Keepalived+MySQL】MySQL双主互备+高可用

痴心易碎 提交于 2020-01-01 02:18:37
一、基本信息说明 【DB1】 IP: 192.168.102.144 hostname: LVS-Real1 【DB2】 IP: 192.168.102.145 hostname: LVS-Real2 【VIP】 IP: 192.168.102.146 二、MySQL配置主主互备 1.配置DB1和DB2的/etc/my.cnf 【DB1】 [root@LVS-Real1 ~]# more /etc/my.cnf [client] port = 3306 socket = /tmp/mysql.sock [mysqld] user=mysql port = 3306 server_id = 1 #需保证唯一性 socket=/tmp/mysql.sock basedir =/usr/local/mysql datadir =/usr/local/mysql/data pid-file=/usr/local/mysql/data/mysqld.pid log-error=/usr/local/mysql/log/mysql-error.log log-bin=mysql-bin #开启二进制日志 relay-log=mysql-relay-bin replicate-wild-ignore-table=mysql.% #忽略复制mysql数据库下的所有对象,以下依次类推

Keepalived+MySQL实现高可用

旧城冷巷雨未停 提交于 2020-01-01 02:12:21
MySQL的高可用方案有很多,比如 Cluster , MMM , MHA , DRBD 等,这些都比较复杂,我前面的文章也有介绍。最近Oracle官方也推出了 Fabric 。有时我们不需要这么复杂的环境,这些方案各有优劣。有时简单的且我们能够hold住的方案才是适合我们的。比如MySQL Replication,然后加上各种高可用软件,比如 Keepalived 等,就能实现我们需要的高可用环境。 MySQL架构为master/slave,当master故障时,vip漂移到slave上。提供服务。当然也可以设置为双master,但是不是每个方案都是完美的。这里设置为双master有个问题需要注意,比如,当用户发表文章时,由于此时主机的压力很大时,假设落后2000秒,那么这台主机宕机了,另一台主机接管(vip漂移到从机上)时,因为同步延时大,用户刚才发表的文章还没复制过来,于是用户又发表了一遍文章,当原来的master修复好后,由于I/O和SQL线程还处于开启状态,因此还会继续同步刚才没有同步复制完的数据,这时有可能把用户新发表的文章更改掉。这里所以采用master/slave架构。在这种架构中,故障切换以后,采取手动操作的方式与新的master进行复制。 简单环境如下: master 192.168.0.100 slave 192.168.0.101 VIP 192.168.0

Multicast from kernel to user space via Netlink in C

Deadly 提交于 2019-12-28 07:00:50
问题 I was trying to write a simple program communicating between kernel and user space using Netlink. Basically here's what I wanted to achieve: User space program starts binding to a user defined multicast group. Insert kernel module Kernel module sends a message to this multicast group User space program receives the message Here's my code: ======User space program====== #include<stdio.h> #include<string.h> #include<stdlib.h> #include<sys/socket.h> #include<linux/netlink.h> #include<sys/types.h

libnl-3 includes broken?

岁酱吖の 提交于 2019-12-23 03:25:07
问题 I am trying to use libnl 3 (http://www.infradead.org/~tgr/libnl/) under Ubuntu to use netlink in order to get some information from the IPv6 Neighbour Cache. I am including a bunch of headers for this lib, but gcc already fails for the first one: #include <libnl3/netlink/netlink.h> There is no "main header", like libnl.h. >$ gcc netlink_test.c In file included from netlink_test.c:11:0: /usr/include/libnl3/netlink/netlink.h:24:36: fatal error: netlink/netlink-compat.h: No such file or

How to monitor ip address change using RTNETLINK socket in go language

旧巷老猫 提交于 2019-12-23 02:42:40
问题 I have following code, which should monitor network changes using RTNETLINK socket. However when I am setting new IP address for interface "New Addr" or "Del Addr" does not showing. What can be possible problem. package main import ( "fmt" "syscall" ) func main() { l, _ := ListenNetlink() for { msgs, err := l.ReadMsgs() if err != nil { fmt.Println("Could not read netlink: %s", err) } for _, m := range msgs { if IsNewAddr(&m) { fmt.Println("New Addr") } if IsDelAddr(&m) { fmt.Println("Del Addr

NetlinkListener and NetlinkEvent error messages

▼魔方 西西 提交于 2019-12-22 08:15:13
问题 My application does not break during Runtime. However, the following error messages always show up NetlinkListener: ignoring non-kernel netlink multicast message NetlinkEvent: NetlinkEvent::FindParam(): Parameter 'UDEV_LOG' not found The app I'm developing uses sockets to receive packages from a specific IP source (with specific enabled port number). I set up a set of Log outputs (I even tried 'System.out.println' calls) to verify the data flow and everything seems to be fine. Can anyone tell

Where m flag and o flag will be stored in Linux

三世轮回 提交于 2019-12-22 04:37:22
问题 I want to know the value of m flag and o flag of recently received Router Advertisement. From the kernel source code I came to know that m flag and o flag are stored. /* * Remember the managed/otherconf flags from most recently * received RA message (RFC 2462) -- yoshfuji */ in6_dev->if_flags = (in6_dev->if_flags & ~(IF_RA_MANAGED | IF_RA_OTHERCONF)) | (ra_msg->icmph.icmp6_addrconf_managed ? IF_RA_MANAGED : 0) | (ra_msg->icmph.icmp6_addrconf_other ? IF_RA_OTHERCONF : 0); . . . Then I believe