Skip to content

Commit

Permalink
malloc.h -> stdlib.h, perform DHCP, remove redundant ifaddrs.o
Browse files Browse the repository at this point in the history
* Some compatibility for macOS
* Actually do DHCP plz...Though I don't mean it that way, at least
  it works (kinda)
  • Loading branch information
updateing committed Oct 24, 2016
1 parent d898cb0 commit ed768d8
Show file tree
Hide file tree
Showing 14 changed files with 18 additions and 15 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*.o
.*
minieap
ifaddrs.c
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
MINIEAP_COMMON_OBJS := config.o logging.o minieap.o misc.o linkedlist.o if_impl.o packet_builder.o \
packet_util.o packet_plugin.o eap_state_machine.o net_util.o sched_alarm.o ifaddrs.o
packet_util.o packet_plugin.o eap_state_machine.o net_util.o sched_alarm.o

# If your platform does not get getifaddrs, you can find some implemention and compile it
# If your platform does not provide getifaddrs(), you can find some implemention and compile it here
#MINIEAP_COMMON_OBJS += ifaddrs.o

MINIEAP_PLUGIN_OBJS := if_impl_sockraw.o
Expand Down
2 changes: 1 addition & 1 deletion if_impl_sockraw.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include <sys/socket.h>
#include <string.h>
#include <unistd.h>
#include <malloc.h>
#include <stdlib.h>
#include <ifaddrs.h>

typedef struct _if_impl_sockraw_priv {
Expand Down
2 changes: 1 addition & 1 deletion linkedlist.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "linkedlist.h"
#include "misc.h"
#include <malloc.h>
#include <stdlib.h>
#include <string.h>

/* Rather naive! */
Expand Down
2 changes: 1 addition & 1 deletion misc.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <malloc.h>
#include <stdlib.h>
#include <ctype.h>
#include <stdint.h>
#include <string.h>
Expand Down
6 changes: 4 additions & 2 deletions net_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
#include <ifaddrs.h>
#include <string.h>
#include <net/if.h>
#include <malloc.h>
#include <stdlib.h>
#include <unistd.h>
#include <linux/netlink.h>
#include <linux/rtnetlink.h>
#include <stdlib.h>
#include <stdio.h>

static int ip_addr_family_cmpfunc(void* family, void* ip_addr) {
if (*(short*)family == ((IP_ADDR*)ip_addr)->family) {
Expand Down Expand Up @@ -192,7 +192,9 @@ static RESULT retrive_if_gateway(const char* ifname, struct nlmsghdr* nl_hdr, st
}
}

#ifdef DEBUG
PR_DBG("%08X %08X %s", dst_addr.s_addr, this_gateway.s_addr, this_ifname);
#endif
if (dst_addr.s_addr == 0 && strncmp(this_ifname, ifname, IFNAMSIZ) == 0) {
gateway->s_addr = this_gateway.s_addr;
return SUCCESS;
Expand Down
2 changes: 1 addition & 1 deletion packet_builder.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <string.h>
#include <malloc.h>
#include <stdlib.h>
#include <arpa/inet.h>

#include "packet_builder.h"
Expand Down
2 changes: 1 addition & 1 deletion packet_plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include "logging.h"

#include <string.h>
#include <malloc.h>
#include <stdlib.h>
#include <getopt.h>

#define TRUE 1
Expand Down
2 changes: 1 addition & 1 deletion packet_plugin_printer.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "packet_plugin.h"
#include "eth_frame.h"
#include "logging.h"
#include "malloc.h"
#include "stdlib.h"
#include <stdio.h>

RESULT printer_prepare_frame(struct _packet_plugin* this, ETH_EAP_FRAME* frame) {
Expand Down
2 changes: 1 addition & 1 deletion packet_plugin_rjv3.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ static RESULT rjv3_process_success(struct _packet_plugin* this, ETH_EAP_FRAME* f
if (PRIV->dhcp_type == DHCP_DOUBLE_AUTH) {
if (PRIV->succ_count < 2) {
PR_INFO("正在执行 DHCP 脚本以准备第二次认证");
system(""); // TODO
system((get_program_config())->run_on_success); // TODO move this to plugin

/* Try right before the script ends */
rjv3_start_secondary_auth(this);
Expand Down
2 changes: 1 addition & 1 deletion packet_plugin_rjv3_keepalive.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "sched_alarm.h"
#include "misc.h"

#include <malloc.h>
#include <stdlib.h>

static uint32_t g_echokey;
static uint32_t g_echono;
Expand Down
2 changes: 1 addition & 1 deletion packet_plugin_rjv3_priv.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include <sys/ioctl.h>
#include <stdio.h>
#include <fcntl.h>
#include <malloc.h>
#include <stdlib.h>
#include <arpa/inet.h>

/*
Expand Down
2 changes: 1 addition & 1 deletion packet_plugin_rjv3_prop.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "packet_util.h"

#include <stdint.h>
#include <malloc.h>
#include <stdlib.h>
#include <limits.h>

RJ_PROP* new_rjv3_prop() {
Expand Down
2 changes: 1 addition & 1 deletion sched_alarm.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include <limits.h>
#include <unistd.h>
#include <signal.h>
#include <malloc.h>
#include <stdlib.h>

typedef struct _alarm_event {
int remaining;
Expand Down

0 comments on commit ed768d8

Please sign in to comment.