xboxscene.org forums

Author Topic: My Final Unsuccessful Attempt At Porting µip 1.0 Stack  (Read 197 times)

Mios∞ft

  • Archived User
  • Full Member
  • *
  • Posts: 119
My Final Unsuccessful Attempt At Porting µip 1.0 Stack
« on: April 16, 2008, 04:51:00 PM »

In pktdrv.c
//Buffers must be contiguous memory buffers (use Mm fonction).

Can we use regular
unsigned char uip_buf[1500 + 2];

DHCP sends requests but I recieve no reply/offer....


Anyway, Before I suffer from Brain trauma... What's wrong with my SOURCE?  uhh.gif

Wattcp = No more attempts after 102 builds... Hence my switch to simplistic yet flexible UIP 1.0  laugh.gif

Also, There's no restricting license

Thanks
Logged

Mios∞ft

  • Archived User
  • Full Member
  • *
  • Posts: 119
My Final Unsuccessful Attempt At Porting µip 1.0 Stack
« Reply #1 on: April 17, 2008, 05:28:00 PM »

QUOTE(Mi©®os∞ft @ Apr 16 2008, 07:27 PM) View Post

In pktdrv.c
//Buffers must be contiguous memory buffers (use Mm fonction).


Can we use regular
unsigned char packetbuff[1520];

instead of

static unsigned char *packetbuff; and later use mmMmAllocateContiguousMemoryEx

 uhh.gif
Logged

ressurectionx

  • Archived User
  • Hero Member
  • *
  • Posts: 2778
My Final Unsuccessful Attempt At Porting µip 1.0 Stack
« Reply #2 on: April 18, 2008, 10:06:00 AM »

Love to help you out man, but that's all a foreign language to me.  I still don't even know what you're trying to do, but great you're trying to do it.  Keep your head up.  Somebody around here will help you and some of the legends stop by to give a hand on occasion

Good luck
~Rx
Logged

Mios∞ft

  • Archived User
  • Full Member
  • *
  • Posts: 119
My Final Unsuccessful Attempt At Porting µip 1.0 Stack
« Reply #3 on: April 18, 2008, 01:33:00 PM »

QUOTE(ressurectionx @ Apr 18 2008, 12:42 PM) View Post

Love to help you out man, but that's all a foreign language to me.  I still don't even know what you're trying to do, but great you're trying to do it.  Keep your head up.  Somebody around here will help you and some of the legends stop by to give a hand on occasion

Good luck
~Rx


Hehe. I am still working on this... Wonder why I wrote "Final attempt"

I keep on trying things until I succeed since I started w/ computers, donno if it's good or bad for me  laugh.gif

Logged

ressurectionx

  • Archived User
  • Hero Member
  • *
  • Posts: 2778
My Final Unsuccessful Attempt At Porting µip 1.0 Stack
« Reply #4 on: April 18, 2008, 08:23:00 PM »

What are we on now.... Final Fantasy 12.... Final Fight 3.... and all of their offspring...

Don't worry about it.  I'm pretty sure Final doesn't mean anything anymore.  It's just a filler word.
Logged

Mios∞ft

  • Archived User
  • Full Member
  • *
  • Posts: 119
My Final Unsuccessful Attempt At Porting µip 1.0 Stack
« Reply #5 on: April 19, 2008, 04:13:00 PM »

QUOTE(openxdkman @ Apr 19 2008, 05:38 PM) View Post

You should have tested the detect_ping sample supplied in the xbox1 packet driver archive

It's right at the beginning of the code :

CODE

void XBoxStartup(void)
{
...
    packetbuffer=(unsigned char *)MmAllocateContiguousMemoryEx(
            1520,
            0,        //lowest acceptable
            0xFFFFFFFF,    //highest acceptable
            0,          //no need to align to specific boundaries multiple
            4);        //non cached, non ordered


The problem is to give a physical address. It's not so hard to comply to.



By hardware address, It's the Ethernet MAC right?
I do set it by:
CODE
uip_setethaddr(&mac); //tapdev.c tapdev_init inits uip_eth_addr mac;


Any other ideas  uhh.gif
Logged

Mios∞ft

  • Archived User
  • Full Member
  • *
  • Posts: 119
My Final Unsuccessful Attempt At Porting µip 1.0 Stack
« Reply #6 on: April 21, 2008, 04:35:00 PM »

OK. I'm close but not quiet, It seems we actually send the broadcast signal out, however the source MAC is getting corrupted... Trying to figure out the bug

IPB Image
IPB Image

OK, since now I use

CODE
u8_t *uip_buf=NULL; //u8_t uip_buf[1520]; -- old
uip_buf=(unsigned char *)MmAllocateContiguousMemoryEx(
            1520,
            0,        //lowest acceptable
            0xFFFFFFFF,    //highest acceptable
            0,          //no need to align to specific boundaries multiple
            4);        //non cached, non ordered



CODE
static u8_t c, opt;


I'm confused with Statements like:

CODE

if(uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 1 + c] == 0)

should be changed to which one of the below?

if((uip_buf+UIP_TCPIP_HLEN + UIP_LLH_LEN + 1 + c) == 0)
or
if(*(uip_buf+UIP_TCPIP_HLEN + UIP_LLH_LEN + 1 + c) == 0)
 uhh.gif


CODE
c += uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 1 + c];

to

