Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This is not a issues, could set a localAddress when do CreateSocket() in options #20

Closed
CoNETProject opened this issue Aug 27, 2016 · 5 comments

Comments

@CoNETProject
Copy link

CoNETProject commented Aug 27, 2016

Hi Stephenwvickers,
Thank you for your great project. It really help our project.
I have a problem when I use node-raw-socket.
I need assign localAddress in socket's header before send or listen the localAddress.
Because my eth0 have 2 or more ip4 address.
I want raw-socket can specific a ip from eth0's ip4 group.
if raw-socket can add a option like:
var options = {
addressFamily: raw.AddressFamily.IPv4,
protocol: raw.Protocol.None,
bufferSize: 4096,
generateChecksums: false,
checksumOffset: 0
localAddress: '192.168.0.1'
};
if have localAddress
raw-socket will listen only for localAddress and send socket use the localAddress in socket header.

Thank you so much

Peter

@CoNETProject
Copy link
Author

Hi Stephenwvickers,

I find a way for clear my problem.
I use socket.setOption to bind the network interface before send pocket.
socket.setOption (raw.SocketLevel.SOL_SOCKET, raw.SocketOption.SO_BINDTODEVICE, new Buffer (interfaceName), interfaceName.length)
It looks working perfect.

Thank you.

Peter

@stephenwvickers
Copy link
Collaborator

Thanks for the update.

@sky37042
Copy link

Hello,

Let interfaceName is 'eth1:1', but it will show 'Error: No such device'.

How to fix it problem ?

Thanks

@CoNETProject
Copy link
Author

CoNETProject commented Oct 22, 2016

Hi sky37042

You looks used a vlan interface.
The raw-socket looks can't reach a alias of interface.
If need use vlan may be the veth peer vlan is good solution.
this link have more detail:
http://superuser.com/questions/764986/howto-setup-a-veth-virtual-network

Peter

@stephenwvickers
Copy link
Collaborator

HI,

It is unclear to me what the problem is - I don't understand where you provide interfaceName for example.

Can you provide example code that emits the issue, and how you run the code?

Thanks

Steve

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants