Skip to content

Commit

Permalink
code cleanup and reorganization
Browse files Browse the repository at this point in the history
  • Loading branch information
reubenhwk committed Jun 4, 2014
1 parent cff118b commit 0ea020e
Show file tree
Hide file tree
Showing 7 changed files with 609 additions and 538 deletions.
2 changes: 1 addition & 1 deletion interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ void iface_init_defaults(struct Interface *iface)

iface->cease_adv = 0;

iface->HasFailed = 0;
iface->ready = 0;
iface->IgnoreIfMissing = DFLT_IgnoreIfMissing;
iface->AdvSendAdvert = DFLT_AdvSendAdv;
iface->MaxRtrAdvInterval = DFLT_MaxRtrAdvInterval;
Expand Down
10 changes: 5 additions & 5 deletions netlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#define SOL_NETLINK 270
#endif

void process_netlink_msg(int sock)
void process_netlink_msg(int sock, struct Interface * ifaces)
{
int rc = 0;

Expand Down Expand Up @@ -77,7 +77,7 @@ void process_netlink_msg(int sock)
}

/* Reinit the interfaces which needs it. */
struct Interface *iface = find_iface_by_index(interfaces, ifinfo->ifi_index);
struct Interface *iface = find_iface_by_index(ifaces, ifinfo->ifi_index);
if (iface) {
iface->racount = 0;
reschedule_iface(iface, 0);
Expand All @@ -104,7 +104,7 @@ void process_netlink_msg(int sock)

++rc;

struct Interface *iface = find_iface_by_index(interfaces, ifaddr->ifa_index);
struct Interface *iface = find_iface_by_index(ifaces, ifaddr->ifa_index);
if (iface) {
iface->racount = 0;
reschedule_iface(iface, 0);
Expand All @@ -115,8 +115,8 @@ void process_netlink_msg(int sock)

int netlink_socket(void)
{
int rc, sock;
unsigned int val = 1;
int sock = socket(PF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
if (sock == -1) {
flog(LOG_ERR, "Unable to open netlink socket: %s", strerror(errno));
}
Expand All @@ -130,7 +130,7 @@ int netlink_socket(void)
snl.nl_family = AF_NETLINK;
snl.nl_groups = RTMGRP_LINK | RTMGRP_IPV6_IFADDR;

rc = bind(sock, (struct sockaddr *)&snl, sizeof(snl));
int rc = bind(sock, (struct sockaddr *)&snl, sizeof(snl));
if (rc == -1) {
flog(LOG_ERR, "Unable to bind netlink socket: %s", strerror(errno));
close(sock);
Expand Down
4 changes: 3 additions & 1 deletion netlink.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,7 @@

#pragma once

void process_netlink_msg(int sock);
#include "radvd.h"

void process_netlink_msg(int sock, struct Interface * ifaces);
int netlink_socket(void);
Loading

0 comments on commit 0ea020e

Please sign in to comment.