c += (uip_buf+UIP_TCPIP_HLEN + UIP_LLH_LEN + 1 + c);
or
c += *(uip_buf+UIP_TCPIP_HLEN + UIP_LLH_LEN + 1 + c);




CODE

tmp16 = ((u16_t)uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 2 + c] << 8) |
      (u16_t)uip_buf[UIP_IPTCPH_LEN + UIP_LLH_LEN + 3 + c];
    uip_connr->initialmss = uip_connr->mss =
      tmp16 > UIP_TCP_MSS? UIP_TCP_MSS: tmp16;
uhh.gif


Thanks... Just some help need with this overly complicated stuff.
Logged

Mios∞ft

  • Archived User
  • Full Member
  • *
  • Posts: 119
My Final Unsuccessful Attempt At Porting µip 1.0 Stack
« Reply #7 on: April 22, 2008, 07:49:00 AM »

QUOTE(openxdkman @ Apr 22 2008, 10:14 AM) View Post

You are on the right path...
Packet analyser is a must to see what you put wrong inside packets
Some can even tell you if your checksums are wrongly calculated (EtherPeekNX)

if you have
unsigned char *p;
p[offset] will be the value of byte at the given offset
*(p+offset) will be the same

I smell these lines are for the checksum calculation
(I had horrible time with it, because it's not so simple to know what parts are summed)

I could finally succeed by spying a normal communication between two machines
and try to see if I would get exactly same packet if I was one of these machines

That way you can see what is wrong in the packet you build up yourself



Thanks...

I am not so good at casting stuff... What would this statement be? uhh.gif

CODE
tmp16 = ((u16_t)uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 2 + c] << 8) |
      (u16_t)uip_buf[UIP_IPTCPH_LEN + UIP_LLH_LEN + 3 + c];


Logged

Mios∞ft

  • Archived User
  • Full Member
  • *
  • Posts: 119
My Final Unsuccessful Attempt At Porting µip 1.0 Stack
« Reply #8 on: April 22, 2008, 09:10:00 PM »

QUOTE(Mi©®os∞ft @ Apr 22 2008, 10:25 AM) View Post

Thanks...

I am not so good at casting stuff... What would this statement be? uhh.gif

CODE
tmp16 = ((u16_t)uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN + 2 + c] << 8) |
      (u16_t)uip_buf[UIP_IPTCPH_LEN + UIP_LLH_LEN + 3 + c];



NVM.

I believe I am getting EXTREMELY close to making it.  biggrin.gif

I actually saw "Who has 192.168.2.4? Tell 192.168.2.1 (ROUTER)"
Xbox Responded "192.169.2.4 is at 00:0d:3a:xx:xx:xx"  love.gif  ARP Runs perfectly; however it's manually assigned IP address  pop.gif


However DHCP still doesn't seems to work; it produces a incomplete packet and I'm investigating it   cool.gif
I resolved the wrong MAC issue.
Logged

Mios∞ft

  • Archived User
  • Full Member
  • *
  • Posts: 119
My Final Unsuccessful Attempt At Porting µip 1.0 Stack
« Reply #9 on: April 26, 2008, 09:34:00 AM »

Need some help:

IP packet is getting corrupted!  sad.gif

CODE

struct uip_eth_addr {
  u8_t addr[6];
};

struct uip_eth_hdr {
  struct uip_eth_addr dest;
  struct uip_eth_addr src;
  u16_t type;
};


Does  this struct look right?
CODE
struct ethip_hdr {
  struct uip_eth_hdr ethhdr; //
  /* IP header. */
   u8_t vhl,
    tos,
    len[2],
    ipid[2],
    ipoffset[2],
    ttl,
    proto;
  u16_t ipchksum;
  u16_t srcipaddr[2],
    destipaddr[2];
};


The ARP code checks to see if destination IP is broadcast or not.... It says it is not... but it IS.  blink.gif
The checking code is correct... But IPBUF->destipaddr[0]!=0xffff && IPBUF->destipaddr[0]!=0xffff !

#define BUF   ((struct arp_hdr *)uip_buf)
#define IPBUF ((struct ethip_hdr *)uip_buf)

CODE
if(uip_ipaddr_cmp(IPBUF->destipaddr, broadcast_ipaddr)) {
    dbgPrint("YES Broadcast Addr");
    memcpy(IPBUF->ethhdr.dest.addr, broadcast_ethaddr.addr, 6);
  } else {
// reaches here :(
    dbgPrint("Not Broadcast Addr, Replacing IP packet with ARP request VERSION: %x %x:%x\n",IPBUF->vhl,IPBUF->destipaddr,IPBUF->destipaddr+1);
  


That was why it seemed to send Who is 0.0.16.240 Tell 0.0.0.0 and such crap... Which makes sense since it thinks it's not broadcast address.

THe linklevelheader length is 14; guessing it's right.


Openxdkman, Any ideas?
Logged

Mios∞ft

  • Archived User
  • Full Member
  • *
  • Posts: 119
My Final Unsuccessful Attempt At Porting µip 1.0 Stack
« Reply #10 on: May 02, 2008, 08:59:00 PM »

DHCP works... Recieves messages from PC client.... That's the progress from few days back  biggrin.gif

However, Unable to send any data back! blink.gif
Just a few steps away! Hooooohooo! biggrin.gif

Just thought I would post my progress  rolleyes.gif
Logged