0

I am given a task to eliminate the

<app> uses obsolete (PF_INET,SOCK_PACKET)

warning from a userspace client. If this type of use is obsolete; what is the correct, similar replacement for this task?

Edit: There was misleading information here.

Atilla Filiz
  • 2,383
  • 8
  • 29
  • 47
  • 1
    I really don't think that the `socket` call you are showing is responsible for the warning, I suggest you look elsewhere. perhaps in a library that you are using? – Hasturkun May 19 '11 at 15:21
  • Indeed, the message comes from a library. This question is invalid. – Atilla Filiz May 19 '11 at 15:56

2 Answers2

2

Check man 7 packet and man 7 ip for more information, but it looks like what you need is

socket(PF_PACKET, SOCK_RAW, <protocol>)

"For compatibility with Linux 2.0, the obsolete socket(PF_INET,
SOCK_RAW, protocol) syntax is still supported to open a
packet(7) socket.  This is deprecated and should be replaced by
socket(PF_PACKET, SOCK_RAW, protocol) instead.  The main
difference is the new sockaddr_ll address structure for generic
link layer information instead of sockaddr_pkt." - ip(7)

Although I don't know what additional changes might be required.

John Ledbetter
  • 13,557
  • 1
  • 61
  • 80
0

The problem is a library function calling socket(AF_INET, SOCK_PACKET, htons(0x0806)), and not the application itself.

Atilla Filiz
  • 2,383
  • 8
  • 29
  • 47
  • 1
    Then you should fix the library or get an updated version which does not. Although if it's not broken, I'd be tempted not to fix it. I don't expect the kernel to remove this feature for a while. – MarkR May 19 '11 at 20:09
  • 1
    This feature is still present in Linux 2.6.39 and is not mentioned in the feature-removal-schedule.txt document. I guess it will probably stay for at least a few years in the mainline kernel and could persist a while longer in vendor kernels. – MarkR May 19 '11 at 20:13
  • 1
    Thanks for the update but I have reasons to fix the library. It is developed in-house so it will not be much trouble. – Atilla Filiz May 20 '11 at 08:32