X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=utilities%2Fnlmon.c;h=b6396d50b9da8c89bfa864ac031db7864e59904d;hb=9d9a0a0452a957472b0f3a9c132aea19cfb4e568;hp=eb1be60a71394c2dbccb2baea31d2dd3e375862b;hpb=064af42167bf4fc9aaea2702d80ce08074b889c0;p=openvswitch diff --git a/utilities/nlmon.c b/utilities/nlmon.c index eb1be60a..b6396d50 100644 --- a/utilities/nlmon.c +++ b/utilities/nlmon.c @@ -1,3 +1,19 @@ +/* + * Copyright (c) 2009, 2010, 2011 Nicira Networks. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #include #include #include @@ -8,6 +24,7 @@ #include #include #include "netlink.h" +#include "netlink-socket.h" #include "ofpbuf.h" #include "poll-loop.h" #include "timeval.h" @@ -20,21 +37,24 @@ static const struct nl_policy rtnlgrp_link_policy[] = { }; int -main(int argc UNUSED, char *argv[]) +main(int argc OVS_UNUSED, char *argv[]) { struct nl_sock *sock; int error; set_program_name(argv[0]); - time_init(); - vlog_init(); - vlog_set_levels(VLM_ANY_MODULE, VLF_ANY_FACILITY, VLL_DBG); + vlog_set_levels(NULL, VLF_ANY_FACILITY, VLL_DBG); - error = nl_sock_create(NETLINK_ROUTE, RTNLGRP_LINK, 0, 0, &sock); + error = nl_sock_create(NETLINK_ROUTE, &sock); if (error) { ovs_fatal(error, "could not create rtnetlink socket"); } + error = nl_sock_join_mcgroup(sock, RTNLGRP_LINK); + if (error) { + ovs_fatal(error, "could not join RTNLGRP_LINK multicast group"); + } + for (;;) { struct ofpbuf *buf;