summaryrefslogtreecommitdiff
path: root/cleopatre
diff options
context:
space:
mode:
authorsave2009-11-24 10:10:12 +0000
committersave2009-11-24 10:10:12 +0000
commitc0107c5216641b79ed8e3c60c582f8e94a21c11c (patch)
tree450b622b0b2b37d5401529907c6ecf4b47a34755 /cleopatre
parente0336812c41fee1f77bcfc20722f11a4ed26402c (diff)
cleo/app/managerd: add our (INPUT) mac address in context
Currently it's not use but may be one day... git-svn-id: svn+ssh://pessac/svn/cesar/trunk@6465 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'cleopatre')
-rw-r--r--cleopatre/application/managerd/inc/managerd.h2
-rw-r--r--cleopatre/application/managerd/src/bridge.c10
2 files changed, 12 insertions, 0 deletions
diff --git a/cleopatre/application/managerd/inc/managerd.h b/cleopatre/application/managerd/inc/managerd.h
index ad3d5fc54f..b97a0f52d9 100644
--- a/cleopatre/application/managerd/inc/managerd.h
+++ b/cleopatre/application/managerd/inc/managerd.h
@@ -24,6 +24,7 @@
#include <linux/if_packet.h>
#include <netinet/in.h>
#include <net/if.h>
+#include <linux/if_ether.h>
#include "../../linux/gpio.h"
/** Define packet max length */
@@ -40,6 +41,7 @@ struct managerd_ctx {
socklen_t output_sll_sz;
struct ifreq input_ifr;
struct ifreq output_ifr;
+ uint8_t input_mac_addr[ETH_ALEN];
union gpio_info sc_gpio;
union gpio_info led_gpio;
};
diff --git a/cleopatre/application/managerd/src/bridge.c b/cleopatre/application/managerd/src/bridge.c
index 8c2eef8216..1c10713c68 100644
--- a/cleopatre/application/managerd/src/bridge.c
+++ b/cleopatre/application/managerd/src/bridge.c
@@ -179,6 +179,16 @@ int bridge_init(struct managerd_ctx *ctx)
ctx->input_sll.sll_ifindex = ctx->input_ifr.ifr_ifindex;
ctx->input_sll.sll_protocol = htons(ETH_P_HPAV);
+ //Find INPUT mac address
+ if(-1 == (ioctl(ctx->sock_input, SIOCGIFHWADDR, &ctx->input_ifr)))
+ {
+ syslog(LOG_WARNING, "cannot get interface %s mac address (%s)", INPUT_IFNAME, strerror(errno));
+ close(ctx->sock_input);
+ close(ctx->sock_output);
+ return -1;
+ }
+ memcpy(ctx->input_mac_addr, ctx->input_ifr.ifr_hwaddr.sa_data, ETH_ALEN);
+
//Prepare OUTPUT socket address
strncpy(ctx->output_ifr.ifr_name, (char*)OUTPUT_IFNAME, IFNAMSIZ);
if(-1 == (ioctl(ctx->sock_output, SIOCGIFINDEX, &ctx->output_ifr)))