Netraw arbitrary ethernet TX addresses

I have an application where need to send and receive raw Ethernet
messages. I am currently using netraw and have the Net.ether2100 driver
in promiscuous mode to receive packets from any address but I also need
to be able to set the ethernet source address to arbitrary addresses on
the fly. I have looked at the .h files included in netraw but there is
no place to set the TX source address for transmission. So in other
words, netraw is not raw enough. Any help would be appreciated.

Steve

I haven’t looked at the netraw archive, but looking at the driver, I see
that if the tx_qpkt.type == _VC_RAW && tx_qpkt.zero1 is set, then the
address from tx_qpkt.remote_seg is copied to the source address field.
Otherwise, the NICs address is used.

Previously, Steve Spears wrote in qdn.public.qnx4:

I have an application where need to send and receive raw Ethernet
messages. I am currently using netraw and have the Net.ether2100 driver
in promiscuous mode to receive packets from any address but I also need
to be able to set the ethernet source address to arbitrary addresses on
the fly. I have looked at the .h files included in netraw but there is
no place to set the TX source address for transmission. So in other
words, netraw is not raw enough. Any help would be appreciated.

Steve

Hugh,

Thank you, that works. I went back and read the readme file and that was in
there, just not in the example program. It had been a year or so since I had
read it so I forgot the readme even existed. I guess I should have Read The
Fine Manual, RTFM?

For anyone else using the tx routine,
one thing I noticed:
The buffer and length use global variables, not the ones passed to the
routine.
This caused a little problem.

/* transmit a packet */
void
tx( char *data, int len, mac_t addr, int lan ){

Is:
_setmx32_16(txpkt->mx, MK_FP(net_ds, buffer), BUF_LEN);

Should be:

_setmx32_16(txpkt->mx, MK_FP(net_ds, data), len);

Thanks again,

Steve


Hugh Brown wrote:

I haven’t looked at the netraw archive, but looking at the driver, I see
that if the tx_qpkt.type == _VC_RAW && tx_qpkt.zero1 is set, then the
address from tx_qpkt.remote_seg is copied to the source address field.
Otherwise, the NICs address is used.