summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsave2010-05-06 15:31:30 +0000
committersave2010-05-06 15:31:30 +0000
commit5d7214bb06c3b06b8c87ae0e8d3d8b72fec401f5 (patch)
treea5959a95f4d2aab5301f4c87735644381063de8c
parente6cb064510efea1877a98f023cdd0e6104aa3d0b (diff)
cleo/spidupd: add OUI filed on MME messages, closes #1468
git-svn-id: svn+ssh://pessac/svn/cesar/trunk@6991 017c9cb6-072f-447c-8318-d5b54f68fe89
-rw-r--r--cleopatre/tools/spidupd/spidupd_host.c1
-rw-r--r--cleopatre/tools/spidupd/spidupd_host.h13
-rw-r--r--cleopatre/u-boot-1.1.6/include/net.h25
-rw-r--r--cleopatre/u-boot-1.1.6/net/spidupd.c14
4 files changed, 46 insertions, 7 deletions
diff --git a/cleopatre/tools/spidupd/spidupd_host.c b/cleopatre/tools/spidupd/spidupd_host.c
index 8c7bc49e3d..72907b12f4 100644
--- a/cleopatre/tools/spidupd/spidupd_host.c
+++ b/cleopatre/tools/spidupd/spidupd_host.c
@@ -110,6 +110,7 @@ prepare_mme_header (connection_t *connect, unsigned char *pkt,
hdr->mmv = MME_MMV;
hdr->fmi = 0;
hdr->mmtype = htommes (mmtype);
+ MME_SET_OUI(hdr, OUI_SPIDCOM);
}
static connection_t *
diff --git a/cleopatre/tools/spidupd/spidupd_host.h b/cleopatre/tools/spidupd/spidupd_host.h
index 61a0cc8339..21e2a8e142 100644
--- a/cleopatre/tools/spidupd/spidupd_host.h
+++ b/cleopatre/tools/spidupd/spidupd_host.h
@@ -37,6 +37,8 @@ struct MME_t
unsigned short mmtype;
/** Fragmentation Management Info. */
unsigned short fmi;
+ /** Organizationally Unique Identifier. */
+ unsigned char oui[3];
} __attribute__ ((__packed__));
typedef struct MME_t MME_t;
@@ -55,6 +57,17 @@ typedef struct MME_t MME_t;
/** Management Message Version. */
#define MME_MMV 1
+#define OUI_SPIDCOM "\x00\x13\xd7"
+#define MME_IS_CORRECT_OUI(mme, _oui) (mme != NULL && !memcmp ((mme)->oui, _oui, 3))
+#define MME_SET_OUI(mme, _oui) \
+do \
+{ \
+ if(mme != NULL) \
+ memcpy ((mme)->oui, _oui, 3); \
+} \
+while (0);
+
+
/** Default Spidupd block size. */
#define SPIDUPD_BLOCK_SIZE 1024
diff --git a/cleopatre/u-boot-1.1.6/include/net.h b/cleopatre/u-boot-1.1.6/include/net.h
index b79acd0df4..aa794d78ca 100644
--- a/cleopatre/u-boot-1.1.6/include/net.h
+++ b/cleopatre/u-boot-1.1.6/include/net.h
@@ -149,7 +149,7 @@ typedef struct {
#define ETHER_HDR_SIZE 14 /* Ethernet header size */
#define E802_HDR_SIZE 22 /* 802 ethernet header size */
-typedef struct
+typedef struct
{
unsigned char mme_dest[6]; /* Destination node */
unsigned char mme_src[6]; /* Source node */
@@ -161,6 +161,29 @@ typedef struct
#define MME_HDR_SIZE 23 /* MME header size (Homeplug AV) */
+typedef struct
+{
+ unsigned char mme_dest[6]; /* Destination node */
+ unsigned char mme_src[6]; /* Source node */
+ unsigned short mtype; /* 0x88e1 (iee assigned Ethertype) */
+ unsigned char mmv; /* Management Message Version */
+ unsigned short mmtype; /* Management Message Type */
+ unsigned short fmi; /* Fragmentation Management Info */
+ unsigned char oui[3]; /* Organizationally Unique Identifier */
+} __attribute__ ((__packed__)) VSMS_MME_t;
+
+#define VSMS_MME_HDR_SIZE 26 /* header size for Vendor and Manufacturer Specific MME */
+
+#define OUI_SPIDCOM "\x00\x13\xd7"
+#define VSMS_MME_IS_CORRECT_OUI(mme, _oui) (mme != NULL && !memcmp (mme->oui, _oui, 3))
+#define VSMS_MME_SET_OUI(mme, _oui) \
+do \
+{ \
+ if(mme != NULL) \
+ memcpy ((mme)->oui, _oui, 3); \
+} \
+while (0);
+
/*
* Ethernet header
*/
diff --git a/cleopatre/u-boot-1.1.6/net/spidupd.c b/cleopatre/u-boot-1.1.6/net/spidupd.c
index 270930b670..823e3a67dc 100644
--- a/cleopatre/u-boot-1.1.6/net/spidupd.c
+++ b/cleopatre/u-boot-1.1.6/net/spidupd.c
@@ -537,21 +537,22 @@ static void SpidupdSend(void)
int len = 0;
int transfer_end = 0;
volatile uchar *pkt;
- MME_t *mme;
+ VSMS_MME_t *mme;
MsUpdStartCnf_t *ms_update_start_cnf;
MsUpdTransfCnf_t *ms_update_transfer_cnf;
MsUpdEndCnf_t *ms_update_end_cnf;
/* Set structures pointers */
pkt = NetTxPacket;
- mme = (MME_t *)pkt;
+ mme = (VSMS_MME_t *)pkt;
ms_update_start_cnf = (MsUpdStartCnf_t *)(mme+1);
ms_update_transfer_cnf = (MsUpdTransfCnf_t *)(mme+1);
ms_update_end_cnf = (MsUpdEndCnf_t *)(mme+1);
- /* Set the MME version and FMI */
+ /* Set the MME version, FMI and OUI */
mme->mmv = MME_MMV;
mme->fmi = 0;
+ VSMS_MME_SET_OUI(mme, OUI_SPIDCOM);
/* Set MAC Address */
NetSetEther(pkt, NetClientEther, PROT_HPAV);
@@ -631,7 +632,7 @@ static void SpidupdSend(void)
static void SpidupdHandler(uchar *pkt, unsigned dest, unsigned src, unsigned len)
{
int i;
- MME_t *mme;
+ VSMS_MME_t *mme;
MsUpdStartReq_t *ms_update_start_req;
MsUpdTransfReq_t *ms_update_transfer_req;
MsUpdEndReq_t *ms_update_end_req;
@@ -642,13 +643,14 @@ static void SpidupdHandler(uchar *pkt, unsigned dest, unsigned src, unsigned len
ushort mmtype;
/* Set structures pointers */
- mme = (MME_t *)pkt;
+ mme = (VSMS_MME_t *)pkt;
ms_update_start_req = (MsUpdStartReq_t *)(mme+1);
ms_update_transfer_req = (MsUpdTransfReq_t *)(mme+1);
ms_update_end_req = (MsUpdEndReq_t *)(mme+1);
mmtype = (ushort)(mmetohs(mme->mmtype));
- if(!MS_UPDATE_RANGE(mmtype))
+ if(!MS_UPDATE_RANGE(mmtype) ||
+ !VSMS_MME_IS_CORRECT_OUI(mme, OUI_SPIDCOM))
return;
/* We received MME packet from PC client, reset the NETLOOP Timeout */