Skip to content

Commit

Permalink
Fix different compiling issues
Browse files Browse the repository at this point in the history
  • Loading branch information
HoratiuVultur committed Sep 1, 2020
1 parent c2af067 commit d3d179c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/ef-exec.c
Expand Up @@ -108,7 +108,7 @@ int ring_wait_for_init(tpacket_ring *ring) {


int raw_socket(cmd_socket_t *cmd_socket) {
int s, res, val, ifidx;
int s, res, val, ifidx, i;
struct sockaddr_ll sa = {};
struct packet_mreq mr = {};

Expand Down Expand Up @@ -194,7 +194,7 @@ int raw_socket(cmd_socket_t *cmd_socket) {
//
// TODO: This does not seem to be needed, if we uses a RX ring buffer
// instead (atleast that seems to work for libpcap)
for (int i = 0; i < 10000; ++i) {
for (i = 0; i < 10000; ++i) {
struct msghdr msg = { 0 };
int res = recvmsg(s, &msg, MSG_DONTWAIT);
if (res < 0)
Expand Down
8 changes: 6 additions & 2 deletions src/ef-parse-bytes.c
Expand Up @@ -2,6 +2,7 @@
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <endian.h>
#include <arpa/inet.h>

struct start_with {
Expand Down Expand Up @@ -212,7 +213,9 @@ buf_t *parse_bytes(const char *s, int bytes) {
for (s = data_begin; *s; ++s) {
int match_found = 0;
for (i = 0; i < sizeof(has_chars)/sizeof(has_chars[0]); ++i) {
for (const char *set_i = has_chars[i].char_set; *set_i; ++set_i) {
const char *set_i;

for (set_i = has_chars[i].char_set; *set_i; ++set_i) {
if (*s == *set_i) {
has_mask |= has_chars[i].mask;
match_found = 1;
Expand Down Expand Up @@ -313,6 +316,7 @@ buf_t *parse_bytes(const char *s, int bytes) {
((has_mask & ~(HAS_HEX_COL)) == 0) && (has_mask & HAS_COLON)) {
// This will be treated as a mac-address
uint8_t m[6] = {};
const char *x;

// We want to be able to write something like this (like we RFC2373
// specifies for IPv6):
Expand All @@ -334,7 +338,7 @@ buf_t *parse_bytes(const char *s, int bytes) {

//po("line: %d data_begin: %s\n", __LINE__, data_begin);

for (const char *x = data_begin; *x; ++x) {
for (x = data_begin; *x; ++x) {
int colon = 0;
int val = 0;

Expand Down
4 changes: 2 additions & 2 deletions src/ef.h
Expand Up @@ -59,8 +59,8 @@ void bl_check(buf_list_t *b);
void bl_reset(buf_list_t *b);
void bset_value(buf_t *b, uint8_t v);

inline void bl_init(buf_list_t *b) { bl_reset(b); }
inline void bl_destroy(buf_list_t *b) { bl_reset(b); }
static inline void bl_init(buf_list_t *b) { bl_reset(b); }
static inline void bl_destroy(buf_list_t *b) { bl_reset(b); }

int bl_printf_append(buf_list_t *b, const char *format, ...)
__attribute__ ((format (printf, 2, 3)));
Expand Down

0 comments on commit d3d179c

Please sign in to comment.