update copyright, remove obsolete prints
Signed-off-by: Luotao Fu <l.fu@pengutronix.de>pull/106/head^2
parent
64c23c603c
commit
0e3319df98
|
|
@ -1,10 +1,25 @@
|
||||||
/*
|
/*
|
||||||
* Header file for CAN netlink support
|
* socketcan_netlink.h
|
||||||
|
*
|
||||||
* (C) 2009 Luotao Fu <l.fu@pengutronix.de>
|
* (C) 2009 Luotao Fu <l.fu@pengutronix.de>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the version 2 of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _NMS_H
|
|
||||||
#define _NMS_H
|
#ifndef _SOCKETCAN_NETLINK_H
|
||||||
|
#define _SOCKETCAN_NETLINK_H
|
||||||
|
|
||||||
#define IFLA_CAN_MAX (__IFLA_CAN_MAX - 1)
|
#define IFLA_CAN_MAX (__IFLA_CAN_MAX - 1)
|
||||||
#define IF_UP 1
|
#define IF_UP 1
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,22 @@
|
||||||
|
/*
|
||||||
|
* socketcan_netlink.c
|
||||||
|
*
|
||||||
|
* (C) 2009 Luotao Fu <l.fu@pengutronix.de>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the version 2 of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
@ -127,18 +146,15 @@ static int send_mod_request(int fd, struct nlmsghdr *n)
|
||||||
perror("Cannot talk to rtnetlink");
|
perror("Cannot talk to rtnetlink");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
//printf("stat sent: %d\n", status);
|
|
||||||
|
|
||||||
iov.iov_base = buf;
|
iov.iov_base = buf;
|
||||||
while (1) {
|
while (1) {
|
||||||
iov.iov_len = sizeof(buf);
|
iov.iov_len = sizeof(buf);
|
||||||
status = recvmsg(fd, &msg, 0);
|
status = recvmsg(fd, &msg, 0);
|
||||||
//printf("stat rcv: %d\n", status);
|
|
||||||
for (h = (struct nlmsghdr *)buf;
|
for (h = (struct nlmsghdr *)buf;
|
||||||
(size_t)status >= sizeof(*h);) {
|
(size_t)status >= sizeof(*h);) {
|
||||||
int len = h->nlmsg_len;
|
int len = h->nlmsg_len;
|
||||||
int l = len - sizeof(*h);
|
int l = len - sizeof(*h);
|
||||||
//printf("msgtype: %d, len %d, l %d\n", h->nlmsg_type, len, l);
|
|
||||||
if (l < 0 || len > status) {
|
if (l < 0 || len > status) {
|
||||||
if (msg.msg_flags & MSG_TRUNC) {
|
if (msg.msg_flags & MSG_TRUNC) {
|
||||||
fprintf(stderr, "Truncated message\n");
|
fprintf(stderr, "Truncated message\n");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue