Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[PATCH] Force Netcat to use a specifiy interface
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
manuels
Advocate
Advocate


Joined: 22 Nov 2003
Posts: 2146
Location: Europe

PostPosted: Fri Dec 23, 2005 7:12 pm    Post subject: [PATCH] Force Netcat to use a specifiy interface Reply with quote

Hi,

analog to ping's -I I created a patch to force netcat to use a specifiy interface for sending data.
This patch is for net-analyzer/netcat-110-r8.[/code]
Here's the diff-file, if you'd like to use it:
Code:

93a94
> #include <linux/if.h>
146a148
> char * device;
822a825,831
>   if (device) {
>     struct ifreq ifr;
>     memset(&ifr, 0, sizeof(ifr));
>     strncpy(ifr.ifr_name, device, IFNAMSIZ-1);
>     if (setsockopt(nnetfd, SOL_SOCKET, SO_BINDTODEVICE, device, strlen(device)+1) == -1)
>       bail ("Error setting interface");
>   }
1919a1929
>   device = NULL;
2001c2011
<   while ((x = getopt (argc, argv, "46A:abc:e:g:G:hi:k:lno:p:q:rs:tuvw:z")) != EOF) {
---
>   while ((x = getopt (argc, argv, "46A:abc:e:g:G:hi:k:lno:p:q:rs:tuvw:zI:")) != EOF) {
2097c2107,2111
<       case 'l':            /* listen mode */
---
>    case 'I':
>      device = malloc(strlen(optarg));
>      strcpy(device, optarg);
>      break;
>    case 'l':            /* listen mode */

_________________
Build your own live cd with catalyst 2.0!


Last edited by manuels on Sun Dec 25, 2005 12:16 pm; edited 1 time in total
Back to top
View user's profile Send private message
JloR
n00b
n00b


Joined: 29 Jun 2004
Posts: 43
Location: Denmark

PostPosted: Sat Dec 24, 2005 1:14 pm    Post subject: Reply with quote

Thank you very very much - will become very useful from time to time on my LAN when I have to test my wireless/wired network!

Though, how can I apply this and use it without changing the ebuild?

Of course I suppose I can copy it to my overlay and change it to include the patch - but.. Wouldn't there be an easier way?
_________________
-- Jakob L. O. Rosenlund
Back to top
View user's profile Send private message
manuels
Advocate
Advocate


Joined: 22 Nov 2003
Posts: 2146
Location: Europe

PostPosted: Sat Dec 24, 2005 3:28 pm    Post subject: Reply with quote

You're welcome,

I did it like that:
Code:

ebuild  /usr/portage/net-analyzer/netcat/netcat-110-r8.ebuild  unpack

go to /var/tmp/portage/netcat-110-r8/work/ and apply the patch
and then run
Code:

ebuild  /usr/portage/net-analyzer/netcat/netcat-110-r8.ebuild  merge


that's it
_________________
Build your own live cd with catalyst 2.0!
Back to top
View user's profile Send private message
GentooBox
Veteran
Veteran


Joined: 22 Jun 2003
Posts: 1168
Location: Denmark

PostPosted: Sun Dec 25, 2005 6:41 pm    Post subject: Reply with quote

have you pushed this patch upstream ?
_________________
Encrypt, lock up everything and duct tape the rest
Back to top
View user's profile Send private message
manuels
Advocate
Advocate


Joined: 22 Nov 2003
Posts: 2146
Location: Europe

PostPosted: Sun Dec 25, 2005 7:06 pm    Post subject: Reply with quote

sorry, my english is not so good.
what do you mean by pushing the patch upstream?
_________________
Build your own live cd with catalyst 2.0!
Back to top
View user's profile Send private message
Gatta
n00b
n00b


Joined: 28 Mar 2004
Posts: 53

PostPosted: Sat Jan 21, 2006 10:01 am    Post subject: Reply with quote

He means sending it to the Netcat developers.
Back to top
View user's profile Send private message
manuels
Advocate
Advocate


Joined: 22 Nov 2003
Posts: 2146
Location: Europe

PostPosted: Sun Jan 22, 2006 1:59 pm    Post subject: Reply with quote

ahh, ok. i'll do so.

cheers,
Manuel
_________________
Build your own live cd with catalyst 2.0!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum